Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 317962
b: refs/heads/master
c: f782a25
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jul 16, 2012
1 parent 8c2cce6 commit 0c033e8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6c1a597924c486c53db4a75903a1e0a21264edd3
refs/heads/master: f782a255b93adc02e58024f9fc2c0e8fac35e7cf
29 changes: 22 additions & 7 deletions trunk/drivers/staging/comedi/drivers/rtd520.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,6 @@ struct rtdPrivate {
#define CHAN_ARRAY_CLEAR(array, index) \
(((array)[(index)/8] &= ~(1 << ((index) & 0x7))))

/*
* most drivers define the following macro to make it easy to
* access the private structure.
*/
#define devpriv ((struct rtdPrivate *)dev->private)

/*
Given a desired period and the clock period (both in ns),
return the proper counter value (divider-1).
Expand Down Expand Up @@ -453,6 +447,7 @@ static int rtd_ns_to_timer(unsigned int *ns, int round_mode)
static unsigned short rtdConvertChanGain(struct comedi_device *dev,
unsigned int comediChan, int chanIndex)
{ /* index in channel list */
struct rtdPrivate *devpriv = dev->private;
unsigned int chan, range, aref;
unsigned short r = 0;

Expand Down Expand Up @@ -505,6 +500,8 @@ static unsigned short rtdConvertChanGain(struct comedi_device *dev,
static void rtd_load_channelgain_list(struct comedi_device *dev,
unsigned int n_chan, unsigned int *list)
{
struct rtdPrivate *devpriv = dev->private;

if (n_chan > 1) { /* setup channel gain table */
int ii;

Expand All @@ -525,6 +522,7 @@ static void rtd_load_channelgain_list(struct comedi_device *dev,
empty status flag clears */
static int rtd520_probe_fifo_depth(struct comedi_device *dev)
{
struct rtdPrivate *devpriv = dev->private;
unsigned int chanspec = CR_PACK(0, 0, AREF_GROUND);
unsigned i;
static const unsigned limit = 0x2000;
Expand Down Expand Up @@ -572,6 +570,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn,
unsigned int *data)
{
struct rtdPrivate *devpriv = dev->private;
int n, ii;
int stat;

Expand Down Expand Up @@ -627,6 +626,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev,
static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s,
int count)
{
struct rtdPrivate *devpriv = dev->private;
int ii;

for (ii = 0; ii < count; ii++) {
Expand Down Expand Up @@ -667,6 +667,8 @@ static int ai_read_n(struct comedi_device *dev, struct comedi_subdevice *s,
*/
static int ai_read_dregs(struct comedi_device *dev, struct comedi_subdevice *s)
{
struct rtdPrivate *devpriv = dev->private;

while (readl(devpriv->las0 + LAS0_ADC) & FS_ADC_NOT_EMPTY) {
short sample;
s16 d = readw(devpriv->las1 + LAS1_ADC_FIFO);
Expand Down Expand Up @@ -697,6 +699,7 @@ static int ai_read_dregs(struct comedi_device *dev, struct comedi_subdevice *s)
*/
void abort_dma(struct comedi_device *dev, unsigned int channel)
{ /* DMA channel 0, 1 */
struct rtdPrivate *devpriv = dev->private;
unsigned long dma_cs_addr; /* the control/status register */
uint8_t status;
unsigned int ii;
Expand Down Expand Up @@ -755,6 +758,7 @@ void abort_dma(struct comedi_device *dev, unsigned int channel)
*/
static int ai_process_dma(struct comedi_device *dev, struct comedi_subdevice *s)
{
struct rtdPrivate *devpriv = dev->private;
int ii, n;
s16 *dp;

Expand Down Expand Up @@ -817,8 +821,9 @@ static int ai_process_dma(struct comedi_device *dev, struct comedi_subdevice *s)
static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */
void *d)
{ /* our data *//* cpu context (ignored) */
struct comedi_device *dev = d; /* must be called "dev" for devpriv */
struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->subdevices + 0; /* analog in subdevice */
struct rtdPrivate *devpriv = dev->private;
u32 overrun;
u16 status;
u16 fifoStatus;
Expand Down Expand Up @@ -1206,6 +1211,7 @@ static int rtd_ai_cmdtest(struct comedi_device *dev,
*/
static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{
struct rtdPrivate *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
int timer;

Expand Down Expand Up @@ -1417,6 +1423,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
*/
static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{
struct rtdPrivate *devpriv = dev->private;
u32 overrun;
u16 status;

Expand Down Expand Up @@ -1449,6 +1456,7 @@ static int rtd_ao_winsn(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn,
unsigned int *data)
{
struct rtdPrivate *devpriv = dev->private;
int i;
int chan = CR_CHAN(insn->chanspec);
int range = CR_RANGE(insn->chanspec);
Expand Down Expand Up @@ -1511,6 +1519,7 @@ static int rtd_ao_rinsn(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn,
unsigned int *data)
{
struct rtdPrivate *devpriv = dev->private;
int i;
int chan = CR_CHAN(insn->chanspec);

Expand All @@ -1535,6 +1544,8 @@ static int rtd_dio_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
struct rtdPrivate *devpriv = dev->private;

/* The insn data is a mask in data[0] and the new data
* in data[1], each channel cooresponding to a bit. */
if (data[0]) {
Expand All @@ -1560,6 +1571,7 @@ static int rtd_dio_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
struct rtdPrivate *devpriv = dev->private;
int chan = CR_CHAN(insn->chanspec);

/* The input or output configuration of each digital line is
Expand Down Expand Up @@ -1599,6 +1611,7 @@ static int rtd_dio_insn_config(struct comedi_device *dev,

static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{ /* board name and options flags */
struct rtdPrivate *devpriv;
struct comedi_subdevice *s;
struct pci_dev *pcidev;
int ret;
Expand All @@ -1623,6 +1636,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
*/
if (alloc_private(dev, sizeof(struct rtdPrivate)) < 0)
return -ENOMEM;
devpriv = dev->private;

/*
* Probe the device to determine what device in the series it is.
Expand Down Expand Up @@ -1949,6 +1963,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)

static void rtd_detach(struct comedi_device *dev)
{
struct rtdPrivate *devpriv = dev->private;
#ifdef USE_DMA
int index;
#endif
Expand Down

0 comments on commit 0c033e8

Please sign in to comment.