Re: [PATCH v3 02/11] leds: led-class: Add __led_get() helper function

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

 



On Fri, Dec 16, 2022 at 12:30:04PM +0100, Hans de Goede wrote:
> Split out part of of_led_get() into a generic __led_get() helper function.
> 
> This is a preparation patch for adding a generic (non devicetree specific)
> led_get() function.

...

> +static struct led_classdev *__led_get(struct device *led_dev)
> +{
> +	struct led_classdev *led_cdev;
> +
> +	if (!led_dev)
> +		return ERR_PTR(-EPROBE_DEFER);
> +
> +	led_cdev = dev_get_drvdata(led_dev);
> +
> +	if (!try_module_get(led_cdev->dev->parent->driver->owner)) {
> +		put_device(led_cdev->dev);
> +		return ERR_PTR(-ENODEV);
> +	}
> +
> +	return led_cdev;
> +}

If I'm not mistaken, the entire series leaves this function as is.
At the end I found three _get functions:
 __led_get
 led_get
 __devm_led_get


As far as I can see the above can be named more precisely, i.e.
led_module_get(). Or alike if this sounds not good either.


-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux