[PATCH 3/4] staging: comedi: remove cb_pcidio driver

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

 



Move the support for the boards in the cb_pcidio driver to
the generic 8255_pci driver and remove the cb_pcidio driver.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/Kconfig             |  11 +-
 drivers/staging/comedi/drivers/8255_pci.c  |  36 +++++-
 drivers/staging/comedi/drivers/Makefile    |   1 -
 drivers/staging/comedi/drivers/cb_pcidio.c | 189 -----------------------------
 4 files changed, 36 insertions(+), 201 deletions(-)
 delete mode 100644 drivers/staging/comedi/drivers/cb_pcidio.c

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 1ecf213..1bd7e93 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -558,6 +558,7 @@ config COMEDI_8255_PCI
 
 	  Supported boards:
 	    ADlink - PCI-7224, PCI-7248, and PCI-7296
+	    Measurement Computing - PCI-DIO24, PCI-DIO24H and PCI-DIO48H
 
 	  To compile this driver as a module, choose M here: the module will
 	  be called 8255_pci.
@@ -934,16 +935,6 @@ config COMEDI_CB_PCIDDA
 	  To compile this driver as a module, choose M here: the module will be
 	  called cb_pcidda.
 
-config COMEDI_CB_PCIDIO
-	tristate "MeasurementComputing PCI-DIO series support"
-	select COMEDI_8255
-	---help---
-	  Enable support for ComputerBoards/MeasurementComputing PCI-DIO series
-	  PCI-DIO24, PCI-DIO24H and PCI-DIO48H
-
-	  To compile this driver as a module, choose M here: the module will be
-	  called cb_pcidio.
-
 config COMEDI_CB_PCIMDAS
 	tristate "MeasurementComputing PCIM-DAS1602/16 support"
 	select COMEDI_8255
diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c
index cc8b1e0..e011b0a 100644
--- a/drivers/staging/comedi/drivers/8255_pci.c
+++ b/drivers/staging/comedi/drivers/8255_pci.c
@@ -4,6 +4,8 @@
  *
  * Based on the tested adl_pci7296 driver written by:
  *	Jon Grierson <jd@xxxxxxxxxxx>
+ * and the experimental cb_pcidio driver written by:
+ *	Yoshiya Matsuzaka
  *
  * COMEDI - Linux Control and Measurement Device Interface
  * Copyright (C) 2000 David A. Schleef <ds@xxxxxxxxxxx>
@@ -29,6 +31,9 @@ Description: Generic PCI based 8255 Digital I/O boards
 Devices: (ADLink) PCI-7224 [adl_pci-7224] - 24 channels
 	 (ADLink) PCI-7248 [adl_pci-7248] - 48 channels
 	 (ADLink) PCI-7296 [adl_pci-7296] - 96 channels
+	 (Measurement Computing) PCI-DIO24 [cb_pci-dio24] - 24 channels
+	 (Measurement Computing) PCI-DIO24H [cb_pci-dio24h] - 24 channels
+	 (Measurement Computing) PCI-DIO48H [cb_pci-dio48h] - 48 channels
 Author: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
 Updated: Wed, 12 Sep 2012 11:52:01 -0700
 Status: untested
@@ -52,9 +57,17 @@ Configuration Options: not applicable, uses PCI auto config
 #define PCI_DEVICE_ID_ADLINK_PCI7248	0x7248
 #define PCI_DEVICE_ID_ADLINK_PCI7296	0x7296
 
+/* ComputerBoards is now known as Measurement Computing */
+#define PCI_VENDOR_ID_CB		0x1307
+
+#define PCI_DEVICE_ID_CB_PCIDIO48H	0x000b
+#define PCI_DEVICE_ID_CB_PCIDIO24H	0x0014
+#define PCI_DEVICE_ID_CB_PCIDIO24	0x0028
+
 struct pci_8255_boardinfo {
 	const char *name;
 	unsigned short device;
+	int dio_badr;
 	int n_8255;
 };
 
