diff options
Diffstat (limited to 'drivers/staging/comedi/drivers/pcm3724.c')
-rw-r--r-- | drivers/staging/comedi/drivers/pcm3724.c | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/drivers/staging/comedi/drivers/pcm3724.c b/drivers/staging/comedi/drivers/pcm3724.c index a3ed3a0e855a..a5d6b1d9a1aa 100644 --- a/drivers/staging/comedi/drivers/pcm3724.c +++ b/drivers/staging/comedi/drivers/pcm3724.c @@ -62,18 +62,18 @@ Copy/pasted/hacked from pcm724.c #define CR_A_MODE(a) ((a)<<5) #define CR_CW 0x80 -static int pcm3724_attach(struct comedi_device * dev, struct comedi_devconfig * it); -static int pcm3724_detach(struct comedi_device * dev); +static int pcm3724_attach(struct comedi_device *dev, struct comedi_devconfig *it); +static int pcm3724_detach(struct comedi_device *dev); struct pcm3724_board { - const char *name; // driver name - int dio; // num of DIO - int numofports; // num of 8255 subdevices - unsigned int IRQbits; // allowed interrupts - unsigned int io_range; // len of IO space + const char *name; /* driver name */ + int dio; /* num of DIO */ + int numofports; /* num of 8255 subdevices */ + unsigned int IRQbits; /* allowed interrupts */ + unsigned int io_range; /* len of IO space */ }; -//used to track configured dios +/* used to track configured dios */ struct priv_pcm3724 { int dio_1; int dio_2; @@ -87,36 +87,36 @@ static const struct pcm3724_board boardtypes[] = { #define this_board ((const struct pcm3724_board *)dev->board_ptr) static struct comedi_driver driver_pcm3724 = { - driver_name:"pcm3724", - module:THIS_MODULE, - attach:pcm3724_attach, - detach:pcm3724_detach, - board_name:&boardtypes[0].name, - num_names:n_boardtypes, - offset:sizeof(struct pcm3724_board), + .driver_name = "pcm3724", + .module = THIS_MODULE, + .attach = pcm3724_attach, + .detach = pcm3724_detach, + .board_name = &boardtypes[0].name, + .num_names = n_boardtypes, + .offset = sizeof(struct pcm3724_board), }; COMEDI_INITCLEANUP(driver_pcm3724); -// (setq c-basic-offset 8) +/* (setq c-basic-offset 8) */ static int subdev_8255_cb(int dir, int port, int data, unsigned long arg) { unsigned long iobase = arg; unsigned char inbres; - //printk("8255cb %d %d %d %lx\n", dir,port,data,arg); + /* printk("8255cb %d %d %d %lx\n", dir,port,data,arg); */ if (dir) { - //printk("8255 cb outb(%x, %lx)\n", data, iobase+port); + /* printk("8255 cb outb(%x, %lx)\n", data, iobase+port); */ outb(data, iobase + port); return 0; } else { inbres = inb(iobase + port); - //printk("8255 cb inb(%lx) = %x\n", iobase+port, inbres); + /* printk("8255 cb inb(%lx) = %x\n", iobase+port, inbres); */ return inbres; } } -static int compute_buffer(int config, int devno, struct comedi_subdevice * s) +static int compute_buffer(int config, int devno, struct comedi_subdevice *s) { /* 1 in io_bits indicates output */ if (s->io_bits & 0x0000ff) { @@ -143,7 +143,7 @@ static int compute_buffer(int config, int devno, struct comedi_subdevice * s) return config; } -static void do_3724_config(struct comedi_device * dev, struct comedi_subdevice * s, +static void do_3724_config(struct comedi_device *dev, struct comedi_subdevice *s, int chanspec) { int config; @@ -173,11 +173,11 @@ static void do_3724_config(struct comedi_device * dev, struct comedi_subdevice * port_8255_cfg = dev->iobase + SIZE_8255 + _8255_CR; } outb(buffer_config, dev->iobase + 8); /* update buffer register */ - //printk("pcm3724 buffer_config (%lx) %d, %x\n", dev->iobase + _8255_CR, chanspec, buffer_config); + /* printk("pcm3724 buffer_config (%lx) %d, %x\n", dev->iobase + _8255_CR, chanspec, buffer_config); */ outb(config, port_8255_cfg); } -static void enable_chan(struct comedi_device * dev, struct comedi_subdevice * s, int chanspec) +static void enable_chan(struct comedi_device *dev, struct comedi_subdevice *s, int chanspec) { unsigned int mask; int gatecfg; @@ -187,9 +187,9 @@ static void enable_chan(struct comedi_device * dev, struct comedi_subdevice * s, priv = (struct priv_pcm3724 *) (dev->private); mask = 1 << CR_CHAN(chanspec); - if (s == dev->subdevices) { // subdev 0 + if (s == dev->subdevices) { /* subdev 0 */ priv->dio_1 |= mask; - } else { //subdev 1 + } else { /* subdev 1 */ priv->dio_2 |= mask; } if (priv->dio_1 & 0xff0000) { @@ -210,13 +210,13 @@ static void enable_chan(struct comedi_device * dev, struct comedi_subdevice * s, if (priv->dio_2 & 0xff) { gatecfg |= GATE_A1; } - // printk("gate control %x\n", gatecfg); + /* printk("gate control %x\n", gatecfg); */ outb(gatecfg, dev->iobase + 9); } /* overriding the 8255 insn config */ -static int subdev_3724_insn_config(struct comedi_device * dev, struct comedi_subdevice * s, - struct comedi_insn * insn, unsigned int * data) +static int subdev_3724_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { unsigned int mask; unsigned int bits; @@ -252,7 +252,7 @@ static int subdev_3724_insn_config(struct comedi_device * dev, struct comedi_sub return 1; } -static int pcm3724_attach(struct comedi_device * dev, struct comedi_devconfig * it) +static int pcm3724_attach(struct comedi_device *dev, struct comedi_devconfig *it) { unsigned long iobase; unsigned int iorange; @@ -260,7 +260,9 @@ static int pcm3724_attach(struct comedi_device * dev, struct comedi_devconfig * iobase = it->options[0]; iorange = this_board->io_range; - if ((ret = alloc_private(dev, sizeof(struct priv_pcm3724))) < 0) + + ret = alloc_private(dev, sizeof(struct priv_pcm3724)); + if (ret < 0) return -ENOMEM; ((struct priv_pcm3724 *) (dev->private))->dio_1 = 0; @@ -279,7 +281,8 @@ static int pcm3724_attach(struct comedi_device * dev, struct comedi_devconfig * n_subdevices = this_board->numofports; - if ((ret = alloc_subdevices(dev, n_subdevices)) < 0) + ret = alloc_subdevices(dev, n_subdevices); + if (ret < 0) return ret; for (i = 0; i < dev->n_subdevices; i++) { @@ -290,7 +293,7 @@ static int pcm3724_attach(struct comedi_device * dev, struct comedi_devconfig * return 0; } -static int pcm3724_detach(struct comedi_device * dev) +static int pcm3724_detach(struct comedi_device *dev) { int i; |