[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r0u844vz.wl-ashutosh.dixit@intel.com>
Date: Wed, 01 Mar 2023 12:02:08 -0800
From: "Dixit, Ashutosh" <ashutosh.dixit@...el.com>
To: Deepak R Varma <drv@...lo.com>
Cc: Ben Skeggs <bskeggs@...hat.com>, Karol Herbst <kherbst@...hat.com>,
Lyude Paul <lyude@...hat.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org, nouveau@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
Praveen Kumar <kumarpraveen@...ux.microsoft.com>,
Saurabh Singh Sengar <ssengar@...rosoft.com>
Subject: Re: [PATCH RESEND] drm/nouveau/hwmon: Use sysfs_emit in show function callsbacks
On Wed, 01 Mar 2023 11:35:41 -0800, Deepak R Varma wrote:
>
> According to Documentation/filesystems/sysfs.rst, the show() callback
> function of kobject attributes should strictly use sysfs_emit() instead
> of sprintf() family functions. So, make this change.
> Issue identified using the coccinelle device_attr_show.cocci script.
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@...el.com>
>
> Signed-off-by: Deepak R Varma <drv@...lo.com>
> ---
> Note:
> Resending the patch for review and feedback. No functional changes.
>
>
> drivers/gpu/drm/nouveau/nouveau_hwmon.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> index a7db7c31064b..e844be49e11e 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> @@ -41,7 +41,7 @@ static ssize_t
> nouveau_hwmon_show_temp1_auto_point1_pwm(struct device *d,
> struct device_attribute *a, char *buf)
> {
> - return snprintf(buf, PAGE_SIZE, "%d\n", 100);
> + return sysfs_emit(buf, "%d\n", 100);
> }
> static SENSOR_DEVICE_ATTR(temp1_auto_point1_pwm, 0444,
> nouveau_hwmon_show_temp1_auto_point1_pwm, NULL, 0);
> @@ -54,8 +54,8 @@ nouveau_hwmon_temp1_auto_point1_temp(struct device *d,
> struct nouveau_drm *drm = nouveau_drm(dev);
> struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
>
> - return snprintf(buf, PAGE_SIZE, "%d\n",
> - therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST) * 1000);
> + return sysfs_emit(buf, "%d\n",
> + therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST) * 1000);
> }
> static ssize_t
> nouveau_hwmon_set_temp1_auto_point1_temp(struct device *d,
> @@ -87,8 +87,8 @@ nouveau_hwmon_temp1_auto_point1_temp_hyst(struct device *d,
> struct nouveau_drm *drm = nouveau_drm(dev);
> struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
>
> - return snprintf(buf, PAGE_SIZE, "%d\n",
> - therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST) * 1000);
> + return sysfs_emit(buf, "%d\n",
> + therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST) * 1000);
> }
> static ssize_t
> nouveau_hwmon_set_temp1_auto_point1_temp_hyst(struct device *d,
> --
> 2.34.1
>
>
>
Powered by blists - more mailing lists