Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1734007 > unrolled thread

[PATCH 1/2] fpga: altera-cvp: remove DRIVER_ATTR() usage

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-09-18 12:20 +0200
Last post2017-09-19 09:20 +0200
Articles 7 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] fpga: altera-cvp: remove DRIVER_ATTR() usage Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-18 12:20 +0200
    [PATCH 2/2] driver core: remove DRIVER_ATTR Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-18 12:20 +0200
      Re: [PATCH 2/2] driver core: remove DRIVER_ATTR Moritz Fischer <mdf@kernel.org> - 2017-09-18 18:50 +0200
        Re: [PATCH 2/2] driver core: remove DRIVER_ATTR Alan Tull <atull@kernel.org> - 2017-09-18 22:50 +0200
    Re: [PATCH 1/2] fpga: altera-cvp: remove DRIVER_ATTR() usage Moritz Fischer <mdf@kernel.org> - 2017-09-18 18:50 +0200
      Re: [PATCH 1/2] fpga: altera-cvp: remove DRIVER_ATTR() usage Alan Tull <atull@kernel.org> - 2017-09-18 22:50 +0200
        Re: [PATCH 1/2] fpga: altera-cvp: remove DRIVER_ATTR() usage Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-19 09:20 +0200

#1734007 — [PATCH 1/2] fpga: altera-cvp: remove DRIVER_ATTR() usage

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-09-18 12:20 +0200
Subject[PATCH 1/2] fpga: altera-cvp: remove DRIVER_ATTR() usage
Message-ID<ur1jH-51J-3@gated-at.bofh.it>
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 <atull@kernel.org>
Cc: Moritz Fischer <mdf@kernel.org>
Cc: linux-fpga@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/fpga/altera-cvp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
index 08629ee69d11..00e73d28077c 100644
--- a/drivers/fpga/altera-cvp.c
+++ b/drivers/fpga/altera-cvp.c
@@ -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

[toc] | [next] | [standalone]


#1734009 — [PATCH 2/2] driver core: remove DRIVER_ATTR

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-09-18 12:20 +0200
Subject[PATCH 2/2] driver core: remove DRIVER_ATTR
Message-ID<ur1jH-51J-7@gated-at.bofh.it>
In reply to#1734007
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.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 Documentation/driver-model/driver.txt | 7 ++++---
 Documentation/filesystems/sysfs.txt   | 3 ++-
 include/linux/device.h                | 2 --
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/driver-model/driver.txt b/Documentation/driver-model/driver.txt
index 4421135826a2..d661e6f7e6a0 100644
--- a/Documentation/driver-model/driver.txt
+++ b/Documentation/driver-model/driver.txt
@@ -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:
 
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 24da7b32c489..9a3658cc399e 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -366,7 +366,8 @@ struct driver_attribute {
 
 Declaring:
 
-DRIVER_ATTR(_name, _mode, _show, _store)
+DRIVER_ATTR_RO(_name)
+DRIVER_ATTR_RW(_name)
 
 Creation/Removal:
 
diff --git a/include/linux/device.h b/include/linux/device.h
index c6f27207dbe8..2bc70ddda09b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -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) \
-- 
2.14.1

[toc] | [prev] | [next] | [standalone]


#1734296 — Re: [PATCH 2/2] driver core: remove DRIVER_ATTR

FromMoritz Fischer <mdf@kernel.org>
Date2017-09-18 18:50 +0200
SubjectRe: [PATCH 2/2] driver core: remove DRIVER_ATTR
Message-ID<ur7p7-ju-7@gated-at.bofh.it>
In reply to#1734009

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 18, 2017 at 12:17:57PM +0200, Greg Kroah-Hartman wrote:
> 
> 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.
> 
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
> ---
>  Documentation/driver-model/driver.txt | 7 ++++---
>  Documentation/filesystems/sysfs.txt   | 3 ++-
>  include/linux/device.h                | 2 --
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/driver-model/driver.txt b/Documentation/driver-model/driver.txt
> index 4421135826a2..d661e6f7e6a0 100644
> --- a/Documentation/driver-model/driver.txt
> +++ b/Documentation/driver-model/driver.txt
> @@ -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:
>  
> diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
> index 24da7b32c489..9a3658cc399e 100644
> --- a/Documentation/filesystems/sysfs.txt
> +++ b/Documentation/filesystems/sysfs.txt
> @@ -366,7 +366,8 @@ struct driver_attribute {
>  
>  Declaring:
>  
> -DRIVER_ATTR(_name, _mode, _show, _store)
> +DRIVER_ATTR_RO(_name)
> +DRIVER_ATTR_RW(_name)
>  
>  Creation/Removal:
>  
> diff --git a/include/linux/device.h b/include/linux/device.h
> index c6f27207dbe8..2bc70ddda09b 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -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) \
> -- 
> 2.14.1
> 

Thanks,

Moritz

