fpga: altera-cvp: remove DRIVER_ATTR() usage
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 1/2 fpga: altera-cvp: remove DRIVER_ATTR() usage
It's better to be explicit and use the DRIVER_ATTR_RW() macro when defining a driver's sysfs file.
This is part of a series to drop DRIVER_ATTR() from the tree entirely.
--- drivers/fpga/altera-cvp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/fpga/altera-cvp.c +3 -3
@@ -361,12 +361,12 @@ static const struct fpga_manager_ops altera_cvp_ops = { .write_complete = altera_cvp_write_complete, }; -static ssize_t show_chkcfg (struct device_driver *dev,char *buf) +static ssize_t chkcfg_show (struct device_driver *dev,char *buf) {return snprintf (buf,3 ,"%d\n" , altera_cvp_chkcfg); } -static ssize_t store_chkcfg (struct device_driver *drv,const char *buf, +static ssize_t chkcfg_store (struct device_driver *drv,const char *buf,size_t count) {int ret;
@@ -378,7 +378,7 @@ static ssize_t store_chkcfg(struct device_driver *drv, const char *buf,return count; } -static DRIVER_ATTR(chkcfg, 0600, show_chkcfg, store_chkcfg); +static DRIVER_ATTR_RW (chkcfg);static int altera_cvp_probe (struct pci_dev *pdev,const struct pci_device_id *dev_id);
Signature · 1 line
2.14.1
Greg Kroah-Hartman
maintainerPATCH 2/2 driver core: remove DRIVER_ATTR
DRIVER_ATTR is no longer in use, and driver authors should be using DRIVER_ATTR_RW() or DRIVER_ATTR_RO() or DRIVER_ATTR_WO() instead in order to always get the permissions correct. So remove it so that no one can use it anymore.
--- Documentation/driver-model/driver.txt | 7 ++++--- Documentation/filesystems/sysfs.txt | 3 ++- include/linux/device.h | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-)
Documentation/driver-model/driver.txt +4 -3
@@ -196,12 +196,13 @@ struct driver_attribute { }; Device drivers can export attributes via their sysfs directories. -Drivers can declare attributes using a DRIVER_ATTR macro that works -identically to the DEVICE_ATTR macro. +Drivers can declare attributes using a DRIVER_ATTR_RW and DRIVER_ATTR_RO +macro that works identically to the DEVICE_ATTR_RW and DEVICE_ATTR_RO +macros. Example: -DRIVER_ATTR(debug,0644,show_debug,store_debug); +DRIVER_ATTR_RW(debug); This is equivalent to declaring:
Documentation/filesystems/sysfs.txt +2 -1
@@ -366,7 +366,8 @@ struct driver_attribute { Declaring: -DRIVER_ATTR(_name, _mode, _show, _store) +DRIVER_ATTR_RO(_name) +DRIVER_ATTR_RW(_name) Creation/Removal:
include/linux/device.h +0 -2
@@ -307,8 +307,6 @@ struct driver_attribute { size_t count); }; -#define DRIVER_ATTR (_name, _mode, _show, _store) \ - struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store)#define DRIVER_ATTR_RW (_name) \ struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)#define DRIVER_ATTR_RO (_name) \
Signature · 1 line
2.14.1
Quoted 9 lines · Greg Kroah-Hartman
It's better to be explicit and use the
DRIVER_ATTR_RW()macro when defining a driver's sysfs file.This is part of a series to drop
DRIVER_ATTR()from the tree entirely.Cc Alan Tull <[email protected]>Cc Moritz Fischer <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 35 lines
--- drivers/fpga/altera-cvp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/fpga/altera-cvp.c +3
-3@@ -361,12 +361,12 @@ static const struct fpga_manager_ops altera_cvp_ops = { .write_complete = altera_cvp_write_complete, }; -static ssize_t show_chkcfg (struct device_driver *dev,char *buf) +static ssize_t chkcfg_show (struct device_driver *dev,char *buf) {return snprintf (buf,3 ,"%d\n" , altera_cvp_chkcfg); } -static ssize_t store_chkcfg (struct device_driver *drv,const char *buf, +static ssize_t chkcfg_store (struct device_driver *drv,const char *buf,size_t count) {int ret;@@ -378,7 +378,7 @@ static ssize_t store_chkcfg(struct device_driver *drv, const char *buf,return count; } -static DRIVER_ATTR(chkcfg, 0600, show_chkcfg, store_chkcfg); +static DRIVER_ATTR_RW (chkcfg);static int altera_cvp_probe (struct pci_dev *pdev,const struct pci_device_id *dev_id);Signature · 1 line
2.14.1
Re: [PATCH 2/2] driver core: remove DRIVER_ATTR
In reply to Greg Kroah-HartmanQuoted 7 lines · Greg Kroah-Hartman
DRIVER_ATTRis no longer in use, and driver authors should be usingDRIVER_ATTR_RW()orDRIVER_ATTR_RO()orDRIVER_ATTR_WO()instead in order to always get the permissions correct. So remove it so that no one can use it anymore.Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 57 lines
--- Documentation/driver-model/driver.txt | 7 ++++--- Documentation/filesystems/sysfs.txt | 3 ++- include/linux/device.h | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-)Documentation/driver-model/driver.txt +4
-3@@ -196,12 +196,13 @@ struct driver_attribute { }; Device drivers can export attributes via their sysfs directories. -Drivers can declare attributes using a DRIVER_ATTR macro that works -identically to the DEVICE_ATTR macro. +Drivers can declare attributes using a DRIVER_ATTR_RW and DRIVER_ATTR_RO +macro that works identically to the DEVICE_ATTR_RW and DEVICE_ATTR_RO +macros. Example: -DRIVER_ATTR(debug,0644,show_debug,store_debug); +DRIVER_ATTR_RW(debug); This is equivalent to declaring:Documentation/filesystems/sysfs.txt +2
-1@@ -366,7 +366,8 @@ struct driver_attribute { Declaring: -DRIVER_ATTR(_name, _mode, _show, _store) +DRIVER_ATTR_RO(_name) +DRIVER_ATTR_RW(_name) Creation/Removal:include/linux/device.h +0
-2@@ -307,8 +307,6 @@ struct driver_attribute { size_t count); }; -#define DRIVER_ATTR (_name, _mode, _show, _store) \ - struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store)#define DRIVER_ATTR_RW (_name) \ struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)#define DRIVER_ATTR_RO (_name) \Signature · 1 line
2.14.1
Thanks,
Moritz
Alan Tull
Acked-byQuoted 11 lines · Moritz Fischer
Quoted 9 lines · Greg Kroah-Hartman
It's better to be explicit and use the
DRIVER_ATTR_RW()macro when defining a driver's sysfs file.This is part of a series to drop
DRIVER_ATTR()from the tree entirely.Cc Alan Tull <[email protected]>Cc Moritz Fischer <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Acked-by Moritz Fischer <[email protected]>
Quoted 35 lines
Quoted 35 lines
--- drivers/fpga/altera-cvp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/fpga/altera-cvp.c +3
-4@@ -361,12 +361,12 @@ static const struct fpga_manager_ops altera_cvp_ops = { .write_complete = altera_cvp_write_complete, }; -static ssize_t show_chkcfg (struct device_driver *dev,char *buf) +static ssize_t chkcfg_show (struct device_driver *dev,char *buf) {return snprintf (buf,3 ,"%d\n" , altera_cvp_chkcfg); } -static ssize_t store_chkcfg (struct device_driver *drv,const char *buf, +static ssize_t chkcfg_store (struct device_driver *drv,const char *buf,size_t count) {int ret;@@ -378,7 +378,7 @@ static ssize_t store_chkcfg(struct device_driver *drv, const char *buf,return count; } -static DRIVER_ATTR(chkcfg, 0600, show_chkcfg, store_chkcfg); +static DRIVER_ATTR_RW (chkcfg);static int altera_cvp_probe (struct pci_dev *pdev,const struct pci_device_id *dev_id); --2.14.1
Alan Tull
Acked-byRe: [PATCH 2/2] driver core: remove DRIVER_ATTR
In reply to Moritz FischerQuoted 9 lines · Moritz Fischer
Quoted 7 lines · Greg Kroah-Hartman
DRIVER_ATTRis no longer in use, and driver authors should be usingDRIVER_ATTR_RW()orDRIVER_ATTR_RO()orDRIVER_ATTR_WO()instead in order to always get the permissions correct. So remove it so that no one can use it anymore.Signed-off-by Greg Kroah-Hartman <[email protected]>Reviewed-by Moritz Fischer <[email protected]>
Quoted 61 lines
Quoted 55 lines
--- Documentation/driver-model/driver.txt | 7 ++++--- Documentation/filesystems/sysfs.txt | 3 ++- include/linux/device.h | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-)Documentation/driver-model/driver.txt +4
-3@@ -196,12 +196,13 @@ struct driver_attribute { }; Device drivers can export attributes via their sysfs directories. -Drivers can declare attributes using a DRIVER_ATTR macro that works -identically to the DEVICE_ATTR macro. +Drivers can declare attributes using a DRIVER_ATTR_RW and DRIVER_ATTR_RO +macro that works identically to the DEVICE_ATTR_RW and DEVICE_ATTR_RO +macros. Example: -DRIVER_ATTR(debug,0644,show_debug,store_debug); +DRIVER_ATTR_RW(debug); This is equivalent to declaring:Documentation/filesystems/sysfs.txt +2
-1@@ -366,7 +366,8 @@ struct driver_attribute { Declaring: -DRIVER_ATTR(_name, _mode, _show, _store) +DRIVER_ATTR_RO(_name) +DRIVER_ATTR_RW(_name) Creation/Removal:include/linux/device.h +0
-3@@ -307,8 +307,6 @@ struct driver_attribute { size_t count); }; -#define DRIVER_ATTR (_name, _mode, _show, _store) \ - struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store)#define DRIVER_ATTR_RW (_name) \ struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)#define DRIVER_ATTR_RO (_name) \ --Quoted 2 lines
2.14.1
Thanks,
Moritz
Greg Kroah-Hartman
maintainerQuoted 5 lines · Alan Tull
Quoted 4 lines · Moritz Fischer
Quoted 3 lines · Greg Kroah-Hartman
It's better to be explicit and use the
DRIVER_ATTR_RW()macro when defining a driver's sysfs file.
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
This is part of a series to drop
DRIVER_ATTR()from the tree entirely.Cc Alan Tull <[email protected]>Cc Moritz Fischer <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Acked-by Moritz Fischer <[email protected]>Acked-by Alan Tull <[email protected]>
Thanks to both of you for the review.
greg k-h