summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2012-10-24 15:47:54 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-24 22:25:11 (GMT)
commit4bb4021762c33e65645244a965001454cbda6145 (patch)
treecc237156e4c833cfe184685e88b0d08cae995c64
parenta56a8a3c4979b0c968a53ab9cdbf6887e8e6ba1e (diff)
downloadlinux-fsl-qoriq-4bb4021762c33e65645244a965001454cbda6145.tar.xz
staging: comedi: amplc_dio200: remove 'has_clk_gat_sce' from subdevice
The `has_clk_gat_sce` member of `struct dio200_subdev_8254` indicates whether the board has clock and gate source selection registers. The same information can be obtained from read-only board layout data so doesn't need to be set per '8254' counter subdevice. Eliminate the member and use the read-only data instead. The last parameter of `dio200_subdev_8254_init()` is used to initialize this member, so remove that parameter as well. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/comedi/drivers/amplc_dio200.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c
index bf4f6e3..bab2e64 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200.c
@@ -425,7 +425,6 @@ struct dio200_subdev_8254 {
unsigned long clk_sce_iobase; /* CLK_SCE base address */
unsigned long gat_sce_iobase; /* GAT_SCE base address */
int which; /* Bit 5 of CLK_SCE or GAT_SCE */
- int has_clk_gat_sce;
unsigned clock_src[3]; /* Current clock sources */
unsigned gate_src[3]; /* Current gate sources */
spinlock_t spinlock;
@@ -970,10 +969,11 @@ dio200_subdev_8254_set_gate_src(struct comedi_device *dev,
unsigned int counter_number,
unsigned int gate_src)
{
+ const struct dio200_layout *layout = dio200_dev_layout(dev);
struct dio200_subdev_8254 *subpriv = s->private;
unsigned char byte;
- if (!subpriv->has_clk_gat_sce)
+ if (!layout->has_clk_gat_sce)
return -1;
if (counter_number > 2)
return -1;
@@ -995,9 +995,10 @@ dio200_subdev_8254_get_gate_src(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned int counter_number)
{
+ const struct dio200_layout *layout = dio200_dev_layout(dev);
struct dio200_subdev_8254 *subpriv = s->private;
- if (!subpriv->has_clk_gat_sce)
+ if (!layout->has_clk_gat_sce)
return -1;
if (counter_number > 2)
return -1;
@@ -1014,10 +1015,11 @@ dio200_subdev_8254_set_clock_src(struct comedi_device *dev,
unsigned int counter_number,
unsigned int clock_src)
{
+ const struct dio200_layout *layout = dio200_dev_layout(dev);
struct dio200_subdev_8254 *subpriv = s->private;
unsigned char byte;
- if (!subpriv->has_clk_gat_sce)
+ if (!layout->has_clk_gat_sce)
return -1;
if (counter_number > 2)
return -1;
@@ -1040,10 +1042,11 @@ dio200_subdev_8254_get_clock_src(struct comedi_device *dev,
unsigned int counter_number,
unsigned int *period_ns)
{
+ const struct dio200_layout *layout = dio200_dev_layout(dev);
struct dio200_subdev_8254 *subpriv = s->private;
unsigned clock_src;
- if (!subpriv->has_clk_gat_sce)
+ if (!layout->has_clk_gat_sce)
return -1;
if (counter_number > 2)
return -1;
@@ -1117,9 +1120,9 @@ dio200_subdev_8254_config(struct comedi_device *dev, struct comedi_subdevice *s,
*/
static int
dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned long iobase, unsigned offset,
- int has_clk_gat_sce)
+ unsigned long iobase, unsigned offset)
{
+ const struct dio200_layout *layout = dio200_dev_layout(dev);
struct dio200_subdev_8254 *subpriv;
unsigned int chan;
@@ -1140,8 +1143,7 @@ dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
spin_lock_init(&subpriv->spinlock);
subpriv->iobase = offset + iobase;
- subpriv->has_clk_gat_sce = has_clk_gat_sce;
- if (has_clk_gat_sce) {
+ if (layout->has_clk_gat_sce) {
/* Derive CLK_SCE and GAT_SCE register offsets from
* 8254 offset. */
subpriv->clk_sce_iobase =
@@ -1155,7 +1157,7 @@ dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
for (chan = 0; chan < 3; chan++) {
i8254_set_mode(subpriv->iobase, 0, chan,
I8254_MODE0 | I8254_BINARY);
- if (subpriv->has_clk_gat_sce) {
+ if (layout->has_clk_gat_sce) {
/* Gate source 0 is VCC (logic 1). */
dio200_subdev_8254_set_gate_src(dev, s, chan, 0);
/* Clock source 0 is the dedicated clock input. */
@@ -1227,8 +1229,7 @@ static int dio200_common_attach(struct comedi_device *dev, unsigned long iobase,
case sd_8254:
/* counter subdevice (8254) */
ret = dio200_subdev_8254_init(dev, s, iobase,
- layout->sdinfo[n],
- layout->has_clk_gat_sce);
+ layout->sdinfo[n]);
if (ret < 0)
return ret;
break;