diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2007-05-06 11:38:47 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-05-07 06:31:15 -0400 |
commit | 29aa0289b895a0ad1641a90f94638c277f9cf8ec (patch) | |
tree | aa5ed3d8f6c34c62514f2c13748c6b0b2efde5b0 /drivers/macintosh/macio_sysfs.c | |
parent | de41189bf6838c1c885d360e5cdf7ec6b4d336d6 (diff) |
[POWERPC] macintosh: Use common modalias generation for macio_sysfs
There is now a common function to generate the modalias string,
so use it. We just need to add the \n at the end.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
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"); |