Commit f6009ae5 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: adl_pci9118: allocate private data in pci9118_common_attach()

The (*auto_attach) and legacy (*attach) both allocate the private data but
don't use it. For aesthetics, move the allocation into the common attach
code.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 25a8aaf0
...@@ -1767,12 +1767,16 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, ...@@ -1767,12 +1767,16 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq,
int hw_err_mask) int hw_err_mask)
{ {
const struct pci9118_boardinfo *board = comedi_board(dev); const struct pci9118_boardinfo *board = comedi_board(dev);
struct pci9118_private *devpriv = dev->private;
struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct pci9118_private *devpriv;
struct comedi_subdevice *s; struct comedi_subdevice *s;
int ret, pages, i; int ret, pages, i;
u16 u16w; u16 u16w;
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
if (!devpriv)
return -ENOMEM;
ret = comedi_pci_enable(dev); ret = comedi_pci_enable(dev);
if (ret) if (ret)
return ret; return ret;
...@@ -1923,7 +1927,6 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, ...@@ -1923,7 +1927,6 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq,
static int pci9118_attach(struct comedi_device *dev, static int pci9118_attach(struct comedi_device *dev,
struct comedi_devconfig *it) struct comedi_devconfig *it)
{ {
struct pci9118_private *devpriv;
struct pci_dev *pcidev; struct pci_dev *pcidev;
int ext_mux, disable_irq, master, softsshdelay, hw_err_mask; int ext_mux, disable_irq, master, softsshdelay, hw_err_mask;
...@@ -1933,10 +1936,6 @@ static int pci9118_attach(struct comedi_device *dev, ...@@ -1933,10 +1936,6 @@ static int pci9118_attach(struct comedi_device *dev,
softsshdelay = it->options[4]; softsshdelay = it->options[4];
hw_err_mask = it->options[5]; hw_err_mask = it->options[5];
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
if (!devpriv)
return -ENOMEM;
pcidev = pci9118_find_pci(dev, it); pcidev = pci9118_find_pci(dev, it);
if (!pcidev) if (!pcidev)
return -EIO; return -EIO;
...@@ -1951,7 +1950,6 @@ static int pci9118_auto_attach(struct comedi_device *dev, ...@@ -1951,7 +1950,6 @@ static int pci9118_auto_attach(struct comedi_device *dev,
{ {
struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct pci_dev *pcidev = comedi_to_pci_dev(dev);
const struct pci9118_boardinfo *board = NULL; const struct pci9118_boardinfo *board = NULL;
struct pci9118_private *devpriv;
if (context < ARRAY_SIZE(pci9118_boards)) if (context < ARRAY_SIZE(pci9118_boards))
board = &pci9118_boards[context]; board = &pci9118_boards[context];
...@@ -1960,10 +1958,6 @@ static int pci9118_auto_attach(struct comedi_device *dev, ...@@ -1960,10 +1958,6 @@ static int pci9118_auto_attach(struct comedi_device *dev,
dev->board_ptr = board; dev->board_ptr = board;
dev->board_name = board->name; dev->board_name = board->name;
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
if (!devpriv)
return -ENOMEM;
/* /*
* Need to 'get' the PCI device to match the 'put' in pci9118_detach(). * Need to 'get' the PCI device to match the 'put' in pci9118_detach().
* (The 'put' also matches the implicit 'get' by pci9118_find_pci().) * (The 'put' also matches the implicit 'get' by pci9118_find_pci().)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment