linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers:edac: Use DEVICE_ATTR helper macros
@ 2021-07-11  7:27 Dwaipayan Ray
  2021-07-11 11:48 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Dwaipayan Ray @ 2021-07-11  7:27 UTC (permalink / raw)
  To: yazen.ghannam, bp, mchehab, tony.luck, james.morse, rric
  Cc: linux-edac, linux-kernel, lukas.bulwahn, Dwaipayan Ray

Instead of "open coding" DEVICE_ATTR, use the corresponding
helper macros DEVICE_ATTR_{RW,RO_WO}.

Some function names needed to be changed to match the device
conventions <foo>_show and <foo>_store, but the functionality
itself is unchanged.

Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
---

Build tested only with CONFIG_EDAC_DEBUG=y

 drivers/edac/amd64_edac.c | 35 +++++++++++++++--------------------
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index f0d8f60acee1..088dad0c7b40 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -567,12 +567,12 @@ static ssize_t reg##_show(struct device *dev,				\
 }
 
 EDAC_DCT_ATTR_SHOW(dhar);
-EDAC_DCT_ATTR_SHOW(dbam0);
-EDAC_DCT_ATTR_SHOW(top_mem);
-EDAC_DCT_ATTR_SHOW(top_mem2);
+EDAC_DCT_ATTR_SHOW(dbam);
+EDAC_DCT_ATTR_SHOW(topmem);
+EDAC_DCT_ATTR_SHOW(topmem2);
 
