1 From 75b607ff8725eac74f3375b3370f7d121d1827a3 Mon Sep 17 00:00:00 2001
2 From: Lijun Pan <Lijun.Pan@freescale.com>
3 Date: Mon, 8 Feb 2016 17:40:14 -0600
4 Subject: [PATCH 190/226] staging: fsl-mc: root dprc rescan attribute to sync
7 Introduce the rescan attribute as a device attribute to
8 synchronize the fsl-mc bus objects and the MC firmware.
10 To rescan the root dprc only, e.g.
11 echo 1 > /sys/bus/fsl-mc/devices/dprc.1/rescan
13 Signed-off-by: Lijun Pan <Lijun.Pan@freescale.com>
14 [Stuart: resolved merge conflict]
15 Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
17 drivers/staging/fsl-mc/bus/mc-bus.c | 29 +++++++++++++++++++++++++++++
18 1 file changed, 29 insertions(+)
20 --- a/drivers/staging/fsl-mc/bus/mc-bus.c
21 +++ b/drivers/staging/fsl-mc/bus/mc-bus.c
22 @@ -96,8 +96,37 @@ static ssize_t modalias_show(struct devi
24 static DEVICE_ATTR_RO(modalias);
26 +static ssize_t rescan_store(struct device *dev,
27 + struct device_attribute *attr,
28 + const char *buf, size_t count)
31 + unsigned int irq_count;
32 + struct fsl_mc_device *root_mc_dev;
33 + struct fsl_mc_bus *root_mc_bus;
35 + if (!fsl_mc_is_root_dprc(dev))
38 + root_mc_dev = to_fsl_mc_device(dev);
39 + root_mc_bus = to_fsl_mc_bus(root_mc_dev);
41 + if (kstrtoul(buf, 0, &val) < 0)
45 + mutex_lock(&root_mc_bus->scan_mutex);
46 + dprc_scan_objects(root_mc_dev, &irq_count);
47 + mutex_unlock(&root_mc_bus->scan_mutex);
52 +static DEVICE_ATTR_WO(rescan);
54 static struct attribute *fsl_mc_dev_attrs[] = {
55 &dev_attr_modalias.attr,
56 + &dev_attr_rescan.attr,