diff options
author | Rob Herring <robh@kernel.org> | 2017-03-22 15:16:27 +0100 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2017-03-22 20:56:13 +0100 |
commit | 0634c2958927198797bf9e55d26fb51cce4c22b4 (patch) | |
tree | e517e4931cce3cec6323e08355d53a97b8de66b3 /drivers/macintosh | |
parent | of: fix of_device_get_modalias returned length when truncating buffers (diff) | |
download | linux-0634c2958927198797bf9e55d26fb51cce4c22b4.tar.xz linux-0634c2958927198797bf9e55d26fb51cce4c22b4.zip |
of: Add function for generating a DT modalias with a newline
The modalias sysfs attr is lacking a newline for DT aliases on platform
devices. The macio and ibmebus correctly add the newline, but open code it.
Introduce a new function, of_device_modalias(), that fills the buffer with
the modalias including the newline and update users of the old
of_device_get_modalias function.
Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r-- | drivers/macintosh/macio_sysfs.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index 8eb40afbd0f5..0b1f9c76c68d 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c @@ -41,12 +41,7 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf) static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, char *buf) { - int len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2); - - buf[len] = '\n'; - buf[len+1] = 0; - - return len+1; + return of_device_modalias(dev, buf, PAGE_SIZE); } static ssize_t devspec_show(struct device *dev, |