All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Arun R Murthy <arun.r.murthy@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCHv3] drm/i915/display: add support for dual panel backlight
Date: Wed, 03 Aug 2022 11:41:37 +0300	[thread overview]
Message-ID: <87fsiden26.fsf@intel.com> (raw)
In-Reply-To: <20220803082010.2952698-1-arun.r.murthy@intel.com>

On Wed, 03 Aug 2022, Arun R Murthy <arun.r.murthy@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")
> v3: fixed the ref count leak(Jani N)

Err, with the "forgot to git add" comment I tried to say the fix isn't
part of the patch. The bd returned by backlight_device_get_by_name()
isn't stored anywhere, and there's no device put on it.

BR,
Jani.

>
> Signed-off-by: Arun R Murthy <arun.r.murthy@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)) {
> +		/*
> +		 * 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.
> +		 */
>  		kfree(name);
>  		name = kasprintf(GFP_KERNEL, "card%d-%s-backlight",
>  				 i915->drm.primary->index, connector->base.name);
>  		if (!name)
>  			return -ENOMEM;
> -
> -		bd = backlight_device_register(name, connector->base.kdev, connector,
> -					       &intel_backlight_device_ops, &props);
>  	}
> +	bd = backlight_device_register(name, connector->base.kdev, connector,
> +				       &intel_backlight_device_ops, &props);
>  
>  	if (IS_ERR(bd)) {
>  		drm_err(&i915->drm,

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2022-08-03  8:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03  8:20 [Intel-gfx] [PATCHv3] drm/i915/display: add support for dual panel backlight Arun R Murthy
2022-08-03  8:41 ` Jani Nikula [this message]
2022-08-03  8:57 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2022-08-03  9:19 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-08-03 10:09 ` [Intel-gfx] [PATCHv3] " Arun R Murthy
2022-08-03 13:33   ` Jani Nikula
2022-08-08  3:55     ` Murthy, Arun R
2022-08-03 12:50 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/display: add support for dual panel backlight (rev2) Patchwork
2022-08-03 16:09 ` [Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/display: add support for dual panel backlight Patchwork
2022-08-03 22:46 ` [Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/display: add support for dual panel backlight (rev2) Patchwork
2022-08-08  3:57 ` [Intel-gfx] [PATCHv3] drm/i915/display: add support for dual panel backlight Arun R Murthy
2022-08-22  3:34   ` Murthy, Arun R
2022-08-22  9:23   ` Jani Nikula
2022-08-08  4:55 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/display: add support for dual panel backlight (rev3) Patchwork
2022-08-08  6:57 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2022-07-13  8:17 [Intel-gfx] [PATCHv2] drm/i915/display: add support for dual panel backlight Arun R Murthy
2022-08-03  8:08 ` [Intel-gfx] [PATCHv3] " Arun R Murthy
2022-08-03  8:19   ` Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsiden26.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.