-static ssize_t hole_show(struct device *dev, struct device_attribute *mattr,
-			 char *data)
+static ssize_t dram_hole_show(struct device *dev, struct device_attribute *mattr,
+			      char *data)
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 
@@ -589,11 +589,11 @@ static ssize_t hole_show(struct device *dev, struct device_attribute *mattr,
 /*
  * update NUM_DBG_ATTRS in case you add new members
  */
-static DEVICE_ATTR(dhar, S_IRUGO, dhar_show, NULL);
-static DEVICE_ATTR(dbam, S_IRUGO, dbam0_show, NULL);
-static DEVICE_ATTR(topmem, S_IRUGO, top_mem_show, NULL);
-static DEVICE_ATTR(topmem2, S_IRUGO, top_mem2_show, NULL);
-static DEVICE_ATTR(dram_hole, S_IRUGO, hole_show, NULL);
+static DEVICE_ATTR_RO(dhar);
+static DEVICE_ATTR_RO(dbam);
+static DEVICE_ATTR_RO(topmem);
+static DEVICE_ATTR_RO(topmem2);
+static DEVICE_ATTR_RO(dram_hole);
 
 static struct attribute *dbg_attrs[] = {
 	&dev_attr_dhar.attr,
@@ -802,16 +802,11 @@ static ssize_t inject_write_store(struct device *dev,
  * update NUM_INJ_ATTRS in case you add new members
  */
 
-static DEVICE_ATTR(inject_section, S_IRUGO | S_IWUSR,
-		   inject_section_show, inject_section_store);
-static DEVICE_ATTR(inject_word, S_IRUGO | S_IWUSR,
-		   inject_word_show, inject_word_store);
-static DEVICE_ATTR(inject_ecc_vector, S_IRUGO | S_IWUSR,
-		   inject_ecc_vector_show, inject_ecc_vector_store);
-static DEVICE_ATTR(inject_write, S_IWUSR,
-		   NULL, inject_write_store);
-static DEVICE_ATTR(inject_read,  S_IWUSR,
-		   NULL, inject_read_store);
+static DEVICE_ATTR_RW(inject_section);
+static DEVICE_ATTR_RW(inject_word);
+static DEVICE_ATTR_RW(inject_ecc_vector);
+static DEVICE_ATTR_WO(inject_write);
+static DEVICE_ATTR_WO(inject_read);
 
 static struct attribute *inj_attrs[] = {
 	&dev_attr_inject_section.attr,
-- 
2.28.0


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

* Re: [PATCH] drivers:edac: Use DEVICE_ATTR helper macros
  2021-07-11  7:27 [PATCH] drivers:edac: Use DEVICE_ATTR helper macros Dwaipayan Ray
@ 2021-07-11 11:48 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-07-11 11:48 UTC (permalink / raw)
  To: Dwaipayan Ray, yazen.ghannam, bp, mchehab, tony.luck, james.morse, rric
  Cc: kbuild-all, linux-edac, linux-kernel, lukas.bulwahn, Dwaipayan Ray

[-- Attachment #1: Type: text/plain, Size: 3999 bytes --]

Hi Dwaipayan,

I love your patch! Yet something to improve:

[auto build test ERROR on ras/edac-for-next]
[also build test ERROR on v5.13 next-20210709]
[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]

url:    https://github.com/0day-ci/linux/commits/Dwaipayan-Ray/drivers-edac-Use-DEVICE_ATTR-helper-macros/20210711-152925
base:   https://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-for-next
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/adad6ecbf0efe710fee1495b85d840ad53825124
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Dwaipayan-Ray/drivers-edac-Use-DEVICE_ATTR-helper-macros/20210711-152925
        git checkout adad6ecbf0efe710fee1495b85d840ad53825124
        # save the attached .config to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/edac/amd64_edac.c: In function 'dbam_show':
>> drivers/edac/amd64_edac.c:570:20: error: 'struct amd64_pvt' has no member named 'dbam'; did you mean 'dbam0'?
     570 | EDAC_DCT_ATTR_SHOW(dbam);
         |                    ^~~~
   drivers/edac/amd64_edac.c:566:48: note: in definition of macro 'EDAC_DCT_ATTR_SHOW'
     566 |  return sprintf(data, "0x%016llx\n", (u64)pvt->reg);  \
         |                                                ^~~
   drivers/edac/amd64_edac.c: In function 'topmem_show':
>> drivers/edac/amd64_edac.c:571:20: error: 'struct amd64_pvt' has no member named 'topmem'; did you mean 'top_mem'?
     571 | EDAC_DCT_ATTR_SHOW(topmem);
         |                    ^~~~~~
   drivers/edac/amd64_edac.c:566:48: note: in definition of macro 'EDAC_DCT_ATTR_SHOW'
     566 |  return sprintf(data, "0x%016llx\n", (u64)pvt->reg);  \
         |                                                ^~~
   drivers/edac/amd64_edac.c: In function 'topmem2_show':
>> drivers/edac/amd64_edac.c:572:20: error: 'struct amd64_pvt' has no member named 'topmem2'; did you mean 'top_mem2'?
     572 | EDAC_DCT_ATTR_SHOW(topmem2);
         |                    ^~~~~~~
   drivers/edac/amd64_edac.c:566:48: note: in definition of macro 'EDAC_DCT_ATTR_SHOW'
     566 |  return sprintf(data, "0x%016llx\n", (u64)pvt->reg);  \
         |                                                ^~~
   drivers/edac/amd64_edac.c:567:1: error: control reaches end of non-void function [-Werror=return-type]
     567 | }
         | ^
   drivers/edac/amd64_edac.c:572:1: note: in expansion of macro 'EDAC_DCT_ATTR_SHOW'
     572 | EDAC_DCT_ATTR_SHOW(topmem2);
         | ^~~~~~~~~~~~~~~~~~
   drivers/edac/amd64_edac.c: In function 'topmem_show':
   drivers/edac/amd64_edac.c:567:1: error: control reaches end of non-void function [-Werror=return-type]
     567 | }
         | ^
   drivers/edac/amd64_edac.c:571:1: note: in expansion of macro 'EDAC_DCT_ATTR_SHOW'
     571 | EDAC_DCT_ATTR_SHOW(topmem);
         | ^~~~~~~~~~~~~~~~~~
   drivers/edac/amd64_edac.c: In function 'dbam_show':
   drivers/edac/amd64_edac.c:567:1: error: control reaches end of non-void function [-Werror=return-type]
     567 | }
         | ^
   drivers/edac/amd64_edac.c:570:1: note: in expansion of macro 'EDAC_DCT_ATTR_SHOW'
     570 | EDAC_DCT_ATTR_SHOW(dbam);
         | ^~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +570 drivers/edac/amd64_edac.c

   568	
   569	EDAC_DCT_ATTR_SHOW(dhar);
 > 570	EDAC_DCT_ATTR_SHOW(dbam);
 > 571	EDAC_DCT_ATTR_SHOW(topmem);
 > 572	EDAC_DCT_ATTR_SHOW(topmem2);
   573	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 65260 bytes --]

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

end of thread, other threads:[~2021-07-11 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-11  7:27 [PATCH] drivers:edac: Use DEVICE_ATTR helper macros Dwaipayan Ray
2021-07-11 11:48 ` 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).