diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2012-05-30 14:04:44 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-04 23:48:08 -0400 |
commit | 04d66968b34e3e22a524064df387c9fe906c6efa (patch) | |
tree | 79884a59c52d77374b48fd255710c982d2157dca | |
parent | 7ac75ba4f364fb655c89b4f9ccf1cfbdf9dfd370 (diff) |
staging: comedi: amplc_pc263: Remove thisboard and devpriv macros
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@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/amplc_pc263.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index dd0b4b20582b..62fc335c4ea0 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c | |||
@@ -93,11 +93,6 @@ static const struct pc263_board pc263_boards[] = { | |||
93 | #endif | 93 | #endif |
94 | }; | 94 | }; |
95 | 95 | ||
96 | /* | ||
97 | * Useful for shorthand access to the particular board structure | ||
98 | */ | ||
99 | #define thisboard ((const struct pc263_board *)dev->board_ptr) | ||
100 | |||
101 | /* this structure is for data unique to this hardware driver. If | 96 | /* this structure is for data unique to this hardware driver. If |
102 | several hardware drivers keep similar information in this structure, | 97 | several hardware drivers keep similar information in this structure, |
103 | feel free to suggest moving the variable to the struct comedi_device struct. | 98 | feel free to suggest moving the variable to the struct comedi_device struct. |
@@ -107,8 +102,6 @@ struct pc263_private { | |||
107 | struct pci_dev *pci_dev; | 102 | struct pci_dev *pci_dev; |
108 | }; | 103 | }; |
109 | 104 | ||
110 | #define devpriv ((struct pc263_private *)dev->private) | ||
111 | |||
112 | /* | 105 | /* |
113 | * This function looks for a PCI device matching the requested board name, | 106 | * This function looks for a PCI device matching the requested board name, |
114 | * bus and slot. | 107 | * bus and slot. |
@@ -116,6 +109,7 @@ struct pc263_private { | |||
116 | static struct pci_dev * | 109 | static struct pci_dev * |
117 | pc263_find_pci(struct comedi_device *dev, int bus, int slot) | 110 | pc263_find_pci(struct comedi_device *dev, int bus, int slot) |
118 | { | 111 | { |
112 | const struct pc263_board *thisboard = comedi_board(dev); | ||
119 | struct pci_dev *pci_dev = NULL; | 113 | struct pci_dev *pci_dev = NULL; |
120 | 114 | ||
121 | /* Look for matching PCI device. */ | 115 | /* Look for matching PCI device. */ |
@@ -139,6 +133,7 @@ pc263_find_pci(struct comedi_device *dev, int bus, int slot) | |||
139 | if (pci_dev->device == pc263_boards[i].devid) { | 133 | if (pci_dev->device == pc263_boards[i].devid) { |
140 | /* Change board_ptr to matched board. */ | 134 | /* Change board_ptr to matched board. */ |
141 | dev->board_ptr = &pc263_boards[i]; | 135 | dev->board_ptr = &pc263_boards[i]; |
136 | thisboard = comedi_board(dev); | ||
142 | break; | 137 | break; |
143 | } | 138 | } |
144 | } | 139 | } |
@@ -200,6 +195,8 @@ static int pc263_do_insn_bits(struct comedi_device *dev, | |||
200 | 195 | ||
201 | static void pc263_report_attach(struct comedi_device *dev) | 196 | static void pc263_report_attach(struct comedi_device *dev) |
202 | { | 197 | { |
198 | const struct pc263_board *thisboard = comedi_board(dev); | ||
199 | struct pc263_private *devpriv = dev->private; | ||
203 | char tmpbuf[40]; | 200 | char tmpbuf[40]; |
204 | 201 | ||
205 | if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) && | 202 | if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_ISA) && |
@@ -222,6 +219,7 @@ static void pc263_report_attach(struct comedi_device *dev) | |||
222 | */ | 219 | */ |
223 | static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) | 220 | static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) |
224 | { | 221 | { |
222 | const struct pc263_board *thisboard = comedi_board(dev); | ||
225 | struct comedi_subdevice *s; | 223 | struct comedi_subdevice *s; |
226 | unsigned long iobase = 0; | 224 | unsigned long iobase = 0; |
227 | int ret; | 225 | int ret; |
@@ -237,6 +235,7 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
237 | return ret; | 235 | return ret; |
238 | } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && | 236 | } else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && |
239 | thisboard->bustype == pci_bustype) { | 237 | thisboard->bustype == pci_bustype) { |
238 | struct pc263_private *devpriv; | ||
240 | struct pci_dev *pci_dev = NULL; | 239 | struct pci_dev *pci_dev = NULL; |
241 | int bus, slot; | 240 | int bus, slot; |
242 | 241 | ||
@@ -245,11 +244,13 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
245 | dev_err(dev->class_dev, "error! out of memory!\n"); | 244 | dev_err(dev->class_dev, "error! out of memory!\n"); |
246 | return ret; | 245 | return ret; |
247 | } | 246 | } |
247 | devpriv = dev->private; | ||
248 | bus = it->options[0]; | 248 | bus = it->options[0]; |
249 | slot = it->options[1]; | 249 | slot = it->options[1]; |
250 | pci_dev = pc263_find_pci(dev, bus, slot); | 250 | pci_dev = pc263_find_pci(dev, bus, slot); |
251 | if (pci_dev == NULL) | 251 | if (pci_dev == NULL) |
252 | return -EIO; | 252 | return -EIO; |
253 | thisboard = comedi_board(dev); /* replaced wildcard board */ | ||
253 | devpriv->pci_dev = pci_dev; | 254 | devpriv->pci_dev = pci_dev; |
254 | ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME); | 255 | ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME); |
255 | if (ret < 0) { | 256 | if (ret < 0) { |
@@ -290,6 +291,8 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
290 | 291 | ||
291 | static void pc263_detach(struct comedi_device *dev) | 292 | static void pc263_detach(struct comedi_device *dev) |
292 | { | 293 | { |
294 | struct pc263_private *devpriv = dev->private; | ||
295 | |||
293 | if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && devpriv && | 296 | if (IS_ENABLED(CONFIG_COMEDI_AMPLC_PC263_PCI) && devpriv && |
294 | devpriv->pci_dev) { | 297 | devpriv->pci_dev) { |
295 | if (dev->iobase) | 298 | if (dev->iobase) |