Skip to content

Commit

Permalink
staging: comedi: pcm_common: remove module
Browse files Browse the repository at this point in the history
This module is built whenever CONFIG_COMEDI is enabled but it is
only used by the pcmmio and pcmuio drivers. The pcm_common module
consists of one exported function. Put a local copy of the function
in the pcmmio and pcmuio drivers.

This removes the need for the pcm_common module and the now unused
pcm_common.[ch] files can be deleted and removed from the Makefile.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jan 7, 2013
1 parent 215cace commit f95d45d
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 85 deletions.
1 change: 0 additions & 1 deletion drivers/staging/comedi/drivers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#

# Comedi "helper" modules
obj-$(CONFIG_COMEDI) += pcm_common.o

# Comedi misc drivers
obj-$(CONFIG_COMEDI_BOND) += comedi_bond.o
Expand Down
63 changes: 0 additions & 63 deletions drivers/staging/comedi/drivers/pcm_common.c

This file was deleted.

8 changes: 0 additions & 8 deletions drivers/staging/comedi/drivers/pcm_common.h

This file was deleted.

61 changes: 55 additions & 6 deletions drivers/staging/comedi/drivers/pcmmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ Configuration Options:

#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/pci.h>

#include "../comedidev.h"
#include "pcm_common.h"
#include <linux/pci.h> /* for PCI devices */
#include "comedi_fc.h"

/* This stuff is all from pcmuio.c -- it refers to the DIO subdevices only */
#define CHANS_PER_PORT 8
Expand Down Expand Up @@ -802,11 +803,59 @@ static int pcmmio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
return 0;
}

static int
pcmmio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_cmd *cmd)
static int pcmmio_cmdtest(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_cmd *cmd)
{
return comedi_pcm_cmdtest(dev, s, cmd);
int err = 0;

/* Step 1 : check if triggers are trivially valid */

err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT);
err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT);
err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW);
err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE);

if (err)
return 1;

/* Step 2a : make sure trigger sources are unique */

err |= cfc_check_trigger_is_unique(cmd->start_src);
err |= cfc_check_trigger_is_unique(cmd->stop_src);

/* Step 2b : and mutually compatible */

if (err)
return 2;

/* Step 3: check if arguments are trivially valid */

err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0);
err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0);
err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len);

switch (cmd->stop_src) {
case TRIG_COUNT:
/* any count allowed */
break;
case TRIG_NONE:
err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0);
break;
default:
break;
}

if (err)
return 3;

/* step 4: fix up any arguments */

/* if (err) return 4; */

return 0;
}

static int adc_wait_ready(unsigned long iobase)
Expand Down
62 changes: 55 additions & 7 deletions drivers/staging/comedi/drivers/pcmuio.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ Configuration Options:

#include <linux/interrupt.h>
#include <linux/slab.h>
#include "../comedidev.h"
#include "pcm_common.h"
#include <linux/pci.h>

#include <linux/pci.h> /* for PCI devices */
#include "../comedidev.h"
#include "comedi_fc.h"

#define CHANS_PER_PORT 8
#define PORTS_PER_ASIC 6
Expand Down Expand Up @@ -740,11 +740,59 @@ static int pcmuio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
return 0;
}

static int
pcmuio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_cmd *cmd)
static int pcmuio_cmdtest(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_cmd *cmd)
{
return comedi_pcm_cmdtest(dev, s, cmd);
int err = 0;

/* Step 1 : check if triggers are trivially valid */

err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_INT);
err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT);
err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW);
err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE);

if (err)
return 1;

/* Step 2a : make sure trigger sources are unique */

err |= cfc_check_trigger_is_unique(cmd->start_src);
err |= cfc_check_trigger_is_unique(cmd->stop_src);

/* Step 2b : and mutually compatible */

if (err)
return 2;

/* Step 3: check if arguments are trivially valid */

err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0);
err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0);
err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len);

switch (cmd->stop_src) {
case TRIG_COUNT:
/* any count allowed */
break;
case TRIG_NONE:
err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0);
break;
default:
break;
}

if (err)
return 3;

/* step 4: fix up any arguments */

/* if (err) return 4; */

return 0;
}

static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
Expand Down

0 comments on commit f95d45d

Please sign in to comment.