All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] drm/nouveau/hwmon: Use sysfs_emit in show function callsbacks
@ 2023-03-01 19:35 ` Deepak R Varma
  0 siblings, 0 replies; 8+ messages in thread
From: Deepak R Varma @ 2023-03-01 19:35 UTC (permalink / raw)
  To: Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie,
	Daniel Vetter, dri-devel, nouveau, linux-kernel
  Cc: Saurabh Singh Sengar, Praveen Kumar, Deepak R Varma

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.

Signed-off-by: Deepak R Varma <drv@mailo.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




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH RESEND] drm/nouveau/hwmon: Use sysfs_emit in show function callsbacks
@ 2023-03-01 19:35 ` Deepak R Varma
  0 siblings, 0 replies; 8+ messages in thread
From: Deepak R Varma @ 2023-03-01 19:35 UTC (permalink / raw)
  To: Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie,
	Daniel Vetter, dri-devel, nouveau, linux-kernel
  Cc: Praveen Kumar, Deepak R Varma, Saurabh Singh Sengar

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.

Signed-off-by: Deepak R Varma <drv@mailo.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




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Nouveau] [PATCH RESEND] drm/nouveau/hwmon: Use sysfs_emit in show function callsbacks
@ 2023-03-01 19:35 ` Deepak R Varma
  0 siblings, 0 replies; 8+ messages in thread
From: Deepak R Varma @ 2023-03-01 19:35 UTC (permalink / raw)
  To: Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie,
	Daniel Vetter, dri-devel, nouveau, linux-kernel
  Cc: Praveen Kumar, Deepak R Varma, Saurabh Singh Sengar

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.

Signed-off-by: Deepak R Varma <drv@mailo.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




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND] drm/nouveau/hwmon: Use sysfs_emit in show function callsbacks
  2023-03-01 19:35 ` Deepak R Varma
@ 2023-03-01 20:02   ` Dixit, Ashutosh
  -1 siblings, 0 replies; 8+ messages in thread
From: Dixit, Ashutosh @ 2023-03-01 20:02 UTC (permalink / raw)
  To: Deepak R Varma
  Cc: Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie,
	Daniel Vetter, dri-devel, nouveau, linux-kernel, Praveen Kumar,
	Saurabh Singh Sengar

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@intel.com>

>
> Signed-off-by: Deepak R Varma <drv@mailo.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
>
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND] drm/nouveau/hwmon: Use sysfs_emit in show function callsbacks
@ 2023-03-01 20:02   ` Dixit, Ashutosh
  0 siblings, 0 replies; 8+ messages in thread
From: Dixit, Ashutosh @ 2023-03-01 20:02 UTC (permalink / raw)
  To: Deepak R Varma
  Cc: Karol Herbst, Praveen Kumar, nouveau, Saurabh Singh Sengar,
	linux-kernel, dri-devel, Ben Skeggs

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@intel.com>

>
> Signed-off-by: Deepak R Varma <drv@mailo.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
>
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND] drm/nouveau/hwmon: Use sysfs_emit in show function callsbacks
  2023-03-01 19:35 ` Deepak R Varma
  (?)
@ 2023-03-07  0:20   ` Lyude Paul
  -1 siblings, 0 replies; 8+ messages in thread
From: Lyude Paul @ 2023-03-07  0:20 UTC (permalink / raw)
  To: Deepak R Varma, Ben Skeggs, Karol Herbst, David Airlie,
	Daniel Vetter, dri-devel, nouveau, linux-kernel
  Cc: Saurabh Singh Sengar, Praveen Kumar

Reviewed-by: Lyude Paul <lyude@redhat.com>

Will push upstream in a moment

On Thu, 2023-03-02 at 01:05 +0530, 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.
> 
> Signed-off-by: Deepak R Varma <drv@mailo.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,

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Nouveau] [PATCH RESEND] drm/nouveau/hwmon: Use sysfs_emit in show function callsbacks
@ 2023-03-07  0:20   ` Lyude Paul
  0 siblings, 0 replies; 8+ messages in thread
From: Lyude Paul @ 2023-03-07  0:20 UTC (permalink / raw)
  To: Deepak R Varma, Ben Skeggs, Karol Herbst, David Airlie,
	Daniel Vetter, dri-devel, nouveau, linux-kernel
  Cc: Praveen Kumar, Saurabh Singh Sengar

Reviewed-by: Lyude Paul <lyude@redhat.com>

Will push upstream in a moment

On Thu, 2023-03-02 at 01:05 +0530, 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.
> 
> Signed-off-by: Deepak R Varma <drv@mailo.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,

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND] drm/nouveau/hwmon: Use sysfs_emit in show function callsbacks
@ 2023-03-07  0:20   ` Lyude Paul
  0 siblings, 0 replies; 8+ messages in thread
From: Lyude Paul @ 2023-03-07  0:20 UTC (permalink / raw)
  To: Deepak R Varma, Ben Skeggs, Karol Herbst, David Airlie,
	Daniel Vetter, dri-devel, nouveau, linux-kernel
  Cc: Praveen Kumar, Saurabh Singh Sengar

Reviewed-by: Lyude Paul <lyude@redhat.com>

Will push upstream in a moment

On Thu, 2023-03-02 at 01:05 +0530, 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.
> 
> Signed-off-by: Deepak R Varma <drv@mailo.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,

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-05-04 12:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01 19:35 [PATCH RESEND] drm/nouveau/hwmon: Use sysfs_emit in show function callsbacks Deepak R Varma
2023-03-01 19:35 ` [Nouveau] " Deepak R Varma
2023-03-01 19:35 ` Deepak R Varma
2023-03-01 20:02 ` Dixit, Ashutosh
2023-03-01 20:02   ` Dixit, Ashutosh
2023-03-07  0:20 ` Lyude Paul
2023-03-07  0:20   ` Lyude Paul
2023-03-07  0:20   ` [Nouveau] " Lyude Paul

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.