staging: comedi: remove inline alloc_private()
authorH Hartley Sweeten <hartleys@visionengravers.com>
Tue, 23 Oct 2012 20:22:37 +0000 (13:22 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Oct 2012 03:28:19 +0000 (20:28 -0700)
This inline function has a very generic name and it's only a
wrapper around a simple kzalloc(). Since the inline function
does not save any lines-of-code, instead of renaming it just
remove it and do the kzalloc() directly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
80 files changed:
drivers/staging/comedi/comedidev.h
drivers/staging/comedi/drivers/8255_pci.c
drivers/staging/comedi/drivers/addi-data/addi_common.c
drivers/staging/comedi/drivers/adl_pci6208.c
drivers/staging/comedi/drivers/adl_pci9111.c
drivers/staging/comedi/drivers/adl_pci9118.c
drivers/staging/comedi/drivers/adq12b.c
drivers/staging/comedi/drivers/adv_pci1710.c
drivers/staging/comedi/drivers/adv_pci1723.c
drivers/staging/comedi/drivers/adv_pci_dio.c
drivers/staging/comedi/drivers/aio_aio12_8.c
drivers/staging/comedi/drivers/amplc_dio200.c
drivers/staging/comedi/drivers/amplc_pc236.c
drivers/staging/comedi/drivers/amplc_pci224.c
drivers/staging/comedi/drivers/amplc_pci230.c
drivers/staging/comedi/drivers/cb_das16_cs.c
drivers/staging/comedi/drivers/cb_pcidas.c
drivers/staging/comedi/drivers/cb_pcidas64.c
drivers/staging/comedi/drivers/cb_pcidda.c
drivers/staging/comedi/drivers/cb_pcimdas.c
drivers/staging/comedi/drivers/cb_pcimdda.c
drivers/staging/comedi/drivers/comedi_bond.c
drivers/staging/comedi/drivers/comedi_parport.c
drivers/staging/comedi/drivers/comedi_test.c
drivers/staging/comedi/drivers/daqboard2000.c
drivers/staging/comedi/drivers/das08.c
drivers/staging/comedi/drivers/das08_cs.c
drivers/staging/comedi/drivers/das16.c
drivers/staging/comedi/drivers/das16m1.c
drivers/staging/comedi/drivers/das1800.c
drivers/staging/comedi/drivers/das6402.c
drivers/staging/comedi/drivers/das800.c
drivers/staging/comedi/drivers/dmm32at.c
drivers/staging/comedi/drivers/dt2801.c
drivers/staging/comedi/drivers/dt2811.c
drivers/staging/comedi/drivers/dt2814.c
drivers/staging/comedi/drivers/dt2815.c
drivers/staging/comedi/drivers/dt282x.c
drivers/staging/comedi/drivers/dt3000.c
drivers/staging/comedi/drivers/dt9812.c
drivers/staging/comedi/drivers/dyna_pci10xx.c
drivers/staging/comedi/drivers/fl512.c
drivers/staging/comedi/drivers/gsc_hpdi.c
drivers/staging/comedi/drivers/icp_multi.c
drivers/staging/comedi/drivers/ii_pci20kc.c
drivers/staging/comedi/drivers/jr3_pci.c
drivers/staging/comedi/drivers/me4000.c
drivers/staging/comedi/drivers/me_daq.c
drivers/staging/comedi/drivers/mpc624.c
drivers/staging/comedi/drivers/multiq3.c
drivers/staging/comedi/drivers/ni_6527.c
drivers/staging/comedi/drivers/ni_65xx.c
drivers/staging/comedi/drivers/ni_660x.c
drivers/staging/comedi/drivers/ni_670x.c
drivers/staging/comedi/drivers/ni_at_a2150.c
drivers/staging/comedi/drivers/ni_at_ao.c
drivers/staging/comedi/drivers/ni_atmio16d.c
drivers/staging/comedi/drivers/ni_daq_dio24.c
drivers/staging/comedi/drivers/ni_labpc.c
drivers/staging/comedi/drivers/ni_labpc_cs.c
drivers/staging/comedi/drivers/ni_mio_common.c
drivers/staging/comedi/drivers/ni_pcidio.c
drivers/staging/comedi/drivers/pcl711.c
drivers/staging/comedi/drivers/pcl726.c
drivers/staging/comedi/drivers/pcl812.c
drivers/staging/comedi/drivers/pcl816.c
drivers/staging/comedi/drivers/pcl818.c
drivers/staging/comedi/drivers/pcm3724.c
drivers/staging/comedi/drivers/pcmad.c
drivers/staging/comedi/drivers/pcmda12.c
drivers/staging/comedi/drivers/pcmmio.c
drivers/staging/comedi/drivers/pcmuio.c
drivers/staging/comedi/drivers/poc.c
drivers/staging/comedi/drivers/rtd520.c
drivers/staging/comedi/drivers/rti800.c
drivers/staging/comedi/drivers/rti802.c
drivers/staging/comedi/drivers/s526.c
drivers/staging/comedi/drivers/s626.c
drivers/staging/comedi/drivers/serial2002.c
drivers/staging/comedi/drivers/skel.c

index 100ea0b0772c7f30a008333fdeac74538df97e7c..78a44fc46ef28a632f276b1542dfa1db957ec3c6 100644 (file)
@@ -415,14 +415,6 @@ struct comedi_lrange {
 
 /* 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)
index af76e4e3e405a058360d580b52ac962e9d6fa835..6a4f2a1ea6629030f1c38da19644ca4f556f30c9 100644 (file)
@@ -235,10 +235,10 @@ static int pci_8255_attach_pci(struct comedi_device *dev,
        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)
index 1d4ecfec447f90709ddda8987d3d29f820215277..10ae752f21c8117f49c0c8b0426e0d21d868e618 100644 (file)
@@ -1482,10 +1482,10 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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.. */
index de3625224c88d706ea9a6b179b131a48b38dd79d..343422abcd31d4b22f345e40181d711a32932013 100644 (file)
@@ -191,10 +191,10 @@ static int pci6208_attach_pci(struct comedi_device *dev,
        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)
index a87192ac2846d939957176eca026801db860f3a5..aa55443742cac871ece1f720d7ca746ab686a5f5 100644 (file)
@@ -889,10 +889,10 @@ static int pci9111_attach_pci(struct comedi_device *dev,
        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)
index 4eca8764685f0042e8d01d8c27bad049e6a61f37..4bcc5b1171d94608c78e800cac9ad90be6381cd1 100644 (file)
@@ -1923,10 +1923,10 @@ static int pci9118_attach(struct comedi_device *dev,
        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)
index bdc5ebce8774b3d7fe74b7c11b53489529225958..f7950dfe2ddbca536a112310d56a54bb5bd12913 100644 (file)
@@ -243,10 +243,10 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        }
        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;
index 322d0118dccaea829546718f5ee397aa9630f88e..4161cb6be488d16b0850f9e5450552630bc9244c 100644 (file)
@@ -1273,10 +1273,10 @@ static int pci1710_attach_pci(struct comedi_device *dev,
        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)
index 3c932e7309bc2fa3b43f81ba509957c4e6a95f17..d14ddcb17520a88f9286bfae91522cb446d26fba 100644 (file)
@@ -244,10 +244,10 @@ static int pci1723_attach_pci(struct comedi_device *dev,
        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)
index 8fa61592bbfe3d8a47116f58abb798cea4c81aff..47a7584d291f03f64705446d1d193674835cea42 100644 (file)
@@ -1108,10 +1108,10 @@ static int pci_dio_attach_pci(struct comedi_device *dev,
        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)
index 8acf60d0f20d49a901591d1f06a65102f68dd7f0..601f03d5897faab43d95dd7223826796cb0e4d46 100644 (file)
@@ -212,10 +212,10 @@ static int aio_aio12_8_attach(struct comedi_device *dev,
        }
        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)
index 556c63304324f79ea07bad69332db2eea13c772b..35cd3cbb3bec359456d80c1550193838b32fdcd0 100644 (file)
@@ -1339,10 +1339,10 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
        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)) {
@@ -1378,7 +1378,6 @@ static int __devinit dio200_attach_pci(struct comedi_device *dev,
                                       struct pci_dev *pci_dev)
 {
        struct dio200_private *devpriv;
-       int ret;
 
        if (!DO_PCI)
                return -EINVAL;
@@ -1386,10 +1385,10 @@ static int __devinit dio200_attach_pci(struct comedi_device *dev,
        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) {
index 56354aa2708e688a9a4ed429b4fd253e4cd975e7..52541c95ba65d250108fd70e398124d4995bffc6 100644 (file)
@@ -510,10 +510,10 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
        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)) {
@@ -546,7 +546,6 @@ static int __devinit pc236_attach_pci(struct comedi_device *dev,
                                      struct pci_dev *pci_dev)
 {
        struct pc236_private *devpriv;
-       int ret;
 
        if (!DO_PCI)
                return -EINVAL;
@@ -554,10 +553,10 @@ static int __devinit pc236_attach_pci(struct comedi_device *dev,
        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) {
index 5d73082adfc54e6f1b92c626d3f9010ec68e697d..6a9ec11c4f079e83dcd69fd72b7521b250bc9b45 100644 (file)
@@ -1445,14 +1445,13 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
        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)
@@ -1465,15 +1464,14 @@ static int __devinit
 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) {
index cf454b9cb292a4a8f9a00cc9f1c6f147a9e03eba..2675eefe8b5a41d0406546d30680bb43236d6f1a 100644 (file)
@@ -2660,12 +2660,11 @@ static struct pci_dev *pci230_find_pci_dev(struct comedi_device *dev,
 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);
index 64442b360663e7ad0221fa2cdf1fbcd2b1e484ed..8b091c61cbc847b625bbf7e9cd95f8a5a95e8cbf 100644 (file)
@@ -452,10 +452,10 @@ static int das16cs_attach(struct comedi_device *dev,
                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)
index de21a261ff453b9db06ebfe4ac99617d68204408..3f4f8bef692bf81abf95102a598f3a525373706e 100644 (file)
@@ -1486,10 +1486,10 @@ static int cb_pcidas_attach_pci(struct comedi_device *dev,
        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)
index 08546a1091a25a23750d2f21d75ce504fc51e2eb..a6f5e5e92c8e0164b748ca53809b9390c819ccec 100644 (file)
@@ -1688,10 +1688,10 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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)
index aef946df27e2f22ba85c48e3072ffbc6866d7431..07a8969c8919790505ef264502763e94cb9491c1 100644 (file)
@@ -664,10 +664,10 @@ static int cb_pcidda_attach_pci(struct comedi_device *dev,
        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)
index d1c7220c0b7be4f9ee0aab403aadce4d03c39f2d..9df9a02553c0fb74d296c0fb4bb6759e8542b0f9 100644 (file)
@@ -219,10 +219,10 @@ static int cb_pcimdas_attach_pci(struct comedi_device *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)
index ba9f0599be28b134d20c635ce474cd038ca682ae..651cf18cd606c21d923acc9667ce310014d566a3 100644 (file)
@@ -162,10 +162,10 @@ static int cb_pcimdda_attach_pci(struct comedi_device *dev,
        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)
index 5c768bc76eb1ad750a158934957f470de6c683ab..31515999bb97e47b153c4848d192a62321cc3084 100644 (file)
@@ -304,10 +304,10 @@ static int bonding_attach(struct comedi_device *dev,
        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..
index a1371c5a7d868de1495f8883546716b8b348cc46..6d3b56a70aa93e9355ffa2e9ee5a2f6ab9969fea 100644 (file)
@@ -305,10 +305,10 @@ static int parport_attach(struct comedi_device *dev,
        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;
index 788a5cc89e219c96147056b1cdd1ce452e96dd93..1be345518b64a06984314d254a817bdf889638a9 100644 (file)
@@ -414,10 +414,10 @@ static int waveform_attach(struct comedi_device *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;
 
        /* set default amplitude and period */
        if (amplitude <= 0)
index 6bc51fcc6881353a07d3972dfdb4987847ed7f06..513056d232f492b176e9c442062eccc38b31df4a 100644 (file)
@@ -706,10 +706,10 @@ static int daqboard2000_attach_pci(struct comedi_device *dev,
        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)
index 19c2907c3842b24ae72ba69b112eca7c8ffde588..4fa8f0baa4ac9f68a0813aa4ec287f2373118e16 100644 (file)
@@ -780,15 +780,14 @@ das08_attach_pci(struct comedi_device *dev, struct pci_dev *pdev)
 {
        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);
@@ -813,13 +812,12 @@ das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
        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)) {
index d908d2d04f8c7cac1f62d7964e7fcbdc6c6ebda2..024262375e3c2abed705da3c753c5f73e3525ef2 100644 (file)
@@ -91,14 +91,13 @@ static int das08_cs_attach(struct comedi_device *dev,
 {
        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 */
index 3f614dcde8bcc2626b6ac9bf39527fcfb58b6bd5..2ceadcb97408a03bf754a26c2a4cc7d7cb80b7e2 100644 (file)
@@ -1127,10 +1127,10 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                }
        }
 
-       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);
index b06f2b8aad66337a36ef3bf94ad0808275d3f2ba..d93d95102af7542ce638c5f663daec65a7c2c0df 100644 (file)
@@ -594,10 +594,10 @@ static int das16m1_attach(struct comedi_device *dev,
 
        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");
index 3754fcb8353160b062d126bfa2632505b04d1470..2495cd914793b218391839e34099f1c44490075f 100644 (file)
@@ -1542,10 +1542,10 @@ static int das1800_attach(struct comedi_device *dev,
        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);
index 8029e370b2d8911055a5bb4348a64ef9644a1822..2efddb89bbcb67c24f6d6f0dbb2a6b20f0e308bf 100644 (file)
@@ -310,10 +310,10 @@ static int das6402_attach(struct comedi_device *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, 1);
        if (ret)
index 2a6df6b6ae3989848c19c451c5c6bbbb4fceb1f6..1ba26b46fd9a5402dc082cfbd31ec4af19f52c12 100644 (file)
@@ -472,10 +472,10 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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,
index c8b7a031c48f7bdaccc136ec3aecd0cbaf60e946..a526c6770bbc040de13bbf2c2052be0e7f289fae 100644 (file)
@@ -793,10 +793,10 @@ static int dmm32at_attach(struct comedi_device *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)
index da139d212ce39ff9fe1a3edf6387fa10435c4bca..f6942aaf0ecd0f485b2dad3237be27e231142a93 100644 (file)
@@ -633,10 +633,10 @@ havetype:
        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;
 
index c4a7768971d2189fa88c6d73ac5e59b751978b89..f90ecf494aafd7005b415e35c9023ab5267a3f44 100644 (file)
@@ -465,10 +465,10 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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:
index 4b81ae33ca02b02b0605522566af03fdd5335b8a..35cb2b55236c6ada7aeb654fa020896ed69472f8 100644 (file)
@@ -325,10 +325,10 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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;
index 1f1998f3d2452fe93c6b451bfc1d202e63a1dafb..1e0cfe4972a6f39ecffdd2ecba2c374b89659ab9 100644 (file)
@@ -183,10 +183,10 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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 */
index f25246833213eb8599a2bc1c37f4d3db14d4e13e..9746294efc94904ec26ccc11ffce1892f74e9a60 100644 (file)
@@ -1239,10 +1239,10 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 #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]);
index e71d880bddaa73f7c187731c8e7d006845f4dc22..46645759781d141d192cefb57771dd4732188ecc 100644 (file)
@@ -806,10 +806,10 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
        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)
index 02b5394d7bdf13202bfc73b51d066d36353ed192..176799849d20ec02c70c6860d106c03aebdff239 100644 (file)
@@ -1031,10 +1031,10 @@ static int dt9812_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
        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
index 6f612be1b0a51359a0ce41520ed3735b498c9641..98e2ffb1992951293b60e62428b536370193ca04 100644 (file)
@@ -190,10 +190,10 @@ static int dyna_pci10xx_attach_pci(struct comedi_device *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)
index c1c24b0625551383dd0435991d5d3b0f358d17c9..019c96eda6fd25b93f65c59524263bde72157fd7 100644 (file)
@@ -127,10 +127,10 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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");
index 550f458cb59ce10316db172c283c9ad04565929c..17aec51343b80e10c9080b9cf3c357b7984d631f 100644 (file)
@@ -481,10 +481,10 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
        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) &&
index 8eb3a87b5b8ca0ae2f41949da8a641246382d382..8a3f63484371b4be417ded8dd6461f961b1c250e 100644 (file)
@@ -505,10 +505,10 @@ static int icp_multi_attach_pci(struct comedi_device *dev,
        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)
index 972a09fa7532b14741df68c64bbc881f8660006e..93584e2be35a50c8e97dbfec2a494e33e60cddae 100644 (file)
@@ -206,10 +206,10 @@ static int pci20xxx_attach(struct comedi_device *dev,
        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";
index 69378dd90e28bc57ba43973841defff5745cf84f..68400f13af0e08ae8fa35fc0fc078ec06f6705d5 100644 (file)
@@ -762,10 +762,10 @@ static int jr3_pci_attach(struct comedi_device *dev,
                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);
index 22db35d091f89e600d9853e96ada2799e3314fa1..ae91837fe7eb3e718fcbf0968635fc1fecce8fb3 100644 (file)
@@ -1586,10 +1586,10 @@ static int me4000_attach_pci(struct comedi_device *dev,
        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)
index 3eac3ef8d79d7ffd1e042d29b9f82e4978bbc990..33b13aedfc021c9b13d42b16041367e74d4ea503 100644 (file)
@@ -656,10 +656,10 @@ static int me_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev)
        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) {
index 3e8892c820940d75607ef6748d90b73952ac99c8..67dc5ad81b0d883334c6ad51d479bfa749e87895 100644 (file)
@@ -298,10 +298,10 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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:
index f707ee02dcca9eaace2d14d4fd513fed8ee1ee3c..1f5f402f3d17245322c8387767c8ec7158cd3d6b 100644 (file)
@@ -258,10 +258,10 @@ static int multiq3_attach(struct comedi_device *dev,
        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 */
index 4f5624a3a1b05a02e062026704bcf5fe1c12e7cc..d853e75be7910b798f0401d9fc7809f6c9c01e85 100644 (file)
@@ -364,10 +364,10 @@ static int __devinit ni6527_attach_pci(struct comedi_device *dev,
        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)
index 1881f3346259359d6b939e448d64b89ee8956fa9..19d5e8c96e8f72c6ba819766cd5ddc9d79049f91 100644 (file)
@@ -635,10 +635,10 @@ static int __devinit ni_65xx_attach_pci(struct comedi_device *dev,
        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)
index d868407274495f659891d06cef711f3e1169b117..3cff208de8a31f75ed94cd03472f701daacbca83 100644 (file)
@@ -996,13 +996,12 @@ static int ni_660x_buf_change(struct comedi_device *dev,
 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);
index e7ccf0423b0b7277bcea58e737ecd167d5e031e1..2cf4907c366acc4f6ad5ac1f803994d9ece32dc9 100644 (file)
@@ -210,10 +210,10 @@ static int __devinit ni_670x_attach_pci(struct comedi_device *dev,
        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)
index 34c186b9dce1085ca52eba6e17078ead46567aab..0222def373c2f881248ce5eea3b5af0756576328 100644 (file)
@@ -758,10 +758,10 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        }
        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");
index 66071600de02d0cd208d682fc6f5916eb386f47a..907f65cdbdc0bc60a5504941f457f24370f737cf 100644 (file)
@@ -356,10 +356,10 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
        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)
index 93969865b35144330e8b207d8fe66653f5aa83a9..a3884b4d90c699a72e53060fd3c2b135631573cf 100644 (file)
@@ -678,10 +678,10 @@ static int atmio16d_attach(struct comedi_device *dev,
        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);
index 8df5bfe721f56c1b8482c70e45b69dc399b5db94..7b333353c5d9707baee59322036ce8e25ae9d6c2 100644 (file)
@@ -117,10 +117,10 @@ static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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) {
index d3b386e51bfbc0635d4ddef359542f51ba824497..40012506334f77a670f1c7360df7f0ef9e92dfd5 100644 (file)
@@ -707,10 +707,10 @@ static int __devinit labpc_attach_pci(struct comedi_device *dev,
        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)
@@ -732,12 +732,11 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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) {
index 791a66ff65a07b6771f0207ed641acbb4d6fa4f6..bfe19fa7d66f6206919a8c5856682f4e71b237e7 100644 (file)
@@ -131,12 +131,11 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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) {
index b096c4647b12baa1e70eca18e2d692ffdfd2eb6b..743a9016e076015369d6692f25eac1ba19b34349 100644 (file)
@@ -4424,12 +4424,11 @@ static int ni_freq_out_insn_config(struct comedi_device *dev,
 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);
index 233a2d350e841afa79fb1bc91cd642b60759627d..fcf56cf4811b77ef2ec732b20d0020401d9e706e 100644 (file)
@@ -1128,10 +1128,10 @@ static int __devinit nidio_attach_pci(struct comedi_device *dev,
        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);
 
index 33bda31392da079bf5d2b3bf0cfe509ff796856e..f9c15aa45fea04a79bb44181d4b347889f01e3e9 100644 (file)
@@ -503,10 +503,10 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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 */
index 22f907a07041a6320ef7943743b07b819852d537..50e01968f19c6ae445997ca43a5a61cf0056bd7f 100644 (file)
@@ -248,10 +248,10 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
        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;
index 0d825915d46da4a509efe659f5dd0374d6288f9e..d94c9dc78323326cb746afde3d12fc31c90cbb67 100644 (file)
@@ -1167,12 +1167,12 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        }
        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;
 
