[PATCH 4/8] staging: comedi: gsc_hpdi: remove board(dev) function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The `board(dev)` function just casts `dev->board_ptr` to a pointer to
the private data type `struct hpdi_private` and returns it.  It's only
called from one function: `hpdi_auto_attach()`.

Remove `board()` and use a local variable to point to the `struct
hpdi_private` data structure.

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
---
 drivers/staging/comedi/drivers/gsc_hpdi.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c
index 816296b..2246338 100644
--- a/drivers/staging/comedi/drivers/gsc_hpdi.c
+++ b/drivers/staging/comedi/drivers/gsc_hpdi.c
@@ -207,11 +207,6 @@ static const struct hpdi_board hpdi_boards[] = {
 #endif
 };
 
-static inline struct hpdi_board *board(const struct comedi_device *dev)
-{
-	return (struct hpdi_board *)dev->board_ptr;
-}
-
 struct hpdi_private {
 	/*  base addresses (ioremapped) */
 	void __iomem *plx9080_iobase;
@@ -482,16 +477,19 @@ static int __devinit hpdi_auto_attach(struct comedi_device *dev,
 				      unsigned long context_unused)
 {
 	struct pci_dev *pcidev = comedi_to_pci_dev(dev);
+	const struct hpdi_board *thisboard;
 	struct hpdi_private *devpriv;
 	int i;
 	int retval;
 
-	dev->board_ptr = hpdi_find_board(pcidev);
-	if (!dev->board_ptr) {
+	thisboard = hpdi_find_board(pcidev);
+	if (!thisboard) {
 		dev_err(dev->class_dev, "gsc_hpdi: pci %s not supported\n",
 			pci_name(pcidev));
 		return -EINVAL;
 	}
+	dev->board_ptr = thisboard;
+	dev->board_name = thisboard->name;
 
 	devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
 	if (!devpriv)
@@ -506,9 +504,6 @@ static int __devinit hpdi_auto_attach(struct comedi_device *dev,
 	dev->iobase = 1;	/* the "detach" needs this */
 	pci_set_master(pcidev);
 
-	/* Initialize dev->board_name */
-	dev->board_name = board(dev)->name;
-
 	devpriv->plx9080_iobase =
 		ioremap(pci_resource_start(pcidev, PLX9080_BADDRINDEX),
 			pci_resource_len(pcidev, PLX9080_BADDRINDEX));
-- 
1.7.12.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux