aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rapidio/rio-sysfs.c
diff options
context:
space:
mode:
authorAlexandre Bounine <alexandre.bounine@idt.com>2013-05-24 18:55:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-24 19:22:50 -0400
commitbc8fcfea18249640f2728c46d70999dcb7e4dc49 (patch)
tree7d24b4132c4dd821c998649f21344bec6f4a3453 /drivers/rapidio/rio-sysfs.c
parenta11650e11093ed57dca78bf16e7836517c599098 (diff)
rapidio: add enumeration/discovery start from user space
Add RapidIO enumeration/discovery start from user space. User space start allows to defer RapidIO fabric scan until the moment when all participating endpoints are initialized avoiding mandatory synchronized start of all endpoints (which may be challenging in systems with large number of RapidIO endpoints). Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com> Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Li Yang <leoli@freescale.com> Cc: Kumar Gala <galak@kernel.crashing.org> Cc: Andre van Herk <andre.van.herk@Prodrive.nl> Cc: Micha Nelissen <micha.nelissen@Prodrive.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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};