/* some silly little inline functions */
-static inline int alloc_private(struct comedi_device *dev, int size)
-{
- dev->private = kzalloc(size, GFP_KERNEL);
- if (!dev->private)
- return -ENOMEM;
- return 0;
-}
-
static inline unsigned int bytes_per_sample(const struct comedi_subdevice *subd)
{
if (subd->subdev_flags & SDF_LSAMPL)
dev->board_ptr = board;
dev->board_name = board->name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
unsigned char pci_bus, pci_slot, pci_func;
int i_Dma = 0;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
if (!pci_list_builded) {
v_pci_card_list_init(this_board->i_VendorId, 1); /* 1 for displaying the list.. */
dev->board_ptr = boardinfo;
dev->board_name = boardinfo->name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
comedi_set_hw_dev(dev, &pcidev->dev);
dev->board_name = dev->driver->driver_name;
- ret = alloc_private(dev, sizeof(*dev_private));
- if (ret)
- return ret;
- dev_private = dev->private;
+ dev_private = kzalloc(sizeof(*dev_private), GFP_KERNEL);
+ if (!dev_private)
+ return -ENOMEM;
+ dev->private = dev_private;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
else
master = 1;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
pcidev = pci9118_find_pci(dev, it);
if (!pcidev)
}
dev->iobase = iobase;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
devpriv->unipolar = unipolar;
devpriv->differential = differential;
dev->board_ptr = this_board;
dev->board_name = this_board->name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
comedi_set_hw_dev(dev, &pcidev->dev);
dev->board_name = dev->driver->driver_name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
dev->board_ptr = this_board;
dev->board_name = this_board->name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
}
dev->iobase = iobase;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_alloc_subdevices(dev, 4);
if (ret)
dev_info(dev->class_dev, DIO200_DRIVER_NAME ": attach\n");
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
/* Process options and reserve resources according to bus type. */
if (is_isa_board(thisboard)) {
struct pci_dev *pci_dev)
{
struct dio200_private *devpriv;
- int ret;
if (!DO_PCI)
return -EINVAL;
dev_info(dev->class_dev, DIO200_DRIVER_NAME ": attach pci %s\n",
pci_name(pci_dev));
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev->board_ptr = dio200_find_pci_board(pci_dev);
if (dev->board_ptr == NULL) {
dev_info(dev->class_dev, PC236_DRIVER_NAME ": attach\n");
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
/* Process options according to bus type. */
if (is_isa_board(thisboard)) {
struct pci_dev *pci_dev)
{
struct pc236_private *devpriv;
- int ret;
if (!DO_PCI)
return -EINVAL;
dev_info(dev->class_dev, PC236_DRIVER_NAME ": attach pci %s\n",
pci_name(pci_dev));
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev->board_ptr = pc236_find_pci_board(pci_dev);
if (dev->board_ptr == NULL) {
{
struct pci224_private *devpriv;
struct pci_dev *pci_dev;
- int ret;
dev_info(dev->class_dev, DRIVER_NAME ": attach\n");
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
pci_dev = pci224_find_pci_dev(dev, it);
if (!pci_dev)
pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev)
{
struct pci224_private *devpriv;
- int ret;
dev_info(dev->class_dev, DRIVER_NAME ": attach_pci %s\n",
pci_name(pci_dev));
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev->board_ptr = pci224_find_pci_board(pci_dev);
if (dev->board_ptr == NULL) {
static int pci230_alloc_private(struct comedi_device *dev)
{
struct pci230_private *devpriv;
- int err;
- err = alloc_private(dev, sizeof(*devpriv));
- if (err)
- return err;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
spin_lock_init(&devpriv->isr_spinlock);
spin_lock_init(&devpriv->res_spinlock);
return ret;
dev->irq = link->irq;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_alloc_subdevices(dev, 3);
if (ret)
dev->board_ptr = thisboard;
dev->board_name = thisboard->name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
uint32_t local_range, local_decode;
int retval;
- retval = alloc_private(dev, sizeof(*devpriv));
- if (retval)
- return retval;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
pcidev = cb_pcidas64_find_pci_dev(dev, it);
if (!pcidev)
dev->board_ptr = thisboard;
dev->board_name = thisboard->name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
dev->board_name = dev->driver->driver_name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
comedi_set_hw_dev(dev, &pcidev->dev);
dev->board_name = dev->driver->driver_name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
struct comedi_subdevice *s;
int ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
/*
* Setup our bonding from config params.. sets up our private struct..
if (ret)
return ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
s = &dev->subdevices[0];
s->type = COMEDI_SUBD_DIO;
dev->board_name = dev->driver->driver_name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
/* set default amplitude and period */
if (amplitude <= 0)
dev->board_ptr = board;
dev->board_name = board->name;
- result = alloc_private(dev, sizeof(*devpriv));
- if (result)
- return result;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
result = comedi_pci_enable(pcidev, dev->driver->driver_name);
if (result < 0)
{
struct das08_private_struct *devpriv;
unsigned long iobase;
- int ret;
if (!DO_PCI)
return -EINVAL;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev_info(dev->class_dev, "attach pci %s\n", pci_name(pdev));
dev->board_ptr = das08_find_pci_board(pdev);
{
const struct das08_board_struct *thisboard = comedi_board(dev);
struct das08_private_struct *devpriv;
- int ret;
unsigned long iobase;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev_info(dev->class_dev, "attach\n");
if (is_pci_board(thisboard)) {
{
const struct das08_board_struct *thisboard = comedi_board(dev);
struct das08_private_struct *devpriv;
- int ret;
unsigned long iobase;
struct pcmcia_device *link = cur_dev; /* XXX hack */
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev_info(dev->class_dev, "das08_cs: attach\n");
/* deal with a pci board */
}
}
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
if (board->size < 0x400) {
printk(" 0x%04lx-0x%04lx\n", iobase, iobase + board->size);
iobase = it->options[0];
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
if (!request_region(iobase, DAS16M1_SIZE, dev->board_name)) {
comedi_error(dev, "I/O port conflict\n");
int board;
int retval;
- retval = alloc_private(dev, sizeof(*devpriv));
- if (retval)
- return retval;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
printk(KERN_DEBUG "comedi%d: %s: io 0x%lx", dev->minor,
dev->driver->driver_name, iobase);
dev->irq = irq;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_alloc_subdevices(dev, 1);
if (ret)
if (irq)
dev_dbg(dev->class_dev, "irq %u\n", irq);
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
if (iobase == 0) {
dev_err(dev->class_dev,
dev->irq = irq;
}
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_alloc_subdevices(dev, 3);
if (ret)
if (ret)
goto out;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev->board_name = boardtype.name;
if (ret)
return ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
switch (it->options[2]) {
case 0:
if (ret)
return ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
s = &dev->subdevices[0];
dev->read_subdev = s;
if (ret)
return ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
s = &dev->subdevices[0];
/* ao subdevice */
#endif
}
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = dt282x_grab_dma(dev, it->options[opt_dma1],
it->options[opt_dma2]);
dev_dbg(dev->class_dev, "dt3000:\n");
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
pcidev = dt3000_find_pci_dev(dev, it);
if (!pcidev)
dev->board_name = "dt9812";
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
/*
* Special open routine, since USB unit may be unattached at
dev->board_name = dev->driver->driver_name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
dev->iobase = iobase;
dev->board_name = "fl512";
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
#if DEBUG
printk(KERN_DEBUG "malloc ok\n");
printk(KERN_WARNING "comedi%d: gsc_hpdi\n", dev->minor);
- retval = alloc_private(dev, sizeof(*devpriv));
- if (retval)
- return retval;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
pcidev = NULL;
for (i = 0; i < ARRAY_SIZE(hpdi_boards) &&
comedi_set_hw_dev(dev, &pcidev->dev);
dev->board_name = dev->driver->driver_name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
if (ret)
return ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
devpriv->ioaddr = (void __iomem *)(unsigned long)it->options[0];
dev->board_name = "pci20kc";
return -EINVAL;
}
- result = alloc_private(dev, sizeof(*devpriv));
- if (result)
- return result;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
card = NULL;
init_timer(&devpriv->timer);
dev->board_ptr = thisboard;
dev->board_name = thisboard->name;
- result = alloc_private(dev, sizeof(*info));
- if (result)
- return result;
- info = dev->private;
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return -ENOMEM;
+ dev->private = info;
result = comedi_pci_enable(pcidev, dev->board_name);
if (result)
dev->board_ptr = board;
dev->board_name = board->name;
- error = alloc_private(dev, sizeof(*dev_private));
- if (error)
- return error;
- dev_private = dev->private;
+ dev_private = kzalloc(sizeof(*dev_private), GFP_KERNEL);
+ if (!dev_private)
+ return -ENOMEM;
+ dev->private = dev_private;
/* Enable PCI device and request PCI regions */
if (comedi_pci_enable(pcidev, dev->board_name) < 0) {
dev->iobase = iobase;
dev->board_name = "mpc624";
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
switch (it->options[1]) {
case 0:
if (result)
return result;
- result = alloc_private(dev, sizeof(*devpriv));
- if (result)
- return result;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
s = &dev->subdevices[0];
/* ai subdevice */
struct comedi_subdevice *s;
int ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev->board_ptr = ni6527_find_boardinfo(pcidev);
if (!dev->board_ptr)
unsigned i;
int ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev->board_ptr = ni_65xx_find_boardinfo(pcidev);
if (!dev->board_ptr)
static int ni_660x_allocate_private(struct comedi_device *dev)
{
struct ni_660x_private *devpriv;
- int retval;
unsigned i;
- retval = alloc_private(dev, sizeof(*devpriv));
- if (retval)
- return retval;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
spin_lock_init(&devpriv->mite_channel_lock);
spin_lock_init(&devpriv->interrupt_lock);
int ret;
int i;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev->board_ptr = ni_670x_find_boardinfo(pcidev);
if (!dev->board_ptr)
}
printk("\n");
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
if (iobase == 0) {
printk(" io base address required\n");
dev->board_name = board->name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_alloc_subdevices(dev, 4);
if (ret)
if (ret)
return ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
/* reset the atmio16d hardware */
reset_atmio16d(dev);
struct pcmcia_device *link;
int ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
/* get base address, irq etc. based on bustype */
switch (thisboard->bustype) {
if (!IS_ENABLED(CONFIG_COMEDI_PCI_DRIVERS))
return -ENODEV;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev->board_ptr = labpc_pci_find_boardinfo(pcidev);
if (!dev->board_ptr)
unsigned long iobase = 0;
unsigned int irq = 0;
unsigned int dma_chan = 0;
- int ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
/* get base address, irq etc. based on bustype */
switch (thisboard->bustype) {
unsigned long iobase = 0;
unsigned int irq = 0;
struct pcmcia_device *link;
- int ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
/* get base address, irq etc. based on bustype */
switch (thisboard->bustype) {
static int ni_alloc_private(struct comedi_device *dev)
{
struct ni_private *devpriv;
- int ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
spin_lock_init(&devpriv->window_lock);
spin_lock_init(&devpriv->soft_reg_copy_lock);
int ret;
unsigned int irq;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
spin_lock_init(&devpriv->mite_channel_lock);
if (ret)
return ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
s = &dev->subdevices[0];
/* AI subdevice */
dev->board_name = board->name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
for (i = 0; i < 12; i++) {
devpriv->bipolar[i] = 0;
}
dev->iobase = iobase;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret) {
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv) {
free_resources(dev);
- return ret;
+ return -ENOMEM;
}
- devpriv = dev->private;
+ dev->private = devpriv;
dev->board_name = board->name;
return -EIO;
}
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev->board_name = board->name;
unsigned long pages;
struct comedi_subdevice *s;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
/* claim our I/O space */
iobase = it->options[0];
iobase = it->options[0];
iorange = PCM3724_SIZE;
- ret = alloc_private(dev, sizeof(*priv));
- if (ret)
- return ret;
- priv = dev->private;
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+ dev->private = priv;
printk(KERN_INFO "comedi%d: pcm3724: board=%s, 0x%03lx ", dev->minor,
dev->board_name, iobase);
if (ret)
return ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev->board_name = board->name;
dev->board_name = dev->driver->driver_name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
devpriv->simultaneous_xfer_mode = it->options[1];
return -EIO;
}
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
for (asic = 0; asic < MAX_ASICS; ++asic) {
devpriv->asics[asic].num = asic;
dev->board_name = board->name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
for (asic = 0; asic < MAX_ASICS; ++asic) {
devpriv->asics[asic].num = asic;
if (ret)
return ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
/* analog output subdevice */
s = &dev->subdevices[0];
comedi_debug = 1;
#endif
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
pcidev = rtd_find_pci(dev, it);
if (!pcidev)
if (ret)
return ret;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
devpriv->adc_mux = it->options[2];
devpriv->adc_range = it->options[3];
dev->board_name = "rti802";
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_alloc_subdevices(dev, 1);
if (ret)
}
dev->iobase = iobase;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_alloc_subdevices(dev, 4);
if (ret)
comedi_set_hw_dev(dev, &pcidev->dev);
dev->board_name = dev->driver->driver_name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
dev_dbg(dev->class_dev, "serial2002: attach\n");
dev->board_name = dev->driver->driver_name;
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
dev->open = serial_2002_open;
dev->close = serial_2002_close;
dev->board_name = thisboard->name;
/* Allocate the private data */
- ret = alloc_private(dev, sizeof(*devpriv));
- if (ret)
- return ret;
- devpriv = dev->private;
+ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
+ if (!devpriv)
+ return -ENOMEM;
+ dev->private = devpriv;
ret = comedi_alloc_subdevices(dev, 3);
if (ret)