Skip to contentSkip to conversation

PCI: fix name of 'enable' sysfs file

PATCH In review Greg Kroah-Hartman 4 participants 5 messages Oct 30, 2014 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: fix name of 'enable' sysfs file

From: Greg Kroah-Hartman <[email protected]>

Back in commit 5136b2da770d ("PCI: convert bus code to use dev_groups"), I misstyped the 'enable' sysfs file as 'enabled', which broke the userspace api. This patch fixes that issue by renaming the file back.

---

Jeff, if you could test this to make sure I got it right, that would be great. Again, sorry about this, it was a dumb typo on my part.

drivers/pci/pci-sysfs.c +4 -4
index 92b6d9ab00e4..2c6643fdc0cf 100644
@@ -185,7 +185,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RO(modalias);
 
-static ssize_t enabled_store(struct device *dev, struct device_attribute *attr,
+static ssize_t enable_store(struct device *dev, struct device_attribute *attr,
 			     const char *buf, size_t count)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
@@ -210,7 +210,7 @@ static ssize_t enabled_store(struct device *dev, struct device_attribute *attr,
 	return result < 0 ? result : count;
 }
 
-static ssize_t enabled_show(struct device *dev, struct device_attribute *attr,
+static ssize_t enable_show(struct device *dev, struct device_attribute *attr,
 			    char *buf)
 {
 	struct pci_dev *pdev;
@@ -218,7 +218,7 @@ static ssize_t enabled_show(struct device *dev, struct device_attribute *attr,
 	pdev = to_pci_dev(dev);
 	return sprintf(buf, "%u\n", atomic_read(&pdev->enable_cnt));
 }
-static DEVICE_ATTR_RW(enabled);
+static DEVICE_ATTR_RW(enable);
 
 #ifdef CONFIG_NUMA
 static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr,
@@ -563,7 +563,7 @@ static struct attribute *pci_dev_attrs[] = {
 #endif
 	&dev_attr_dma_mask_bits.attr,
 	&dev_attr_consistent_dma_mask_bits.attr,
-	&dev_attr_enabled.attr,
+	&dev_attr_enable.attr,
 	&dev_attr_broken_parity_status.attr,
 	&dev_attr_msi_bus.attr,
 #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
#1 lore raw
Quoted 5 lines · Greg Kroah-Hartman

From: Greg Kroah-Hartman <[email protected]>

Back in commit 5136b2da770d ("PCI: convert bus code to use dev_groups"), I misstyped the 'enable' sysfs file as 'enabled', which broke the userspace api. This patch fixes that issue by renaming the file back.

But this is in turn 3.13 -> 3.18 userspace interface breakage ... I don't think there is other graceful way out of this than creating a symlink so that both variants work, right?

Signature · 2 lines
Jiri Kosina
SUSE Labs
#2 lore raw
Quoted 11 lines · Jiri Kosina
Quoted 5 lines · Greg Kroah-Hartman

From: Greg Kroah-Hartman <[email protected]>

Back in commit 5136b2da770d ("PCI: convert bus code to use dev_groups"), I misstyped the 'enable' sysfs file as 'enabled', which broke the userspace api. This patch fixes that issue by renaming the file back.

But this is in turn 3.13 -> 3.18 userspace interface breakage ... I don't think there is other graceful way out of this than creating a symlink so that both variants work, right?

Given that no one noticed that this was broken until now, I really doubt that anyone wrote code for the new file name. I recommend just fixing it back, and getting it into all stable kernel trees and moving on.

A symlink for such a foolish mistake seems like a bigger mistake :)

thanks,

greg k-h

maintainer
#3 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

From: Greg Kroah-Hartman <[email protected]>

Back in commit 5136b2da770d ("PCI: convert bus code to use dev_groups"), I misstyped the 'enable' sysfs file as 'enabled', which broke the userspace api. This patch fixes that issue by renaming the file back.

I applied this to for-linus for v3.18. If a symlink turns out to be needed, we can also add that. Jeff, if you test this, I'll update it with your Tested-by.

Quoted 45 lines

---

Jeff, if you could test this to make sure I got it right, that would be great. Again, sorry about this, it was a dumb typo on my part.

drivers/pci/pci-sysfs.c +4 -4
index 92b6d9ab00e4..2c6643fdc0cf 100644
@@ -185,7 +185,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RO(modalias);
 
-static ssize_t enabled_store(struct device *dev, struct device_attribute *attr,
+static ssize_t enable_store(struct device *dev, struct device_attribute *attr,
 			     const char *buf, size_t count)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
@@ -210,7 +210,7 @@ static ssize_t enabled_store(struct device *dev, struct device_attribute *attr,
 	return result < 0 ? result : count;
 }
 
-static ssize_t enabled_show(struct device *dev, struct device_attribute *attr,
+static ssize_t enable_show(struct device *dev, struct device_attribute *attr,
 			    char *buf)
 {
 	struct pci_dev *pdev;
@@ -218,7 +218,7 @@ static ssize_t enabled_show(struct device *dev, struct device_attribute *attr,
 	pdev = to_pci_dev(dev);
 	return sprintf(buf, "%u\n", atomic_read(&pdev->enable_cnt));
 }
-static DEVICE_ATTR_RW(enabled);
+static DEVICE_ATTR_RW(enable);
 
 #ifdef CONFIG_NUMA
 static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr,
@@ -563,7 +563,7 @@ static struct attribute *pci_dev_attrs[] = {
 #endif
 	&dev_attr_dma_mask_bits.attr,
 	&dev_attr_consistent_dma_mask_bits.attr,
-	&dev_attr_enabled.attr,
+	&dev_attr_enable.attr,
 	&dev_attr_broken_parity_status.attr,
 	&dev_attr_msi_bus.attr,
 #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
Tested-by on v1 1/1
#4 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

From: Greg Kroah-Hartman <[email protected]>

Back in commit 5136b2da770d ("PCI: convert bus code to use dev_groups"), I misstyped the 'enable' sysfs file as 'enabled', which broke the userspace api. This patch fixes that issue by renaming the file back.

(with the caveat that, since LinuxCNC uses the -rt kernel, I tested this change manually backported to 3.14-rt)

Thanks again for your fast action on this.

Jeff