]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ssb: use DEVICE_ATTR_ADMIN_RW() helper macro
authorZhen Lei <thunder.leizhen@huawei.com>
Thu, 3 Jun 2021 08:22:18 +0000 (16:22 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 15 Jun 2021 10:11:56 +0000 (13:11 +0300)
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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210603082218.11718-2-thunder.leizhen@huawei.com
drivers/ssb/pci.c
drivers/ssb/pcmcia.c

index dac54041ad8d28a726a1e9b7257a69fbd331bf02..148bcb99c2128779baaae4661675bd8051287cb6 100644 (file)
@@ -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)
 {
index d7d730c245c56870158417d6e1a05d4fb53c963e..45502098e0c785defeb98ceafe304edad14571f1 100644 (file)
@@ -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)
 {