linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] ssb: use DEVICE_ATTR_ADMIN_RW() helper macro
@ 2021-06-03  8:22 Zhen Lei
  2021-06-03  8:22 ` [PATCH v2 1/1] " Zhen Lei
  0 siblings, 1 reply; 3+ messages in thread
From: Zhen Lei @ 2021-06-03  8:22 UTC (permalink / raw)
  To: Michael Buesch, linux-wireless; +Cc: Zhen Lei

v1 --> v2:
Update commit message.


Zhen Lei (1):
  ssb: use DEVICE_ATTR_ADMIN_RW() helper macro

 drivers/ssb/pci.c    | 16 +++++++---------
 drivers/ssb/pcmcia.c | 16 +++++++---------
 2 files changed, 14 insertions(+), 18 deletions(-)

-- 
2.26.0.106.g9fadedd



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

* [PATCH v2 1/1] ssb: use DEVICE_ATTR_ADMIN_RW() helper macro
  2021-06-03  8:22 [PATCH v2 0/1] ssb: use DEVICE_ATTR_ADMIN_RW() helper macro Zhen Lei
@ 2021-06-03  8:22 ` Zhen Lei
  2021-06-15 10:12   ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Zhen Lei @ 2021-06-03  8:22 UTC (permalink / raw)
  To: Michael Buesch, linux-wireless; +Cc: Zhen Lei

Use DEVICE_ATTR_ADMIN_RW() helper macro instead of DEVICE_ATTR(), making
it simpler and easier to read.

Because the read and write function names of the sysfs attribute have been
normalized, there is a natural association.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/ssb/pci.c    | 16 +++++++---------
 drivers/ssb/pcmcia.c | 16 +++++++---------
 2 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index dac54041ad8d28a..148bcb99c212877 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -1117,9 +1117,9 @@ const struct ssb_bus_ops ssb_pci_ops = {
 #endif
 };
 
-static ssize_t ssb_pci_attr_sprom_show(struct device *pcidev,
-				       struct device_attribute *attr,
-				       char *buf)
+static ssize_t ssb_sprom_show(struct device *pcidev,
+			      struct device_attribute *attr,
+			      char *buf)
 {
 	struct pci_dev *pdev = container_of(pcidev, struct pci_dev, dev);
 	struct ssb_bus *bus;
@@ -1131,9 +1131,9 @@ static ssize_t ssb_pci_attr_sprom_show(struct device *pcidev,
 	return ssb_attr_sprom_show(bus, buf, sprom_do_read);
 }
 
-static ssize_t ssb_pci_attr_sprom_store(struct device *pcidev,
-					struct device_attribute *attr,
-					const char *buf, size_t count)
+static ssize_t ssb_sprom_store(struct device *pcidev,
+			       struct device_attribute *attr,
+			       const char *buf, size_t count)
 {
 	struct pci_dev *pdev = container_of(pcidev, struct pci_dev, dev);
 	struct ssb_bus *bus;
@@ -1146,9 +1146,7 @@ static ssize_t ssb_pci_attr_sprom_store(struct device *pcidev,
 				    sprom_check_crc, sprom_do_write);
 }
 
-static DEVICE_ATTR(ssb_sprom, 0600,
-		   ssb_pci_attr_sprom_show,
-		   ssb_pci_attr_sprom_store);
+static DEVICE_ATTR_ADMIN_RW(ssb_sprom);
 
 void ssb_pci_exit(struct ssb_bus *bus)
 {
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c
index d7d730c245c5687..45502098e0c785d 100644
--- a/drivers/ssb/pcmcia.c
+++ b/drivers/ssb/pcmcia.c
@@ -723,9 +723,9 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
 	return -ENODEV;
 }
 
-static ssize_t ssb_pcmcia_attr_sprom_show(struct device *pcmciadev,
-					  struct device_attribute *attr,
-					  char *buf)
+static ssize_t ssb_sprom_show(struct device *pcmciadev,
+			      struct device_attribute *attr,
+			      char *buf)
 {
 	struct pcmcia_device *pdev =
 		container_of(pcmciadev, struct pcmcia_device, dev);
@@ -739,9 +739,9 @@ static ssize_t ssb_pcmcia_attr_sprom_show(struct device *pcmciadev,
 				   ssb_pcmcia_sprom_read_all);
 }
 
-static ssize_t ssb_pcmcia_attr_sprom_store(struct device *pcmciadev,
-					   struct device_attribute *attr,
-					   const char *buf, size_t count)
+static ssize_t ssb_sprom_store(struct device *pcmciadev,
+			       struct device_attribute *attr,
+			       const char *buf, size_t count)
 {
 	struct pcmcia_device *pdev =
 		container_of(pcmciadev, struct pcmcia_device, dev);
@@ -756,9 +756,7 @@ static ssize_t ssb_pcmcia_attr_sprom_store(struct device *pcmciadev,
 				    ssb_pcmcia_sprom_write_all);
 }
 
-static DEVICE_ATTR(ssb_sprom, 0600,
-		   ssb_pcmcia_attr_sprom_show,
-		   ssb_pcmcia_attr_sprom_store);
+static DEVICE_ATTR_ADMIN_RW(ssb_sprom);
 
 static int ssb_pcmcia_cor_setup(struct ssb_bus *bus, u8 cor)
 {
-- 
2.26.0.106.g9fadedd



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

* Re: [PATCH v2 1/1] ssb: use DEVICE_ATTR_ADMIN_RW() helper macro
  2021-06-03  8:22 ` [PATCH v2 1/1] " Zhen Lei
@ 2021-06-15 10:12   ` Kalle Valo
  0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-06-15 10:12 UTC (permalink / raw)
  To: Zhen Lei; +Cc: Michael Buesch, linux-wireless, Zhen Lei

Zhen Lei <thunder.leizhen@huawei.com> wrote:

> Use DEVICE_ATTR_ADMIN_RW() helper macro instead of DEVICE_ATTR(), making
> it simpler and easier to read.
> 
> Because the read and write function names of the sysfs attribute have been
> normalized, there is a natural association.
> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

Patch applied to wireless-drivers-next.git, thanks.

573f1af86891 ssb: use DEVICE_ATTR_ADMIN_RW() helper macro

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210603082218.11718-2-thunder.leizhen@huawei.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03  8:22 [PATCH v2 0/1] ssb: use DEVICE_ATTR_ADMIN_RW() helper macro Zhen Lei
2021-06-03  8:22 ` [PATCH v2 1/1] " Zhen Lei
2021-06-15 10:12   ` Kalle Valo

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