# \[PATCH\] ibmebus/of\_platform: Move "name" sysfs attribute into generic OF devices

- Subsystems: LINUX FOR POWERPC (32-BIT AND 64-BIT), OPEN FIRMWARE AND FLATTENED DEVICE TREE, THE REST
- Maintainers: Madhavan Srinivasan, Rob Herring, Saravana Kannan, Linus Torvalds
- List: linuxppc-dev
- 4 messages, 2 authors
- Page: https://ratatoskr.run/linuxppc-dev/2008/08/1135229/t

## \[PATCH\] ibmebus/of\_platform: Move "name" sysfs attribute into generic OF devices

- From: Joachim Fenkes \<hidden\>
- Date: 2008-08-05 14:32:41 
- Message: https://ratatoskr.run/linuxppc-dev/2008/08/1135229.md

```text
Recent of_platform changes made of_bus_type_init() overwrite the bus type's
.dev_attrs list, so move ibmebus' "name" attribute (which is needed by eHCA
userspace support) into generic OF device code. Tested on POWER.

Signed-off-by: Joachim Fenkes <redacted>
---
 arch/powerpc/kernel/ibmebus.c |   12 ------------
 drivers/of/device.c           |   10 ++++++++++
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 9d42eb5..a063622 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -233,17 +233,6 @@ void ibmebus_free_irq(u32 ist, void *dev_id)
 }
 EXPORT_SYMBOL(ibmebus_free_irq);
 
-static ssize_t name_show(struct device *dev,
-			 struct device_attribute *attr, char *buf)
-{
-	return sprintf(buf, "%s\n", to_of_device(dev)->node->name);
-}
-
-static struct device_attribute ibmebus_dev_attrs[] = {
-	__ATTR_RO(name),
-	__ATTR_NULL
-};
-
 static char *ibmebus_chomp(const char *in, size_t count)
 {
 	char *out = kmalloc(count + 1, GFP_KERNEL);
@@ -327,7 +316,6 @@ static struct bus_attribute ibmebus_bus_attrs[] = {
 
 struct bus_type ibmebus_bus_type = {
 	.uevent    = of_device_uevent,
-	.dev_attrs = ibmebus_dev_attrs,
 	.bus_attrs = ibmebus_bus_attrs
 };
 EXPORT_SYMBOL(ibmebus_bus_type);
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 8a1d93a..51e5214 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -57,6 +57,15 @@ static ssize_t devspec_show(struct device *dev,
 	return sprintf(buf, "%s\n", ofdev->node->full_name);
 }
 
+static ssize_t name_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	struct of_device *ofdev;
+
+	ofdev = to_of_device(dev);
+	return sprintf(buf, "%s\n", ofdev->node->name);
+}
+
 static ssize_t modalias_show(struct device *dev,
 				struct device_attribute *attr, char *buf)
 {
@@ -71,6 +80,7 @@ static ssize_t modalias_show(struct device *dev,
 
 struct device_attribute of_platform_device_attrs[] = {
 	__ATTR_RO(devspec),
+	__ATTR_RO(name),
 	__ATTR_RO(modalias),
 	__ATTR_NULL
 };
-- 
1.5.5
```

## Re: \[PATCH\] ibmebus/of\_platform: Move "name" sysfs attribute into generic OF devices

- From: Paul Mackerras \<hidden\>
- Date: 2008-08-19 04:14:33 
- Message: https://ratatoskr.run/linuxppc-dev/2008/08/1141120.md

```text
Joachim Fenkes writes:

> Recent of_platform changes made of_bus_type_init() overwrite the bus type's
> .dev_attrs list, so move ibmebus' "name" attribute (which is needed by eHCA
> userspace support) into generic OF device code. Tested on POWER.

Is this a bugfix that is needed for 2.6.27?
```

## Re: \[PATCH\] ibmebus/of\_platform: Move "name" sysfs attribute into generic OF devices

- From: Joachim Fenkes \<hidden\>
- Date: 2008-08-19 10:53:16 
- Message: https://ratatoskr.run/linuxppc-dev/2008/08/1141255.md

```text
Paul Mackerras [ref] wrote on 19.08.2008 06:14:00:
 
> > Recent of_platform changes made of_bus_type_init() overwrite the bus 
type's
> > .dev_attrs list, so move ibmebus' "name" attribute (which is needed by 
eHCA
> > userspace support) into generic OF device code. Tested on POWER.
> 
> Is this a bugfix that is needed for 2.6.27?

Yes, definitely. The eHCA userspace driver relies on the name attribute to 
check for valid adapters (it checks that the name is "lhca"), so with the 
name attribute gone, eHCA userspace will cease to work.

Regards,
  Joachim
```

## Re: \[PATCH\] ibmebus/of\_platform: Move "name" sysfs attribute into generic OF devices

- From: Paul Mackerras \<hidden\>
- Date: 2008-08-19 23:29:44 
- Message: https://ratatoskr.run/linuxppc-dev/2008/08/1141638.md

```text
Joachim Fenkes writes:

> > Is this a bugfix that is needed for 2.6.27?
> 
> Yes, definitely. The eHCA userspace driver relies on the name attribute to 
> check for valid adapters (it checks that the name is "lhca"), so with the 
> name attribute gone, eHCA userspace will cease to work.

OK, I'll put it in.  Please, in future, always say explicitly if you
think a patch needs to go in to the kernel we're currently
stablizing.  Otherwise, I'll generally assume it's for the next merge
window.

Paul.
```
