From 82a0bdd1c5a50c31340b43281cbafb51c4f101c2 Mon Sep 17 00:00:00 2001 From: Ravishankar Date: Thu, 7 Jul 2011 21:14:43 +0530 Subject: [PATCH] --- yaml --- r: 260017 b: refs/heads/master c: 33e73e0085089a2653cd638c990996b90833819b h: refs/heads/master i: 260015: b2c8eaf02e3c25bb2639f19d7d3f5fbe64e4f906 v: v3 --- [refs] | 2 +- .../drivers/staging/comedi/drivers/unioxx5.c | 46 ++++++++++++------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/[refs] b/[refs] index 357bf2bd9c4d..cf0fafaf27cb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e9d1cf89ed5561adc1d36aea6d1349d12dfedd74 +refs/heads/master: 33e73e0085089a2653cd638c990996b90833819b diff --git a/trunk/drivers/staging/comedi/drivers/unioxx5.c b/trunk/drivers/staging/comedi/drivers/unioxx5.c index 598884ec3ede..89e62aa134b0 100644 --- a/trunk/drivers/staging/comedi/drivers/unioxx5.c +++ b/trunk/drivers/staging/comedi/drivers/unioxx5.c @@ -75,8 +75,10 @@ Devices: [Fastwel] UNIOxx-5 (unioxx5), /* 'private' structure for each subdevice */ struct unioxx5_subd_priv { int usp_iobase; - unsigned char usp_module_type[12]; /* 12 modules. each can be 70L or 73L */ - unsigned char usp_extra_data[12][4]; /* for saving previous written value for analog modules */ + /* 12 modules. each can be 70L or 73L */ + unsigned char usp_module_type[12]; + /* for saving previous written value for analog modules */ + unsigned char usp_extra_data[12][4]; unsigned char usp_prev_wr_val[3]; /* previous written value */ unsigned char usp_prev_cn_val[3]; /* previous channel value */ }; @@ -169,7 +171,7 @@ static int unioxx5_attach(struct comedi_device *dev, return -1; } - printk("attached\n"); + printk(KERN_INFO "attached\n"); return 0; } @@ -181,7 +183,8 @@ static int unioxx5_subdev_read(struct comedi_device *dev, int channel, type; channel = CR_CHAN(insn->chanspec); - type = usp->usp_module_type[channel / 2]; /* defining module type(analog or digital) */ + /* defining module type(analog or digital) */ + type = usp->usp_module_type[channel / 2]; if (type == MODULE_DIGITAL) { if (!__unioxx5_digital_read(usp, data, channel, dev->minor)) @@ -202,7 +205,8 @@ static int unioxx5_subdev_write(struct comedi_device *dev, int channel, type; channel = CR_CHAN(insn->chanspec); - type = usp->usp_module_type[channel / 2]; /* defining module type(analog or digital) */ + /* defining module type(analog or digital) */ + type = usp->usp_module_type[channel / 2]; if (type == MODULE_DIGITAL) { if (!__unioxx5_digital_write(usp, data, channel, dev->minor)) @@ -261,9 +265,12 @@ static int unioxx5_insn_config(struct comedi_device *dev, * change channel type on input or output) * \* */ outb(1, usp->usp_iobase + 0); - outb(flags, usp->usp_iobase + channel_offset); /* changes type of _one_ channel */ - outb(0, usp->usp_iobase + 0); /* sets channels bank to 0(allows directly input/output) */ - usp->usp_prev_cn_val[channel_offset - 1] = flags; /* saves written value */ + /* changes type of _one_ channel */ + outb(flags, usp->usp_iobase + channel_offset); + /* sets channels bank to 0(allows directly input/output) */ + outb(0, usp->usp_iobase + 0); + /* saves written value */ + usp->usp_prev_cn_val[channel_offset - 1] = flags; return 0; } @@ -304,14 +311,15 @@ static int __unioxx5_subdev_init(struct comedi_subdevice *subdev, } usp->usp_iobase = subdev_iobase; - printk("comedi%d: |", minor); + printk(KERN_INFO "comedi%d: |", minor); /* defining modules types */ for (i = 0; i < 12; i++) { to = 10000; __unioxx5_analog_config(usp, i * 2); - outb(i + 1, subdev_iobase + 5); /* sends channel number to card */ + /* sends channel number to card */ + outb(i + 1, subdev_iobase + 5); outb('H', subdev_iobase + 6); /* requests EEPROM world */ while (!(inb(subdev_iobase + 0) & TxBE)) ; /* waits while writting will be allowed */ @@ -346,9 +354,10 @@ static int __unioxx5_subdev_init(struct comedi_subdevice *subdev, subdev->range_table = &range_digital; subdev->insn_read = unioxx5_subdev_read; subdev->insn_write = unioxx5_subdev_write; - subdev->insn_config = unioxx5_insn_config; /* for digital modules only!!! */ + /* for digital modules only!!! */ + subdev->insn_config = unioxx5_insn_config; - printk("subdevice configured\n"); + printk(KERN_INFO "subdevice configured\n"); return 0; } @@ -367,7 +376,8 @@ static int __unioxx5_digital_write(struct unioxx5_subd_priv *usp, return 0; } - val = usp->usp_prev_wr_val[channel_offset - 1]; /* getting previous written value */ + /* getting previous written value */ + val = usp->usp_prev_wr_val[channel_offset - 1]; if (*data) val |= mask; @@ -375,7 +385,8 @@ static int __unioxx5_digital_write(struct unioxx5_subd_priv *usp, val &= ~mask; outb(val, usp->usp_iobase + channel_offset); - usp->usp_prev_wr_val[channel_offset - 1] = val; /* saving new written value */ + /* saving new written value */ + usp->usp_prev_wr_val[channel_offset - 1] = val; return 1; } @@ -399,7 +410,6 @@ static int __unioxx5_digital_read(struct unioxx5_subd_priv *usp, if (channel_offset > 1) channel -= 2 << channel_offset; /* this operation is created for correct readed value to 0 or 1 */ - *data >>= channel; return 1; } @@ -444,7 +454,8 @@ static int __unioxx5_analog_write(struct unioxx5_subd_priv *usp, usp->usp_extra_data[module][i] = (unsigned char)((*data & 0xFF00) >> 8); /* while(!((inb(usp->usp_iobase + 0)) & TxBE)); */ - outb(module + 1, usp->usp_iobase + 5); /* sending module number to card(1 .. 12) */ + /* sending module number to card(1 .. 12) */ + outb(module + 1, usp->usp_iobase + 5); outb('W', usp->usp_iobase + 6); /* sends (W)rite command to module */ /* sending for bytes to module(one byte per cycle iteration) */ @@ -475,7 +486,8 @@ static int __unioxx5_analog_read(struct unioxx5_subd_priv *usp, } __unioxx5_analog_config(usp, channel); - outb(module_no + 1, usp->usp_iobase + 5); /* sends module number to card(1 .. 12) */ + /* sends module number to card(1 .. 12) */ + outb(module_no + 1, usp->usp_iobase + 5); outb('V', usp->usp_iobase + 6); /* sends to module (V)erify command */ control = inb(usp->usp_iobase); /* get control register byte */