@@ -62,15 +75,33 @@ static const struct pci_8255_boardinfo pci_8255_boards[] = {
 	{
 		.name		= "adl_pci-7224",
 		.device		= PCI_DEVICE_ID_ADLINK_PCI7224,
+		.dio_badr	= 2,
 		.n_8255		= 1,
 	}, {
 		.name		= "adl_pci-7248",
 		.device		= PCI_DEVICE_ID_ADLINK_PCI7248,
+		.dio_badr	= 2,
 		.n_8255		= 2,
 	}, {
 		.name		= "adl_pci-7296",
 		.device		= PCI_DEVICE_ID_ADLINK_PCI7296,
+		.dio_badr	= 2,
 		.n_8255		= 4,
+	}, {
+		.name		= "cb_pci-dio24",
+		.device		= PCI_DEVICE_ID_CB_PCIDIO24,
+		.dio_badr	= 2,
+		.n_8255		= 1,
+	}, {
+		.name		= "cb_pci-dio24h",
+		.device		= PCI_DEVICE_ID_CB_PCIDIO24H,
+		.dio_badr	= 2,
+		.n_8255		= 1,
+	}, {
+		.name		= "cb_pci-dio48h",
+		.device		= PCI_DEVICE_ID_CB_PCIDIO48H,
+		.dio_badr	= 1,
+		.n_8255		= 2,
 	},
 };
 
