blob: 13c608f5fb302864b7bae16defaf2d95365ea815 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Bjorn Helgaas07d4e9a2007-07-26 10:41:21 -07002 * support.c - standard functions for the use of pnp protocol drivers
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Copyright 2003 Adam Belay <ambx1@neo.rr.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 */
6
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <linux/module.h>
8#include <linux/ctype.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <linux/pnp.h>
10#include "base.h"
11
12/**
Bjorn Helgaas07d4e9a2007-07-26 10:41:21 -070013 * pnp_is_active - Determines if a device is active based on its current
14 * resources
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 * @dev: pointer to the desired PnP device
Linus Torvalds1da177e2005-04-16 15:20:36 -070016 */
Bjorn Helgaas9dd78462007-07-26 10:41:20 -070017int pnp_is_active(struct pnp_dev *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070018{
19 if (!pnp_port_start(dev, 0) && pnp_port_len(dev, 0) <= 1 &&
20 !pnp_mem_start(dev, 0) && pnp_mem_len(dev, 0) <= 1 &&
Bjorn Helgaas9dd78462007-07-26 10:41:20 -070021 pnp_irq(dev, 0) == -1 && pnp_dma(dev, 0) == -1)
22 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070023 else
24 return 1;
25}
26
Linus Torvalds1da177e2005-04-16 15:20:36 -070027EXPORT_SYMBOL(pnp_is_active);