[toc] | [prev] | [next] | [standalone]


#1734472 — Re: [PATCH 2/2] driver core: remove DRIVER_ATTR

FromAlan Tull <atull@kernel.org>
Date2017-09-18 22:50 +0200
SubjectRe: [PATCH 2/2] driver core: remove DRIVER_ATTR
Message-ID<urb9p-2X2-29@gated-at.bofh.it>
In reply to#1734296
On Mon, Sep 18, 2017 at 11:43 AM, Moritz Fischer <mdf@kernel.org> wrote:
> On Mon, Sep 18, 2017 at 12:17:57PM +0200, Greg Kroah-Hartman wrote:
>>
>> 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.
>>
>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Reviewed-by: Moritz Fischer <mdf@kernel.org>
Acked-by: Alan Tull <atull@kernel.org>
>> ---
>>  Documentation/driver-model/driver.txt | 7 ++++---
>>  Documentation/filesystems/sysfs.txt   | 3 ++-
>>  include/linux/device.h                | 2 --
>>  3 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/Documentation/driver-model/driver.txt b/Documentation/driver-model/driver.txt
>> index 4421135826a2..d661e6f7e6a0 100644
>> --- a/Documentation/driver-model/driver.txt
>> +++ b/Documentation/driver-model/driver.txt
>> @@ -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:
>>
>> diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
>> index 24da7b32c489..9a3658cc399e 100644
>> --- a/Documentation/filesystems/sysfs.txt
>> +++ b/Documentation/filesystems/sysfs.txt
>> @@ -366,7 +366,8 @@ struct driver_attribute {
>>
>>  Declaring:
>>
>> -DRIVER_ATTR(_name, _mode, _show, _store)
>> +DRIVER_ATTR_RO(_name)
>> +DRIVER_ATTR_RW(_name)
>>
>>  Creation/Removal:
>>
>> diff --git a/include/linux/device.h b/include/linux/device.h
>> index c6f27207dbe8..2bc70ddda09b 100644
>> --- a/include/linux/device.h
>> +++ b/include/linux/device.h
>> @@ -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) \
>> --
>> 2.14.1
>>
>
> Thanks,
>
> Moritz

[toc] | [prev] | [next] | [standalone]


#1734297

FromMoritz Fischer <mdf@kernel.org>
Date2017-09-18 18:50 +0200
Message-ID<ur7p7-ju-11@gated-at.bofh.it>
In reply to#1734007

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 18, 2017 at 12:17:36PM +0200, Greg Kroah-Hartman wrote:
> 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 <atull@kernel.org>
> Cc: Moritz Fischer <mdf@kernel.org>
> Cc: linux-fpga@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Moritz Fischer <mdf@kernel.org>
> ---
>  drivers/fpga/altera-cvp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
> index 08629ee69d11..00e73d28077c 100644
> --- a/drivers/fpga/altera-cvp.c
> +++ b/drivers/fpga/altera-cvp.c
> @@ -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
> 

[toc] | [prev] | [next] | [standalone]


#1734470

FromAlan Tull <atull@kernel.org>
Date2017-09-18 22:50 +0200
Message-ID<urb9p-2X2-25@gated-at.bofh.it>
In reply to#1734297
On Mon, Sep 18, 2017 at 11:42 AM, Moritz Fischer <mdf@kernel.org> wrote:
> On Mon, Sep 18, 2017 at 12:17:36PM +0200, Greg Kroah-Hartman wrote:
>> 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 <atull@kernel.org>
>> Cc: Moritz Fischer <mdf@kernel.org>
>> Cc: linux-fpga@vger.kernel.org
>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Acked-by: Moritz Fischer <mdf@kernel.org>
Acked-by: Alan Tull <atull@kernel.org>
>> ---
>>  drivers/fpga/altera-cvp.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
>> index 08629ee69d11..00e73d28077c 100644
>> --- a/drivers/fpga/altera-cvp.c
>> +++ b/drivers/fpga/altera-cvp.c
>> @@ -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
>>

[toc] | [prev] | [next] | [standalone]


#1734708

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-09-19 09:20 +0200
Message-ID<urkZ4-16Q-11@gated-at.bofh.it>
In reply to#1734470
On Mon, Sep 18, 2017 at 03:40:13PM -0500, Alan Tull wrote:
> On Mon, Sep 18, 2017 at 11:42 AM, Moritz Fischer <mdf@kernel.org> wrote:
> > On Mon, Sep 18, 2017 at 12:17:36PM +0200, Greg Kroah-Hartman wrote:
> >> 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 <atull@kernel.org>
> >> Cc: Moritz Fischer <mdf@kernel.org>
> >> Cc: linux-fpga@vger.kernel.org
> >> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Acked-by: Moritz Fischer <mdf@kernel.org>
> Acked-by: Alan Tull <atull@kernel.org>

Thanks to both of you for the review.

greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web