diff options
author | Edward A. James <eajames@us.ibm.com> | 2017-04-14 23:36:25 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-05-01 21:53:43 +0300 |
commit | d819a6dba2dd4c21949a38b6422a9845124a93de (patch) | |
tree | 7e643a570ed62631f03851112f14bfe4b1c23d9e | |
parent | 70ae0d4dfa0400537e3eb22524ea30bf87814598 (diff) | |
download | linux-d819a6dba2dd4c21949a38b6422a9845124a93de.tar.xz |
drivers: fsi: Fix hub unregistration
Hub master unregistration was missing a few things.
Signed-off-by: Edward A. James <eajames@us.ibm.com>
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
-rw-r--r-- | drivers/fsi/fsi-core.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 9f55d69ff021..a65e93720096 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -775,6 +775,30 @@ static int fsi_master_scan(struct fsi_master *master) return 0; } +static ssize_t fsi_ipoll_period_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return snprintf(buf, PAGE_SIZE - 1, "%u\n", fsi_ipoll_period_ms); +} + +static ssize_t fsi_ipoll_period_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int rc; + unsigned long val = 0; + + rc = kstrtoul(buf, 0, &val); + + if (val > 1 && val < 10000) + fsi_ipoll_period_ms = val; + + return count; +} + +DEVICE_ATTR(fsi_ipoll_period, S_IRUGO | S_IWUSR, fsi_ipoll_period_show, + fsi_ipoll_period_store); + static int fsi_unregister_hubs(struct device *dev, void *data) { struct fsi_master_hub *hub = dev_get_drvdata(dev); @@ -782,8 +806,11 @@ static int fsi_unregister_hubs(struct device *dev, void *data) if (!hub) return 0; - device_del(dev); + ida_simple_remove(&master_ida, hub->master.idx); + hub->master.idx = -1; + device_remove_file(dev, &dev_attr_fsi_ipoll_period); fsi_master_unscan(&hub->master); + device_del(dev); return 0; } @@ -969,30 +996,6 @@ done: return 0; } -static ssize_t fsi_ipoll_period_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return snprintf(buf, PAGE_SIZE - 1, "%u\n", fsi_ipoll_period_ms); -} - -static ssize_t fsi_ipoll_period_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - int rc; - unsigned long val = 0; - - rc = kstrtoul(buf, 0, &val); - - if (val > 1 && val < 10000) - fsi_ipoll_period_ms = val; - - return count; -} - -DEVICE_ATTR(fsi_ipoll_period, S_IRUGO | S_IWUSR, fsi_ipoll_period_show, - fsi_ipoll_period_store); - int fsi_master_register(struct fsi_master *master) { if (!master || !master->dev) @@ -1125,7 +1128,7 @@ static int set_upstream_irq_masks(struct fsi_master *master, uint32_t mask, si1m; int rc; - if (!master->idx) + if (master->idx <= 0) return 0; upstream_slave = to_fsi_slave(slave->master->dev->parent); |