Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 317299
b: refs/heads/master
c: 2f0b9d0
h: refs/heads/master
i:
  317297: f7d49bf
  317295: cd494ba
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jun 12, 2012
1 parent 37ef004 commit 821be74
Show file tree
Hide file tree
Showing 106 changed files with 128 additions and 124 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e34995148a2a305106c4f746fb76da23488c46c7
refs/heads/master: 2f0b9d082e5d0056a3aca4be038483a564849196
22 changes: 2 additions & 20 deletions trunk/drivers/staging/comedi/comedidev.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ static inline struct comedi_subdevice *comedi_get_write_subdevice(
return info->device->write_subdev;
}

int comedi_alloc_subdevices(struct comedi_device *, unsigned int);

void comedi_device_detach(struct comedi_device *dev);
int comedi_device_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
Expand Down Expand Up @@ -413,26 +415,6 @@ struct comedi_lrange {

/* some silly little inline functions */

static inline int alloc_subdevices(struct comedi_device *dev,
unsigned int num_subdevices)
{
unsigned i;

dev->n_subdevices = num_subdevices;
dev->subdevices =
kcalloc(num_subdevices, sizeof(struct comedi_subdevice),
GFP_KERNEL);
if (!dev->subdevices)
return -ENOMEM;
for (i = 0; i < num_subdevices; ++i) {
dev->subdevices[i].device = dev;
dev->subdevices[i].async_dma_dir = DMA_NONE;
spin_lock_init(&dev->subdevices[i].spin_lock);
dev->subdevices[i].minor = -1;
}
return 0;
}

static inline int alloc_private(struct comedi_device *dev, int size)
{
dev->private = kzalloc(size, GFP_KERNEL);
Expand Down
21 changes: 21 additions & 0 deletions trunk/drivers/staging/comedi/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ static int poll_invalid(struct comedi_device *dev, struct comedi_subdevice *s);

struct comedi_driver *comedi_drivers;

int comedi_alloc_subdevices(struct comedi_device *dev,
unsigned int num_subdevices)
{
unsigned i;

dev->n_subdevices = num_subdevices;
dev->subdevices =
kcalloc(num_subdevices, sizeof(struct comedi_subdevice),
GFP_KERNEL);
if (!dev->subdevices)
return -ENOMEM;
for (i = 0; i < num_subdevices; ++i) {
dev->subdevices[i].device = dev;
dev->subdevices[i].async_dma_dir = DMA_NONE;
spin_lock_init(&dev->subdevices[i].spin_lock);
dev->subdevices[i].minor = -1;
}
return 0;
}
EXPORT_SYMBOL_GPL(comedi_alloc_subdevices);

static void cleanup_device(struct comedi_device *dev)
{
int i;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/8255.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ static int dev_8255_attach(struct comedi_device *dev,
return -EINVAL;
}

ret = alloc_subdevices(dev, i);
ret = comedi_alloc_subdevices(dev, i);
if (ret < 0) {
/* FIXME this printk call should give a proper message, the
* below line just maintains previous functionality */
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/acl7225b.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static int acl7225b_attach(struct comedi_device *dev,
dev->iobase = iobase;
dev->irq = 0;

if (alloc_subdevices(dev, 3) < 0)
if (comedi_alloc_subdevices(dev, 3) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,7 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
} else {
/* Update-0.7.57->0.7.68dev->n_subdevices = 7; */
n_subdevices = 7;
ret = alloc_subdevices(dev, n_subdevices);
ret = comedi_alloc_subdevices(dev, n_subdevices);
if (ret < 0)
return ret;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void i_ADDI_AttachPCI1710(struct comedi_device *dev)
int n_subdevices = 9;

/* Update-0.7.57->0.7.68dev->n_subdevices = 9; */
ret = alloc_subdevices(dev, n_subdevices);
ret = comedi_alloc_subdevices(dev, n_subdevices);
if (ret < 0)
return;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/adl_pci6208.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ static int pci6208_attach(struct comedi_device *dev,
dev->iobase = io_base;
dev->board_name = thisboard->name;

if (alloc_subdevices(dev, 2) < 0)
if (comedi_alloc_subdevices(dev, 2) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/adl_pci7230.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static int adl_pci7230_attach(struct comedi_device *dev,
if (alloc_private(dev, sizeof(struct adl_pci7230_private)) < 0)
return -ENOMEM;

if (alloc_subdevices(dev, 2) < 0)
if (comedi_alloc_subdevices(dev, 2) < 0)
return -ENOMEM;

devpriv->pci_dev = adl_pci7230_find_pci(dev, it);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/adl_pci7296.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static int adl_pci7296_attach(struct comedi_device *dev,
if (alloc_private(dev, sizeof(struct adl_pci7296_private)) < 0)
return -ENOMEM;

if (alloc_subdevices(dev, 4) < 0)
if (comedi_alloc_subdevices(dev, 4) < 0)
return -ENOMEM;

devpriv->pci_dev = adl_pci7296_find_pci(dev, it);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/adl_pci7432.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static int adl_pci7432_attach(struct comedi_device *dev,
if (alloc_private(dev, sizeof(struct adl_pci7432_private)) < 0)
return -ENOMEM;

if (alloc_subdevices(dev, 2) < 0)
if (comedi_alloc_subdevices(dev, 2) < 0)
return -ENOMEM;

devpriv->pci_dev = adl_pci7432_find_pci(dev, it);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/adl_pci8164.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ static int adl_pci8164_attach(struct comedi_device *dev,
if (alloc_private(dev, sizeof(struct adl_pci8164_private)) < 0)
return -ENOMEM;

if (alloc_subdevices(dev, 4) < 0)
if (comedi_alloc_subdevices(dev, 4) < 0)
return -ENOMEM;

devpriv->pci_dev = adl_pci8164_find_pci(dev, it);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/adl_pci9111.c
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ static int pci9111_attach(struct comedi_device *dev,

/* TODO: Add external multiplexer setup (according to option[2]). */

error = alloc_subdevices(dev, 4);
error = comedi_alloc_subdevices(dev, 4);
if (error < 0)
return error;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/adl_pci9118.c
Original file line number Diff line number Diff line change
Expand Up @@ -2268,7 +2268,7 @@ static int pci9118_attach(struct comedi_device *dev,
pci_write_config_word(devpriv->pcidev, PCI_COMMAND, u16w | 64);
/* Enable parity check for parity error */

ret = alloc_subdevices(dev, 4);
ret = comedi_alloc_subdevices(dev, 4);
if (ret < 0)
return ret;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/adq12b.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it)
* Allocate the subdevice structures. alloc_subdevice() is a
* convenient macro defined in comedidev.h.
*/
if (alloc_subdevices(dev, 3) < 0)
if (comedi_alloc_subdevices(dev, 3) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/adv_pci1710.c
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ static int pci1710_attach(struct comedi_device *dev,
if (this_board->n_counter)
n_subdevices++;

ret = alloc_subdevices(dev, n_subdevices);
ret = comedi_alloc_subdevices(dev, n_subdevices);
if (ret < 0)
return ret;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/adv_pci1723.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ static int pci1723_attach(struct comedi_device *dev,
if (this_board->n_diochan)
n_subdevices++;

ret = alloc_subdevices(dev, n_subdevices);
ret = comedi_alloc_subdevices(dev, n_subdevices);
if (ret < 0) {
printk(" - Allocation failed!\n");
return ret;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/adv_pci_dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ static int pci_dio_attach(struct comedi_device *dev,
n_subdevices++;
}

ret = alloc_subdevices(dev, n_subdevices);
ret = comedi_alloc_subdevices(dev, n_subdevices);
if (ret < 0)
return ret;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/aio_aio12_8.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev,
if (alloc_private(dev, sizeof(struct aio12_8_private)) < 0)
return -ENOMEM;

if (alloc_subdevices(dev, 3) < 0)
if (comedi_alloc_subdevices(dev, 3) < 0)
return -ENOMEM;

s = &dev->subdevices[0];
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/aio_iiro_16.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
if (alloc_private(dev, sizeof(struct aio_iiro_16_private)) < 0)
return -ENOMEM;

if (alloc_subdevices(dev, 2) < 0)
if (comedi_alloc_subdevices(dev, 2) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/amplc_dio200.c
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ static int dio200_common_attach(struct comedi_device *dev, unsigned long iobase,
devpriv->intr_sd = -1;
dev->iobase = iobase;
dev->board_name = thisboard->name;
ret = alloc_subdevices(dev, layout->n_subdevs);
ret = comedi_alloc_subdevices(dev, layout->n_subdevs);
if (ret < 0) {
dev_err(dev->class_dev, "error! out of memory!\n");
return ret;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/amplc_pc236.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ static int pc236_common_attach(struct comedi_device *dev, unsigned long iobase,
dev->board_name = thisboard->name;
dev->iobase = iobase;

ret = alloc_subdevices(dev, 2);
ret = comedi_alloc_subdevices(dev, 2);
if (ret < 0) {
dev_err(dev->class_dev, "error! out of memory!\n");
return ret;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/amplc_pc263.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ static int pc263_common_attach(struct comedi_device *dev, unsigned long iobase)
dev->board_name = thisboard->name;
dev->iobase = iobase;

ret = alloc_subdevices(dev, 1);
ret = comedi_alloc_subdevices(dev, 1);
if (ret < 0) {
dev_err(dev->class_dev, "error! out of memory!\n");
return ret;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/amplc_pci224.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ static int pci224_attach_common(struct comedi_device *dev,
dev->iobase + PCI224_DACCON);

/* Allocate subdevices. There is only one! */
ret = alloc_subdevices(dev, 1);
ret = comedi_alloc_subdevices(dev, 1);
if (ret < 0) {
dev_err(dev->class_dev, "error! out of memory!\n");
return ret;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/amplc_pci230.c
Original file line number Diff line number Diff line change
Expand Up @@ -2843,7 +2843,7 @@ static int pci230_attach_common(struct comedi_device *dev,
* Allocate the subdevice structures. alloc_subdevice() is a
* convenient macro defined in comedidev.h.
*/
if (alloc_subdevices(dev, 3) < 0)
if (comedi_alloc_subdevices(dev, 3) < 0)
return -ENOMEM;
s = dev->subdevices + 0;
/* analog input subdevice */
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/staging/comedi/drivers/c6xdigio.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ static int c6xdigio_attach(struct comedi_device *dev,
dev->iobase = iobase;
dev->board_name = "c6xdigio";

result = alloc_subdevices(dev, 2); /* 3 with encoder_init write */
/* 3 subdevices with encoder_init write */
result = comedi_alloc_subdevices(dev, 2);
if (result < 0)
return result;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/cb_das16_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static int das16cs_attach(struct comedi_device *dev,
if (alloc_private(dev, sizeof(struct das16cs_private)) < 0)
return -ENOMEM;

if (alloc_subdevices(dev, 4) < 0)
if (comedi_alloc_subdevices(dev, 4) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/cb_pcidas.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ static int cb_pcidas_attach(struct comedi_device *dev,
/*
* Allocate the subdevice structures.
*/
if (alloc_subdevices(dev, 7) < 0)
if (comedi_alloc_subdevices(dev, 7) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/cb_pcidas64.c
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ static int setup_subdevices(struct comedi_device *dev)
void __iomem *dio_8255_iobase;
int i;

if (alloc_subdevices(dev, 10) < 0)
if (comedi_alloc_subdevices(dev, 10) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/cb_pcidda.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ static int cb_pcidda_attach(struct comedi_device *dev,
/*
* Allocate the subdevice structures.
*/
if (alloc_subdevices(dev, 3) < 0)
if (comedi_alloc_subdevices(dev, 3) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/cb_pcidio.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static int pcidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
* Allocate the subdevice structures. alloc_subdevice() is a
* convenient macro defined in comedidev.h.
*/
if (alloc_subdevices(dev, thisboard->n_8255) < 0)
if (comedi_alloc_subdevices(dev, thisboard->n_8255) < 0)
return -ENOMEM;

for (i = 0; i < thisboard->n_8255; i++) {
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/cb_pcimdas.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ static int cb_pcimdas_attach(struct comedi_device *dev,
* Allocate the subdevice structures. alloc_subdevice() is a
* convenient macro defined in comedidev.h.
*/
if (alloc_subdevices(dev, 3) < 0)
if (comedi_alloc_subdevices(dev, 3) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/cb_pcimdda.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
* Allocate the subdevice structures. alloc_subdevice() is a
* convenient macro defined in comedidev.h.
*/
if (alloc_subdevices(dev, 2) < 0)
if (comedi_alloc_subdevices(dev, 2) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/comedi_bond.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ static int bonding_attach(struct comedi_device *dev,
* Allocate the subdevice structures. alloc_subdevice() is a
* convenient macro defined in comedidev.h.
*/
if (alloc_subdevices(dev, 1) < 0)
if (comedi_alloc_subdevices(dev, 1) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/comedi_parport.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ static int parport_attach(struct comedi_device *dev,
}
dev->board_name = "parport";

ret = alloc_subdevices(dev, 4);
ret = comedi_alloc_subdevices(dev, 4);
if (ret < 0)
return ret;
ret = alloc_private(dev, sizeof(struct parport_private));
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/comedi_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ static int waveform_attach(struct comedi_device *dev,
devpriv->usec_period = period;

dev->n_subdevices = 2;
if (alloc_subdevices(dev, dev->n_subdevices) < 0)
if (comedi_alloc_subdevices(dev, dev->n_subdevices) < 0)
return -ENOMEM;

s = dev->subdevices + 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/contec_pci_dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (alloc_private(dev, sizeof(struct contec_private)) < 0)
return -ENOMEM;

if (alloc_subdevices(dev, 2) < 0)
if (comedi_alloc_subdevices(dev, 2) < 0)
return -ENOMEM;

for_each_pci_dev(pcidev) {
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/daqboard2000.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ static int daqboard2000_attach(struct comedi_device *dev,
if (!devpriv->plx || !devpriv->daq)
return -ENOMEM;

result = alloc_subdevices(dev, 3);
result = comedi_alloc_subdevices(dev, 3);
if (result < 0)
goto out;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/drivers/das08.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase)

dev->board_name = thisboard->name;

ret = alloc_subdevices(dev, 6);
ret = comedi_alloc_subdevices(dev, 6);
if (ret < 0)
return ret;

Expand Down
Loading

0 comments on commit 821be74

Please sign in to comment.