All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] can: at91_can: use DEVICE_ATTR_RW() helper macro
@ 2021-06-03 10:02 ` Zhen Lei
  0 siblings, 0 replies; 4+ messages in thread
From: Zhen Lei @ 2021-06-03 10:02 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, David S . Miller,
	Jakub Kicinski, Nicolas Ferre, Alexandre Belloni,
	Ludovic Desroches, linux-can, netdev, linux-arm-kernel,
	linux-kernel
  Cc: Zhen Lei

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

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/net/can/at91_can.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 04d0bb3ffe89661..ca736b26e218ca4 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1176,8 +1176,8 @@ static const struct net_device_ops at91_netdev_ops = {
 	.ndo_change_mtu = can_change_mtu,
 };
 
-static ssize_t at91_sysfs_show_mb0_id(struct device *dev,
-		struct device_attribute *attr, char *buf)
+static ssize_t mb0_id_show(struct device *dev,
+			   struct device_attribute *attr, char *buf)
 {
 	struct at91_priv *priv = netdev_priv(to_net_dev(dev));
 
@@ -1187,8 +1187,8 @@ static ssize_t at91_sysfs_show_mb0_id(struct device *dev,
 		return snprintf(buf, PAGE_SIZE, "0x%03x\n", priv->mb0_id);
 }
 
-static ssize_t at91_sysfs_set_mb0_id(struct device *dev,
-		struct device_attribute *attr, const char *buf, size_t count)
+static ssize_t mb0_id_store(struct device *dev,
+			    struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct net_device *ndev = to_net_dev(dev);
 	struct at91_priv *priv = netdev_priv(ndev);
@@ -1222,7 +1222,7 @@ static ssize_t at91_sysfs_set_mb0_id(struct device *dev,
 	return ret;
 }
 
-static DEVICE_ATTR(mb0_id, 0644, at91_sysfs_show_mb0_id, at91_sysfs_set_mb0_id);
+static DEVICE_ATTR_RW(mb0_id);
 
 static struct attribute *at91_sysfs_attrs[] = {
 	&dev_attr_mb0_id.attr,
-- 
2.26.0.106.g9fadedd



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

* [PATCH 1/1] can: at91_can: use DEVICE_ATTR_RW() helper macro
@ 2021-06-03 10:02 ` Zhen Lei
  0 siblings, 0 replies; 4+ messages in thread
From: Zhen Lei @ 2021-06-03 10:02 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, David S . Miller,
	Jakub Kicinski, Nicolas Ferre, Alexandre Belloni,
	Ludovic Desroches, linux-can, netdev, linux-arm-kernel,
	linux-kernel
  Cc: Zhen Lei

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

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/net/can/at91_can.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 04d0bb3ffe89661..ca736b26e218ca4 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1176,8 +1176,8 @@ static const struct net_device_ops at91_netdev_ops = {
 	.ndo_change_mtu = can_change_mtu,
 };
 
-static ssize_t at91_sysfs_show_mb0_id(struct device *dev,
-		struct device_attribute *attr, char *buf)
+static ssize_t mb0_id_show(struct device *dev,
+			   struct device_attribute *attr, char *buf)
 {
 	struct at91_priv *priv = netdev_priv(to_net_dev(dev));
 
@@ -1187,8 +1187,8 @@ static ssize_t at91_sysfs_show_mb0_id(struct device *dev,
 		return snprintf(buf, PAGE_SIZE, "0x%03x\n", priv->mb0_id);
 }
 
-static ssize_t at91_sysfs_set_mb0_id(struct device *dev,
-		struct device_attribute *attr, const char *buf, size_t count)
+static ssize_t mb0_id_store(struct device *dev,
+			    struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct net_device *ndev = to_net_dev(dev);
 	struct at91_priv *priv = netdev_priv(ndev);
@@ -1222,7 +1222,7 @@ static ssize_t at91_sysfs_set_mb0_id(struct device *dev,
 	return ret;
 }
 
-static DEVICE_ATTR(mb0_id, 0644, at91_sysfs_show_mb0_id, at91_sysfs_set_mb0_id);
+static DEVICE_ATTR_RW(mb0_id);
 
 static struct attribute *at91_sysfs_attrs[] = {
 	&dev_attr_mb0_id.attr,
-- 
2.26.0.106.g9fadedd



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/1] can: at91_can: use DEVICE_ATTR_RW() helper macro
  2021-06-03 10:02 ` Zhen Lei
@ 2021-06-16 10:36   ` Marc Kleine-Budde
  -1 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:36 UTC (permalink / raw)
  To: Zhen Lei
  Cc: Wolfgang Grandegger, David S . Miller, Jakub Kicinski,
	Nicolas Ferre, Alexandre Belloni, Ludovic Desroches, linux-can,
	netdev, linux-arm-kernel, linux-kernel

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

On 03.06.2021 18:02:33, Zhen Lei wrote:
> Use DEVICE_ATTR_RW() helper macro instead of plain DEVICE_ATTR(), which
> makes the code a bit shorter and easier to read.

Applied all 3 (at91, esd_usb2 and janz-ican3) to linux-can-next/testing.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/1] can: at91_can: use DEVICE_ATTR_RW() helper macro
@ 2021-06-16 10:36   ` Marc Kleine-Budde
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-06-16 10:36 UTC (permalink / raw)
  To: Zhen Lei
  Cc: Alexandre Belloni, linux-kernel, netdev, linux-can,
	Ludovic Desroches, linux-arm-kernel, Jakub Kicinski,
	David S . Miller, Wolfgang Grandegger


[-- Attachment #1.1: Type: text/plain, Size: 533 bytes --]

On 03.06.2021 18:02:33, Zhen Lei wrote:
> Use DEVICE_ATTR_RW() helper macro instead of plain DEVICE_ATTR(), which
> makes the code a bit shorter and easier to read.

Applied all 3 (at91, esd_usb2 and janz-ican3) to linux-can-next/testing.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-06-16 10:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 10:02 [PATCH 1/1] can: at91_can: use DEVICE_ATTR_RW() helper macro Zhen Lei
2021-06-03 10:02 ` Zhen Lei
2021-06-16 10:36 ` Marc Kleine-Budde
2021-06-16 10:36   ` Marc Kleine-Budde

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.