netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bonding: helper macro __ATTR_RO to make code more clear
@ 2022-03-06  8:28 Lianjie Zhang
  2022-03-06 18:30 ` Jay Vosburgh
  0 siblings, 1 reply; 2+ messages in thread
From: Lianjie Zhang @ 2022-03-06  8:28 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: David S. Miller, Jay Vosburgh, Veaceslav Falico, netdev,
	linux-kernel, Lianjie Zhang

Signed-off-by: Lianjie Zhang <zhanglianjie@uniontech.com>

diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c
index 6a6cdd0bb258..69b0a3751dff 100644
--- a/drivers/net/bonding/bond_sysfs_slave.c
+++ b/drivers/net/bonding/bond_sysfs_slave.c
@@ -15,14 +15,8 @@ struct slave_attribute {
 	ssize_t (*show)(struct slave *, char *);
 };

-#define SLAVE_ATTR(_name, _mode, _show)				\
-const struct slave_attribute slave_attr_##_name = {		\
-	.attr = {.name = __stringify(_name),			\
-		 .mode = _mode },				\
-	.show	= _show,					\
-};
 #define SLAVE_ATTR_RO(_name)					\
-	SLAVE_ATTR(_name, 0444, _name##_show)
+const struct slave_attribute slave_attr_##_name = __ATTR_RO(_name)

 static ssize_t state_show(struct slave *slave, char *buf)
 {
--
2.20.1




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

* Re: [PATCH] bonding: helper macro __ATTR_RO to make code more clear
  2022-03-06  8:28 [PATCH] bonding: helper macro __ATTR_RO to make code more clear Lianjie Zhang
@ 2022-03-06 18:30 ` Jay Vosburgh
  0 siblings, 0 replies; 2+ messages in thread
From: Jay Vosburgh @ 2022-03-06 18:30 UTC (permalink / raw)
  To: Lianjie Zhang
  Cc: Jakub Kicinski, David S. Miller, Veaceslav Falico, netdev,
	linux-kernel

Lianjie Zhang <zhanglianjie@uniontech.com> wrote:

>Signed-off-by: Lianjie Zhang <zhanglianjie@uniontech.com>

	I'm ok with the change, but this needs a sentence or two in the
commit log message to explain what's going on, so that future readers of
the log don't have to read the diff to figure out why this change makes
sense.

	-J

>diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c
>index 6a6cdd0bb258..69b0a3751dff 100644
>--- a/drivers/net/bonding/bond_sysfs_slave.c
>+++ b/drivers/net/bonding/bond_sysfs_slave.c
>@@ -15,14 +15,8 @@ struct slave_attribute {
> 	ssize_t (*show)(struct slave *, char *);
> };
>
>-#define SLAVE_ATTR(_name, _mode, _show)				\
>-const struct slave_attribute slave_attr_##_name = {		\
>-	.attr = {.name = __stringify(_name),			\
>-		 .mode = _mode },				\
>-	.show	= _show,					\
>-};
> #define SLAVE_ATTR_RO(_name)					\
>-	SLAVE_ATTR(_name, 0444, _name##_show)
>+const struct slave_attribute slave_attr_##_name = __ATTR_RO(_name)
>
> static ssize_t state_show(struct slave *slave, char *buf)
> {
>--
>2.20.1

---
	-Jay Vosburgh, jay.vosburgh@canonical.com

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

end of thread, other threads:[~2022-03-06 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-06  8:28 [PATCH] bonding: helper macro __ATTR_RO to make code more clear Lianjie Zhang
2022-03-06 18:30 ` Jay Vosburgh

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