Skip to content

Commit

Permalink
staging: comedi: remove private header comedi_pci.h
Browse files Browse the repository at this point in the history
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: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jun 5, 2012
1 parent f8f5701 commit 55c03cf
Show file tree
Hide file tree
Showing 39 changed files with 37 additions and 112 deletions.
5 changes: 3 additions & 2 deletions drivers/staging/comedi/comedidev.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <linux/uaccess.h>
#include <linux/io.h>
#include <linux/timer.h>
#include <linux/pci.h>

#include "comedi.h"

Expand Down Expand Up @@ -180,7 +181,6 @@ struct comedi_async {
unsigned int x);
};

struct pci_dev;
struct usb_interface;

struct comedi_driver {
Expand Down Expand Up @@ -310,7 +310,8 @@ int comedi_driver_unregister(struct comedi_driver *);
module_driver(__comedi_driver, comedi_driver_register, \
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 *);
void comedi_pci_driver_unregister(struct comedi_driver *, struct pci_driver *);
Expand Down
34 changes: 34 additions & 0 deletions drivers/staging/comedi/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,40 @@ static void comedi_auto_unconfig(struct device *hardware_device)
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,
struct comedi_driver *driver)
{
Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

#include "../../comedidev.h"

#include "../comedi_pci.h"

#ifdef PCI_SUPPORT_VER1
#error No support for 2.1.55 and older
#endif
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/adl_pci6208.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ Configuration Options:
* options that are used with comedi_config.
*/
#include "../comedidev.h"
#include "comedi_pci.h"

/* Board descriptions */
struct pci6208_board {
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/adl_pci7230.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Configuration Options:

#include "../comedidev.h"
#include <linux/kernel.h>
#include "comedi_pci.h"

#define PCI7230_DI 0x00
#define PCI7230_DO 0x00
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/adl_pci7296.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Configuration Options:
#include "../comedidev.h"
#include <linux/kernel.h>

#include "comedi_pci.h"
#include "8255.h"
/* #include "8253.h" */

Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/adl_pci7432.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Configuration Options:

#include "../comedidev.h"
#include <linux/kernel.h>
#include "comedi_pci.h"

#define PCI7432_DI 0x00
#define PCI7432_DO 0x00
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/adl_pci8164.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Configuration Options:
#include <linux/kernel.h>
#include <linux/delay.h>
#include "comedi_fc.h"
#include "comedi_pci.h"
#include "8253.h"

#define PCI8164_AXIS_X 0x00
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/adl_pci9111.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ a multiple of chanlist_len*convert_arg.
#include <linux/interrupt.h>

#include "8253.h"
#include "comedi_pci.h"
#include "comedi_fc.h"

#define PCI9111_DRIVER_NAME "adl_pci9111"
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/adl_pci9118.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ Configuration options:

#include "amcc_s5933.h"
#include "8253.h"
#include "comedi_pci.h"
#include "comedi_fc.h"

#define PCI_VENDOR_ID_AMCC 0x10e8
Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/adv_pci1710.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ Configuration options:

#include "../comedidev.h"

#include "comedi_pci.h"

#include "8253.h"
#include "amcc_s5933.h"

Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/adv_pci1723.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ configures all channels in the same group.

#include "../comedidev.h"

#include "comedi_pci.h"

#define PCI_VENDOR_ID_ADVANTECH 0x13fe /* Advantech PCI vendor ID */

/* hardware types of the cards */
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/adv_pci_dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Configuration options:

#include <linux/delay.h>

#include "comedi_pci.h"
#include "8255.h"
#include "8253.h"

Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/amplc_dio200.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ order they appear in the channel list.

#include "../comedidev.h"

#include "comedi_pci.h"

#include "8255.h"
#include "8253.h"

Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/amplc_pc236.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ unused.

#include "../comedidev.h"

#include "comedi_pci.h"

#include "8255.h"
#include "plx9052.h"

Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/amplc_pc263.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ The state of the outputs can be read.

#include "../comedidev.h"

#include "comedi_pci.h"

#define PC263_DRIVER_NAME "amplc_pc263"

#ifdef CONFIG_COMEDI_AMPLC_PC263_ISA_MODULE
Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/amplc_pci224.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ Passing a zero for an option is the same as leaving it unspecified.

#include "../comedidev.h"

#include "comedi_pci.h"

#include "comedi_fc.h"
#include "8253.h"

Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/amplc_pci230.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ for (or detection of) various hardware problems added by Ian Abbott.
#include <linux/delay.h>
#include <linux/interrupt.h>

#include "comedi_pci.h"
#include "8253.h"
#include "8255.h"

Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/cb_pcidas.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ analog triggering on 1602 series
#include "8253.h"
#include "8255.h"
#include "amcc_s5933.h"
#include "comedi_pci.h"
#include "comedi_fc.h"

#undef CB_PCIDAS_DEBUG /* disable debugging code */
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/cb_pcidas64.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ known. If you have such a board, please file a bug report at
#include <linux/delay.h>
#include <linux/interrupt.h>

#include "comedi_pci.h"
#include "8253.h"
#include "8255.h"
#include "plx9080.h"
Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/cb_pcidda.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ Please report success/failure with other different cards to

#include "../comedidev.h"

#include "comedi_pci.h"
#include "8255.h"


/* PCI vendor number of ComputerBoards */
#define PCI_VENDOR_ID_CB 0x1307
#define EEPROM_SIZE 128 /* number of entries in eeprom */
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/cb_pcidio.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Passing a zero for an option is the same as leaving it unspecified.

/*------------------------------ HEADER FILES ---------------------------------*/
#include "../comedidev.h"
#include "comedi_pci.h"
#include "8255.h"

/*-------------------------- MACROS and DATATYPES -----------------------------*/
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/cb_pcimdas.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details.
#include <linux/delay.h>
#include <linux/interrupt.h>

#include "comedi_pci.h"
#include "plx9052.h"
#include "8255.h"

Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/cb_pcimdda.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ Configuration Options:

#include "../comedidev.h"

#include "comedi_pci.h"

#include "8255.h"

/* device ids of the cards we support -- currently only 1 card supported */
Expand Down
60 changes: 0 additions & 60 deletions drivers/staging/comedi/drivers/comedi_pci.h

This file was deleted.

2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/contec_pci_dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ Configuration Options:

#include "../comedidev.h"

#include "comedi_pci.h"

enum contec_model {
PIO1616L = 0,
};
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/daqboard2000.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ Configuration options:
#include <linux/delay.h>
#include <linux/interrupt.h>

#include "comedi_pci.h"
#include "8255.h"

#define DAQBOARD2000_SUBSYSTEM_IDS2 0x00021616 /* Daqboard/2000 - 2 Dacs */
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/das08.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@

#include <linux/delay.h>

#include "comedi_pci.h"
#include "8255.h"
#include "das08.h"

Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/dt3000.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ AO commands are not supported.
#include "../comedidev.h"
#include <linux/delay.h>

#include "comedi_pci.h"

#define PCI_VENDOR_ID_DT 0x1116

static const struct comedi_lrange range_dt3000_ai = { 4, {
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/dyna_pci10xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
*/

#include "../comedidev.h"
#include "comedi_pci.h"
#include <linux/mutex.h>

#define PCI_VENDOR_ID_DYNALOG 0x10b5
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/gsc_hpdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ support could be added to this driver.
#include "../comedidev.h"
#include <linux/delay.h>

#include "comedi_pci.h"
#include "plx9080.h"
#include "comedi_fc.h"

Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/icp_multi.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#define _ICP_MULTI_H_

#include "../comedidev.h"
#include "comedi_pci.h"

/****************************************************************************/

Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/jr3_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Devices: [JR3] PCI force sensor board (jr3_pci)
#include <linux/slab.h>
#include <linux/timer.h>
#include <linux/kernel.h>
#include "comedi_pci.h"
#include "jr3_pci.h"

#define PCI_VENDOR_ID_JR3 0x1762
Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/comedi/drivers/ke_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ Kolter Electronic PCI Counter Card.

#include "../comedidev.h"

#include "comedi_pci.h"

#define CNT_DRIVER_NAME "ke_counter"
#define PCI_VENDOR_ID_KOLTER 0x1001
#define CNT_CARD_DEVICE_ID 0x0014
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/me4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ broken.
#include <linux/list.h>
#include <linux/spinlock.h>

#include "comedi_pci.h"
#include "me4000.h"
#if 0
/* file removed due to GPL incompatibility */
Expand Down
Loading

0 comments on commit 55c03cf

Please sign in to comment.