pnpbios #12
PATCH 1/1 pnpbios #12
Patch #12
- Put more of pnp_bios.h inside #ifdef __KERNEL__ ... #endif
- Remove unused pnpbios_module_init stuff from pnp_bios.h
- Make locking coarser. This is a first step toward making the driver ready for hotplug. This is a non-trivial change.
In addition to #11:
- Minor formatting changes
- Use spin_lock_init() instead of "= SPIN_LOCK_UNLOCKED"
- Add some comments
- Don't export pnpbios_announce_device, which isn't used by outsiders
- Don't spinlock when accessing info that doesn't change
- Update Christian Schmidt's e-mail address
The patch:
include/linux/pnp_bios.h +21 -23
@@ -18,14 +18,13 @@* You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* $Original Id: pnp-bios.h,v 0.1 1998/03/19 23:00:00 cs Exp $ -* pnp_bios.h,v 1.1 1999/08/04 15:56:03 root Exp */ #ifndef _LINUX_PNP_BIOS_H#define _LINUX_PNP_BIOS_H +#ifdef __KERNEL__ +#include <linux/types.h> #include <linux/pci.h>
@@ -109,8 +108,6 @@ };#pragma pack() -#ifdef __KERNEL__ -struct pnpbios_device_id {char id[8 ];
@@ -125,24 +122,26 @@void (*remove) (struct pci_dev *dev);/* Device removed, either due to hotplug remove or module remove */ }; -#define pnpbios_dev_g (n) list_entry(n, struct pci_dev, global_list) - -static __inlinestruct pnpbios_driver *pnpbios_dev_driver (const struct pci_dev *dev) -{ -return (struct pnpbios_driver *)dev->driver; -} -#ifdef CONFIG_PNPBIOS -#define pnpbios_for_each_dev (dev) \ - for(dev = pnpbios_dev_g(pnpbios_devices.next); dev != pnpbios_dev_g(&pnpbios_devices); dev = pnpbios_dev_g(dev->global_list.next)) -/* exported functions */ +/* exported */ extern struct pci_dev *pnpbios_find_device (char *pnpid,struct pci_dev *prevdev);extern int pnpbios_get_device (char *pnpid,int prevnodenum,struct pci_dev *dev);extern int pnpbios_register_driver (struct pnpbios_driver *drv);extern void pnpbios_unregister_driver (struct pnpbios_driver *drv); -/* non-exported functions */ +/* non-exported */ +#define pnpbios_for_each_dev (dev) \ + for(dev = pnpbios_dev_g(pnpbios_devices.next); dev != pnpbios_dev_g(&pnpbios_devices); dev = pnpbios_dev_g(dev->global_list.next)) + + +#define pnpbios_dev_g (n) list_entry(n, struct pci_dev, global_list) + +static __inlinestruct pnpbios_driver *pnpbios_dev_driver (const struct pci_dev *dev) +{ +return (struct pnpbios_driver *)dev->driver; +} +extern int pnpbios_dont_use_current_config;extern void *pnpbios_kmalloc (size_t size,int f);extern void pnpbios_init (void );
@@ -197,9 +196,13 @@ }#else /* CONFIG_PNPBIOS */ -#define pnpbios_for_each_dev (dev) for(dev = NULL; 0; ) -static __inline__struct pci_dev *pnpbios_find_device (char *pnpid,struct pci_dev *dev) +static __inline__struct pci_dev *pnpbios_find_device (char *pnpid,struct pci_dev *prevdev) +{ +return NULL ; +} + +static __inline__int pnpbios_get_device (char *pnpid,int prevnodenum,struct pci_dev *dev) {return NULL ; }
@@ -212,11 +215,6 @@static __inline__void pnpbios_unregister_driver (struct pnpbios_driver *drv) {return ; -} - -static __inline__int pnpbios_module_init (struct pnpbios_driver *drv) -{ -return -ENODEV ; }#endif /* CONFIG_PNPBIOS */
drivers/pnp/pnp_bios.c +48 -36
171 lines not on this page · raw message