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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a56a8a3c49
commit
4bb4021762
@@ -425,7 +425,6 @@ struct dio200_subdev_8254 {
|
|||||||
unsigned long clk_sce_iobase; /* CLK_SCE base address */
|
unsigned long clk_sce_iobase; /* CLK_SCE base address */
|
||||||
unsigned long gat_sce_iobase; /* GAT_SCE base address */
|
unsigned long gat_sce_iobase; /* GAT_SCE base address */
|
||||||
int which; /* Bit 5 of CLK_SCE or GAT_SCE */
|
int which; /* Bit 5 of CLK_SCE or GAT_SCE */
|
||||||
int has_clk_gat_sce;
|
|
||||||
unsigned clock_src[3]; /* Current clock sources */
|
unsigned clock_src[3]; /* Current clock sources */
|
||||||
unsigned gate_src[3]; /* Current gate sources */
|
unsigned gate_src[3]; /* Current gate sources */
|
||||||
spinlock_t spinlock;
|
spinlock_t spinlock;
|
||||||
@@ -970,10 +969,11 @@ dio200_subdev_8254_set_gate_src(struct comedi_device *dev,
|
|||||||
unsigned int counter_number,
|
unsigned int counter_number,
|
||||||
unsigned int gate_src)
|
unsigned int gate_src)
|
||||||
{
|
{
|
||||||
|
const struct dio200_layout *layout = dio200_dev_layout(dev);
|
||||||
struct dio200_subdev_8254 *subpriv = s->private;
|
struct dio200_subdev_8254 *subpriv = s->private;
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
|
|
||||||
if (!subpriv->has_clk_gat_sce)
|
if (!layout->has_clk_gat_sce)
|
||||||
return -1;
|
return -1;
|
||||||
if (counter_number > 2)
|
if (counter_number > 2)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -995,9 +995,10 @@ dio200_subdev_8254_get_gate_src(struct comedi_device *dev,
|
|||||||
struct comedi_subdevice *s,
|
struct comedi_subdevice *s,
|
||||||
unsigned int counter_number)
|
unsigned int counter_number)
|
||||||
{
|
{
|
||||||
|
const struct dio200_layout *layout = dio200_dev_layout(dev);
|
||||||
struct dio200_subdev_8254 *subpriv = s->private;
|
struct dio200_subdev_8254 *subpriv = s->private;
|
||||||
|
|
||||||
if (!subpriv->has_clk_gat_sce)
|
if (!layout->has_clk_gat_sce)
|
||||||
return -1;
|
return -1;
|
||||||
if (counter_number > 2)
|
if (counter_number > 2)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1014,10 +1015,11 @@ dio200_subdev_8254_set_clock_src(struct comedi_device *dev,
|
|||||||
unsigned int counter_number,
|
unsigned int counter_number,
|
||||||
unsigned int clock_src)
|
unsigned int clock_src)
|
||||||
{
|
{
|
||||||
|
const struct dio200_layout *layout = dio200_dev_layout(dev);
|
||||||
struct dio200_subdev_8254 *subpriv = s->private;
|
struct dio200_subdev_8254 *subpriv = s->private;
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
|
|
||||||
if (!subpriv->has_clk_gat_sce)
|
if (!layout->has_clk_gat_sce)
|
||||||
return -1;
|
return -1;
|
||||||
if (counter_number > 2)
|
if (counter_number > 2)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1040,10 +1042,11 @@ dio200_subdev_8254_get_clock_src(struct comedi_device *dev,
|
|||||||
unsigned int counter_number,
|
unsigned int counter_number,
|
||||||
unsigned int *period_ns)
|
unsigned int *period_ns)
|
||||||
{
|
{
|
||||||
|
const struct dio200_layout *layout = dio200_dev_layout(dev);
|
||||||
struct dio200_subdev_8254 *subpriv = s->private;
|
struct dio200_subdev_8254 *subpriv = s->private;
|
||||||
unsigned clock_src;
|
unsigned clock_src;
|
||||||
|
|
||||||
if (!subpriv->has_clk_gat_sce)
|
if (!layout->has_clk_gat_sce)
|
||||||
return -1;
|
return -1;
|
||||||
if (counter_number > 2)
|
if (counter_number > 2)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1117,9 +1120,9 @@ dio200_subdev_8254_config(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
|
dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
|
||||||
unsigned long iobase, unsigned offset,
|
unsigned long iobase, unsigned offset)
|
||||||
int has_clk_gat_sce)
|
|
||||||
{
|
{
|
||||||
|
const struct dio200_layout *layout = dio200_dev_layout(dev);
|
||||||
struct dio200_subdev_8254 *subpriv;
|
struct dio200_subdev_8254 *subpriv;
|
||||||
unsigned int chan;
|
unsigned int chan;
|
||||||
|
|
||||||
@@ -1140,8 +1143,7 @@ dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||||||
|
|
||||||
spin_lock_init(&subpriv->spinlock);
|
spin_lock_init(&subpriv->spinlock);
|
||||||
subpriv->iobase = offset + iobase;
|
subpriv->iobase = offset + iobase;
|
||||||
subpriv->has_clk_gat_sce = has_clk_gat_sce;
|
if (layout->has_clk_gat_sce) {
|
||||||
if (has_clk_gat_sce) {
|
|
||||||
/* Derive CLK_SCE and GAT_SCE register offsets from
|
/* Derive CLK_SCE and GAT_SCE register offsets from
|
||||||
* 8254 offset. */
|
* 8254 offset. */
|
||||||
subpriv->clk_sce_iobase =
|
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++) {
|
for (chan = 0; chan < 3; chan++) {
|
||||||
i8254_set_mode(subpriv->iobase, 0, chan,
|
i8254_set_mode(subpriv->iobase, 0, chan,
|
||||||
I8254_MODE0 | I8254_BINARY);
|
I8254_MODE0 | I8254_BINARY);
|
||||||
if (subpriv->has_clk_gat_sce) {
|
if (layout->has_clk_gat_sce) {
|
||||||
/* Gate source 0 is VCC (logic 1). */
|
/* Gate source 0 is VCC (logic 1). */
|
||||||
dio200_subdev_8254_set_gate_src(dev, s, chan, 0);
|
dio200_subdev_8254_set_gate_src(dev, s, chan, 0);
|
||||||
/* Clock source 0 is the dedicated clock input. */
|
/* 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:
|
case sd_8254:
|
||||||
/* counter subdevice (8254) */
|
/* counter subdevice (8254) */
|
||||||
ret = dio200_subdev_8254_init(dev, s, iobase,
|
ret = dio200_subdev_8254_init(dev, s, iobase,
|
||||||
layout->sdinfo[n],
|
layout->sdinfo[n]);
|
||||||
layout->has_clk_gat_sce);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user