Commit 55c03cff authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: remove private header comedi_pci.h

Remove the private header, comedi_pci.h, by moving the two
helper functions into divers.c and providing the prototypes
in comedidev.h.

This allows the comedi_pci_enable/disable helper functions
to be shared instead of having an inline version in every
comedi pci driver.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f8f5701b
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/pci.h>
#include "comedi.h" #include "comedi.h"
...@@ -180,7 +181,6 @@ struct comedi_async { ...@@ -180,7 +181,6 @@ struct comedi_async {
unsigned int x); unsigned int x);
}; };
struct pci_dev;
struct usb_interface; struct usb_interface;
struct comedi_driver { struct comedi_driver {
...@@ -310,7 +310,8 @@ int comedi_driver_unregister(struct comedi_driver *); ...@@ -310,7 +310,8 @@ int comedi_driver_unregister(struct comedi_driver *);
module_driver(__comedi_driver, comedi_driver_register, \ module_driver(__comedi_driver, comedi_driver_register, \
comedi_driver_unregister) comedi_driver_unregister)
struct pci_driver; int comedi_pci_enable(struct pci_dev *, const char *);
void comedi_pci_disable(struct pci_dev *);
int comedi_pci_driver_register(struct comedi_driver *, struct pci_driver *); int comedi_pci_driver_register(struct comedi_driver *, struct pci_driver *);
void comedi_pci_driver_unregister(struct comedi_driver *, struct pci_driver *); void comedi_pci_driver_unregister(struct comedi_driver *, struct pci_driver *);
......
...@@ -908,6 +908,40 @@ static void comedi_auto_unconfig(struct device *hardware_device) ...@@ -908,6 +908,40 @@ static void comedi_auto_unconfig(struct device *hardware_device)
comedi_free_board_minor(minor); comedi_free_board_minor(minor);
} }
/**
* comedi_pci_enable() - Enable the PCI device and request the regions.
* @pdev: pci_dev struct
* @res_name: name for the requested reqource
*/
int comedi_pci_enable(struct pci_dev *pdev, const char *res_name)
{
int rc;
rc = pci_enable_device(pdev);
if (rc < 0)
return rc;
rc = pci_request_regions(pdev, res_name);
if (rc < 0)
pci_disable_device(pdev);
return rc;
}
EXPORT_SYMBOL_GPL(comedi_pci_enable);
/**
* comedi_pci_disable() - Release the regions and disable the PCI device.
* @pdev: pci_dev struct
*
* This must be matched with a previous successful call to comedi_pci_enable().
*/
void comedi_pci_disable(struct pci_dev *pdev)
{
pci_release_regions(pdev);
pci_disable_device(pdev);
}
EXPORT_SYMBOL_GPL(comedi_pci_disable);
static int comedi_old_pci_auto_config(struct pci_dev *pcidev, static int comedi_old_pci_auto_config(struct pci_dev *pcidev,
struct comedi_driver *driver) struct comedi_driver *driver)
{ {
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include "../../comedidev.h" #include "../../comedidev.h"
#include "../comedi_pci.h"
#ifdef PCI_SUPPORT_VER1 #ifdef PCI_SUPPORT_VER1
#error No support for 2.1.55 and older #error No support for 2.1.55 and older
#endif #endif
......
...@@ -52,7 +52,6 @@ Configuration Options: ...@@ -52,7 +52,6 @@ Configuration Options:
* options that are used with comedi_config. * options that are used with comedi_config.
*/ */
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
/* Board descriptions */ /* Board descriptions */
struct pci6208_board { struct pci6208_board {
......
...@@ -36,7 +36,6 @@ Configuration Options: ...@@ -36,7 +36,6 @@ Configuration Options:
#include "../comedidev.h" #include "../comedidev.h"
#include <linux/kernel.h> #include <linux/kernel.h>
#include "comedi_pci.h"
#define PCI7230_DI 0x00 #define PCI7230_DI 0x00
#define PCI7230_DO 0x00 #define PCI7230_DO 0x00
......
...@@ -37,7 +37,6 @@ Configuration Options: ...@@ -37,7 +37,6 @@ Configuration Options:
#include "../comedidev.h" #include "../comedidev.h"
#include <linux/kernel.h> #include <linux/kernel.h>
#include "comedi_pci.h"
#include "8255.h" #include "8255.h"
/* #include "8253.h" */ /* #include "8253.h" */
......
...@@ -36,7 +36,6 @@ Configuration Options: ...@@ -36,7 +36,6 @@ Configuration Options:
#include "../comedidev.h" #include "../comedidev.h"
#include <linux/kernel.h> #include <linux/kernel.h>
#include "comedi_pci.h"
#define PCI7432_DI 0x00 #define PCI7432_DI 0x00
#define PCI7432_DO 0x00 #define PCI7432_DO 0x00
......
...@@ -38,7 +38,6 @@ Configuration Options: ...@@ -38,7 +38,6 @@ Configuration Options:
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/delay.h> #include <linux/delay.h>
#include "comedi_fc.h" #include "comedi_fc.h"
#include "comedi_pci.h"
#include "8253.h" #include "8253.h"
#define PCI8164_AXIS_X 0x00 #define PCI8164_AXIS_X 0x00
......
...@@ -81,7 +81,6 @@ a multiple of chanlist_len*convert_arg. ...@@ -81,7 +81,6 @@ a multiple of chanlist_len*convert_arg.
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include "8253.h" #include "8253.h"
#include "comedi_pci.h"
#include "comedi_fc.h" #include "comedi_fc.h"
#define PCI9111_DRIVER_NAME "adl_pci9111" #define PCI9111_DRIVER_NAME "adl_pci9111"
......
...@@ -71,7 +71,6 @@ Configuration options: ...@@ -71,7 +71,6 @@ Configuration options:
#include "amcc_s5933.h" #include "amcc_s5933.h"
#include "8253.h" #include "8253.h"
#include "comedi_pci.h"
#include "comedi_fc.h" #include "comedi_fc.h"
#define PCI_VENDOR_ID_AMCC 0x10e8 #define PCI_VENDOR_ID_AMCC 0x10e8
......
...@@ -45,8 +45,6 @@ Configuration options: ...@@ -45,8 +45,6 @@ Configuration options:
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#include "8253.h" #include "8253.h"
#include "amcc_s5933.h" #include "amcc_s5933.h"
......
...@@ -50,8 +50,6 @@ configures all channels in the same group. ...@@ -50,8 +50,6 @@ configures all channels in the same group.
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#define PCI_VENDOR_ID_ADVANTECH 0x13fe /* Advantech PCI vendor ID */ #define PCI_VENDOR_ID_ADVANTECH 0x13fe /* Advantech PCI vendor ID */
/* hardware types of the cards */ /* hardware types of the cards */
......
...@@ -33,7 +33,6 @@ Configuration options: ...@@ -33,7 +33,6 @@ Configuration options:
#include <linux/delay.h> #include <linux/delay.h>
#include "comedi_pci.h"
#include "8255.h" #include "8255.h"
#include "8253.h" #include "8253.h"
......
...@@ -210,8 +210,6 @@ order they appear in the channel list. ...@@ -210,8 +210,6 @@ order they appear in the channel list.
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#include "8255.h" #include "8255.h"
#include "8253.h" #include "8253.h"
......
...@@ -56,8 +56,6 @@ unused. ...@@ -56,8 +56,6 @@ unused.
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#include "8255.h" #include "8255.h"
#include "plx9052.h" #include "plx9052.h"
......
...@@ -46,8 +46,6 @@ The state of the outputs can be read. ...@@ -46,8 +46,6 @@ The state of the outputs can be read.
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#define PC263_DRIVER_NAME "amplc_pc263" #define PC263_DRIVER_NAME "amplc_pc263"
#ifdef CONFIG_COMEDI_AMPLC_PC263_ISA_MODULE #ifdef CONFIG_COMEDI_AMPLC_PC263_ISA_MODULE
......
...@@ -108,8 +108,6 @@ Passing a zero for an option is the same as leaving it unspecified. ...@@ -108,8 +108,6 @@ Passing a zero for an option is the same as leaving it unspecified.
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#include "comedi_fc.h" #include "comedi_fc.h"
#include "8253.h" #include "8253.h"
......
...@@ -193,7 +193,6 @@ for (or detection of) various hardware problems added by Ian Abbott. ...@@ -193,7 +193,6 @@ for (or detection of) various hardware problems added by Ian Abbott.
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include "comedi_pci.h"
#include "8253.h" #include "8253.h"
#include "8255.h" #include "8255.h"
......
...@@ -77,7 +77,6 @@ analog triggering on 1602 series ...@@ -77,7 +77,6 @@ analog triggering on 1602 series
#include "8253.h" #include "8253.h"
#include "8255.h" #include "8255.h"
#include "amcc_s5933.h" #include "amcc_s5933.h"
#include "comedi_pci.h"
#include "comedi_fc.h" #include "comedi_fc.h"
#undef CB_PCIDAS_DEBUG /* disable debugging code */ #undef CB_PCIDAS_DEBUG /* disable debugging code */
......
...@@ -87,7 +87,6 @@ known. If you have such a board, please file a bug report at ...@@ -87,7 +87,6 @@ known. If you have such a board, please file a bug report at
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include "comedi_pci.h"
#include "8253.h" #include "8253.h"
#include "8255.h" #include "8255.h"
#include "plx9080.h" #include "plx9080.h"
......
...@@ -48,10 +48,8 @@ Please report success/failure with other different cards to ...@@ -48,10 +48,8 @@ Please report success/failure with other different cards to
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#include "8255.h" #include "8255.h"
/* PCI vendor number of ComputerBoards */ /* PCI vendor number of ComputerBoards */
#define PCI_VENDOR_ID_CB 0x1307 #define PCI_VENDOR_ID_CB 0x1307
#define EEPROM_SIZE 128 /* number of entries in eeprom */ #define EEPROM_SIZE 128 /* number of entries in eeprom */
......
...@@ -41,7 +41,6 @@ Passing a zero for an option is the same as leaving it unspecified. ...@@ -41,7 +41,6 @@ Passing a zero for an option is the same as leaving it unspecified.
/*------------------------------ HEADER FILES ---------------------------------*/ /*------------------------------ HEADER FILES ---------------------------------*/
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#include "8255.h" #include "8255.h"
/*-------------------------- MACROS and DATATYPES -----------------------------*/ /*-------------------------- MACROS and DATATYPES -----------------------------*/
......
...@@ -45,7 +45,6 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details. ...@@ -45,7 +45,6 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details.
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include "comedi_pci.h"
#include "plx9052.h" #include "plx9052.h"
#include "8255.h" #include "8255.h"
......
...@@ -86,8 +86,6 @@ Configuration Options: ...@@ -86,8 +86,6 @@ Configuration Options:
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#include "8255.h" #include "8255.h"
/* device ids of the cards we support -- currently only 1 card supported */ /* device ids of the cards we support -- currently only 1 card supported */
......
/*
comedi/drivers/comedi_pci.h
Various PCI functions for drivers.
Copyright (C) 2007 MEV Ltd. <http://www.mev.co.uk/>
COMEDI - Linux Control and Measurement Device Interface
Copyright (C) 2000 David A. Schleef <ds@schleef.org>
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.
*/
#ifndef _COMEDI_PCI_H_
#define _COMEDI_PCI_H_
#include <linux/pci.h>
/*
* Enable the PCI device and request the regions.
*/
static inline int comedi_pci_enable(struct pci_dev *pdev, const char *res_name)
{
int rc;
rc = pci_enable_device(pdev);
if (rc < 0)
return rc;
rc = pci_request_regions(pdev, res_name);
if (rc < 0)
pci_disable_device(pdev);
return rc;
}
/*
* Release the regions and disable the PCI device.
*
* This must be matched with a previous successful call to comedi_pci_enable().
*/
static inline void comedi_pci_disable(struct pci_dev *pdev)
{
pci_release_regions(pdev);
pci_disable_device(pdev);
}
#endif
...@@ -36,8 +36,6 @@ Configuration Options: ...@@ -36,8 +36,6 @@ Configuration Options:
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
enum contec_model { enum contec_model {
PIO1616L = 0, PIO1616L = 0,
}; };
......
...@@ -118,7 +118,6 @@ Configuration options: ...@@ -118,7 +118,6 @@ Configuration options:
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include "comedi_pci.h"
#include "8255.h" #include "8255.h"
#define DAQBOARD2000_SUBSYSTEM_IDS2 0x00021616 /* Daqboard/2000 - 2 Dacs */ #define DAQBOARD2000_SUBSYSTEM_IDS2 0x00021616 /* Daqboard/2000 - 2 Dacs */
......
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
#include <linux/delay.h> #include <linux/delay.h>
#include "comedi_pci.h"
#include "8255.h" #include "8255.h"
#include "das08.h" #include "das08.h"
......
...@@ -63,8 +63,6 @@ AO commands are not supported. ...@@ -63,8 +63,6 @@ AO commands are not supported.
#include "../comedidev.h" #include "../comedidev.h"
#include <linux/delay.h> #include <linux/delay.h>
#include "comedi_pci.h"
#define PCI_VENDOR_ID_DT 0x1116 #define PCI_VENDOR_ID_DT 0x1116
static const struct comedi_lrange range_dt3000_ai = { 4, { static const struct comedi_lrange range_dt3000_ai = { 4, {
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
*/ */
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#include <linux/mutex.h> #include <linux/mutex.h>
#define PCI_VENDOR_ID_DYNALOG 0x10b5 #define PCI_VENDOR_ID_DYNALOG 0x10b5
......
...@@ -49,7 +49,6 @@ support could be added to this driver. ...@@ -49,7 +49,6 @@ support could be added to this driver.
#include "../comedidev.h" #include "../comedidev.h"
#include <linux/delay.h> #include <linux/delay.h>
#include "comedi_pci.h"
#include "plx9080.h" #include "plx9080.h"
#include "comedi_fc.h" #include "comedi_fc.h"
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#define _ICP_MULTI_H_ #define _ICP_MULTI_H_
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
/****************************************************************************/ /****************************************************************************/
......
...@@ -49,7 +49,6 @@ Devices: [JR3] PCI force sensor board (jr3_pci) ...@@ -49,7 +49,6 @@ Devices: [JR3] PCI force sensor board (jr3_pci)
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include "comedi_pci.h"
#include "jr3_pci.h" #include "jr3_pci.h"
#define PCI_VENDOR_ID_JR3 0x1762 #define PCI_VENDOR_ID_JR3 0x1762
......
...@@ -40,8 +40,6 @@ Kolter Electronic PCI Counter Card. ...@@ -40,8 +40,6 @@ Kolter Electronic PCI Counter Card.
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#define CNT_DRIVER_NAME "ke_counter" #define CNT_DRIVER_NAME "ke_counter"
#define PCI_VENDOR_ID_KOLTER 0x1001 #define PCI_VENDOR_ID_KOLTER 0x1001
#define CNT_CARD_DEVICE_ID 0x0014 #define CNT_CARD_DEVICE_ID 0x0014
......
...@@ -58,7 +58,6 @@ broken. ...@@ -58,7 +58,6 @@ broken.
#include <linux/list.h> #include <linux/list.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include "comedi_pci.h"
#include "me4000.h" #include "me4000.h"
#if 0 #if 0
/* file removed due to GPL incompatibility */ /* file removed due to GPL incompatibility */
......
...@@ -54,8 +54,6 @@ from http://www.comedi.org ...@@ -54,8 +54,6 @@ from http://www.comedi.org
#include <linux/sched.h> #include <linux/sched.h>
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
/*#include "me2600_fw.h" */ /*#include "me2600_fw.h" */
#define ME_DRIVER_NAME "me_daq" #define ME_DRIVER_NAME "me_daq"
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#include "mite.h" #include "mite.h"
#include "comedi_fc.h" #include "comedi_fc.h"
#include "comedi_pci.h"
#include "../comedidev.h" #include "../comedidev.h"
......
...@@ -105,7 +105,6 @@ Configuration options: ...@@ -105,7 +105,6 @@ Configuration options:
#include <linux/delay.h> #include <linux/delay.h>
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#define DRV_NAME "rtd520" #define DRV_NAME "rtd520"
......
...@@ -74,8 +74,6 @@ INSN_CONFIG instructions: ...@@ -74,8 +74,6 @@ INSN_CONFIG instructions:
#include "../comedidev.h" #include "../comedidev.h"
#include "comedi_pci.h"
#include "comedi_fc.h" #include "comedi_fc.h"
#include "s626.h" #include "s626.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment