All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 2/2] drm/i915/backlight: use unique backlight device names
Date: Wed, 28 Apr 2021 15:01:23 +0300	[thread overview]
Message-ID: <YIlOk2U9YgmXR+jb@intel.com> (raw)
In-Reply-To: <7dc3f6974711ce44522189dc9db05d1e6e24e6d8.1619604743.git.jani.nikula@intel.com>

On Wed, Apr 28, 2021 at 01:14:29PM +0300, Jani Nikula wrote:
> Registering multiple backlight devices with intel_backlight name will
> obviously fail, regardless of whether they're two connectors in the same
> drm device or two different drm devices.
> 
> It would be preferrable to switch to completely unique names, and sunset
> the generic intel_backlight name. However, there are apparently users
> out there that hardcode the name, so the change would break backward
> compatibility.
> 
> As a compromise, register the first device with intel_backlight name. In
> the common case, this is the only backlight device anyway. From the
> second device on, use card%d-%s-backlight format, for example
> card0-eDP-2-backlight, to make the name unique.
> 
> This approach does not preclude us from registering the first device
> using the same naming scheme in the future.

"intel_backlight" symlink for the first backlight might be an option I
guess.

Series is
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> 
> v2: Keep using intel_backlight name for first backlight device
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2794
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_panel.c | 23 ++++++++++++++++++----
>  1 file changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
> index 3088677ab8a7..a20761079ae0 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.c
> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> @@ -1401,16 +1401,31 @@ int intel_backlight_device_register(struct intel_connector *connector)
>  	else
>  		props.power = FB_BLANK_POWERDOWN;
>  
> -	/*
> -	 * Note: using the same name independent of the connector prevents
> -	 * registration of multiple backlight devices in the driver.
> -	 */
>  	name = kstrdup("intel_backlight", GFP_KERNEL);
>  	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) {
> +		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);
> +	}
> +
>  	if (IS_ERR(bd)) {
>  		drm_err(&i915->drm,
>  			"[CONNECTOR:%d:%s] backlight device %s register failed: %ld\n",
> -- 
> 2.20.1

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-04-28 12:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 10:14 [Intel-gfx] [PATCH 0/2] drm/i915/backlight: use unique backlight device names Jani Nikula
2021-04-28 10:14 ` [Intel-gfx] [PATCH 1/2] drm/i915/backlight: clean up backlight device register Jani Nikula
2021-04-28 10:14 ` [Intel-gfx] [PATCH 2/2] drm/i915/backlight: use unique backlight device names Jani Nikula
2021-04-28 12:01   ` Ville Syrjälä [this message]
2021-04-28 12:06     ` Jani Nikula
2021-04-28 11:19 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2021-04-28 12:45 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-04-29 13:28 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/backlight: use unique backlight device names (rev2) Patchwork
2021-04-29 16:11 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

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=YIlOk2U9YgmXR+jb@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /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.