diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-04-07 00:44:28 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-04-07 00:44:28 -0400 |
commit | 578b7cd1518f8d1b17a7fb1671d3d756c9cb49f1 (patch) | |
tree | 2106e756c29c17b67b42c9bb81064df8296c49cd /arch/powerpc/kernel/vio.c | |
parent | 55052eeca6d71d76f7c3f156c0501814d8e5e6d3 (diff) |
powerpc/vio: Add modalias support
BenH: Added to vio_cmo_dev_attrs as well
Provide a modalias entry for VIO devices in sysfs. I believe
this was another initrd generation bugfix for anaconda.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/vio.c')
-rw-r--r-- | arch/powerpc/kernel/vio.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index 82237176a2a3..2f57956714bd 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c | |||
@@ -958,9 +958,12 @@ viodev_cmo_rd_attr(allocated); | |||
958 | 958 | ||
959 | static ssize_t name_show(struct device *, struct device_attribute *, char *); | 959 | static ssize_t name_show(struct device *, struct device_attribute *, char *); |
960 | static ssize_t devspec_show(struct device *, struct device_attribute *, char *); | 960 | static ssize_t devspec_show(struct device *, struct device_attribute *, char *); |
961 | static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, | ||
962 | char *buf); | ||
961 | static struct device_attribute vio_cmo_dev_attrs[] = { | 963 | static struct device_attribute vio_cmo_dev_attrs[] = { |
962 | __ATTR_RO(name), | 964 | __ATTR_RO(name), |
963 | __ATTR_RO(devspec), | 965 | __ATTR_RO(devspec), |
966 | __ATTR_RO(modalias), | ||
964 | __ATTR(cmo_desired, S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IROTH, | 967 | __ATTR(cmo_desired, S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IROTH, |
965 | viodev_cmo_desired_show, viodev_cmo_desired_set), | 968 | viodev_cmo_desired_show, viodev_cmo_desired_set), |
966 | __ATTR(cmo_entitled, S_IRUGO, viodev_cmo_entitled_show, NULL), | 969 | __ATTR(cmo_entitled, S_IRUGO, viodev_cmo_entitled_show, NULL), |
@@ -1320,9 +1323,27 @@ static ssize_t devspec_show(struct device *dev, | |||
1320 | return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none"); | 1323 | return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none"); |
1321 | } | 1324 | } |
1322 | 1325 | ||
1326 | static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, | ||
1327 | char *buf) | ||
1328 | { | ||
1329 | const struct vio_dev *vio_dev = to_vio_dev(dev); | ||
1330 | struct device_node *dn; | ||
1331 | const char *cp; | ||
1332 | |||
1333 | dn = dev->archdata.of_node; | ||
1334 | if (!dn) | ||
1335 | return -ENODEV; | ||
1336 | cp = of_get_property(dn, "compatible", NULL); | ||
1337 | if (!cp) | ||
1338 | return -ENODEV; | ||
1339 | |||
1340 | return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp); | ||
1341 | } | ||
1342 | |||
1323 | static struct device_attribute vio_dev_attrs[] = { | 1343 | static struct device_attribute vio_dev_attrs[] = { |
1324 | __ATTR_RO(name), | 1344 | __ATTR_RO(name), |
1325 | __ATTR_RO(devspec), | 1345 | __ATTR_RO(devspec), |
1346 | __ATTR_RO(modalias), | ||
1326 | __ATTR_NULL | 1347 | __ATTR_NULL |
1327 | }; | 1348 | }; |
1328 | 1349 | ||