You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.6 KiB
59 lines
1.6 KiB
From 75b607ff8725eac74f3375b3370f7d121d1827a3 Mon Sep 17 00:00:00 2001
|
|
From: Lijun Pan <Lijun.Pan@freescale.com>
|
|
Date: Mon, 8 Feb 2016 17:40:14 -0600
|
|
Subject: [PATCH 190/226] staging: fsl-mc: root dprc rescan attribute to sync
|
|
kernel with MC
|
|
|
|
Introduce the rescan attribute as a device attribute to
|
|
synchronize the fsl-mc bus objects and the MC firmware.
|
|
|
|
To rescan the root dprc only, e.g.
|
|
echo 1 > /sys/bus/fsl-mc/devices/dprc.1/rescan
|
|
|
|
Signed-off-by: Lijun Pan <Lijun.Pan@freescale.com>
|
|
[Stuart: resolved merge conflict]
|
|
Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
|
|
---
|
|
drivers/staging/fsl-mc/bus/mc-bus.c | 29 +++++++++++++++++++++++++++++
|
|
1 file changed, 29 insertions(+)
|
|
|
|
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
|
|
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
|
|
@@ -96,8 +96,37 @@ static ssize_t modalias_show(struct devi
|
|
}
|
|
static DEVICE_ATTR_RO(modalias);
|
|
|
|
+static ssize_t rescan_store(struct device *dev,
|
|
+ struct device_attribute *attr,
|
|
+ const char *buf, size_t count)
|
|
+{
|
|
+ unsigned long val;
|
|
+ unsigned int irq_count;
|
|
+ struct fsl_mc_device *root_mc_dev;
|
|
+ struct fsl_mc_bus *root_mc_bus;
|
|
+
|
|
+ if (!fsl_mc_is_root_dprc(dev))
|
|
+ return -EINVAL;
|
|
+
|
|
+ root_mc_dev = to_fsl_mc_device(dev);
|
|
+ root_mc_bus = to_fsl_mc_bus(root_mc_dev);
|
|
+
|
|
+ if (kstrtoul(buf, 0, &val) < 0)
|
|
+ return -EINVAL;
|
|
+
|
|
+ if (val) {
|
|
+ mutex_lock(&root_mc_bus->scan_mutex);
|
|
+ dprc_scan_objects(root_mc_dev, &irq_count);
|
|
+ mutex_unlock(&root_mc_bus->scan_mutex);
|
|
+ }
|
|
+
|
|
+ return count;
|
|
+}
|
|
+static DEVICE_ATTR_WO(rescan);
|
|
+
|
|
static struct attribute *fsl_mc_dev_attrs[] = {
|
|
&dev_attr_modalias.attr,
|
|
+ &dev_attr_rescan.attr,
|
|
NULL,
|
|
};
|
|
|
|
|