subr_bus.c (297776) | subr_bus.c (298707) |
---|---|
1/*- 2 * Copyright (c) 1997,1998,2003 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997,1998,2003 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/kern/subr_bus.c 297776 2016-04-10 05:05:02Z jhb $"); | 28__FBSDID("$FreeBSD: head/sys/kern/subr_bus.c 298707 2016-04-27 16:29:03Z jhb $"); |
29 30#include "opt_bus.h" 31 32#include <sys/param.h> 33#include <sys/conf.h> 34#include <sys/filio.h> 35#include <sys/lock.h> 36#include <sys/kernel.h> --- 5161 unchanged lines hidden (view full) --- 5198 switch (cmd) { 5199 case DEV_ATTACH: 5200 case DEV_DETACH: 5201 case DEV_ENABLE: 5202 case DEV_DISABLE: 5203 case DEV_SUSPEND: 5204 case DEV_RESUME: 5205 case DEV_SET_DRIVER: | 29 30#include "opt_bus.h" 31 32#include <sys/param.h> 33#include <sys/conf.h> 34#include <sys/filio.h> 35#include <sys/lock.h> 36#include <sys/kernel.h> --- 5161 unchanged lines hidden (view full) --- 5198 switch (cmd) { 5199 case DEV_ATTACH: 5200 case DEV_DETACH: 5201 case DEV_ENABLE: 5202 case DEV_DISABLE: 5203 case DEV_SUSPEND: 5204 case DEV_RESUME: 5205 case DEV_SET_DRIVER: |
5206 case DEV_RESCAN: |
|
5206 error = priv_check(td, PRIV_DRIVER); 5207 if (error == 0) 5208 error = find_device(req, &dev); 5209 break; 5210 default: 5211 error = ENOTTY; 5212 break; 5213 } --- 147 unchanged lines hidden (view full) --- 5361 /* Force the new device class. */ 5362 error = devclass_add_device(dc, dev); 5363 if (error) 5364 break; 5365 dev->flags |= DF_FIXEDCLASS; 5366 error = device_probe_and_attach(dev); 5367 break; 5368 } | 5207 error = priv_check(td, PRIV_DRIVER); 5208 if (error == 0) 5209 error = find_device(req, &dev); 5210 break; 5211 default: 5212 error = ENOTTY; 5213 break; 5214 } --- 147 unchanged lines hidden (view full) --- 5362 /* Force the new device class. */ 5363 error = devclass_add_device(dc, dev); 5364 if (error) 5365 break; 5366 dev->flags |= DF_FIXEDCLASS; 5367 error = device_probe_and_attach(dev); 5368 break; 5369 } |
5370 case DEV_RESCAN: 5371 if (!device_is_attached(dev)) { 5372 error = ENXIO; 5373 break; 5374 } 5375 error = BUS_RESCAN(dev); 5376 break; |
|
5369 } 5370 mtx_unlock(&Giant); 5371 return (error); 5372} 5373 5374static struct cdevsw devctl2_cdevsw = { 5375 .d_version = D_VERSION, 5376 .d_ioctl = devctl2_ioctl, 5377 .d_name = "devctl2", 5378}; 5379 5380static void 5381devctl2_init(void) 5382{ 5383 5384 make_dev_credf(MAKEDEV_ETERNAL, &devctl2_cdevsw, 0, NULL, 5385 UID_ROOT, GID_WHEEL, 0600, "devctl2"); 5386} | 5377 } 5378 mtx_unlock(&Giant); 5379 return (error); 5380} 5381 5382static struct cdevsw devctl2_cdevsw = { 5383 .d_version = D_VERSION, 5384 .d_ioctl = devctl2_ioctl, 5385 .d_name = "devctl2", 5386}; 5387 5388static void 5389devctl2_init(void) 5390{ 5391 5392 make_dev_credf(MAKEDEV_ETERNAL, &devctl2_cdevsw, 0, NULL, 5393 UID_ROOT, GID_WHEEL, 0600, "devctl2"); 5394} |