xref: /linux/drivers/pnp/support.c (revision 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2)
1*1da177e4SLinus Torvalds /*
2*1da177e4SLinus Torvalds  * support.c - provides standard pnp functions for the use of pnp protocol drivers,
3*1da177e4SLinus Torvalds  *
4*1da177e4SLinus Torvalds  * Copyright 2003 Adam Belay <ambx1@neo.rr.com>
5*1da177e4SLinus Torvalds  *
6*1da177e4SLinus Torvalds  */
7*1da177e4SLinus Torvalds 
8*1da177e4SLinus Torvalds #include <linux/config.h>
9*1da177e4SLinus Torvalds #include <linux/module.h>
10*1da177e4SLinus Torvalds #include <linux/ctype.h>
11*1da177e4SLinus Torvalds 
12*1da177e4SLinus Torvalds #ifdef CONFIG_PNP_DEBUG
13*1da177e4SLinus Torvalds 	#define DEBUG
14*1da177e4SLinus Torvalds #else
15*1da177e4SLinus Torvalds 	#undef DEBUG
16*1da177e4SLinus Torvalds #endif
17*1da177e4SLinus Torvalds 
18*1da177e4SLinus Torvalds #include <linux/pnp.h>
19*1da177e4SLinus Torvalds #include "base.h"
20*1da177e4SLinus Torvalds 
21*1da177e4SLinus Torvalds /**
22*1da177e4SLinus Torvalds  * pnp_is_active - Determines if a device is active based on its current resources
23*1da177e4SLinus Torvalds  * @dev: pointer to the desired PnP device
24*1da177e4SLinus Torvalds  *
25*1da177e4SLinus Torvalds  */
26*1da177e4SLinus Torvalds 
27*1da177e4SLinus Torvalds int pnp_is_active(struct pnp_dev * dev)
28*1da177e4SLinus Torvalds {
29*1da177e4SLinus Torvalds 	if (!pnp_port_start(dev, 0) && pnp_port_len(dev, 0) <= 1 &&
30*1da177e4SLinus Torvalds 	    !pnp_mem_start(dev, 0) && pnp_mem_len(dev, 0) <= 1 &&
31*1da177e4SLinus Torvalds 	    pnp_irq(dev, 0) == -1 &&
32*1da177e4SLinus Torvalds 	    pnp_dma(dev, 0) == -1)
33*1da177e4SLinus Torvalds 	    	return 0;
34*1da177e4SLinus Torvalds 	else
35*1da177e4SLinus Torvalds 		return 1;
36*1da177e4SLinus Torvalds }
37*1da177e4SLinus Torvalds 
38*1da177e4SLinus Torvalds 
39*1da177e4SLinus Torvalds 
40*1da177e4SLinus Torvalds EXPORT_SYMBOL(pnp_is_active);
41