Skip to content

Commit

Permalink
staging: comedi: amplc_dio200: abbreviate IS_ENABLED()
Browse files Browse the repository at this point in the history
The IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) and
IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) macro calls are a bit
long-winded.  Define a couple of macros DO_ISA and DO_PCI as
abbreviations for them.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Aug 14, 2012
1 parent 2f123cb commit d99ff52
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions drivers/staging/comedi/drivers/amplc_dio200.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ order they appear in the channel list.

#define DIO200_DRIVER_NAME "amplc_dio200"

#define DO_ISA IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA)
#define DO_PCI IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI)

/* PCI IDs */
#define PCI_VENDOR_ID_AMPLICON 0x14dc
#define PCI_DEVICE_ID_AMPLICON_PCI272 0x000a
Expand Down Expand Up @@ -272,12 +275,12 @@ enum dio200_model {
};

enum dio200_layout {
#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA)
#if DO_ISA
pc212_layout,
pc214_layout,
#endif
pc215_layout,
#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA)
#if DO_ISA
pc218_layout,
#endif
pc272_layout
Expand All @@ -292,7 +295,7 @@ struct dio200_board {
};

static const struct dio200_board dio200_boards[] = {
#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA)
#if DO_ISA
{
.name = "pc212e",
.bustype = isa_bustype,
Expand Down Expand Up @@ -324,7 +327,7 @@ static const struct dio200_board dio200_boards[] = {
.layout = pc272_layout,
},
#endif
#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI)
#if DO_PCI
{
.name = "pci215",
.devid = PCI_DEVICE_ID_AMPLICON_PCI215,
Expand Down Expand Up @@ -367,7 +370,7 @@ struct dio200_layout_struct {
};

static const struct dio200_layout_struct dio200_layouts[] = {
#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA)
#if DO_ISA
[pc212_layout] = {
.n_subdevs = 6,
.sdtype = {sd_8255, sd_8254, sd_8254, sd_8254,
Expand Down Expand Up @@ -396,7 +399,7 @@ static const struct dio200_layout_struct dio200_layouts[] = {
.has_int_sce = 1,
.has_clk_gat_sce = 1,
},
#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA)
#if DO_ISA
[pc218_layout] = {
.n_subdevs = 7,
.sdtype = {sd_8254, sd_8254, sd_8255, sd_8254,
Expand Down Expand Up @@ -1228,12 +1231,10 @@ static void dio200_report_attach(struct comedi_device *dev, unsigned int irq)
char tmpbuf[60];
int tmplen;

if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) &&
thisboard->bustype == isa_bustype)
if (DO_ISA && thisboard->bustype == isa_bustype)
tmplen = scnprintf(tmpbuf, sizeof(tmpbuf),
"(base %#lx) ", dev->iobase);
else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) &&
thisboard->bustype == pci_bustype)
else if (DO_PCI && thisboard->bustype == pci_bustype)
tmplen = scnprintf(tmpbuf, sizeof(tmpbuf),
"(pci %s) ", pci_name(pcidev));
else
Expand Down Expand Up @@ -1361,8 +1362,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
}

/* Process options and reserve resources according to bus type. */
if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA) &&
thisboard->bustype == isa_bustype) {
if (DO_ISA && thisboard->bustype == isa_bustype) {
unsigned long iobase;
unsigned int irq;

Expand All @@ -1372,8 +1372,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (ret < 0)
return ret;
return dio200_common_attach(dev, iobase, irq, 0);
} else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) &&
thisboard->bustype == pci_bustype) {
} else if (DO_PCI && thisboard->bustype == pci_bustype) {
struct pci_dev *pci_dev;

pci_dev = dio200_find_pci_dev(dev, it);
Expand All @@ -1397,7 +1396,7 @@ static int __devinit dio200_attach_pci(struct comedi_device *dev,
{
int ret;

if (!IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI))
if (!DO_PCI)
return -EINVAL;

dev_info(dev->class_dev, DIO200_DRIVER_NAME ": attach pci %s\n",
Expand Down Expand Up @@ -1470,7 +1469,7 @@ static struct comedi_driver amplc_dio200_driver = {
.num_names = ARRAY_SIZE(dio200_boards),
};

#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI)
#if DO_PCI
static DEFINE_PCI_DEVICE_TABLE(dio200_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272) },
Expand Down

0 comments on commit d99ff52

Please sign in to comment.