#define PARPORT_B 1
#define PARPORT_C 2
-static int parport_attach(comedi_device * dev, comedi_devconfig * it);
-static int parport_detach(comedi_device * dev);
+static int parport_attach(comedi_device *dev, comedi_devconfig *it);
+static int parport_detach(comedi_device *dev);
static comedi_driver driver_parport = {
- driver_name:"comedi_parport",
- module:THIS_MODULE,
- attach:parport_attach,
- detach:parport_detach,
+ .driver_name = "comedi_parport",
+ .module = THIS_MODULE,
+ .attach = parport_attach,
+ .detach = parport_detach,
};
COMEDI_INITCLEANUP(driver_parport);
-typedef struct parport_private_struct {
+struct parport_private {
unsigned int a_data;
unsigned int c_data;
int enable_irq;
-} parport_private;
-#define devpriv ((parport_private *)(dev->private))
+};
+#define devpriv ((struct parport_private *)(dev->private))
-static int parport_insn_a(comedi_device * dev, comedi_subdevice * s,
- comedi_insn * insn, lsampl_t * data)
+static int parport_insn_a(comedi_device *dev, comedi_subdevice *s,
+ comedi_insn *insn, lsampl_t *data)
{
if (data[0]) {
devpriv->a_data &= ~data[0];
return 2;
}
-static int parport_insn_config_a(comedi_device * dev, comedi_subdevice * s,
- comedi_insn * insn, lsampl_t * data)
+static int parport_insn_config_a(comedi_device *dev, comedi_subdevice *s,
+ comedi_insn *insn, lsampl_t *data)
{
if (data[0]) {
s->io_bits = 0xff;
return 1;
}
-static int parport_insn_b(comedi_device * dev, comedi_subdevice * s,
- comedi_insn * insn, lsampl_t * data)
+static int parport_insn_b(comedi_device *dev, comedi_subdevice *s,
+ comedi_insn *insn, lsampl_t *data)
{
if (data[0]) {
- // should writes be ignored?
+ /* should writes be ignored? */
+ /* anyone??? */
}
data[1] = (inb(dev->iobase + PARPORT_B) >> 3);
return 2;
}
-static int parport_insn_c(comedi_device * dev, comedi_subdevice * s,
- comedi_insn * insn, lsampl_t * data)
+static int parport_insn_c(comedi_device *dev, comedi_subdevice *s,
+ comedi_insn *insn, lsampl_t *data)
{
data[0] &= 0x0f;
if (data[0]) {
return 2;
}
-static int parport_intr_insn(comedi_device * dev, comedi_subdevice * s,
- comedi_insn * insn, lsampl_t * data)
+static int parport_intr_insn(comedi_device *dev, comedi_subdevice *s,
+ comedi_insn *insn, lsampl_t *data)
{
if (insn->n < 1)
return -EINVAL;
return 2;
}
-static int parport_intr_cmdtest(comedi_device * dev, comedi_subdevice * s,
- comedi_cmd * cmd)
+static int parport_intr_cmdtest(comedi_device *dev, comedi_subdevice *s,
+ comedi_cmd *cmd)
{
int err = 0;
int tmp;
return 0;
}
-static int parport_intr_cmd(comedi_device * dev, comedi_subdevice * s)
+static int parport_intr_cmd(comedi_device *dev, comedi_subdevice *s)
{
devpriv->c_data |= 0x10;
outb(devpriv->c_data, dev->iobase + PARPORT_C);
return 0;
}
-static int parport_intr_cancel(comedi_device * dev, comedi_subdevice * s)
+static int parport_intr_cancel(comedi_device *dev, comedi_subdevice *s)
{
- printk("parport_intr_cancel()\n");
+ printk(KERN_DEBUG "parport_intr_cancel()\n");
devpriv->c_data &= ~0x10;
outb(devpriv->c_data, dev->iobase + PARPORT_C);
comedi_subdevice *s = dev->subdevices + 3;
if (!devpriv->enable_irq) {
- printk("comedi_parport: bogus irq, ignored\n");
+ printk(KERN_ERR "comedi_parport: bogus irq, ignored\n");
return IRQ_NONE;
}
return IRQ_HANDLED;
}
-static int parport_attach(comedi_device * dev, comedi_devconfig * it)
+static int parport_attach(comedi_device *dev, comedi_devconfig *it)
{
int ret;
unsigned int irq;
comedi_subdevice *s;
iobase = it->options[0];
- printk("comedi%d: parport: 0x%04lx ", dev->minor, iobase);
+ printk(KERN_INFO "comedi%d: parport: 0x%04lx ", dev->minor, iobase);
if (!request_region(iobase, PARPORT_SIZE, "parport (comedi)")) {
printk("I/O port conflict\n");
return -EIO;
}
dev->board_name = "parport";
- if ((ret = alloc_subdevices(dev, 4)) < 0)
+ ret = alloc_subdevices(dev, 4);
+ if (ret < 0)
return ret;
- if ((ret = alloc_private(dev, sizeof(parport_private))) < 0)
+ ret = alloc_private(dev, sizeof(struct parport_private));
+ if (ret < 0)
return ret;
s = dev->subdevices + 0;
return 1;
}
-static int parport_detach(comedi_device * dev)
+static int parport_detach(comedi_device *dev)
{
printk("comedi%d: parport: remove\n", dev->minor);