Skip to content

Commit

Permalink
staging: comedi: mite: remove list of devices
Browse files Browse the repository at this point in the history
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: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Sep 17, 2012
1 parent a5cf79e commit 551e2c3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 63 deletions.
56 changes: 0 additions & 56 deletions drivers/staging/comedi/drivers/mite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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",
Expand Down Expand Up @@ -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);
Expand All @@ -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; */
Expand All @@ -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 =
Expand Down Expand Up @@ -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

Expand Down
7 changes: 0 additions & 7 deletions drivers/staging/comedi/drivers/mite.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,18 @@ 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;
unsigned fifo_size;
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)
Expand All @@ -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,
Expand Down

0 comments on commit 551e2c3

Please sign in to comment.