mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-14 01:49:20 -04:00
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: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
25a8aaf03e
commit
f6009ae536
@@ -1767,12 +1767,16 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq,
|
||||
int hw_err_mask)
|
||||
{
|
||||
const struct pci9118_boardinfo *board = comedi_board(dev);
|
||||
struct pci9118_private *devpriv = dev->private;
|
||||
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
|
||||
struct pci9118_private *devpriv;
|
||||
struct comedi_subdevice *s;
|
||||
int ret, pages, i;
|
||||
u16 u16w;
|
||||
|
||||
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
|
||||
if (!devpriv)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = comedi_pci_enable(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -1923,7 +1927,6 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq,
|
||||
static int pci9118_attach(struct comedi_device *dev,
|
||||
struct comedi_devconfig *it)
|
||||
{
|
||||
struct pci9118_private *devpriv;
|
||||
struct pci_dev *pcidev;
|
||||
int ext_mux, disable_irq, master, softsshdelay, hw_err_mask;
|
||||
|
||||
@@ -1933,10 +1936,6 @@ static int pci9118_attach(struct comedi_device *dev,
|
||||
softsshdelay = it->options[4];
|
||||
hw_err_mask = it->options[5];
|
||||
|
||||
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
|
||||
if (!devpriv)
|
||||
return -ENOMEM;
|
||||
|
||||
pcidev = pci9118_find_pci(dev, it);
|
||||
if (!pcidev)
|
||||
return -EIO;
|
||||
@@ -1951,7 +1950,6 @@ static int pci9118_auto_attach(struct comedi_device *dev,
|
||||
{
|
||||
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
|
||||
const struct pci9118_boardinfo *board = NULL;
|
||||
struct pci9118_private *devpriv;
|
||||
|
||||
if (context < ARRAY_SIZE(pci9118_boards))
|
||||
board = &pci9118_boards[context];
|
||||
@@ -1960,10 +1958,6 @@ static int pci9118_auto_attach(struct comedi_device *dev,
|
||||
dev->board_ptr = board;
|
||||
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().
|
||||
* (The 'put' also matches the implicit 'get' by pci9118_find_pci().)
|
||||
|
||||
Reference in New Issue
Block a user