mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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:
parent
bcf54d5385
commit
0634c29589
7 changed files with 24 additions and 22 deletions
|
|
@ -176,7 +176,7 @@ const void *of_device_get_match_data(const struct device *dev)
|
|||
}
|
||||
EXPORT_SYMBOL(of_device_get_match_data);
|
||||
|
||||
ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)
|
||||
static ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)
|
||||
{
|
||||
const char *compat;
|
||||
int cplen, i;
|
||||
|
|
@ -225,7 +225,6 @@ ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len)
|
|||
|
||||
return repend;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_device_get_modalias);
|
||||
|
||||
int of_device_request_module(struct device *dev)
|
||||
{
|
||||
|
|
@ -250,6 +249,21 @@ int of_device_request_module(struct device *dev)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(of_device_request_module);
|
||||
|
||||
/**
|
||||
* of_device_modalias - Fill buffer with newline terminated modalias string
|
||||
*/
|
||||
ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len)
|
||||
{
|
||||
ssize_t sl = of_device_get_modalias(dev, str, len - 2);
|
||||
if (sl < 0)
|
||||
return sl;
|
||||
|
||||
str[sl++] = '\n';
|
||||
str[sl] = 0;
|
||||
return sl;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_device_modalias);
|
||||
|
||||
/**
|
||||
* of_device_uevent - Display OF related uevent information
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue