rio-sysfs.c (94bd217e2d683719ab21a4ac117d8a1b91cbedc9) | rio-sysfs.c (bc8fcfea18249640f2728c46d70999dcb7e4dc49) |
---|---|
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 --- 271 unchanged lines hidden (view full) --- 280 if (rdev->pef & RIO_PEF_SWITCH) { 281 device_remove_file(&rdev->dev, &dev_attr_routes); 282 device_remove_file(&rdev->dev, &dev_attr_lnext); 283 device_remove_file(&rdev->dev, &dev_attr_hopcount); 284 if (rdev->rswitch->sw_sysfs) 285 rdev->rswitch->sw_sysfs(rdev, RIO_SW_SYSFS_REMOVE); 286 } 287} | 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 --- 271 unchanged lines hidden (view full) --- 280 if (rdev->pef & RIO_PEF_SWITCH) { 281 device_remove_file(&rdev->dev, &dev_attr_routes); 282 device_remove_file(&rdev->dev, &dev_attr_lnext); 283 device_remove_file(&rdev->dev, &dev_attr_hopcount); 284 if (rdev->rswitch->sw_sysfs) 285 rdev->rswitch->sw_sysfs(rdev, RIO_SW_SYSFS_REMOVE); 286 } 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}; |
|