From: H Hartley Sweeten Date: Fri, 17 Aug 2012 02:46:20 +0000 (-0700) Subject: staging: comedi: cb_pcimdas: remove thisboard and devpriv macros X-Git-Tag: firefly_0821_release~3680^2~1977^2~889 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5f7cab0a9b0651e8cb125eb7ce2b1cb21f48b24f;p=firefly-linux-kernel-4.4.55.git staging: comedi: cb_pcimdas: remove thisboard and devpriv macros These macros rely on a local variable having a specific name. Remove them and use the comedi_board() helper to get the thisboard pointer. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index c632a89f3ae9..124478d22a48 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -118,11 +118,6 @@ static const struct cb_pcimdas_board cb_pcimdas_boards[] = { }, }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct cb_pcimdas_board *)dev->board_ptr) - /* * this structure is for data unique to this hardware driver. If * several hardware drivers keep similar information in this structure, @@ -137,12 +132,6 @@ struct cb_pcimdas_private { unsigned int ao_readback[2]; }; -/* - * most drivers define the following macro to make it easy to - * access the private structure. - */ -#define devpriv ((struct cb_pcimdas_private *)dev->private) - static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -193,21 +182,23 @@ static struct pci_dev *cb_pcimdas_find_pci_dev(struct comedi_device *dev, static int cb_pcimdas_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct cb_pcimdas_board *thisboard; + struct cb_pcimdas_private *devpriv; struct pci_dev *pcidev; struct comedi_subdevice *s; unsigned long iobase_8255; int ret; -/* - * Allocate the private structure area. - */ - if (alloc_private(dev, sizeof(struct cb_pcimdas_private)) < 0) - return -ENOMEM; + ret = alloc_private(dev, sizeof(*devpriv)); + if (ret) + return ret; + devpriv = dev->private; pcidev = cb_pcimdas_find_pci_dev(dev, it); if (!pcidev) return -EIO; comedi_set_hw_dev(dev, &pcidev->dev); + thisboard = comedi_board(dev); /* Warn about non-tested features */ switch (thisboard->device_id) { @@ -299,6 +290,8 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + const struct cb_pcimdas_board *thisboard = comedi_board(dev); + struct cb_pcimdas_private *devpriv = dev->private; int n, i; unsigned int d; unsigned int busy; @@ -368,6 +361,7 @@ static int cb_pcimdas_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct cb_pcimdas_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec); @@ -397,6 +391,7 @@ static int cb_pcimdas_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct cb_pcimdas_private *devpriv = dev->private; int i; int chan = CR_CHAN(insn->chanspec);