linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ehea: Use DEVICE_ATTR_*() macro
@ 2021-05-23  3:15 YueHaibing
  2021-05-23  5:14 ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2021-05-23  3:15 UTC (permalink / raw)
  To: dougmill, davem, kuba; +Cc: netdev, linux-kernel, YueHaibing

Use DEVICE_ATTR_*() helper instead of plain DEVICE_ATTR,
which makes the code a bit shorter and easier to read.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/ethernet/ibm/ehea/ehea_main.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index ea55314b209d..fb639f7644bc 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -2867,14 +2867,14 @@ static int ehea_get_jumboframe_status(struct ehea_port *port, int *jumbo)
 	return ret;
 }
 
-static ssize_t ehea_show_port_id(struct device *dev,
-				 struct device_attribute *attr, char *buf)
+static ssize_t log_port_id_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
 {
 	struct ehea_port *port = container_of(dev, struct ehea_port, ofdev.dev);
 	return sprintf(buf, "%d", port->logical_port_id);
 }
 
-static DEVICE_ATTR(log_port_id, 0444, ehea_show_port_id, NULL);
+static DEVICE_ATTR_RO(log_port_id);
 
 static void logical_port_release(struct device *dev)
 {
@@ -3113,7 +3113,7 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter,
 	return NULL;
 }
 
-static ssize_t ehea_probe_port(struct device *dev,
+static ssize_t probe_port_show(struct device *dev,
 			       struct device_attribute *attr,
 			       const char *buf, size_t count)
 {
@@ -3168,9 +3168,9 @@ static ssize_t ehea_probe_port(struct device *dev,
 	return (ssize_t) count;
 }
 
-static ssize_t ehea_remove_port(struct device *dev,
-				struct device_attribute *attr,
-				const char *buf, size_t count)
+static ssize_t remove_port_store(struct device *dev,
+				 struct device_attribute *attr,
+				 const char *buf, size_t count)
 {
 	struct ehea_adapter *adapter = dev_get_drvdata(dev);
 	struct ehea_port *port;
@@ -3203,8 +3203,8 @@ static ssize_t ehea_remove_port(struct device *dev,
 	return (ssize_t) count;
 }
 
-static DEVICE_ATTR(probe_port, 0200, NULL, ehea_probe_port);
-static DEVICE_ATTR(remove_port, 0200, NULL, ehea_remove_port);
+static DEVICE_ATTR_WO(probe_port);
+static DEVICE_ATTR_WO(remove_port);
 
 static int ehea_create_device_sysfs(struct platform_device *dev)
 {
-- 
2.17.1


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

* Re: [PATCH net-next] ehea: Use DEVICE_ATTR_*() macro
  2021-05-23  3:15 [PATCH net-next] ehea: Use DEVICE_ATTR_*() macro YueHaibing
@ 2021-05-23  5:14 ` kernel test robot
  2021-05-23  6:01   ` YueHaibing
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-05-23  5:14 UTC (permalink / raw)
  To: YueHaibing, dougmill, davem, kuba
  Cc: kbuild-all, netdev, linux-kernel, YueHaibing

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

Hi YueHaibing,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/YueHaibing/ehea-Use-DEVICE_ATTR_-macro/20210523-111702
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git f5120f5998803a973b1d432ed2aa7e592527aa46
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/7402089765bd60dcd72cad433fd318058e06d514
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review YueHaibing/ehea-Use-DEVICE_ATTR_-macro/20210523-111702
        git checkout 7402089765bd60dcd72cad433fd318058e06d514
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

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 >>):

   In file included from include/linux/kobject.h:20,
                    from include/linux/energy_model.h:7,
                    from include/linux/device.h:16,
                    from drivers/net/ethernet/ibm/ehea/ehea_main.c:17:
>> drivers/net/ethernet/ibm/ehea/ehea_main.c:3206:23: error: 'probe_port_store' undeclared here (not in a function); did you mean 'probe_port_show'?
    3206 | static DEVICE_ATTR_WO(probe_port);
         |                       ^~~~~~~~~~
   include/linux/sysfs.h:135:11: note: in definition of macro '__ATTR_WO'
     135 |  .store = _name##_store,     \
         |           ^~~~~
   drivers/net/ethernet/ibm/ehea/ehea_main.c:3206:8: note: in expansion of macro 'DEVICE_ATTR_WO'
    3206 | static DEVICE_ATTR_WO(probe_port);
         |        ^~~~~~~~~~~~~~
   drivers/net/ethernet/ibm/ehea/ehea_main.c:3116:16: warning: 'probe_port_show' defined but not used [-Wunused-function]
    3116 | static ssize_t probe_port_show(struct device *dev,
         |                ^~~~~~~~~~~~~~~


vim +3206 drivers/net/ethernet/ibm/ehea/ehea_main.c

  3205	
> 3206	static DEVICE_ATTR_WO(probe_port);
  3207	static DEVICE_ATTR_WO(remove_port);
  3208	

---
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: 73343 bytes --]

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

* Re: [PATCH net-next] ehea: Use DEVICE_ATTR_*() macro
  2021-05-23  5:14 ` kernel test robot
@ 2021-05-23  6:01   ` YueHaibing
  0 siblings, 0 replies; 3+ messages in thread
From: YueHaibing @ 2021-05-23  6:01 UTC (permalink / raw)
  To: kernel test robot, dougmill, davem, kuba; +Cc: kbuild-all, netdev, linux-kernel

On 2021/5/23 13:14, kernel test robot wrote:
> Hi YueHaibing,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on net-next/master]
> 
> url:    https://github.com/0day-ci/linux/commits/YueHaibing/ehea-Use-DEVICE_ATTR_-macro/20210523-111702
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git f5120f5998803a973b1d432ed2aa7e592527aa46
> config: powerpc-allmodconfig (attached as .config)
> compiler: powerpc64-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/0day-ci/linux/commit/7402089765bd60dcd72cad433fd318058e06d514
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review YueHaibing/ehea-Use-DEVICE_ATTR_-macro/20210523-111702
>         git checkout 7402089765bd60dcd72cad433fd318058e06d514
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 
> 
> 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 >>):
> 
>    In file included from include/linux/kobject.h:20,
>                     from include/linux/energy_model.h:7,
>                     from include/linux/device.h:16,
>                     from drivers/net/ethernet/ibm/ehea/ehea_main.c:17:
>>> drivers/net/ethernet/ibm/ehea/ehea_main.c:3206:23: error: 'probe_port_store' undeclared here (not in a function); did you mean 'probe_port_show'?

Sorry, this is the wrong version.

>     3206 | static DEVICE_ATTR_WO(probe_port);
>          |                       ^~~~~~~~~~
>    include/linux/sysfs.h:135:11: note: in definition of macro '__ATTR_WO'
>      135 |  .store = _name##_store,     \
>          |           ^~~~~
>    drivers/net/ethernet/ibm/ehea/ehea_main.c:3206:8: note: in expansion of macro 'DEVICE_ATTR_WO'
>     3206 | static DEVICE_ATTR_WO(probe_port);
>          |        ^~~~~~~~~~~~~~
>    drivers/net/ethernet/ibm/ehea/ehea_main.c:3116:16: warning: 'probe_port_show' defined but not used [-Wunused-function]
>     3116 | static ssize_t probe_port_show(struct device *dev,
>          |                ^~~~~~~~~~~~~~~
> 
> 
> vim +3206 drivers/net/ethernet/ibm/ehea/ehea_main.c
> 
>   3205	
>> 3206	static DEVICE_ATTR_WO(probe_port);
>   3207	static DEVICE_ATTR_WO(remove_port);
>   3208	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> 

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

end of thread, other threads:[~2021-05-23  6:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23  3:15 [PATCH net-next] ehea: Use DEVICE_ATTR_*() macro YueHaibing
2021-05-23  5:14 ` kernel test robot
2021-05-23  6:01   ` YueHaibing

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).