[Intel-gfx] [PATCHv2] drm/i915/display: add support for dual panel backlight

Murthy, Arun R arun.r.murthy at intel.com
Wed Aug 3 08:10:06 UTC 2022


> -----Original Message-----
> From: Nikula, Jani <jani.nikula at intel.com>
> Sent: Tuesday, August 2, 2022 8:31 PM
> To: Murthy, Arun R <arun.r.murthy at intel.com>; intel-
> gfx at lists.freedesktop.org
> Cc: Shankar, Uma <uma.shankar at intel.com>; Murthy, Arun R
> <arun.r.murthy at intel.com>
> Subject: Re: [PATCHv2] drm/i915/display: add support for dual panel
> backlight
> 
> On Wed, 13 Jul 2022, Arun R Murthy <arun.r.murthy at intel.com> wrote:
> > The patch with commit 20f85ef89d94 ("drm/i915/backlight: use unique
> > backlight device names") already adds support for dual panel backlight
> > but with error prints. Since the patch tried to create the backlight
> > device with the same name and upon failure will try with a different
> > name it leads to failure logs in dmesg inturn getting caught by CI.
> >
> > This patch alternately will check if the backlight class of same name
> > exists, will use a different name.
> >
> > v2: reworked on top of the patch 20f85ef89d94 ("drm/i915/backlight:
> > use unique backlight device names")
> >
> > Signed-off-by: Arun R Murthy <arun.r.murthy at intel.com>
> > ---
> >  .../gpu/drm/i915/display/intel_backlight.c    | 24 ++++++++-----------
> >  1 file changed, 10 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_backlight.c
> > b/drivers/gpu/drm/i915/display/intel_backlight.c
> > index 110fc98ec280..1e550d048e86 100644
> > --- a/drivers/gpu/drm/i915/display/intel_backlight.c
> > +++ b/drivers/gpu/drm/i915/display/intel_backlight.c
> > @@ -971,26 +971,22 @@ int intel_backlight_device_register(struct
> intel_connector *connector)
> >  	if (!name)
> >  		return -ENOMEM;
> >
> > -	bd = backlight_device_register(name, connector->base.kdev,
> connector,
> > -				       &intel_backlight_device_ops, &props);
> > -
> > -	/*
> > -	 * Using the same name independent of the drm device or connector
> > -	 * prevents registration of multiple backlight devices in the
> > -	 * driver. However, we need to use the default name for backward
> > -	 * compatibility. Use unique names for subsequent backlight devices
> as a
> > -	 * fallback when the default name already exists.
> > -	 */
> > -	if (IS_ERR(bd) && PTR_ERR(bd) == -EEXIST) {
> > +	if (backlight_device_get_by_name(name)) {
> 
> This leaks a reference count to the backlight device. It needs to be something
> like:
> 
> 	bd = backlight_device_get_by_name(name);
> 	if (bd) {
> 		put_device(&bd->dev);
> 
> 		/* ... */
> 	}
Thanks, Corrected and sent a revised version on patch!

Thanks and Regards.
Arun R Murthy
--------------------


More information about the Intel-gfx mailing list