aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rapidio/rio-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rapidio/rio-sysfs.c')
-rw-r--r--drivers/rapidio/rio-sysfs.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c
index 4dbe360989be..66d4acd5e18f 100644
--- a/drivers/rapidio/rio-sysfs.c
+++ b/drivers/rapidio/rio-sysfs.c
@@ -285,3 +285,48 @@ void rio_remove_sysfs_dev_files(struct rio_dev *rdev)
285 rdev->rswitch->sw_sysfs(rdev, RIO_SW_SYSFS_REMOVE); 285 rdev->rswitch->sw_sysfs(rdev, RIO_SW_SYSFS_REMOVE);
286 } 286 }
287} 287}
288
289static ssize_t bus_scan_store(struct bus_type *bus, const char *buf,
290 size_t count)
291{
292 long val;
293 struct rio_mport *port = NULL;
294 int rc;
295
296 if (kstrtol(buf, 0, &val) < 0)
297 return -EINVAL;
298
299 if (val == RIO_MPORT_ANY) {
300 rc = rio_init_mports();
301 goto exit;
302 }
303
304 if (val < 0 || val >= RIO_MAX_MPORTS)
305 return -EINVAL;
306
307 port = rio_find_mport((int)val);
308
309 if (!port) {
310 pr_debug("RIO: %s: mport_%d not available\n",
311 __func__, (int)val);
312 return -EINVAL;
313 }
314
315 if (!port->nscan)
316 return -EINVAL;
317
318 if (port->host_deviceid >= 0)
319 rc = port->nscan->enumerate(port, 0);
320 else
321 rc = port->nscan->discover(port, RIO_SCAN_ENUM_NO_WAIT);
322exit:
323 if (!rc)
324 rc = count;
325
326 return rc;
327}
328
329struct bus_attribute rio_bus_attrs[] = {
330 __ATTR(scan, (S_IWUSR|S_IWGRP), NULL, bus_scan_store),
331 __ATTR_NULL
332};