X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fof%2Fdevice.c;h=224ae6bc67b6bb7b5b893192b7170cc6be8ef29c;hb=17d0cdfa8f3c09a110061c67421d662b3e149d0a;hp=8a1d93a2bb815c380bb18710369912834c2d2f06;hpb=09e67ca2c523544e6b38aa570a5f62a0cf20b87b;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/of/device.c b/drivers/of/device.c index 8a1d93a..224ae6b 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 }; @@ -95,7 +105,16 @@ EXPORT_SYMBOL(of_release_dev); int of_device_register(struct of_device *ofdev) { BUG_ON(ofdev->node == NULL); - return device_register(&ofdev->dev); + + device_initialize(&ofdev->dev); + + /* device_add will assume that this device is on the same node as + * the parent. If there is no parent defined, set the node + * explicitly */ + if (!ofdev->dev.parent) + set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->node)); + + return device_add(&ofdev->dev); } EXPORT_SYMBOL(of_device_register);