From 8f567c373c4b3dbfd62714cb27ad2bb91cf48761 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 3 Aug 2012 10:28:18 -0700 Subject: staging: comedi: new adl_pci7x3x driver Currently the ADLink PCI-7230 and PCI-7432 Isolated Digital I/O Boards are supported using two drivers (adl_pci7230 and adl_pci7432). These drivers are very similar and only differ in the total number of di/do channels provided. This driver combines the support for both boards into one common driver. In addition, it adds PCI PnP support for the other boards in the ADLink PCI-723x and PCI-743x series. This driver only supports the comedi PCI auto config attach mechanism. The legacy attach using the comedi_config utility is not supported or required by this driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 11 + drivers/staging/comedi/drivers/Makefile | 1 + drivers/staging/comedi/drivers/adl_pci7x3x.c | 342 +++++++++++++++++++++++++++ 3 files changed, 354 insertions(+) create mode 100644 drivers/staging/comedi/drivers/adl_pci7x3x.c diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 6cee7855b019..d8b006554cc5 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -676,6 +676,17 @@ config COMEDI_ADL_PCI6208 To compile this driver as a module, choose M here: the module will be called adl_pci6208. +config COMEDI_ADL_PCI7X3X + tristate "ADLink PCI-723X/743X isolated digital i/o board support" + ---help--- + Enable support for ADlink PCI-723X/743X isolated digital i/o boards. + Supported boards include the 32-channel PCI-7230 (16 in/16 out), + PCI-7233 (32 in), and PCI-7234 (32 out) as well as the 64-channel + PCI-7432 (32 in/32 out), PCI-7433 (64 in), and PCI-7434 (64 out). + + To compile this driver as a module, choose M here: the module will be + called adl_pci7x3x. + config COMEDI_ADL_PCI7230 tristate "ADLink PCI-7230 digital io board support" ---help--- diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index 57b19e44d867..d13d5a91fa3b 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -69,6 +69,7 @@ obj-$(CONFIG_COMEDI_ADDI_APCI_3120) += addi_apci_3120.o obj-$(CONFIG_COMEDI_ADDI_APCI_3501) += addi_apci_3501.o obj-$(CONFIG_COMEDI_ADDI_APCI_3XXX) += addi_apci_3xxx.o obj-$(CONFIG_COMEDI_ADL_PCI6208) += adl_pci6208.o +obj-$(CONFIG_COMEDI_ADL_PCI7X3X) += adl_pci7x3x.o obj-$(CONFIG_COMEDI_ADL_PCI7230) += adl_pci7230.o obj-$(CONFIG_COMEDI_ADL_PCI7296) += adl_pci7296.o obj-$(CONFIG_COMEDI_ADL_PCI7432) += adl_pci7432.o diff --git a/drivers/staging/comedi/drivers/adl_pci7x3x.c b/drivers/staging/comedi/drivers/adl_pci7x3x.c new file mode 100644 index 000000000000..990670a3c5b1 --- /dev/null +++ b/drivers/staging/comedi/drivers/adl_pci7x3x.c @@ -0,0 +1,342 @@ +/* + * COMEDI driver for the ADLINK PCI-723x/743x series boards. + * Copyright (C) 2012 H Hartley Sweeten + * + * Based on the adl_pci7230 driver written by: + * David Fernandez + * and the adl_pci7432 driver written by: + * Michel Lachaine + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2000 David A. Schleef + * + * 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: adl_pci7x3x +Description: 32/64-Channel Isolated Digital I/O Boards +Devices: (ADLink) PCI-7230 [adl_pci7230] - 16 input / 16 output + (ADLink) PCI-7233 [adl_pci7233] - 32 input + (ADLink) PCI-7234 [adl_pci7234] - 32 output + (ADLink) PCI-7432 [adl_pci7432] - 32 input / 32 output + (ADLink) PCI-7433 [adl_pci7433] - 64 input + (ADLink) PCI-7434 [adl_pci7434] - 64 output +Author: H Hartley Sweeten +Updated: Thu, 02 Aug 2012 14:27:46 -0700 +Status: untested + +This driver only attaches using the PCI PnP auto config support +in the comedi core. The module parameter 'comedi_autoconfig' +must be 1 (default) to enable this feature. The COMEDI_DEVCONFIG +ioctl, used by the comedi_config utility, is not supported by +this driver. + +The PCI-7230, PCI-7432 and PCI-7433 boards also support external +interrupt signals on digital input channels 0 and 1. The PCI-7233 +has dual-interrupt sources for change-of-state (COS) on any 16 +digital input channels of LSB and for COS on any 16 digital input +lines of MSB. Interrupts are not currently supported by this +driver. + +Configuration Options: not applicable +*/ + +#include "../comedidev.h" + +/* + * PCI Device ID's supported by this driver + */ +#define PCI_DEVICE_ID_PCI7230 0x7230 +#define PCI_DEVICE_ID_PCI7233 0x7233 +#define PCI_DEVICE_ID_PCI7234 0x7234 +#define PCI_DEVICE_ID_PCI7432 0x7432 +#define PCI_DEVICE_ID_PCI7433 0x7433 +#define PCI_DEVICE_ID_PCI7434 0x7434 + +/* + * Register I/O map (32-bit access only) + */ +#define PCI7X3X_DIO_REG 0x00 +#define PCI743X_DIO_REG 0x04 + +struct adl_pci7x3x_boardinfo { + const char *name; + unsigned short device; + int nsubdevs; + int di_nchan; + int do_nchan; +}; + +static const struct adl_pci7x3x_boardinfo adl_pci7x3x_boards[] = { + { + .name = "adl_pci7230", + .device = PCI_DEVICE_ID_PCI7230, + .nsubdevs = 2, + .di_nchan = 16, + .do_nchan = 16, + }, { + .name = "adl_pci7233", + .device = PCI_DEVICE_ID_PCI7233, + .nsubdevs = 1, + .di_nchan = 32, + }, { + .name = "adl_pci7234", + .device = PCI_DEVICE_ID_PCI7234, + .nsubdevs = 1, + .do_nchan = 32, + }, { + .name = "adl_pci7432", + .device = PCI_DEVICE_ID_PCI7432, + .nsubdevs = 2, + .di_nchan = 32, + .do_nchan = 32, + }, { + .name = "adl_pci7433", + .device = PCI_DEVICE_ID_PCI7433, + .nsubdevs = 2, + .di_nchan = 64, + }, { + .name = "adl_pci7434", + .device = PCI_DEVICE_ID_PCI7434, + .nsubdevs = 2, + .do_nchan = 64, + } +}; + +static int adl_pci7x3x_do_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + unsigned int reg = (unsigned int)s->private; + unsigned int mask = data[0]; + unsigned int bits = data[1]; + + if (mask) { + s->state &= ~mask; + s->state |= (bits & mask); + + outl(s->state, dev->iobase + reg); + } + + /* + * NOTE: The output register is not readable. + * This returned state will not be correct until all the + * outputs have been updated. + */ + data[1] = s->state; + + return insn->n; +} + +static int adl_pci7x3x_di_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + unsigned int reg = (unsigned int)s->private; + + data[1] = inl(dev->iobase + reg); + + return insn->n; +} + +static const void *adl_pci7x3x_find_boardinfo(struct comedi_device *dev, + struct pci_dev *pcidev) +{ + const struct adl_pci7x3x_boardinfo *board; + int i; + + for (i = 0; i < ARRAY_SIZE(adl_pci7x3x_boards); i++) { + board = &adl_pci7x3x_boards[i]; + if (pcidev->device == board->device) + return board; + } + return NULL; +} + +static int adl_pci7x3x_attach_pci(struct comedi_device *dev, + struct pci_dev *pcidev) +{ + const struct adl_pci7x3x_boardinfo *board; + struct comedi_subdevice *s; + int subdev; + int nchan; + int ret; + + comedi_set_hw_dev(dev, &pcidev->dev); + + board = adl_pci7x3x_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, 2); + + /* + * One or two subdevices are setup by this driver depending on + * the number of digital inputs and/or outputs provided by the + * board. Each subdevice has a maximum of 32 channels. + * + * PCI-7230 - 2 subdevices: 0 - 16 input, 1 - 16 output + * PCI-7233 - 1 subdevice: 0 - 32 input + * PCI-7234 - 1 subdevice: 0 - 32 output + * PCI-7432 - 2 subdevices: 0 - 32 input, 1 - 32 output + * PCI-7433 - 2 subdevices: 0 - 32 input, 1 - 32 input + * PCI-7434 - 2 subdevices: 0 - 32 output, 1 - 32 output + */ + ret = comedi_alloc_subdevices(dev, board->nsubdevs); + if (ret) + return ret; + + subdev = 0; + + if (board->di_nchan) { + nchan = min(board->di_nchan, 32); + + s = dev->subdevices + subdev; + /* Isolated digital inputs 0 to 15/31 */ + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = nchan; + s->maxdata = 1; + s->insn_bits = adl_pci7x3x_di_insn_bits; + s->range_table = &range_digital; + + s->private = (void *)PCI7X3X_DIO_REG; + + subdev++; + + nchan = board->di_nchan - nchan; + if (nchan) { + s = dev->subdevices + subdev; + /* Isolated digital inputs 32 to 63 */ + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = nchan; + s->maxdata = 1; + s->insn_bits = adl_pci7x3x_di_insn_bits; + s->range_table = &range_digital; + + s->private = (void *)PCI743X_DIO_REG; + + subdev++; + } + } + + if (board->do_nchan) { + nchan = min(board->do_nchan, 32); + + s = dev->subdevices + subdev; + /* Isolated digital outputs 0 to 15/31 */ + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = nchan; + s->maxdata = 1; + s->insn_bits = adl_pci7x3x_do_insn_bits; + s->range_table = &range_digital; + + s->private = (void *)PCI7X3X_DIO_REG; + + subdev++; + + nchan = board->do_nchan - nchan; + if (nchan) { + s = dev->subdevices + subdev; + /* Isolated digital outputs 32 to 63 */ + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = nchan; + s->maxdata = 1; + s->insn_bits = adl_pci7x3x_do_insn_bits; + s->range_table = &range_digital; + + s->private = (void *)PCI743X_DIO_REG; + + subdev++; + } + } + + dev_info(dev->class_dev, "%s attached (%d inputs/%d outputs)\n", + dev->board_name, board->di_nchan, board->do_nchan); + + return 0; +} + +static int adl_pci7x3x_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + dev_warn(dev->class_dev, + "This driver does not support attach using comedi_config\n"); + + return -ENOSYS; +} + +static void adl_pci7x3x_detach(struct comedi_device *dev) +{ + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + } +} + +static struct comedi_driver adl_pci7x3x_driver = { + .driver_name = "adl_pci7x3x", + .module = THIS_MODULE, + .attach = adl_pci7x3x_attach, + .attach_pci = adl_pci7x3x_attach_pci, + .detach = adl_pci7x3x_detach, +}; + +static int __devinit adl_pci7x3x_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &adl_pci7x3x_driver); +} + +static void __devexit adl_pci7x3x_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(adl_pci7x3x_pci_table) = { + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7230) }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7233) }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7234) }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7432) }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7433) }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7434) }, + { 0 } +}; +MODULE_DEVICE_TABLE(pci, adl_pci7x3x_pci_table); + +static struct pci_driver adl_pci7x3x_pci_driver = { + .name = "adl_pci7x3x", + .id_table = adl_pci7x3x_pci_table, + .probe = adl_pci7x3x_pci_probe, + .remove = __devexit_p(adl_pci7x3x_pci_remove), +}; +module_comedi_pci_driver(adl_pci7x3x_driver, adl_pci7x3x_pci_driver); + +MODULE_DESCRIPTION("ADLINK PCI-723x/743x Isolated Digital I/O boards"); +MODULE_AUTHOR("H Hartley Sweeten "); +MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 657f77d173d32d53b8217561446e59160ee0fb91 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 3 Aug 2012 10:29:02 -0700 Subject: staging: comedi: remove adl_pci7230 and adl_pci7432 drivers The boards supported by these drivers are now handled by the adl_pci7x3x driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 16 --- drivers/staging/comedi/drivers/Makefile | 2 - drivers/staging/comedi/drivers/adl_pci7230.c | 190 ------------------------- drivers/staging/comedi/drivers/adl_pci7432.c | 200 --------------------------- 4 files changed, 408 deletions(-) delete mode 100644 drivers/staging/comedi/drivers/adl_pci7230.c delete mode 100644 drivers/staging/comedi/drivers/adl_pci7432.c diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index d8b006554cc5..159de1db2a70 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -687,14 +687,6 @@ config COMEDI_ADL_PCI7X3X To compile this driver as a module, choose M here: the module will be called adl_pci7x3x. -config COMEDI_ADL_PCI7230 - tristate "ADLink PCI-7230 digital io board support" - ---help--- - Enable support for ADlink PCI-7230 digital io board support - - To compile this driver as a module, choose M here: the module will be - called adl_pci7230. - config COMEDI_ADL_PCI7296 tristate "ADLink PCI-7296 96 ch. digital io board support" select COMEDI_8255 @@ -704,14 +696,6 @@ config COMEDI_ADL_PCI7296 To compile this driver as a module, choose M here: the module will be called adl_pci7296. -config COMEDI_ADL_PCI7432 - tristate "ADLink PCI-7432 64 ch. isolated digital io board support" - ---help--- - Enable support for ADlink PCI-7432 64 ch. isolated digital io board - - To compile this driver as a module, choose M here: the module will be - called adl_pci7432. - config COMEDI_ADL_PCI8164 tristate "ADLink PCI-8164 4 Axes Motion Control board support" ---help--- diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index d13d5a91fa3b..849ea7fb0ab7 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -70,9 +70,7 @@ obj-$(CONFIG_COMEDI_ADDI_APCI_3501) += addi_apci_3501.o obj-$(CONFIG_COMEDI_ADDI_APCI_3XXX) += addi_apci_3xxx.o obj-$(CONFIG_COMEDI_ADL_PCI6208) += adl_pci6208.o obj-$(CONFIG_COMEDI_ADL_PCI7X3X) += adl_pci7x3x.o -obj-$(CONFIG_COMEDI_ADL_PCI7230) += adl_pci7230.o obj-$(CONFIG_COMEDI_ADL_PCI7296) += adl_pci7296.o -obj-$(CONFIG_COMEDI_ADL_PCI7432) += adl_pci7432.o obj-$(CONFIG_COMEDI_ADL_PCI8164) += adl_pci8164.o obj-$(CONFIG_COMEDI_ADL_PCI9111) += adl_pci9111.o obj-$(CONFIG_COMEDI_ADL_PCI9118) += adl_pci9118.o diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c deleted file mode 100644 index 7df4c960d5e4..000000000000 --- a/drivers/staging/comedi/drivers/adl_pci7230.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - comedi/drivers/adl_pci7230.c - - Hardware comedi driver fot PCI7230 Adlink card - Copyright (C) 2010 David Fernandez - - 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: adl_pci7230 -Description: Driver for the Adlink PCI-7230 32 ch. isolated digital io board -Devices: [ADLink] PCI-7230 (adl_pci7230) -Author: David Fernandez -Status: experimental -Updated: Mon, 14 Apr 2008 15:08:14 +0100 - -Configuration Options: - [0] - PCI bus of device (optional) - [1] - PCI slot of device (optional) - If bus/slot is not specified, the first supported - PCI device found will be used. -*/ - -#include "../comedidev.h" -#include - -#define PCI7230_DI 0x00 -#define PCI7230_DO 0x00 - -#define PCI_DEVICE_ID_PCI7230 0x7230 - -static int adl_pci7230_do_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - if (data[0]) { - s->state &= ~data[0]; - s->state |= (data[0] & data[1]); - - outl((s->state << 16) & 0xffffffff, dev->iobase + PCI7230_DO); - } - - return insn->n; -} - -static int adl_pci7230_di_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - data[1] = inl(dev->iobase + PCI7230_DI) & 0xffffffff; - - return insn->n; -} - -static struct pci_dev *adl_pci7230_find_pci(struct comedi_device *dev, - struct comedi_devconfig *it) -{ - struct pci_dev *pcidev = NULL; - int bus = it->options[0]; - int slot = it->options[1]; - - for_each_pci_dev(pcidev) { - if (pcidev->vendor != PCI_VENDOR_ID_ADLINK || - pcidev->device != PCI_DEVICE_ID_PCI7230) - continue; - if (bus || slot) { - /* requested particular bus/slot */ - if (pcidev->bus->number != bus || - PCI_SLOT(pcidev->devfn) != slot) - continue; - } - return pcidev; - } - printk(KERN_ERR "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", - dev->minor, bus, slot); - return NULL; -} - -static int adl_pci7230_attach(struct comedi_device *dev, - struct comedi_devconfig *it) -{ - struct comedi_subdevice *s; - struct pci_dev *pcidev; - int ret; - - printk(KERN_INFO "comedi%d: adl_pci7230\n", dev->minor); - - dev->board_name = "pci7230"; - - ret = comedi_alloc_subdevices(dev, 2); - if (ret) - return ret; - - pcidev = adl_pci7230_find_pci(dev, it); - if (!pcidev) - return -EIO; - comedi_set_hw_dev(dev, &pcidev->dev); - - if (comedi_pci_enable(pcidev, "adl_pci7230") < 0) { - printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", - dev->minor); - return -EIO; - } - dev->iobase = pci_resource_start(pcidev, 2); - printk(KERN_DEBUG "comedi: base addr %4lx\n", dev->iobase); - - s = dev->subdevices + 0; - /* Isolated do */ - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = adl_pci7230_do_insn_bits; - - s = dev->subdevices + 1; - /* Isolated di */ - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = adl_pci7230_di_insn_bits; - - printk(KERN_DEBUG "comedi: attached\n"); - - return 1; -} - -static void adl_pci7230_detach(struct comedi_device *dev) -{ - struct pci_dev *pcidev = comedi_to_pci_dev(dev); - - if (pcidev) { - if (dev->iobase) - comedi_pci_disable(pcidev); - pci_dev_put(pcidev); - } -} - -static struct comedi_driver adl_pci7230_driver = { - .driver_name = "adl_pci7230", - .module = THIS_MODULE, - .attach = adl_pci7230_attach, - .detach = adl_pci7230_detach, -}; - -static int __devinit adl_pci7230_pci_probe(struct pci_dev *dev, - const struct pci_device_id *ent) -{ - return comedi_pci_auto_config(dev, &adl_pci7230_driver); -} - -static void __devexit adl_pci7230_pci_remove(struct pci_dev *dev) -{ - comedi_pci_auto_unconfig(dev); -} - -static DEFINE_PCI_DEVICE_TABLE(adl_pci7230_pci_table) = { - { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7230) }, - { 0 } -}; -MODULE_DEVICE_TABLE(pci, adl_pci7230_pci_table); - -static struct pci_driver adl_pci7230_pci_driver = { - .name = "adl_pci7230", - .id_table = adl_pci7230_pci_table, - .probe = adl_pci7230_pci_probe, - .remove = __devexit_p(adl_pci7230_pci_remove), -}; -module_comedi_pci_driver(adl_pci7230_driver, adl_pci7230_pci_driver); - -MODULE_AUTHOR("Comedi http://www.comedi.org"); -MODULE_DESCRIPTION("Comedi low-level driver"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/comedi/drivers/adl_pci7432.c b/drivers/staging/comedi/drivers/adl_pci7432.c deleted file mode 100644 index 6b8d9408e3bc..000000000000 --- a/drivers/staging/comedi/drivers/adl_pci7432.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - comedi/drivers/adl_pci7432.c - - Hardware comedi driver fot PCI7432 Adlink card - Copyright (C) 2004 Michel Lachine - - 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: adl_pci7432 -Description: Driver for the Adlink PCI-7432 64 ch. isolated digital io board -Devices: [ADLink] PCI-7432 (adl_pci7432) -Author: Michel Lachaine -Status: experimental -Updated: Mon, 14 Apr 2008 15:08:14 +0100 - -Configuration Options: - [0] - PCI bus of device (optional) - [1] - PCI slot of device (optional) - If bus/slot is not specified, the first supported - PCI device found will be used. -*/ - -#include "../comedidev.h" -#include - -#define PCI7432_DI 0x00 -#define PCI7432_DO 0x00 - -#define PCI_DEVICE_ID_PCI7432 0x7432 - -static int adl_pci7432_do_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - printk(KERN_DEBUG "comedi: pci7432_do_insn_bits called\n"); - printk(KERN_DEBUG "comedi: data0: %8x data1: %8x\n", data[0], data[1]); - - if (data[0]) { - s->state &= ~data[0]; - s->state |= (data[0] & data[1]); - - printk(KERN_DEBUG "comedi: out: %8x on iobase %4lx\n", s->state, - dev->iobase + PCI7432_DO); - outl(s->state & 0xffffffff, dev->iobase + PCI7432_DO); - } - return insn->n; -} - -static int adl_pci7432_di_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - printk(KERN_DEBUG "comedi: pci7432_di_insn_bits called\n"); - printk(KERN_DEBUG "comedi: data0: %8x data1: %8x\n", data[0], data[1]); - - data[1] = inl(dev->iobase + PCI7432_DI) & 0xffffffff; - printk(KERN_DEBUG "comedi: data1 %8x\n", data[1]); - - return insn->n; -} - -static struct pci_dev *adl_pci7432_find_pci(struct comedi_device *dev, - struct comedi_devconfig *it) -{ - struct pci_dev *pcidev = NULL; - int bus = it->options[0]; - int slot = it->options[1]; - - for_each_pci_dev(pcidev) { - if (pcidev->vendor != PCI_VENDOR_ID_ADLINK || - pcidev->device != PCI_DEVICE_ID_PCI7432) - continue; - if (bus || slot) { - /* requested particular bus/slot */ - if (pcidev->bus->number != bus || - PCI_SLOT(pcidev->devfn) != slot) - continue; - } - return pcidev; - } - printk(KERN_ERR - "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", - dev->minor, bus, slot); - return NULL; -} - -static int adl_pci7432_attach(struct comedi_device *dev, - struct comedi_devconfig *it) -{ - struct pci_dev *pcidev; - struct comedi_subdevice *s; - int ret; - - printk(KERN_INFO "comedi%d: attach adl_pci7432\n", dev->minor); - - dev->board_name = "pci7432"; - - ret = comedi_alloc_subdevices(dev, 2); - if (ret) - return ret; - - pcidev = adl_pci7432_find_pci(dev, it); - if (!pcidev) - return -EIO; - comedi_set_hw_dev(dev, &pcidev->dev); - - if (comedi_pci_enable(pcidev, "adl_pci7432") < 0) { - printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", - dev->minor); - return -EIO; - } - dev->iobase = pci_resource_start(pcidev, 2); - printk(KERN_INFO "comedi: base addr %4lx\n", dev->iobase); - - s = dev->subdevices + 0; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 32; - s->maxdata = 1; - s->len_chanlist = 32; - s->io_bits = 0x00000000; - s->range_table = &range_digital; - s->insn_bits = adl_pci7432_di_insn_bits; - - s = dev->subdevices + 1; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 32; - s->maxdata = 1; - s->len_chanlist = 32; - s->io_bits = 0xffffffff; - s->range_table = &range_digital; - s->insn_bits = adl_pci7432_do_insn_bits; - - printk(KERN_DEBUG "comedi%d: adl_pci7432 attached\n", dev->minor); - return 0; -} - -static void adl_pci7432_detach(struct comedi_device *dev) -{ - struct pci_dev *pcidev = comedi_to_pci_dev(dev); - - if (pcidev) { - if (dev->iobase) - comedi_pci_disable(pcidev); - pci_dev_put(pcidev); - } -} - -static struct comedi_driver adl_pci7432_driver = { - .driver_name = "adl_pci7432", - .module = THIS_MODULE, - .attach = adl_pci7432_attach, - .detach = adl_pci7432_detach, -}; - -static int __devinit adl_pci7432_pci_probe(struct pci_dev *dev, - const struct pci_device_id *ent) -{ - return comedi_pci_auto_config(dev, &adl_pci7432_driver); -} - -static void __devexit adl_pci7432_pci_remove(struct pci_dev *dev) -{ - comedi_pci_auto_unconfig(dev); -} - -static DEFINE_PCI_DEVICE_TABLE(adl_pci7432_pci_table) = { - { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7432) }, - { 0 } -}; -MODULE_DEVICE_TABLE(pci, adl_pci7432_pci_table); - -static struct pci_driver adl_pci7432_pci_driver = { - .name = "adl_pci7432", - .id_table = adl_pci7432_pci_table, - .probe = adl_pci7432_pci_probe, - .remove = __devexit_p(adl_pci7432_pci_remove), -}; -module_comedi_pci_driver(adl_pci7432_driver, adl_pci7432_pci_driver); - -MODULE_AUTHOR("Comedi http://www.comedi.org"); -MODULE_DESCRIPTION("Comedi low-level driver"); -MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 32bb1544800c6d08c9a682548c94a27d1eb41875 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 3 Aug 2012 11:33:01 -0700 Subject: staging: comedi: update adl_pci7296 driver Currently this driver only supports the 96-channel PCI-7296. The 24 and 48 channel PCI-7224 and PCI-7248 boards share the same register map and just have less 8255 devices providing the i/o channels. This adds the PCI PnP support for the other boards in the ADLink PCI-72xx series. Also, remove the legacy attach using the comedi_config utility. This driver now supports the comedi PCI auto config attach mechanism and the legacy attach is not supported or required by this driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 6 +- drivers/staging/comedi/drivers/adl_pci7296.c | 220 +++++++++++++++------------ 2 files changed, 123 insertions(+), 103 deletions(-) diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 159de1db2a70..d36486e51a9d 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -688,10 +688,12 @@ config COMEDI_ADL_PCI7X3X called adl_pci7x3x. config COMEDI_ADL_PCI7296 - tristate "ADLink PCI-7296 96 ch. digital io board support" + tristate "ADLink PCI-72xx opto-22 compatible digital i/o board support" select COMEDI_8255 ---help--- - Enable support for ADlink PCI-7296 96 ch. digital io board support + Enable support for ADlink PCI-72xx opto-22 compatible digital i/o + boards. Supported boards include the 24-channel PCI-7224, 48-channel + PCI-7248, and 96-channel PCI-7296. To compile this driver as a module, choose M here: the module will be called adl_pci7296. diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c index 19b47af9c10e..1b9ea543a822 100644 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ b/drivers/staging/comedi/drivers/adl_pci7296.c @@ -1,148 +1,163 @@ /* - comedi/drivers/adl_pci7296.c + * COMEDI driver for the ADLINK PCI-72xx series boards. + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2000 David A. Schleef + * + * 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. + */ - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 2000 David A. Schleef - - 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: adl_pci7296 -Description: Driver for the Adlink PCI-7296 96 ch. digital io board -Devices: [ADLink] PCI-7296 (adl_pci7296) +Description: 24/48/96-Channel Opto-22 Compatible Digital I/O Boards +Devices: (ADLink) PCI-7224 [adl_pci7224] - 24 channels + (ADLink) PCI-7248 [adl_pci7248] - 48 channels + (ADLink) PCI-7296 [adl_pci7296] - 96 channels Author: Jon Grierson Updated: Mon, 14 Apr 2008 15:05:56 +0100 Status: testing -Configuration Options: - [0] - PCI bus of device (optional) - [1] - PCI slot of device (optional) - If bus/slot is not specified, the first supported - PCI device found will be used. +This driver only attaches using the PCI PnP auto config support +in the comedi core. The module parameter 'comedi_autoconfig' +must be 1 (default) to enable this feature. The COMEDI_DEVCONFIG +ioctl, used by the comedi_config utility, is not supported by +this driver. + +These boards also have an 8254 programmable timer/counter chip. +This chip is not currently supported by this driver. + +Interrupt support for these boards is also not currently supported. + +Configuration Options: not applicable */ #include "../comedidev.h" -#include #include "8255.h" -/* #include "8253.h" */ -#define PORT1A 0 -#define PORT2A 4 -#define PORT3A 8 -#define PORT4A 12 +/* + * PCI Device ID's supported by this driver + */ +#define PCI_DEVICE_ID_PCI7224 0x7224 +#define PCI_DEVICE_ID_PCI7248 0x7248 +#define PCI_DEVICE_ID_PCI7296 0x7296 + +struct adl_pci7296_boardinfo { + const char *name; + unsigned short device; + int nsubdevs; +}; -#define PCI_DEVICE_ID_PCI7296 0x7296 +static const struct adl_pci7296_boardinfo adl_pci7296_boards[] = { + { + .name = "adl_pci7224", + .device = PCI_DEVICE_ID_PCI7224, + .nsubdevs = 1, + }, { + .name = "adl_pci7248", + .device = PCI_DEVICE_ID_PCI7248, + .nsubdevs = 2, + }, { + .name = "adl_pci7296", + .device = PCI_DEVICE_ID_PCI7296, + .nsubdevs = 4, + }, +}; -static struct pci_dev *adl_pci7296_find_pci(struct comedi_device *dev, - struct comedi_devconfig *it) +static const void *adl_pci7296_find_boardinfo(struct comedi_device *dev, + struct pci_dev *pcidev) { - struct pci_dev *pcidev = NULL; - int bus = it->options[0]; - int slot = it->options[1]; - - for_each_pci_dev(pcidev) { - if (pcidev->vendor != PCI_VENDOR_ID_ADLINK || - pcidev->device != PCI_DEVICE_ID_PCI7296) - continue; - if (bus || slot) { - /* requested particular bus/slot */ - if (pcidev->bus->number != bus || - PCI_SLOT(pcidev->devfn) != slot) - continue; - } - return pcidev; + const struct adl_pci7296_boardinfo *board; + int i; + + for (i = 0; i < ARRAY_SIZE(adl_pci7296_boards); i++) { + board = &adl_pci7296_boards[i]; + if (pcidev->device == board->device) + return board; } - printk(KERN_ERR - "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", - dev->minor, bus, slot); return NULL; } -static int adl_pci7296_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static int adl_pci7296_attach_pci(struct comedi_device *dev, + struct pci_dev *pcidev) { - struct pci_dev *pcidev; + const struct adl_pci7296_boardinfo *board; struct comedi_subdevice *s; int ret; + int i; - printk(KERN_INFO "comedi%d: attach adl_pci7432\n", dev->minor); + comedi_set_hw_dev(dev, &pcidev->dev); - dev->board_name = "pci7432"; + board = adl_pci7296_find_boardinfo(dev, pcidev); + if (!board) + return -ENODEV; + dev->board_ptr = board; + dev->board_name = board->name; - ret = comedi_alloc_subdevices(dev, 4); + ret = comedi_pci_enable(pcidev, dev->board_name); if (ret) return ret; - - pcidev = adl_pci7296_find_pci(dev, it); - if (!pcidev) - return -EIO; - comedi_set_hw_dev(dev, &pcidev->dev); - - if (comedi_pci_enable(pcidev, "adl_pci7296") < 0) { - printk(KERN_ERR - "comedi%d: Failed to enable PCI device and request regions\n", - dev->minor); - return -EIO; - } - dev->iobase = pci_resource_start(pcidev, 2); - printk(KERN_INFO "comedi: base addr %4lx\n", dev->iobase); - - /* four 8255 digital io subdevices */ - s = dev->subdevices + 0; - subdev_8255_init(dev, s, NULL, (unsigned long)(dev->iobase)); - s = dev->subdevices + 1; - ret = subdev_8255_init(dev, s, NULL, - (unsigned long)(dev->iobase + PORT2A)); - if (ret < 0) - return ret; - - s = dev->subdevices + 2; - ret = subdev_8255_init(dev, s, NULL, - (unsigned long)(dev->iobase + PORT3A)); - if (ret < 0) + /* + * One, two, or four subdevices are setup by this driver depending + * on the number of channels provided by the board. Each subdevice + * has 24 channels supported by the 8255 module. + */ + ret = comedi_alloc_subdevices(dev, board->nsubdevs); + if (ret) return ret; - s = dev->subdevices + 3; - ret = subdev_8255_init(dev, s, NULL, - (unsigned long)(dev->iobase + PORT4A)); - if (ret < 0) - return ret; + for (i = 0; i < board->nsubdevs; i++) { + s = dev->subdevices + i; + ret = subdev_8255_init(dev, s, NULL, dev->iobase + (i * 4)); + if (ret) + return ret; + } - printk(KERN_DEBUG "comedi%d: adl_pci7432 attached\n", dev->minor); + dev_info(dev->class_dev, "%s attached (%d digital i/o channels)\n", + dev->board_name, board->nsubdevs * 24); return 0; } +static int adl_pci7296_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + dev_warn(dev->class_dev, + "This driver does not support attach using comedi_config\n"); + + return -ENOSYS; +} + static void adl_pci7296_detach(struct comedi_device *dev) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); + const struct adl_pci7296_boardinfo *board = comedi_board(dev); + struct comedi_subdevice *s; + int i; + if (dev->subdevices) { + for (i = 0; i < board->nsubdevs; i++) { + s = dev->subdevices + i; + subdev_8255_cleanup(dev, s); + } + } if (pcidev) { if (dev->iobase) comedi_pci_disable(pcidev); - pci_dev_put(pcidev); - } - if (dev->subdevices) { - subdev_8255_cleanup(dev, dev->subdevices + 0); - subdev_8255_cleanup(dev, dev->subdevices + 1); - subdev_8255_cleanup(dev, dev->subdevices + 2); - subdev_8255_cleanup(dev, dev->subdevices + 3); } } @@ -150,6 +165,7 @@ static struct comedi_driver adl_pci7296_driver = { .driver_name = "adl_pci7296", .module = THIS_MODULE, .attach = adl_pci7296_attach, + .attach_pci = adl_pci7296_attach_pci, .detach = adl_pci7296_detach, }; @@ -165,6 +181,8 @@ static void __devexit adl_pci7296_pci_remove(struct pci_dev *dev) } static DEFINE_PCI_DEVICE_TABLE(adl_pci7296_pci_table) = { + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7224) }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7248) }, { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296) }, { 0 } }; @@ -178,6 +196,6 @@ static struct pci_driver adl_pci7296_pci_driver = { }; module_comedi_pci_driver(adl_pci7296_driver, adl_pci7296_pci_driver); +MODULE_DESCRIPTION("ADLINK PCI-72xx Opto-22 Compatible Digital I/O Boards"); MODULE_AUTHOR("Comedi http://www.comedi.org"); -MODULE_DESCRIPTION("Comedi low-level driver"); MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 744a8398e1f48d5349409b1fa9232a109b223458 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 9 Aug 2012 14:50:35 -0700 Subject: staging: comedi: adl_pci6208: use attach_pci callback Convert this PCI driver to use the comedi PCI auto config attach mechanism by adding an attach_pci callback function. Since the driver does not require any external configuration options, disable the legacy attach by making the attach callback simply return -ENOSYS. This removes the need to walk the pci bus to find the pci_dev and the need for the pci_dev_put() in the detach. For aesthetic reasons, rename the local variable 'thisboard' to 'boardinfo'. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci6208.c | 78 +++++++++++----------------- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 3bec0f6e4a8c..6d887f799596 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -33,8 +33,7 @@ Author: nsyeow Updated: Fri, 30 Jan 2004 14:44:27 +0800 Status: untested -Configuration Options: - none +Configuration Options: not applicable, uses PCI auto config References: - ni_660x.c @@ -155,67 +154,41 @@ static int pci6208_dio_insn_config(struct comedi_device *dev, return insn->n; } -static struct pci_dev *pci6208_find_device(struct comedi_device *dev, - struct comedi_devconfig *it) +static const void *pci6208_find_boardinfo(struct comedi_device *dev, + struct pci_dev *pcidev) { - const struct pci6208_board *thisboard; - struct pci_dev *pci_dev = NULL; - int bus = it->options[0]; - int slot = it->options[1]; + const struct pci6208_board *boardinfo; int i; - for_each_pci_dev(pci_dev) { - if (pci_dev->vendor != PCI_VENDOR_ID_ADLINK) - continue; - for (i = 0; i < ARRAY_SIZE(pci6208_boards); i++) { - thisboard = &pci6208_boards[i]; - if (thisboard->dev_id != pci_dev->device) - continue; - /* was a particular bus/slot requested? */ - if (bus || slot) { - /* are we on the wrong bus/slot? */ - if (pci_dev->bus->number != bus || - PCI_SLOT(pci_dev->devfn) != slot) - continue; - } - dev_dbg(dev->class_dev, - "Found %s on bus %d, slot, %d, irq=%d\n", - thisboard->name, - pci_dev->bus->number, - PCI_SLOT(pci_dev->devfn), - pci_dev->irq); - dev->board_ptr = thisboard; - return pci_dev; - } + for (i = 0; i < ARRAY_SIZE(pci6208_boards); i++) { + boardinfo = &pci6208_boards[i]; + if (boardinfo->dev_id == pcidev->device) + return boardinfo; } - dev_err(dev->class_dev, - "No supported board found! (req. bus %d, slot %d)\n", - bus, slot); return NULL; } -static int pci6208_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static int pci6208_attach_pci(struct comedi_device *dev, + struct pci_dev *pcidev) { - const struct pci6208_board *thisboard; + const struct pci6208_board *boardinfo; struct pci6208_private *devpriv; - struct pci_dev *pcidev; struct comedi_subdevice *s; int ret; + comedi_set_hw_dev(dev, &pcidev->dev); + + boardinfo = pci6208_find_boardinfo(dev, pcidev); + if (!boardinfo) + return -ENODEV; + dev->board_ptr = boardinfo; + dev->board_name = boardinfo->name; + ret = alloc_private(dev, sizeof(*devpriv)); if (ret < 0) return ret; devpriv = dev->private; - pcidev = pci6208_find_device(dev, it); - if (!pcidev) - return -EIO; - comedi_set_hw_dev(dev, &pcidev->dev); - thisboard = comedi_board(dev); - - dev->board_name = thisboard->name; - ret = comedi_pci_enable(pcidev, dev->driver->driver_name); if (ret) { dev_err(dev->class_dev, @@ -232,7 +205,7 @@ static int pci6208_attach(struct comedi_device *dev, /* analog output subdevice */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = thisboard->ao_chans; + s->n_chan = boardinfo->ao_chans; s->maxdata = 0xffff; s->range_table = &range_bipolar10; s->insn_write = pci6208_ao_winsn; @@ -257,6 +230,15 @@ static int pci6208_attach(struct comedi_device *dev, return 0; } +static int pci6208_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + dev_warn(dev->class_dev, + "This driver does not support attach using comedi_config\n"); + + return -ENOSYS; +} + static void pci6208_detach(struct comedi_device *dev) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); @@ -264,7 +246,6 @@ static void pci6208_detach(struct comedi_device *dev) if (pcidev) { if (dev->iobase) comedi_pci_disable(pcidev); - pci_dev_put(pcidev); } } @@ -272,6 +253,7 @@ static struct comedi_driver adl_pci6208_driver = { .driver_name = "adl_pci6208", .module = THIS_MODULE, .attach = pci6208_attach, + .attach_pci = pci6208_attach_pci, .detach = pci6208_detach, }; -- cgit v1.2.3 From 0a1e6c1fdbdcdbbf9457bc812e145062d59a68c2 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 9 Aug 2012 14:51:07 -0700 Subject: staging: comedi: adl_pci6208: add support for the PCI-6216 card Add the boardinfo and pci device table information for the PCI-6216 card. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci6208.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 6d887f799596..43e23e179959 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -27,8 +27,9 @@ */ /* Driver: adl_pci6208 -Description: ADLink PCI-6208A -Devices: [ADLink] PCI-6208A (adl_pci6208) +Description: ADLink PCI-6208/6216 Series Multi-channel Analog Output Cards +Devices: (ADLink) PCI-6208 [adl_pci6208] + (ADLink) PCI-6216 [adl_pci6216] Author: nsyeow Updated: Fri, 30 Jan 2004 14:44:27 +0800 Status: untested @@ -43,6 +44,12 @@ References: #include "../comedidev.h" +/* + * ADLINK PCI Device ID's supported by this driver + */ +#define PCI_DEVICE_ID_PCI6208 0x6208 +#define PCI_DEVICE_ID_PCI6216 0x6216 + /* * PCI-6208/6216-GL register map */ @@ -55,7 +62,7 @@ References: #define PCI6208_DIO_DI_MASK (0xf0) #define PCI6208_DIO_DI_SHIFT (4) -#define PCI6208_MAX_AO_CHANNELS 8 +#define PCI6208_MAX_AO_CHANNELS 16 struct pci6208_board { const char *name; @@ -65,9 +72,13 @@ struct pci6208_board { static const struct pci6208_board pci6208_boards[] = { { - .name = "pci6208a", - .dev_id = 0x6208, + .name = "adl_pci6208", + .dev_id = PCI_DEVICE_ID_PCI6208, .ao_chans = 8, + }, { + .name = "adl_pci6216", + .dev_id = PCI_DEVICE_ID_PCI6216, + .ao_chans = 16, }, }; @@ -269,7 +280,8 @@ static void __devexit adl_pci6208_pci_remove(struct pci_dev *dev) } static DEFINE_PCI_DEVICE_TABLE(adl_pci6208_pci_table) = { - { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, 0x6208) }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI6208) }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI6216) }, { 0 } }; MODULE_DEVICE_TABLE(pci, adl_pci6208_pci_table); -- cgit v1.2.3 From 270809a80fb610b54de5ee792a607dc37a71195c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 9 Aug 2012 14:51:26 -0700 Subject: staging: comedi: adl_pci6208: split the digital i/o subdevice The PCI-6208/6216 cards have 4 digital inputs and 4 digital outputs. These are currently being handled by an 8 channel COMEDI_SUBD_DIO subdevice in this driver. This causes the 4 digital outputs to appear as channels 0 thru 3 and the 4 digital inputs to appear as channels 4 thru 7. Userspace can only work out part thisby doing the COMEDI_INSNLIST ioctl with the INSN_CONFIG_DIO_QUERY instruction for each channel to determine the io direction. Make things a bit cleaner for userspace by creating two subdevices instead. One for the 4 digital inputs and one for the 4 digital outputs. For both subdevices the channel number indicates the actual digital input/output signal. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci6208.c | 78 ++++++++++++++++------------ 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 43e23e179959..74695bbd5f3f 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -125,46 +125,41 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, return insn->n; } -static int pci6208_dio_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) +static int pci6208_di_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { - unsigned int mask = data[0] & PCI6208_DIO_DO_MASK; + unsigned int val; + + val = inw(dev->iobase + PCI6208_DIO); + val = (val & PCI6208_DIO_DI_MASK) >> PCI6208_DIO_DI_SHIFT; + + data[1] = val; + + return insn->n; +} + +static int pci6208_do_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + unsigned int mask = data[0]; unsigned int bits = data[1]; if (mask) { s->state &= ~mask; - s->state |= bits & mask; + s->state |= (bits & mask); outw(s->state, dev->iobase + PCI6208_DIO); } - s->state = inw(dev->iobase + PCI6208_DIO); data[1] = s->state; return insn->n; } -static int pci6208_dio_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - int chan = CR_CHAN(insn->chanspec); - unsigned int mask = 1 << chan; - - switch (data[0]) { - case INSN_CONFIG_DIO_QUERY: - data[1] = (s->io_bits & mask) ? COMEDI_OUTPUT : COMEDI_INPUT; - break; - default: - return -EINVAL; - } - - return insn->n; -} - static const void *pci6208_find_boardinfo(struct comedi_device *dev, struct pci_dev *pcidev) { @@ -185,6 +180,7 @@ static int pci6208_attach_pci(struct comedi_device *dev, const struct pci6208_board *boardinfo; struct pci6208_private *devpriv; struct comedi_subdevice *s; + unsigned int val; int ret; comedi_set_hw_dev(dev, &pcidev->dev); @@ -208,7 +204,7 @@ static int pci6208_attach_pci(struct comedi_device *dev, } dev->iobase = pci_resource_start(pcidev, 2); - ret = comedi_alloc_subdevices(dev, 2); + ret = comedi_alloc_subdevices(dev, 3); if (ret) return ret; @@ -223,17 +219,31 @@ static int pci6208_attach_pci(struct comedi_device *dev, s->insn_read = pci6208_ao_rinsn; s = dev->subdevices + 1; - /* digital i/o subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; + /* digital input subdevice */ + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; s->maxdata = 1; s->range_table = &range_digital; - s->insn_bits = pci6208_dio_insn_bits; - s->insn_config = pci6208_dio_insn_config; + s->insn_bits = pci6208_di_insn_bits; + s = dev->subdevices + 2; + /* digital output subdevice */ + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci6208_do_insn_bits; + + /* + * Get the read back signals from the digital outputs + * and save it as the initial state for the subdevice. + */ + val = inw(dev->iobase + PCI6208_DIO); + val = (val & PCI6208_DIO_DO_MASK) >> PCI6208_DIO_DO_SHIFT; + s->state = val; s->io_bits = 0x0f; - s->state = inw(dev->iobase + PCI6208_DIO); dev_info(dev->class_dev, "%s: %s, I/O base=0x%04lx\n", dev->driver->driver_name, dev->board_name, dev->iobase); -- cgit v1.2.3 From 3cf05ddb0d7c5612ee70f250f22427462d820fe1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 9 Aug 2012 14:51:51 -0700 Subject: staging: comedi: adl_pci6208: use the 'board_name' for the resource name Use the 'dev->board_name' instead of the 'dev->driver->driver_name' as the resource name used when requesing the pci regions in comedi_pci_enable(). The board_name has a closer affinity to the card. Also, remove the dev_err() message when comedi_pci_enable() fails. It's just noise and doesn't actually tell the real reason why the call failed. It could have failed either the pci_enable_device() or the pci_request_regions(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci6208.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 74695bbd5f3f..3abff556b846 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -196,12 +196,9 @@ static int pci6208_attach_pci(struct comedi_device *dev, return ret; devpriv = dev->private; - ret = comedi_pci_enable(pcidev, dev->driver->driver_name); - if (ret) { - dev_err(dev->class_dev, - "Failed to enable PCI device and request regions\n"); + ret = comedi_pci_enable(pcidev, dev->board_name); + if (ret) return ret; - } dev->iobase = pci_resource_start(pcidev, 2); ret = comedi_alloc_subdevices(dev, 3); -- cgit v1.2.3 From 53fa8c46881a5a500fdcc4cf86359d92211b1e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCng=C3=B6r=20Erseymen?= Date: Fri, 10 Aug 2012 15:54:40 +0300 Subject: Staging: comedi: ssv_dnp: fix checkpatch.pl warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix checkpatch.pl warning about printk issue by merging two printk calls into one dev_info call. Signed-off-by: Güngör Erseymen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ssv_dnp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index 84b9f2a4280b..d1f5118c3afa 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -177,8 +177,6 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; int ret; - printk(KERN_INFO "comedi%d: dnp: ", dev->minor); - dev->board_name = board->name; ret = comedi_alloc_subdevices(dev, 1); @@ -195,8 +193,6 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->insn_bits = dnp_dio_insn_bits; s->insn_config = dnp_dio_insn_config; - printk("attached\n"); - /* We use the I/O ports 0x22,0x23 and 0xa3-0xa9, which are always * allocated for the primary 8259, so we don't need to allocate them * ourselves. */ @@ -209,6 +205,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) outb(PCMR, CSCIR); outb((inb(CSCDR) & 0xAA), CSCDR); + dev_info(dev->class_dev, "%s: attached\n", dev->board_name); return 1; } -- cgit v1.2.3 From d9fc49b2e0c510bf8c54e157a57bac3bb74184f0 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 3 Aug 2012 11:40:01 +0300 Subject: staging: rts5139: substitute rts51x_dump by print_hex_dump Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts5139/trace.h | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/drivers/staging/rts5139/trace.h b/drivers/staging/rts5139/trace.h index 0584b8ab43ca..c9dfb1ea4115 100644 --- a/drivers/staging/rts5139/trace.h +++ b/drivers/staging/rts5139/trace.h @@ -93,35 +93,9 @@ do { \ #endif #ifdef CONFIG_RTS5139_DEBUG -static inline void rts51x_dump(u8 *buf, int buf_len) -{ - int i; - u8 tmp[16] = { 0 }; - u8 *_ptr = buf; - - for (i = 0; i < ((buf_len) / 16); i++) { - RTS51X_DEBUGP("%02x %02x %02x %02x %02x %02x %02x %02x " - "%02x %02x %02x %02x %02x %02x %02x %02x\n", - _ptr[0], _ptr[1], _ptr[2], _ptr[3], _ptr[4], - _ptr[5], _ptr[6], _ptr[7], _ptr[8], _ptr[9], - _ptr[10], _ptr[11], _ptr[12], _ptr[13], _ptr[14], - _ptr[15]); - _ptr += 16; - } - if ((buf_len) % 16) { - memcpy(tmp, _ptr, (buf_len) % 16); - _ptr = tmp; - RTS51X_DEBUGP("%02x %02x %02x %02x %02x %02x %02x %02x " - "%02x %02x %02x %02x %02x %02x %02x %02x\n", - _ptr[0], _ptr[1], _ptr[2], _ptr[3], _ptr[4], - _ptr[5], _ptr[6], _ptr[7], _ptr[8], _ptr[9], - _ptr[10], _ptr[11], _ptr[12], _ptr[13], _ptr[14], - _ptr[15]); - } -} - -#define RTS51X_DUMP(buf, buf_len) \ - rts51x_dump((u8 *)(buf), (buf_len)) +#define RTS51X_DUMP(buf, buf_len) \ + print_hex_dump(KERN_DEBUG, RTS51X_TIP, DUMP_PREFIX_NONE, \ + 16, 1, (buf), (buf_len), false) #define CATCH_TRIGGER(chip) \ do { \ -- cgit v1.2.3 From c197de2bea11cabbd6f9ad8c6e3f82faa5fc8497 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 3 Aug 2012 11:38:05 +0300 Subject: staging: rts_pstor: substitute rtsx_dump by print_hex_dump Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rts_pstor/trace.h | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/drivers/staging/rts_pstor/trace.h b/drivers/staging/rts_pstor/trace.h index bc83b49a4eb4..cf60a1b872b3 100644 --- a/drivers/staging/rts_pstor/trace.h +++ b/drivers/staging/rts_pstor/trace.h @@ -83,33 +83,9 @@ do { \ #endif #ifdef CONFIG_RTS_PSTOR_DEBUG -static inline void rtsx_dump(u8 *buf, int buf_len) -{ - int i; - u8 tmp[16] = {0}; - u8 *_ptr = buf; - - for (i = 0; i < ((buf_len)/16); i++) { - RTSX_DEBUGP("%02x %02x %02x %02x %02x %02x %02x %02x " - "%02x %02x %02x %02x %02x %02x %02x %02x\n", - _ptr[0], _ptr[1], _ptr[2], _ptr[3], _ptr[4], _ptr[5], - _ptr[6], _ptr[7], _ptr[8], _ptr[9], _ptr[10], _ptr[11], - _ptr[12], _ptr[13], _ptr[14], _ptr[15]); - _ptr += 16; - } - if ((buf_len) % 16) { - memcpy(tmp, _ptr, (buf_len) % 16); - _ptr = tmp; - RTSX_DEBUGP("%02x %02x %02x %02x %02x %02x %02x %02x " - "%02x %02x %02x %02x %02x %02x %02x %02x\n", - _ptr[0], _ptr[1], _ptr[2], _ptr[3], _ptr[4], _ptr[5], - _ptr[6], _ptr[7], _ptr[8], _ptr[9], _ptr[10], _ptr[11], - _ptr[12], _ptr[13], _ptr[14], _ptr[15]); - } -} - -#define RTSX_DUMP(buf, buf_len) rtsx_dump((u8 *)(buf), (buf_len)) - +#define RTSX_DUMP(buf, buf_len) \ + print_hex_dump(KERN_DEBUG, RTSX_STOR, DUMP_PREFIX_NONE, \ + 16, 1, (buf), (buf_len), false) #else #define RTSX_DUMP(buf, buf_len) #endif -- cgit v1.2.3 From 9e58d05a1b24d2c0471c3b4df8f473a7543d7647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Iglesias=20Gons=C3=A1lvez?= Date: Fri, 20 Jul 2012 09:39:03 +0200 Subject: Staging: ipack/bridges/tpci200: avoid kernel bug when uninstalling a device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Samuel Iglesias Gonsálvez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ipack/bridges/tpci200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index 2b83fa8e550a..a7fb2cfe51ee 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -604,8 +604,8 @@ static int tpci200_slot_unregister(struct ipack_device *dev) if (mutex_lock_interruptible(&tpci200->mutex)) return -ERESTARTSYS; - ipack_device_unregister(dev); tpci200->slots[dev->slot].dev = NULL; + ipack_device_unregister(dev); mutex_unlock(&tpci200->mutex); return 0; -- cgit v1.2.3 From f45651f9bb22f7ab60d806707be2c75f3d219157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Iglesias=20Gons=C3=A1lvez?= Date: Fri, 20 Jul 2012 09:39:04 +0200 Subject: Staging: ipack/bridges/tpci200: remove linked list of registered devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The linked list of registered devices is not needed as the struct tpci200_board is saved in private data field of the pci device. Signed-off-by: Jens Taprogge Signed-off-by: Samuel Iglesias Gonsálvez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ipack/bridges/tpci200.c | 34 ++++++--------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index a7fb2cfe51ee..cee25c78a11a 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -24,28 +24,20 @@ static int control_reg[] = { TPCI200_CONTROL_D_REG }; -/* Linked list to save the registered devices */ -static LIST_HEAD(tpci200_list); - static int tpci200_slot_unregister(struct ipack_device *dev); static struct tpci200_board *check_slot(struct ipack_device *dev) { struct tpci200_board *tpci200; - int found = 0; if (dev == NULL) return NULL; - list_for_each_entry(tpci200, &tpci200_list, list) { - if (tpci200->number == dev->bus_nr) { - found = 1; - break; - } - } - if (!found) { - dev_err(&dev->dev, "Carrier not found\n"); + tpci200 = dev_get_drvdata(dev->bus->parent); + + if (tpci200 == NULL) { + dev_info(&dev->dev, "carrier board not found\n"); return NULL; } @@ -831,8 +823,6 @@ static int tpci200_pciprobe(struct pci_dev *pdev, /* save the bus number given by ipack to logging purpose */ tpci200->number = tpci200->info->ipack_bus->bus_nr; dev_set_drvdata(&pdev->dev, tpci200); - /* add the registered device in an internal linked list */ - list_add_tail(&tpci200->list, &tpci200_list); /* * Give the same IRQ number as the slot number. @@ -847,7 +837,6 @@ static int tpci200_pciprobe(struct pci_dev *pdev, static void __tpci200_pci_remove(struct tpci200_board *tpci200) { tpci200_uninstall(tpci200); - list_del(&tpci200->list); ipack_bus_unregister(tpci200->info->ipack_bus); kfree(tpci200->info); kfree(tpci200); @@ -855,15 +844,9 @@ static void __tpci200_pci_remove(struct tpci200_board *tpci200) static void __devexit tpci200_pci_remove(struct pci_dev *dev) { - struct tpci200_board *tpci200, *next; + struct tpci200_board *tpci200 = pci_get_drvdata(dev); - /* Search the registered device to uninstall it */ - list_for_each_entry_safe(tpci200, next, &tpci200_list, list) { - if (tpci200->info->pdev == dev) { - __tpci200_pci_remove(tpci200); - break; - } - } + __tpci200_pci_remove(tpci200); } static DEFINE_PCI_DEVICE_TABLE(tpci200_idtable) = { @@ -888,11 +871,6 @@ static int __init tpci200_drvr_init_module(void) static void __exit tpci200_drvr_exit_module(void) { - struct tpci200_board *tpci200, *next; - - list_for_each_entry_safe(tpci200, next, &tpci200_list, list) - __tpci200_pci_remove(tpci200); - pci_unregister_driver(&tpci200_pci_drv); } -- cgit v1.2.3 From 5b47f3cbf03f69efc24b34200d6b432fe354b8d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Iglesias=20Gons=C3=A1lvez?= Date: Fri, 20 Jul 2012 09:39:05 +0200 Subject: Staging: ipack/bridges/tpci200: use ioremap_nocache instead of ioremap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CPU might write-combine and/or cache memory access. Something that for most modules is not desired. Signed-off-by: Samuel Iglesias Gonsálvez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ipack/bridges/tpci200.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index cee25c78a11a..5831af8f1e8c 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c @@ -390,15 +390,15 @@ static int tpci200_register(struct tpci200_board *tpci200) /* Map internal tpci200 driver user space */ tpci200->info->interface_regs = - ioremap(pci_resource_start(tpci200->info->pdev, + ioremap_nocache(pci_resource_start(tpci200->info->pdev, TPCI200_IP_INTERFACE_BAR), TPCI200_IFACE_SIZE); tpci200->info->ioidint_space = - ioremap(pci_resource_start(tpci200->info->pdev, + ioremap_nocache(pci_resource_start(tpci200->info->pdev, TPCI200_IO_ID_INT_SPACES_BAR), TPCI200_IOIDINT_SIZE); tpci200->info->mem8_space = - ioremap(pci_resource_start(tpci200->info->pdev, + ioremap_nocache(pci_resource_start(tpci200->info->pdev, TPCI200_MEM8_SPACE_BAR), TPCI200_MEM8_SIZE); @@ -677,7 +677,7 @@ static int tpci200_slot_map_space(struct ipack_device *dev, virt_addr_space->size = size_to_map; virt_addr_space->address = - ioremap((unsigned long)phys_address, size_to_map); + ioremap_nocache((unsigned long)phys_address, size_to_map); out_unlock: mutex_unlock(&tpci200->mutex); -- cgit v1.2.3 From 785526207f4cb7a70a9f3f0b9f991ec9ca63c72d Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Thu, 2 Aug 2012 19:05:42 +0300 Subject: staging: csr: print mac address with %pM Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/csr/wext_events.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/csr/wext_events.c b/drivers/staging/csr/wext_events.c index d356887ac4c6..9860ea30da25 100644 --- a/drivers/staging/csr/wext_events.c +++ b/drivers/staging/csr/wext_events.c @@ -194,11 +194,9 @@ _send_michaelmicfailure_event(struct net_device *dev, union iwreq_data wrqu; char buf[128]; - sprintf(buf, - "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=%02x:%02x:%02x:%02x:%02x:%02x)", - key_idx, (key_type == C