lkml.org 
[lkml]   [2019]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 22/26] leds: as3645a: Use generic support for composing LED names
Hi!

> Switch to using generic LED support for composing LED class
> device name.
>
> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>

> +static int as3645a_led_class_setup(struct as3645a *flash)
> {
> struct led_classdev *fled_cdev = &flash->fled.led_cdev;
> struct led_classdev *iled_cdev = &flash->iled_cdev;
> + struct led_init_data init_data;

Not initialized.

> struct led_flash_setting *cfg;
> int rval;
>
> - iled_cdev->name = names->indicator;
> iled_cdev->brightness_set_blocking = as3645a_set_indicator_brightness;
> iled_cdev->max_brightness =
> flash->cfg.indicator_max_ua / AS_INDICATOR_INTENSITY_STEP;
> iled_cdev->flags = LED_CORE_SUSPENDRESUME;
>
> - rval = led_classdev_register(&flash->client->dev, iled_cdev);
> + init_data.fwnode = flash->indicator_node;
> + init_data.devicename = AS_NAME;
> + init_data.default_label = "indicator";

And struct has one more field:

+ /*
+ * indicates if LED name should always comprise
devicename section;
+ * only LEDs exposed by drivers of hot-pluggable
devices should
+ * set it to true
+ */
+ bool devname_mandatory;
};

I believe it would be cleaner to always initialize struct with zeros;
that way you can also expand it in future.
Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-04-24 16:03    [W:0.205 / U:2.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site