index 4cdb3c915f5fd42a56ad94a383f4eb0dfbb00700..858600a753b112d1ceb2dffddb14456ad969786a 100644 (file)
@@ -1024,10 +1024,10 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                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;
 
index 9dcddea3f61a27e789e186c492b226441525bd5c..c94f289e3f3acd18394d92c1a4543f9eb4b64644 100644 (file)
@@ -1625,10 +1625,10 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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];
index 6e9a4ec9e852fb87a39eca927749528fb5cdf876..5f062df1ead4026bdc6310a5f80fcb3f780bce1c 100644 (file)
@@ -235,10 +235,10 @@ static int pcm3724_attach(struct comedi_device *dev,
        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);
index 5d5fc519d82aea3457b794332bc425e0af5ea2c5..13e84215fac3254afcb242e75792fbca99d46002 100644 (file)
@@ -122,10 +122,10 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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;
 
index c3009211026a8141f4f5e0bd994866956d17b329..0882dafaf57bf229730f373dfba40b0fdaa518f9 100644 (file)
@@ -173,10 +173,10 @@ static int pcmda12_attach(struct comedi_device *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;
 
        devpriv->simultaneous_xfer_mode = it->options[1];
 
index 616652e00ef911867f29e83ad87a0de0feb6cf86..7522bfb6db0864fe45e643061d77e4f31bc156d0 100644 (file)
@@ -1005,10 +1005,10 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                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;
index 360180438b316d1008c82ac019c4b58f83c76ce9..31ea20c2d39e1ebe39df58a845b86d70b3787d68 100644 (file)
@@ -775,10 +775,10 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
        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;
index 8e70affb331a62f3fefc93c2695698c9dcc3fef6..d7842c95d9825bf765757b1b269334d53e30b037 100644 (file)
@@ -167,10 +167,10 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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];
index b867470cc3edd18b0a645851f30c09a90345c733..0a91738eae330f0b3c7989ced1823c5a528ffaa6 100644 (file)
@@ -1607,10 +1607,10 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                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)
index 82dae22b08120fc3281fb30c02e07af4f03e2b04..7e577e444909211b192189cef3640ba278ab9083 100644 (file)
@@ -349,10 +349,10 @@ static int rti800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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];
index 844e75ee9c4826e5af6c4d1d75c82a56e2dfed3c..2185ca1bcf020638914eb54621ad2c4696779544 100644 (file)
@@ -105,10 +105,10 @@ static int rti802_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
        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)
index a1e256293bd670b5ebdacaf456041eb85c353a07..39232b359453395a98d08b771d809195827e57c1 100644 (file)
@@ -564,10 +564,10 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        }
        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)
index 511183da0eec2a18e39db189979af55696bb20e0..7c50b01f6a6fb7fbc9d4713e0f54a2119a9f8535 100644 (file)
@@ -2700,10 +2700,10 @@ static int s626_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev)
        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)
index 3f9221d4918f49b221b63bc2c33cfc0d4bd4a850..4b3b9b029476024f725afe904efbedcf10418cf6 100644 (file)
@@ -786,10 +786,10 @@ static int serial2002_attach(struct comedi_device *dev,
        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;
index d2ef7db624793922706ca1a36d5a1b482db70372..f292d798f31ae7b189dbe0d355fab308c644be45 100644 (file)
@@ -225,10 +225,10 @@ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        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)