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 <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Frank Rowand <[email protected]>
Cc: [email protected]
Acked-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
Rob Herring 2017-03-22 09:16:27 -05:00
commit 0634c29589
7 changed files with 24 additions and 22 deletions

View file

@ -847,7 +847,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
struct platform_device *pdev = to_platform_device(dev);
int len;
len = of_device_get_modalias(dev, buf, PAGE_SIZE -1);
len = of_device_modalias(dev, buf, PAGE_SIZE);
if (len != -ENODEV)
return len;