Re: [PATCH v4 22/26] leds: as3645a: Use generic support for composing LED names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pavel,

On 4/24/19 4:01 PM, Pavel Machek wrote:
Hi!

Switch to using generic LED support for composing LED class
device name.

Signed-off-by: Jacek Anaszewski <jacek.anaszewski@xxxxxxxxx>
Cc: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>

+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.

Good point. Will fix that in v5.

--
Best regards,
Jacek Anaszewski



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux