[PATCH 01/10] backlight: Add backlight_device_get_by_name()
Noralf Trønnes
noralf at tronnes.org
Thu Apr 30 09:20:01 UTC 2020
Den 30.04.2020 10.32, skrev Lee Jones:
> On Wed, 29 Apr 2020, Noralf Trønnes wrote:
>
>> Add a way to lookup a backlight device based on its name.
>> Will be used by a USB display gadget getting the name from configfs.
>>
>> Cc: Lee Jones <lee.jones at linaro.org>
>> Cc: Daniel Thompson <daniel.thompson at linaro.org>
>> Cc: Jingoo Han <jingoohan1 at gmail.com>
>> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
>> ---
>> drivers/video/backlight/backlight.c | 21 +++++++++++++++++++++
>> include/linux/backlight.h | 1 +
>> 2 files changed, 22 insertions(+)
>
> Once reviewed, can this patch be applied on its own?
>
If you can apply it for 5.8, then we're good. DRM has cutoff at -rc5 and
the driver won't be ready for that. This patch has this dependency
chain: usb -> drm -> backlight. So if you can apply it for 5.8, things
gets easier.
> My guess is that it can't, as the other patches in this set depend on
> it, right? If this assumption is true, you need to send me the rest
> of the set.
>
> FYI: It's normally better to send the whole set to everyone, as it
> provides visibility on current review (or lack there of) status of the
> other patches and allows each of the maintainers to discuss possible
> merge strategies.
dri-devel is the ML for backlight so I assumed you got the full set.
I have had trouble in the past with my email provider dropping parts of
a series when I had to many recipients.
Noralf.
>
>> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
>> index cac3e35d7630..92d80aa0c0ef 100644
>> --- a/drivers/video/backlight/backlight.c
>> +++ b/drivers/video/backlight/backlight.c
>> @@ -432,6 +432,27 @@ struct backlight_device *backlight_device_get_by_type(enum backlight_type type)
>> }
>> EXPORT_SYMBOL(backlight_device_get_by_type);
>>
>> +/**
>> + * backlight_device_get_by_name - Get backlight device by name
>> + * @name: Device name
>> + *
>> + * This function looks up a backlight device by its name. It obtains a reference
>> + * on the backlight device and it is the caller's responsibility to drop the
>> + * reference by calling backlight_put().
>> + *
>> + * Returns:
>> + * A pointer to the backlight device if found, otherwise NULL.
>> + */
>> +struct backlight_device *backlight_device_get_by_name(const char *name)
>> +{
>> + struct device *dev;
>> +
>> + dev = class_find_device_by_name(backlight_class, name);
>> +
>> + return dev ? to_backlight_device(dev) : NULL;
>> +}
>> +EXPORT_SYMBOL(backlight_device_get_by_name);
>> +
>> /**
>> * backlight_device_unregister - unregisters a backlight device object.
>> * @bd: the backlight device object to be unregistered and freed.
>> diff --git a/include/linux/backlight.h b/include/linux/backlight.h
>> index c7d6b2e8c3b5..56e4580d4f55 100644
>> --- a/include/linux/backlight.h
>> +++ b/include/linux/backlight.h
>> @@ -190,6 +190,7 @@ extern void backlight_force_update(struct backlight_device *bd,
>> extern int backlight_register_notifier(struct notifier_block *nb);
>> extern int backlight_unregister_notifier(struct notifier_block *nb);
>> extern struct backlight_device *backlight_device_get_by_type(enum backlight_type type);
>> +struct backlight_device *backlight_device_get_by_name(const char *name);
>> extern int backlight_device_set_brightness(struct backlight_device *bd, unsigned long brightness);
>>
>> #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev)
>
More information about the dri-devel
mailing list