The 'thisboard' and 'devpriv' macros rely on a local variable having a specific name and yield pointers derived from that local variable. Replace the macros with local variables wherever they occur. Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx> --- drivers/staging/comedi/drivers/amplc_pc236.c | 27 ++++++++++++++++--------- 1 files changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index a30532d..118fced 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -128,11 +128,6 @@ static const struct pc236_board pc236_boards[] = { #endif }; -/* - * Useful for shorthand access to the particular board structure - */ -#define thisboard ((const struct pc236_board *)dev->board_ptr) - /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. @@ -146,8 +141,6 @@ struct pc236_private { int enable_irq; }; -#define devpriv ((struct pc236_private *)dev->private) - /* * This function looks for a PCI device matching the requested board name, * bus and slot. @@ -156,6 +149,7 @@ struct pc236_private { struct pci_dev * pc236_find_pci(struct comedi_device *dev, int bus, int slot) { + const struct pc236_board *thisboard = comedi_board(dev); struct pci_dev *pci_dev = NULL; /* Look for matching PCI device. */ @@ -179,6 +173,7 @@ pc236_find_pci(struct comedi_device *dev, int bus, int slot) if (pci_dev->device == pc236_boards[i].devid) { /* Change board_ptr to matched board. */ dev->board_ptr = &pc236_boards[i]; + thisboard = comedi_board(dev); break; } } @@ -230,6 +225,7 @@ static int pc236_request_region(struct comedi_device *dev, unsigned long from, */ static void pc236_intr_disable(struct comedi_device *dev) { + struct pc236_private *devpriv = dev->private; unsigned long flags; spin_lock_irqsave(&dev->spinlock, flags); @@ -248,6 +244,7 @@ static void pc236_intr_disable(struct comedi_device *dev) */ static void pc236_intr_enable(struct comedi_device *dev) { + struct pc236_private *devpriv = dev->private; unsigned long flags; spin_lock_irqsave(&dev->spinlock, flags); @@ -268,6 +265,7 @@ static void pc236_intr_enable(struct comedi_device *dev) */ static int pc236_intr_check(struct comedi_device *dev) { + struct pc236_private *devpriv = dev->private; int retval = 0; unsigned long flags; @@ -427,6 +425,7 @@ static irqreturn_t pc236_interrupt(int irq, void *d) static void pc236_report_attach(struct comedi_device *dev, unsigned int irq) { + const struct pc236_board *thisboard = comedi_board(dev); char tmpbuf[60]; int tmplen; @@ -438,9 +437,12 @@ static void pc236_report_attach(struct comedi_device *dev, unsigned int irq) break; #endif #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) - case pci_bustype: - tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), - "(pci %s) ", pci_name(devpriv->pci_dev)); + case pci_bustype: { + struct pc236_private *devpriv = dev->private; + struct pci_dev *pci_dev = devpriv->pci_dev; + tmplen = scnprintf(tmpbuf, sizeof(tmpbuf), + "(pci %s) ", pci_name(pci_dev)); + } break; #endif default: @@ -466,10 +468,12 @@ static void pc236_report_attach(struct comedi_device *dev, unsigned int irq) */ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) { + const struct pc236_board *thisboard = comedi_board(dev); struct comedi_subdevice *s; unsigned long iobase = 0; unsigned int irq = 0; #if IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI) + struct pc236_private *devpriv = dev->private; struct pci_dev *pci_dev = NULL; int bus = 0, slot = 0; #endif @@ -500,6 +504,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) pci_dev = pc236_find_pci(dev, bus, slot); if (pci_dev == NULL) return -EIO; + thisboard = comedi_board(dev); /* replaced wildcard board */ devpriv->pci_dev = pci_dev; break; #endif @@ -577,6 +582,8 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) static void pc236_detach(struct comedi_device *dev) { + struct pc236_private *devpriv = dev->private; + if (devpriv) pc236_intr_disable(dev); if (dev->irq) -- 1.7.8.6 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel