linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit()
@ 2025-06-30 12:50 Ryan Chung
  2025-06-30 13:15 ` Greg KH
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ryan Chung @ 2025-06-30 12:50 UTC (permalink / raw)
  To: hao.wu, trix, mdf, yilun.xu
  Cc: linux-fpga, linux-kernel-mentees, linux-kernel, Ryan Chung

Signed-off-by: Ryan Chung <seokwoo.chung130@gmail.com>
---
 drivers/fpga/dfl-afu-main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c
index 3bf8e7338dbe..f2dd4667a43d 100644
--- a/drivers/fpga/dfl-afu-main.c
+++ b/drivers/fpga/dfl-afu-main.c
@@ -156,7 +156,7 @@ id_show(struct device *dev, struct device_attribute *attr, char *buf)
 	struct dfl_feature_dev_data *fdata = to_dfl_feature_dev_data(dev);
 	int id = port_get_id(fdata);
 
-	return scnprintf(buf, PAGE_SIZE, "%d\n", id);
+	return sysfs_emit(buf, PAGE_SIZE, "%d\n", id);
 }
 static DEVICE_ATTR_RO(id);
 
@@ -475,7 +475,7 @@ afu_id_show(struct device *dev, struct device_attribute *attr, char *buf)
 	guidh = readq(base + GUID_H);
 	mutex_unlock(&fdata->lock);
 
-	return scnprintf(buf, PAGE_SIZE, "%016llx%016llx\n", guidh, guidl);
+	return sysfs_emit(buf, PAGE_SIZE, "%016llx%016llx\n", guidh, guidl);
 }
 static DEVICE_ATTR_RO(afu_id);
 
-- 
2.43.0


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

* Re: [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit()
  2025-06-30 12:50 [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit() Ryan Chung
@ 2025-06-30 13:15 ` Greg KH
  2025-07-01  4:09 ` kernel test robot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2025-06-30 13:15 UTC (permalink / raw)
  To: Ryan Chung
  Cc: hao.wu, trix, mdf, yilun.xu, linux-fpga, linux-kernel-mentees,
	linux-kernel

On Mon, Jun 30, 2025 at 09:50:18PM +0900, Ryan Chung wrote:
> Signed-off-by: Ryan Chung <seokwoo.chung130@gmail.com>

I know I can't take patches without any changelog text, but maybe other
maintainers are more lax?

Also, you only said what you did, but not why you did it.

> ---
>  drivers/fpga/dfl-afu-main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c
> index 3bf8e7338dbe..f2dd4667a43d 100644
> --- a/drivers/fpga/dfl-afu-main.c
> +++ b/drivers/fpga/dfl-afu-main.c
> @@ -156,7 +156,7 @@ id_show(struct device *dev, struct device_attribute *attr, char *buf)
>  	struct dfl_feature_dev_data *fdata = to_dfl_feature_dev_data(dev);
>  	int id = port_get_id(fdata);
>  
> -	return scnprintf(buf, PAGE_SIZE, "%d\n", id);
> +	return sysfs_emit(buf, PAGE_SIZE, "%d\n", id);

Did you build this?  Did you test it?

>  }
>  static DEVICE_ATTR_RO(id);
>  
> @@ -475,7 +475,7 @@ afu_id_show(struct device *dev, struct device_attribute *attr, char *buf)
>  	guidh = readq(base + GUID_H);
>  	mutex_unlock(&fdata->lock);
>  
> -	return scnprintf(buf, PAGE_SIZE, "%016llx%016llx\n", guidh, guidl);
> +	return sysfs_emit(buf, PAGE_SIZE, "%016llx%016llx\n", guidh, guidl);

Same here, was this built?

And what's wrong with the original code?

thanks,

greg k-h

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

* Re: [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit()
  2025-06-30 12:50 [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit() Ryan Chung
  2025-06-30 13:15 ` Greg KH
@ 2025-07-01  4:09 ` kernel test robot
  2025-07-01  4:30 ` kernel test robot
  2025-07-01 11:02 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2025-07-01  4:09 UTC (permalink / raw)
  To: Ryan Chung, hao.wu, trix, mdf, yilun.xu
  Cc: llvm, oe-kbuild-all, linux-fpga, linux-kernel-mentees,
	linux-kernel, Ryan Chung

Hi Ryan,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.16-rc4 next-20250630]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ryan-Chung/fpga-dfl-Replace-scnprintf-with-sysfs_emit/20250630-205221
base:   linus/master
patch link:    https://lore.kernel.org/r/20250630125018.48417-1-seokwoo.chung130%40gmail.com
patch subject: [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit()
config: i386-randconfig-011-20250701 (https://download.01.org/0day-ci/archive/20250701/202507011110.nJmYZDdm-lkp@intel.com/config)
compiler: clang version 20.1.7 (https://github.com/llvm/llvm-project 6146a88f60492b520a36f8f8f3231e15f3cc6082)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250701/202507011110.nJmYZDdm-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507011110.nJmYZDdm-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/fpga/dfl-afu-main.c:159:25: error: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const char *' [-Wint-conversion]
     159 |         return sysfs_emit(buf, PAGE_SIZE, "%d\n", id);
         |                                ^~~~~~~~~
   include/vdso/page.h:15:19: note: expanded from macro 'PAGE_SIZE'
      15 | #define PAGE_SIZE       (_AC(1,UL) << CONFIG_PAGE_SHIFT)
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/sysfs.h:492:39: note: passing argument to parameter 'fmt' here
     492 | int sysfs_emit(char *buf, const char *fmt, ...);
         |                                       ^
   drivers/fpga/dfl-afu-main.c:478:25: error: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const char *' [-Wint-conversion]
     478 |         return sysfs_emit(buf, PAGE_SIZE, "%016llx%016llx\n", guidh, guidl);
         |                                ^~~~~~~~~
   include/vdso/page.h:15:19: note: expanded from macro 'PAGE_SIZE'
      15 | #define PAGE_SIZE       (_AC(1,UL) << CONFIG_PAGE_SHIFT)
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/sysfs.h:492:39: note: passing argument to parameter 'fmt' here
     492 | int sysfs_emit(char *buf, const char *fmt, ...);
         |                                       ^
   2 errors generated.


vim +159 drivers/fpga/dfl-afu-main.c

   152	
   153	static ssize_t
   154	id_show(struct device *dev, struct device_attribute *attr, char *buf)
   155	{
   156		struct dfl_feature_dev_data *fdata = to_dfl_feature_dev_data(dev);
   157		int id = port_get_id(fdata);
   158	
 > 159		return sysfs_emit(buf, PAGE_SIZE, "%d\n", id);
   160	}
   161	static DEVICE_ATTR_RO(id);
   162	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit()
  2025-06-30 12:50 [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit() Ryan Chung
  2025-06-30 13:15 ` Greg KH
  2025-07-01  4:09 ` kernel test robot
@ 2025-07-01  4:30 ` kernel test robot
  2025-07-01 11:02 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2025-07-01  4:30 UTC (permalink / raw)
  To: Ryan Chung, hao.wu, trix, mdf, yilun.xu
  Cc: oe-kbuild-all, linux-fpga, linux-kernel-mentees, linux-kernel,
	Ryan Chung

Hi Ryan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.16-rc4 next-20250630]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ryan-Chung/fpga-dfl-Replace-scnprintf-with-sysfs_emit/20250630-205221
base:   linus/master
patch link:    https://lore.kernel.org/r/20250630125018.48417-1-seokwoo.chung130%40gmail.com
patch subject: [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit()
config: x86_64-randconfig-001-20250701 (https://download.01.org/0day-ci/archive/20250701/202507011152.ULf4bZsW-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250701/202507011152.ULf4bZsW-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507011152.ULf4bZsW-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/page_types.h:9,
                    from arch/x86/include/asm/ptrace.h:6,
                    from arch/x86/include/asm/math_emu.h:5,
                    from arch/x86/include/asm/processor.h:13,
                    from arch/x86/include/asm/timex.h:5,
                    from include/linux/timex.h:67,
                    from include/linux/time32.h:13,
                    from include/linux/time.h:60,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:13,
                    from drivers/fpga/dfl-afu-main.c:18:
   drivers/fpga/dfl-afu-main.c: In function 'id_show':
>> include/vdso/page.h:15:25: warning: passing argument 2 of 'sysfs_emit' makes pointer from integer without a cast [-Wint-conversion]
      15 | #define PAGE_SIZE       (_AC(1,UL) << CONFIG_PAGE_SHIFT)
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         long unsigned int
   drivers/fpga/dfl-afu-main.c:159:32: note: in expansion of macro 'PAGE_SIZE'
     159 |         return sysfs_emit(buf, PAGE_SIZE, "%d\n", id);
         |                                ^~~~~~~~~
   In file included from include/linux/kobject.h:20,
                    from include/linux/module.h:21:
   include/linux/sysfs.h:492:39: note: expected 'const char *' but argument is of type 'long unsigned int'
     492 | int sysfs_emit(char *buf, const char *fmt, ...);
         |                           ~~~~~~~~~~~~^~~
   drivers/fpga/dfl-afu-main.c: In function 'afu_id_show':
>> include/vdso/page.h:15:25: warning: passing argument 2 of 'sysfs_emit' makes pointer from integer without a cast [-Wint-conversion]
      15 | #define PAGE_SIZE       (_AC(1,UL) << CONFIG_PAGE_SHIFT)
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         long unsigned int
   drivers/fpga/dfl-afu-main.c:478:32: note: in expansion of macro 'PAGE_SIZE'
     478 |         return sysfs_emit(buf, PAGE_SIZE, "%016llx%016llx\n", guidh, guidl);
         |                                ^~~~~~~~~
   include/linux/sysfs.h:492:39: note: expected 'const char *' but argument is of type 'long unsigned int'
     492 | int sysfs_emit(char *buf, const char *fmt, ...);
         |                           ~~~~~~~~~~~~^~~
--
   In file included from arch/x86/include/asm/page_types.h:9,
                    from arch/x86/include/asm/ptrace.h:6,
                    from arch/x86/include/asm/math_emu.h:5,
                    from arch/x86/include/asm/processor.h:13,
                    from arch/x86/include/asm/timex.h:5,
                    from include/linux/timex.h:67,
                    from include/linux/time32.h:13,
                    from include/linux/time.h:60,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:13,
                    from dfl-afu-main.c:18:
   dfl-afu-main.c: In function 'id_show':
>> include/vdso/page.h:15:25: warning: passing argument 2 of 'sysfs_emit' makes pointer from integer without a cast [-Wint-conversion]
      15 | #define PAGE_SIZE       (_AC(1,UL) << CONFIG_PAGE_SHIFT)
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         long unsigned int
   dfl-afu-main.c:159:32: note: in expansion of macro 'PAGE_SIZE'
     159 |         return sysfs_emit(buf, PAGE_SIZE, "%d\n", id);
         |                                ^~~~~~~~~
   In file included from include/linux/kobject.h:20,
                    from include/linux/module.h:21:
   include/linux/sysfs.h:492:39: note: expected 'const char *' but argument is of type 'long unsigned int'
     492 | int sysfs_emit(char *buf, const char *fmt, ...);
         |                           ~~~~~~~~~~~~^~~
   dfl-afu-main.c: In function 'afu_id_show':
>> include/vdso/page.h:15:25: warning: passing argument 2 of 'sysfs_emit' makes pointer from integer without a cast [-Wint-conversion]
      15 | #define PAGE_SIZE       (_AC(1,UL) << CONFIG_PAGE_SHIFT)
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         long unsigned int
   dfl-afu-main.c:478:32: note: in expansion of macro 'PAGE_SIZE'
     478 |         return sysfs_emit(buf, PAGE_SIZE, "%016llx%016llx\n", guidh, guidl);
         |                                ^~~~~~~~~
   include/linux/sysfs.h:492:39: note: expected 'const char *' but argument is of type 'long unsigned int'
     492 | int sysfs_emit(char *buf, const char *fmt, ...);
         |                           ~~~~~~~~~~~~^~~


vim +/sysfs_emit +15 include/vdso/page.h

efe8419ae78d65e Vincenzo Frascino 2024-10-14  14  
efe8419ae78d65e Vincenzo Frascino 2024-10-14 @15  #define PAGE_SIZE	(_AC(1,UL) << CONFIG_PAGE_SHIFT)
efe8419ae78d65e Vincenzo Frascino 2024-10-14  16  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit()
  2025-06-30 12:50 [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit() Ryan Chung
                   ` (2 preceding siblings ...)
  2025-07-01  4:30 ` kernel test robot
@ 2025-07-01 11:02 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2025-07-01 11:02 UTC (permalink / raw)
  To: Ryan Chung, hao.wu, trix, mdf, yilun.xu
  Cc: oe-kbuild-all, linux-fpga, linux-kernel-mentees, linux-kernel,
	Ryan Chung

Hi Ryan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.16-rc4 next-20250630]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ryan-Chung/fpga-dfl-Replace-scnprintf-with-sysfs_emit/20250630-205221
base:   linus/master
patch link:    https://lore.kernel.org/r/20250630125018.48417-1-seokwoo.chung130%40gmail.com
patch subject: [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit()
config: sparc-randconfig-r112-20250701 (https://download.01.org/0day-ci/archive/20250701/202507011805.BSIqVlhe-lkp@intel.com/config)
compiler: sparc-linux-gcc (GCC) 8.5.0
reproduce: (https://download.01.org/0day-ci/archive/20250701/202507011805.BSIqVlhe-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507011805.BSIqVlhe-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/fpga/dfl-afu-main.c:159:32: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected char const *fmt @@     got unsigned long @@
   drivers/fpga/dfl-afu-main.c:159:32: sparse:     expected char const *fmt
   drivers/fpga/dfl-afu-main.c:159:32: sparse:     got unsigned long
   drivers/fpga/dfl-afu-main.c:478:32: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected char const *fmt @@     got unsigned long @@
   drivers/fpga/dfl-afu-main.c:478:32: sparse:     expected char const *fmt
   drivers/fpga/dfl-afu-main.c:478:32: sparse:     got unsigned long

vim +159 drivers/fpga/dfl-afu-main.c

   152	
   153	static ssize_t
   154	id_show(struct device *dev, struct device_attribute *attr, char *buf)
   155	{
   156		struct dfl_feature_dev_data *fdata = to_dfl_feature_dev_data(dev);
   157		int id = port_get_id(fdata);
   158	
 > 159		return sysfs_emit(buf, PAGE_SIZE, "%d\n", id);
   160	}
   161	static DEVICE_ATTR_RO(id);
   162	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2025-07-01 11:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-30 12:50 [PATCH] fpga: dfl: Replace scnprintf() with sysfs_emit() Ryan Chung
2025-06-30 13:15 ` Greg KH
2025-07-01  4:09 ` kernel test robot
2025-07-01  4:30 ` kernel test robot
2025-07-01 11:02 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).