linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: sysfs: Change bus_rescan and dev_rescan to rescan
@ 2020-03-24 23:48 Kelsey Skunberg
  2020-03-25  7:16 ` [Linux-kernel-mentees] " Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Kelsey Skunberg @ 2020-03-24 23:48 UTC (permalink / raw)
  To: linux-kernel, linux-pci, bhelgaas
  Cc: rbilovol, ddutile, bodong, linux-kernel-mentees, skhan, ruslan.bilovol

From: Kelsey Skunberg <kelsey.skunberg@gmail.com>

rename device attribute name arguments 'bus_rescan' and 'dev_rescan' to 'rescan'
to avoid breaking userspace applications.

The attribute argument names were changed in the following commits:
8bdfa145f582 ("PCI: sysfs: Define device attributes with DEVICE_ATTR*()")
4e2b79436e4f ("PCI: sysfs: Change DEVICE_ATTR() to DEVICE_ATTR_WO()")

Revert the names used for attributes back to the names used before the above
patches were applied. This also requires to change DEVICE_ATTR_WO() to
DEVICE_ATTR() and __ATTR().

Note when using DEVICE_ATTR() the attribute is automatically named
dev_attr_<name>.attr. To avoid duplicated names between attributes, use
__ATTR() instead of DEVICE_ATTR() to a assign a custom attribute name for
dev_rescan.

change bus_rescan_store() to dev_bus_rescan_store() to complete matching the
names used before the mentioned patches were applied.

Signed-off-by: Kelsey Skunberg <kelsey.skunberg@gmail.com>
---
 drivers/pci/pci-sysfs.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 13f766db0684..667e13d597ff 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -464,7 +464,10 @@ static ssize_t dev_rescan_store(struct device *dev,
 	}
 	return count;
 }
-static DEVICE_ATTR_WO(dev_rescan);
+static struct device_attribute dev_rescan_attr = __ATTR(rescan,
+							0220, NULL,
+							dev_rescan_store);
+
 
 static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
 			    const char *buf, size_t count)
@@ -481,9 +484,9 @@ static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
 static DEVICE_ATTR_IGNORE_LOCKDEP(remove, 0220, NULL,
 				  remove_store);
 
-static ssize_t bus_rescan_store(struct device *dev,
-				struct device_attribute *attr,
-				const char *buf, size_t count)
+static ssize_t dev_bus_rescan_store(struct device *dev,
+				    struct device_attribute *attr,
+				    const char *buf, size_t count)
 {
 	unsigned long val;
 	struct pci_bus *bus = to_pci_bus(dev);
@@ -501,7 +504,7 @@ static ssize_t bus_rescan_store(struct device *dev,
 	}
 	return count;
 }
-static DEVICE_ATTR_WO(bus_rescan);
+static DEVICE_ATTR(rescan, 0220, NULL, dev_bus_rescan_store);
 
 #if defined(CONFIG_PM) && defined(CONFIG_ACPI)
 static ssize_t d3cold_allowed_store(struct device *dev,
@@ -641,7 +644,7 @@ static struct attribute *pcie_dev_attrs[] = {
 };
 
 static struct attribute *pcibus_attrs[] = {
-	&dev_attr_bus_rescan.attr,
+	&dev_attr_rescan.attr,
 	&dev_attr_cpuaffinity.attr,
 	&dev_attr_cpulistaffinity.attr,
 	NULL,
@@ -1487,7 +1490,7 @@ static umode_t pci_dev_attrs_are_visible(struct kobject *kobj,
 
 static struct attribute *pci_dev_hp_attrs[] = {
 	&dev_attr_remove.attr,
-	&dev_attr_dev_rescan.attr,
+	&dev_rescan_attr.attr,
 	NULL,
 };
 
-- 
2.20.1


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

* Re: [Linux-kernel-mentees] [PATCH] PCI: sysfs: Change bus_rescan and dev_rescan to rescan
  2020-03-24 23:48 [PATCH] PCI: sysfs: Change bus_rescan and dev_rescan to rescan Kelsey Skunberg
@ 2020-03-25  7:16 ` Greg KH
  2020-03-25 15:23   ` Kelsey
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2020-03-25  7:16 UTC (permalink / raw)
  To: Kelsey Skunberg
  Cc: linux-kernel, linux-pci, bhelgaas, rbilovol, ddutile,
	ruslan.bilovol, linux-kernel-mentees, bodong

On Tue, Mar 24, 2020 at 05:48:48PM -0600, Kelsey Skunberg wrote:
> From: Kelsey Skunberg <kelsey.skunberg@gmail.com>
> 
> rename device attribute name arguments 'bus_rescan' and 'dev_rescan' to 'rescan'
> to avoid breaking userspace applications.
> 
> The attribute argument names were changed in the following commits:
> 8bdfa145f582 ("PCI: sysfs: Define device attributes with DEVICE_ATTR*()")
> 4e2b79436e4f ("PCI: sysfs: Change DEVICE_ATTR() to DEVICE_ATTR_WO()")
> 
> Revert the names used for attributes back to the names used before the above
> patches were applied. This also requires to change DEVICE_ATTR_WO() to
> DEVICE_ATTR() and __ATTR().
> 
> Note when using DEVICE_ATTR() the attribute is automatically named
> dev_attr_<name>.attr. To avoid duplicated names between attributes, use
> __ATTR() instead of DEVICE_ATTR() to a assign a custom attribute name for
> dev_rescan.
> 
> change bus_rescan_store() to dev_bus_rescan_store() to complete matching the
> names used before the mentioned patches were applied.
> 
> Signed-off-by: Kelsey Skunberg <kelsey.skunberg@gmail.com>

You should add:
Fixes: 8bdfa145f582 ("PCI: sysfs: Define device attributes with DEVICE_ATTR*()")
Fixes: 4e2b79436e4f ("PCI: sysfs: Change DEVICE_ATTR() to DEVICE_ATTR_WO()")

to this too, and a
	Cc: stable <stable@vger.kernel.org>
to the signed-off-by: area so that it gets properly backported.

Other than that minor thing, looks good to me, thanks for fixing it so
quickly:

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [Linux-kernel-mentees] [PATCH] PCI: sysfs: Change bus_rescan and dev_rescan to rescan
  2020-03-25  7:16 ` [Linux-kernel-mentees] " Greg KH
@ 2020-03-25 15:23   ` Kelsey
  0 siblings, 0 replies; 3+ messages in thread
From: Kelsey @ 2020-03-25 15:23 UTC (permalink / raw)
  To: Greg KH
  Cc: Linux Kernel Mailing List, linux-pci, Bjorn Helgaas, rbilovol,
	Don Dutile, Ruslan Bilovol, linux-kernel-mentees, Bodong Wang

On Wed, Mar 25, 2020 at 1:16 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Tue, Mar 24, 2020 at 05:48:48PM -0600, Kelsey Skunberg wrote:
> > From: Kelsey Skunberg <kelsey.skunberg@gmail.com>
> >
> > rename device attribute name arguments 'bus_rescan' and 'dev_rescan' to 'rescan'
> > to avoid breaking userspace applications.
> >
> > The attribute argument names were changed in the following commits:
> > 8bdfa145f582 ("PCI: sysfs: Define device attributes with DEVICE_ATTR*()")
> > 4e2b79436e4f ("PCI: sysfs: Change DEVICE_ATTR() to DEVICE_ATTR_WO()")
> >
> > Revert the names used for attributes back to the names used before the above
> > patches were applied. This also requires to change DEVICE_ATTR_WO() to
> > DEVICE_ATTR() and __ATTR().
> >
> > Note when using DEVICE_ATTR() the attribute is automatically named
> > dev_attr_<name>.attr. To avoid duplicated names between attributes, use
> > __ATTR() instead of DEVICE_ATTR() to a assign a custom attribute name for
> > dev_rescan.
> >
> > change bus_rescan_store() to dev_bus_rescan_store() to complete matching the
> > names used before the mentioned patches were applied.
> >
> > Signed-off-by: Kelsey Skunberg <kelsey.skunberg@gmail.com>
>
> You should add:
> Fixes: 8bdfa145f582 ("PCI: sysfs: Define device attributes with DEVICE_ATTR*()")
> Fixes: 4e2b79436e4f ("PCI: sysfs: Change DEVICE_ATTR() to DEVICE_ATTR_WO()")
>
> to this too, and a
>         Cc: stable <stable@vger.kernel.org>
> to the signed-off-by: area so that it gets properly backported.
>
> Other than that minor thing, looks good to me, thanks for fixing it so
> quickly:
>
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Done! I appreciate the review and help, Greg. :)

link to v2:
https://lore.kernel.org/r/20200325151708.32612-1-skunberg.kelsey@gmail.com

- Kelsey

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

end of thread, other threads:[~2020-03-25 15:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 23:48 [PATCH] PCI: sysfs: Change bus_rescan and dev_rescan to rescan Kelsey Skunberg
2020-03-25  7:16 ` [Linux-kernel-mentees] " Greg KH
2020-03-25 15:23   ` Kelsey

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