@@ -107,7 +138,7 @@ static int pci_8255_attach_pci(struct comedi_device *dev,
 	ret = comedi_pci_enable(pcidev, dev->board_name);
 	if (ret)
 		return ret;
-	dev->iobase = pci_resource_start(pcidev, 2);
+	dev->iobase = pci_resource_start(pcidev, board->dio_badr);
 
 	/*
 	 * One, two, or four subdevices are setup by this driver depending
@@ -172,6 +203,9 @@ static DEFINE_PCI_DEVICE_TABLE(pci_8255_pci_table) = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_ADLINK_PCI7224) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_ADLINK_PCI7248) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_ADLINK_PCI7296) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_DEVICE_ID_CB_PCIDIO24) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_DEVICE_ID_CB_PCIDIO24H) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_DEVICE_ID_CB_PCIDIO48H) },
 	{ 0 }
 };
 MODULE_DEVICE_TABLE(pci, pci_8255_pci_table);
diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile
index 7798cdc5..a2787c0 100644
--- a/drivers/staging/comedi/drivers/Makefile
+++ b/drivers/staging/comedi/drivers/Makefile
@@ -95,7 +95,6 @@ obj-$(CONFIG_COMEDI_KE_COUNTER)		+= ke_counter.o
 obj-$(CONFIG_COMEDI_CB_PCIDAS64)	+= cb_pcidas64.o
 obj-$(CONFIG_COMEDI_CB_PCIDAS)		+= cb_pcidas.o
 obj-$(CONFIG_COMEDI_CB_PCIDDA)		+= cb_pcidda.o
-obj-$(CONFIG_COMEDI_CB_PCIDIO)		+= cb_pcidio.o
 obj-$(CONFIG_COMEDI_CB_PCIMDAS)		+= cb_pcimdas.o
 obj-$(CONFIG_COMEDI_CB_PCIMDDA)		+= cb_pcimdda.o
 obj-$(CONFIG_COMEDI_ME4000)		+= me4000.o
diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c
deleted file mode 100644
index 9f406ef..0000000
--- a/drivers/staging/comedi/drivers/cb_pcidio.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
-    comedi/drivers/cb_pcidio.c
-    A Comedi driver for PCI-DIO24H & PCI-DIO48H of ComputerBoards (currently MeasurementComputing)
-
-    COMEDI - Linux Control and Measurement Device Interface
-    Copyright (C) 2000 David A. Schleef <ds@xxxxxxxxxxx>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-/*
-Driver: cb_pcidio
-Description: ComputerBoards' DIO boards with PCI interface
-Devices: [Measurement Computing] PCI-DIO24 (cb_pcidio), PCI-DIO24H, PCI-DIO48H
-Author: Yoshiya Matsuzaka
-Updated: Mon, 29 Oct 2007 15:40:47 +0000
-Status: experimental
-
-This driver has been modified from skel.c of comedi-0.7.70.
-
-Configuration Options: not applicable, uses PCI auto config
-*/
-
-/*------------------------------ HEADER FILES ---------------------------------*/
-#include "../comedidev.h"
-#include "8255.h"
-
-/*-------------------------- MACROS and DATATYPES -----------------------------*/
-#define PCI_VENDOR_ID_CB	0x1307
-
-/*
- * Board descriptions for two imaginary boards.  Describing the
- * boards in this way is optional, and completely driver-dependent.
- * Some drivers use arrays such as this, other do not.
- */
-struct pcidio_board {
-	const char *name;	/*  name of the board */
-	int dev_id;
-	int n_8255;		/*  number of 8255 chips on board */
-
-	/*  indices of base address regions */
-	int pcicontroler_badrindex;
-	int dioregs_badrindex;
-};
-
-static const struct pcidio_board pcidio_boards[] = {
-	{
-	 .name = "pci-dio24",
-	 .dev_id = 0x0028,
-	 .n_8255 = 1,
-	 .pcicontroler_badrindex = 1,
-	 .dioregs_badrindex = 2,
-	 },
-	{
-	 .name = "pci-dio24h",
-	 .dev_id = 0x0014,
-	 .n_8255 = 1,
-	 .pcicontroler_badrindex = 1,
-	 .dioregs_badrindex = 2,
-	 },
-	{
-	 .name = "pci-dio48h",
-	 .dev_id = 0x000b,
-	 .n_8255 = 2,
-	 .pcicontroler_badrindex = 0,
-	 .dioregs_badrindex = 1,
-	 },
-};
-
-static const void *pcidio_find_boardinfo(struct comedi_device *dev,
-					 struct pci_dev *pcidev)
-{
-	const struct pcidio_board *board;
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(pcidio_boards); i++) {
-		board = &pcidio_boards[i];
-		if (board->dev_id == pcidev->device)
-			return board;
-	}
-	return NULL;
-}
-
-static int pcidio_attach_pci(struct comedi_device *dev,
-			     struct pci_dev *pcidev)
-{
-	const struct pcidio_board *board;
-	struct comedi_subdevice *s;
-	int i;
-	int ret;
-
-	comedi_set_hw_dev(dev, &pcidev->dev);
-
-	board = pcidio_find_boardinfo(dev, pcidev);
-	if (!board)
-		return -ENODEV;
-	dev->board_ptr = board;
-	dev->board_name = board->name;
-
-	ret = comedi_pci_enable(pcidev, dev->board_name);
-	if (ret)
-		return ret;
-	dev->iobase = pci_resource_start(pcidev, board->dioregs_badrindex);
-
-	ret = comedi_alloc_subdevices(dev, board->n_8255);
-	if (ret)
-		return ret;
-
-	for (i = 0; i < board->n_8255; i++) {
-		s = &dev->subdevices[i];
-		ret = subdev_8255_init(dev, s, NULL, dev->iobase + i * 4);
-		if (ret)
-			return ret;
-	}
-
-	dev_info(dev->class_dev, "%s attached (%d digital i/o channels)\n",
-		dev->board_name, board->n_8255 * 24);
-
-	return 0;
-}
-
-static void pcidio_detach(struct comedi_device *dev)
-{
-	const struct pcidio_board *board = comedi_board(dev);
-	struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-	struct comedi_subdevice *s;
-	int i;
-
-	if (dev->subdevices) {
-		for (i = 0; i < board->n_8255; i++) {
-			s = &dev->subdevices[i];
-			subdev_8255_cleanup(dev, s);
-		}
-	}
-	if (pcidev) {
-		if (dev->iobase)
-			comedi_pci_disable(pcidev);
-	}
-}
-
-static struct comedi_driver cb_pcidio_driver = {
-	.driver_name	= "cb_pcidio",
-	.module		= THIS_MODULE,
-	.attach_pci	= pcidio_attach_pci,
-	.detach		= pcidio_detach,
-};
-
-static int __devinit cb_pcidio_pci_probe(struct pci_dev *dev,
-						const struct pci_device_id *ent)
-{
-	return comedi_pci_auto_config(dev, &cb_pcidio_driver);
-}
-
-static void __devexit cb_pcidio_pci_remove(struct pci_dev *dev)
-{
-	comedi_pci_auto_unconfig(dev);
-}
-
-static DEFINE_PCI_DEVICE_TABLE(cb_pcidio_pci_table) = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0028) },
-	{ PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0014) },
-	{ PCI_DEVICE(PCI_VENDOR_ID_CB, 0x000b) },
-	{ 0 }
-};
-MODULE_DEVICE_TABLE(pci, cb_pcidio_pci_table);
-
-static struct pci_driver cb_pcidio_pci_driver = {
-	.name		= "cb_pcidio",
-	.id_table	= cb_pcidio_pci_table,
-	.probe		= cb_pcidio_pci_probe,
-	.remove		= __devexit_p(cb_pcidio_pci_remove),
-};
-module_comedi_pci_driver(cb_pcidio_driver, cb_pcidio_pci_driver);
-
-MODULE_AUTHOR("Comedi http://www.comedi.org";);
-MODULE_DESCRIPTION("Comedi low-level driver");
-MODULE_LICENSE("GPL");
-- 
1.7.11

_______________________________________________
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