diff options
Diffstat (limited to 'drivers/macintosh/macio_sysfs.c')
-rw-r--r-- | drivers/macintosh/macio_sysfs.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index cc8267912656..112e5ef728f1 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c | |||
@@ -41,28 +41,15 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf) | |||
41 | static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, | 41 | static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, |
42 | char *buf) | 42 | char *buf) |
43 | { | 43 | { |
44 | struct of_device *of; | 44 | struct of_device *ofdev = to_of_device(dev); |
45 | const char *compat; | 45 | int len; |
46 | int cplen; | ||
47 | int length; | ||
48 | 46 | ||
49 | of = &to_macio_device (dev)->ofdev; | 47 | len = of_device_get_modalias(ofdev, buf, PAGE_SIZE); |
50 | compat = of_get_property(of->node, "compatible", &cplen); | ||
51 | if (!compat) compat = "", cplen = 1; | ||
52 | length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type); | ||
53 | buf += length; | ||
54 | while (cplen > 0) { | ||
55 | int l; | ||
56 | l = sprintf (buf, "C%s", compat); | ||
57 | length += l; | ||
58 | buf += l; | ||
59 | l = strlen (compat) + 1; | ||
60 | compat += l; | ||
61 | cplen -= l; | ||
62 | } | ||
63 | length += sprintf(buf, "\n"); | ||
64 | 48 | ||
65 | return length; | 49 | buf[len] = '\n'; |
50 | buf[len+1] = 0; | ||
51 | |||
52 | return len+1; | ||
66 | } | 53 | } |
67 | 54 | ||
68 | macio_config_of_attr (name, "%s\n"); | 55 | macio_config_of_attr (name, "%s\n"); |