rio-sysfs.c (2ec3ba69faf301fb599e3651515e808e8efa533e) | rio-sysfs.c (9edbc30b434f56258d03faac5daf37a555384db3) |
---|---|
1/* 2 * RapidIO sysfs attributes and support 3 * 4 * Copyright 2005 MontaVista Software, Inc. 5 * Matt Porter <mporter@kernel.crashing.org> 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by the --- 272 unchanged lines hidden (view full) --- 281 device_remove_file(&rdev->dev, &dev_attr_hopcount); 282 } 283} 284 285static ssize_t bus_scan_store(struct bus_type *bus, const char *buf, 286 size_t count) 287{ 288 long val; | 1/* 2 * RapidIO sysfs attributes and support 3 * 4 * Copyright 2005 MontaVista Software, Inc. 5 * Matt Porter <mporter@kernel.crashing.org> 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by the --- 272 unchanged lines hidden (view full) --- 281 device_remove_file(&rdev->dev, &dev_attr_hopcount); 282 } 283} 284 285static ssize_t bus_scan_store(struct bus_type *bus, const char *buf, 286 size_t count) 287{ 288 long val; |
289 struct rio_mport *port = NULL; | |
290 int rc; 291 292 if (kstrtol(buf, 0, &val) < 0) 293 return -EINVAL; 294 295 if (val == RIO_MPORT_ANY) { 296 rc = rio_init_mports(); 297 goto exit; 298 } 299 300 if (val < 0 || val >= RIO_MAX_MPORTS) 301 return -EINVAL; 302 | 289 int rc; 290 291 if (kstrtol(buf, 0, &val) < 0) 292 return -EINVAL; 293 294 if (val == RIO_MPORT_ANY) { 295 rc = rio_init_mports(); 296 goto exit; 297 } 298 299 if (val < 0 || val >= RIO_MAX_MPORTS) 300 return -EINVAL; 301 |
303 port = rio_find_mport((int)val); 304 305 if (!port) { 306 pr_debug("RIO: %s: mport_%d not available\n", 307 __func__, (int)val); 308 return -EINVAL; 309 } 310 311 if (!port->nscan) 312 return -EINVAL; 313 314 if (port->host_deviceid >= 0) 315 rc = port->nscan->enumerate(port, 0); 316 else 317 rc = port->nscan->discover(port, RIO_SCAN_ENUM_NO_WAIT); | 302 rc = rio_mport_scan((int)val); |
318exit: 319 if (!rc) 320 rc = count; 321 322 return rc; 323} 324 325struct bus_attribute rio_bus_attrs[] = { 326 __ATTR(scan, (S_IWUSR|S_IWGRP), NULL, bus_scan_store), 327 __ATTR_NULL 328}; | 303exit: 304 if (!rc) 305 rc = count; 306 307 return rc; 308} 309 310struct bus_attribute rio_bus_attrs[] = { 311 __ATTR(scan, (S_IWUSR|S_IWGRP), NULL, bus_scan_store), 312 __ATTR_NULL 313}; |