layerscape: add ls1088ardb device support
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.4 / 7179-staging-fsl-mc-add-support-for-the-modalias-sysfs-at.patch
1 From 227c693741ce1fbf0ad146c87f03369334941f2e Mon Sep 17 00:00:00 2001
2 From: Stuart Yoder <stuart.yoder@nxp.com>
3 Date: Wed, 22 Jun 2016 16:40:42 -0500
4 Subject: [PATCH 179/226] staging: fsl-mc: add support for the modalias sysfs
5 attribute
6
7 In order to support uevent based module loading implement modalias support
8 for the fsl-mc bus driver. Aliases are based on vendor and object/device
9 id and are of the form "fsl-mc:vNdN".
10
11 Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
12 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 ---
14 drivers/staging/fsl-mc/bus/mc-bus.c | 25 +++++++++++++++++++++++++
15 1 file changed, 25 insertions(+)
16
17 --- a/drivers/staging/fsl-mc/bus/mc-bus.c
18 +++ b/drivers/staging/fsl-mc/bus/mc-bus.c
19 @@ -82,10 +82,35 @@ static int fsl_mc_bus_uevent(struct devi
20 return 0;
21 }
22
23 +static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
24 + char *buf)
25 +{
26 + struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
27 +
28 + return sprintf(buf, "fsl-mc:v%08Xd%s\n", mc_dev->obj_desc.vendor,
29 + mc_dev->obj_desc.type);
30 +}
31 +static DEVICE_ATTR_RO(modalias);
32 +
33 +static struct attribute *fsl_mc_dev_attrs[] = {
34 + &dev_attr_modalias.attr,
35 + NULL,
36 +};
37 +
38 +static const struct attribute_group fsl_mc_dev_group = {
39 + .attrs = fsl_mc_dev_attrs,
40 +};
41 +
42 +static const struct attribute_group *fsl_mc_dev_groups[] = {
43 + &fsl_mc_dev_group,
44 + NULL,
45 +};
46 +
47 struct bus_type fsl_mc_bus_type = {
48 .name = "fsl-mc",
49 .match = fsl_mc_bus_match,
50 .uevent = fsl_mc_bus_uevent,
51 + .dev_groups = fsl_mc_dev_groups,
52 };
53 EXPORT_SYMBOL_GPL(fsl_mc_bus_type);
54