Commit 551e2c3c authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: mite: remove list of devices

All the drivers that use the "mite" module now allocate a `struct
mite_struct` dynamically instead of searching the `mite_devices` list
populated during initialization of the "mite" module.

Remove the list of devices and the function that prints available NI
devices on the list (`mite_list_devices()`).  The list node and `used`
members in `struct mite_struct` are now redundant, so remove them.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a5cf79e3
......@@ -61,9 +61,6 @@
#define PCI_DAQ_SIZE 4096
#define PCI_DAQ_SIZE_660X 8192
struct mite_struct *mite_devices;
EXPORT_SYMBOL(mite_devices);
#define TOP_OF_PAGE(x) ((x)|(~(PAGE_MASK)))
struct mite_struct *mite_alloc(struct pci_dev *pcidev)
......@@ -85,26 +82,6 @@ struct mite_struct *mite_alloc(struct pci_dev *pcidev)
}
EXPORT_SYMBOL(mite_alloc);
static void mite_init(void)
{
struct pci_dev *pcidev = NULL;
struct mite_struct *mite;
for_each_pci_dev(pcidev) {
if (pcidev->vendor == PCI_VENDOR_ID_NI) {
mite = mite_alloc(pcidev);
if (!mite) {
pr_err("allocation failed\n");
pci_dev_put(pcidev);
return;
}
pci_dev_get(pcidev);
mite->next = mite_devices;
mite_devices = mite;
}
}
}
static void dump_chip_signature(u32 csigr_bits)
{
pr_info("version = %i, type = %i, mite mode = %i, interface mode = %i\n",
......@@ -205,8 +182,6 @@ int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1)
}
mite->fifo_size = mite_fifo_size(mite, 0);
dev_info(&mite->pcidev->dev, "fifo size is %i.\n", mite->fifo_size);
mite->used = 1;
return 0;
}
EXPORT_SYMBOL(mite_setup2);
......@@ -217,17 +192,6 @@ int mite_setup(struct mite_struct *mite)
}
EXPORT_SYMBOL(mite_setup);
static void mite_cleanup(void)
{
struct mite_struct *mite, *next;
for (mite = mite_devices; mite; mite = next) {
pci_dev_put(mite->pcidev);
next = mite->next;
mite_free(mite);
}
}
void mite_unsetup(struct mite_struct *mite)
{
/* unsigned long offset, start, length; */
......@@ -247,25 +211,9 @@ void mite_unsetup(struct mite_struct *mite)
comedi_pci_disable(mite->pcidev);
mite->mite_phys_addr = 0;
}
mite->used = 0;
}
EXPORT_SYMBOL(mite_unsetup);
void mite_list_devices(void)
{
struct mite_struct *mite, *next;
pr_info("Available NI device IDs:\n");
if (mite_devices)
for (mite = mite_devices; mite; mite = next) {
next = mite->next;
pr_info("0x%04x%s\n", mite_device_id(mite),
mite->used ? " (used)" : "");
}
}
EXPORT_SYMBOL(mite_list_devices);
struct mite_dma_descriptor_ring *mite_alloc_ring(struct mite_struct *mite)
{
struct mite_dma_descriptor_ring *ring =
......@@ -852,15 +800,11 @@ EXPORT_SYMBOL(mite_dump_regs);
#ifdef MODULE
int __init init_module(void)
{
mite_init();
mite_list_devices();
return 0;
}
void __exit cleanup_module(void)
{
mite_cleanup();
}
#endif
......
......@@ -62,15 +62,11 @@ struct mite_channel {
};
struct mite_struct {
struct mite_struct *next;
int used;
struct pci_dev *pcidev;
resource_size_t mite_phys_addr;
void __iomem *mite_io_addr;
resource_size_t daq_phys_addr;
void __iomem *daq_io_addr;
struct mite_channel channels[MAX_MITE_DMA_CHANNELS];
short channel_allocated[MAX_MITE_DMA_CHANNELS];
int num_channels;
......@@ -78,8 +74,6 @@ struct mite_struct {
spinlock_t lock;
};
extern struct mite_struct *mite_devices;
struct mite_struct *mite_alloc(struct pci_dev *pcidev);
static inline void mite_free(struct mite_struct *mite)
......@@ -100,7 +94,6 @@ static inline unsigned int mite_device_id(struct mite_struct *mite)
int mite_setup(struct mite_struct *mite);
int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1);
void mite_unsetup(struct mite_struct *mite);
void mite_list_devices(void);
struct mite_dma_descriptor_ring *mite_alloc_ring(struct mite_struct *mite);
void mite_free_ring(struct mite_dma_descriptor_ring *ring);
struct mite_channel *mite_request_channel_in_range(struct mite_struct *mite,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment