All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Wentland <harry.wentland@amd.com>
To: Anand K Mistry <amistry@google.com>, amd-gfx@lists.freedesktop.org
Cc: "Eryk Brol" <eryk.brol@amd.com>,
	"David Airlie" <airlied@linux.ie>,
	"Qingqing Zhuo" <qingqing.zhuo@amd.com>,
	"Wayne Lin" <Wayne.Lin@amd.com>,
	"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Nicholas Kazlauskas" <nicholas.kazlauskas@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Bas Nieuwenhuizen" <bas@basnieuwenhuizen.nl>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Nikola Cornij" <nikola.cornij@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH] drm/amd/display: Fix error code on failure to set brightness
Date: Tue, 8 Jun 2021 09:59:59 -0400	[thread overview]
Message-ID: <e599ffb5-da5c-e4bb-a7d6-c2208a48868d@amd.com> (raw)
In-Reply-To: <20210608143159.1.I230026301243fbcee23d408c75aa468c1fec58f7@changeid>

On 2021-06-08 12:32 a.m., Anand K Mistry wrote:
> The backlight_ops.update_status function is required to return a
> negative error code on failure. Returning a positive code may be
> interpreted as a success. This is true for the 'brightness' sysfs file,
> which passes through a non-zero value as the return value of the write()
> syscall. This is interpreted in user-space as a successful write of 1
> character, which is obviously wrong.
> 
> It's not clear exactly what error code to use, but EINVAL should be
> reasonable.
> 
> Signed-off-by: Anand K Mistry <amistry@google.com>

Thanks for your patch but this code has changed on amd-staging-drm-next.

Can you try with the latest? The new backlight_update_status will always
return 0 now.

Harry

> ---
> 
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 652cc1a0e450..ad322613390d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -3431,7 +3431,7 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd)
>  	else
>  		rc = dc_link_set_backlight_level(dm->backlight_link, brightness, 0);
>  
> -	return rc ? 0 : 1;
> +	return rc ? 0 : -EINVAL;
>  }
>  
>  static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd)
> 

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Harry Wentland <harry.wentland@amd.com>
To: Anand K Mistry <amistry@google.com>, amd-gfx@lists.freedesktop.org
Cc: "Eryk Brol" <eryk.brol@amd.com>,
	"David Airlie" <airlied@linux.ie>,
	"Qingqing Zhuo" <qingqing.zhuo@amd.com>,
	"Wayne Lin" <Wayne.Lin@amd.com>,
	"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Nicholas Kazlauskas" <nicholas.kazlauskas@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Nikola Cornij" <nikola.cornij@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH] drm/amd/display: Fix error code on failure to set brightness
Date: Tue, 8 Jun 2021 09:59:59 -0400	[thread overview]
Message-ID: <e599ffb5-da5c-e4bb-a7d6-c2208a48868d@amd.com> (raw)
In-Reply-To: <20210608143159.1.I230026301243fbcee23d408c75aa468c1fec58f7@changeid>

On 2021-06-08 12:32 a.m., Anand K Mistry wrote:
> The backlight_ops.update_status function is required to return a
> negative error code on failure. Returning a positive code may be
> interpreted as a success. This is true for the 'brightness' sysfs file,
> which passes through a non-zero value as the return value of the write()
> syscall. This is interpreted in user-space as a successful write of 1
> character, which is obviously wrong.
> 
> It's not clear exactly what error code to use, but EINVAL should be
> reasonable.
> 
> Signed-off-by: Anand K Mistry <amistry@google.com>

Thanks for your patch but this code has changed on amd-staging-drm-next.

Can you try with the latest? The new backlight_update_status will always
return 0 now.

Harry

> ---
> 
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 652cc1a0e450..ad322613390d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -3431,7 +3431,7 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd)
>  	else
>  		rc = dc_link_set_backlight_level(dm->backlight_link, brightness, 0);
>  
> -	return rc ? 0 : 1;
> +	return rc ? 0 : -EINVAL;
>  }
>  
>  static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd)
> 


WARNING: multiple messages have this Message-ID (diff)
From: Harry Wentland <harry.wentland@amd.com>
To: Anand K Mistry <amistry@google.com>, amd-gfx@lists.freedesktop.org
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
	"Bas Nieuwenhuizen" <bas@basnieuwenhuizen.nl>,
	"Christian König" <christian.koenig@amd.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"David Airlie" <airlied@linux.ie>,
	"Eryk Brol" <eryk.brol@amd.com>, "Leo Li" <sunpeng.li@amd.com>,
	"Nicholas Kazlauskas" <nicholas.kazlauskas@amd.com>,
	"Nikola Cornij" <nikola.cornij@amd.com>,
	"Qingqing Zhuo" <qingqing.zhuo@amd.com>,
	"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>,
	"Wayne Lin" <Wayne.Lin@amd.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/amd/display: Fix error code on failure to set brightness
Date: Tue, 8 Jun 2021 09:59:59 -0400	[thread overview]
Message-ID: <e599ffb5-da5c-e4bb-a7d6-c2208a48868d@amd.com> (raw)
In-Reply-To: <20210608143159.1.I230026301243fbcee23d408c75aa468c1fec58f7@changeid>

On 2021-06-08 12:32 a.m., Anand K Mistry wrote:
> The backlight_ops.update_status function is required to return a
> negative error code on failure. Returning a positive code may be
> interpreted as a success. This is true for the 'brightness' sysfs file,
> which passes through a non-zero value as the return value of the write()
> syscall. This is interpreted in user-space as a successful write of 1
> character, which is obviously wrong.
> 
> It's not clear exactly what error code to use, but EINVAL should be
> reasonable.
> 
> Signed-off-by: Anand K Mistry <amistry@google.com>

Thanks for your patch but this code has changed on amd-staging-drm-next.

Can you try with the latest? The new backlight_update_status will always
return 0 now.

Harry

> ---
> 
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 652cc1a0e450..ad322613390d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -3431,7 +3431,7 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd)
>  	else
>  		rc = dc_link_set_backlight_level(dm->backlight_link, brightness, 0);
>  
> -	return rc ? 0 : 1;
> +	return rc ? 0 : -EINVAL;
>  }
>  
>  static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd)
> 


  reply	other threads:[~2021-06-08 14:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08  4:32 [PATCH] drm/amd/display: Fix error code on failure to set brightness Anand K Mistry
2021-06-08  4:32 ` Anand K Mistry
2021-06-08  4:32 ` Anand K Mistry
2021-06-08 13:59 ` Harry Wentland [this message]
2021-06-08 13:59   ` Harry Wentland
2021-06-08 13:59   ` Harry Wentland
2021-06-09  0:55   ` Anand K. Mistry
2021-06-09  0:55     ` Anand K. Mistry
2021-06-09  0:55     ` Anand K. Mistry

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=e599ffb5-da5c-e4bb-a7d6-c2208a48868d@amd.com \
    --to=harry.wentland@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Wayne.Lin@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=amistry@google.com \
    --cc=aurabindo.pillai@amd.com \
    --cc=bas@basnieuwenhuizen.nl \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eryk.brol@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicholas.kazlauskas@amd.com \
    --cc=nikola.cornij@amd.com \
    --cc=qingqing.zhuo@amd.com \
    --cc=sunpeng.li@amd.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.