Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 669c930c authored by Benjamin Adolphi's avatar Benjamin Adolphi Committed by Greg Kroah-Hartman
Browse files

Staging: comedi: amplc_dio200: Checkpatch cleanups



This fixes all checkpatch issues in the amplc_dio200 comedi driver.

Signed-off-by: default avatarBenjamin Adolphi <b.adolphi@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e20ad20d
Loading
Loading
Loading
Loading
+51 −71
Original line number Original line Diff line number Diff line
@@ -435,11 +435,13 @@ MODULE_DEVICE_TABLE(pci, dio200_pci_table);
 * Useful for shorthand access to the particular board structure
 * Useful for shorthand access to the particular board structure
 */
 */
#define thisboard ((const struct dio200_board *)dev->board_ptr)
#define thisboard ((const struct dio200_board *)dev->board_ptr)
#define thislayout (&dio200_layouts[((struct dio200_board *)dev->board_ptr)->layout])
#define thislayout (&dio200_layouts[((struct dio200_board *) \
		    dev->board_ptr)->layout])


/* this structure is for data unique to this hardware driver.  If
/* this structure is for data unique to this hardware driver.  If
   several hardware drivers keep similar information in this structure,
   several hardware drivers keep similar information in this structure,
   feel free to suggest moving the variable to the struct comedi_device struct.  */
   feel free to suggest moving the variable to the struct comedi_device struct.
 */
struct dio200_private {
struct dio200_private {
#ifdef CONFIG_COMEDI_PCI
#ifdef CONFIG_COMEDI_PCI
	struct pci_dev *pci_dev;	/* PCI device */
	struct pci_dev *pci_dev;	/* PCI device */
@@ -603,10 +605,9 @@ static void dio200_stop_intr(struct comedi_device *dev,


	subpriv->active = 0;
	subpriv->active = 0;
	subpriv->enabled_isns = 0;
	subpriv->enabled_isns = 0;
	if (subpriv->has_int_sce) {
	if (subpriv->has_int_sce)
		outb(0, subpriv->iobase);
		outb(0, subpriv->iobase);
}
}
}


/*
/*
 * Called to start acquisition for an 'INTERRUPT' subdevice.
 * Called to start acquisition for an 'INTERRUPT' subdevice.
@@ -629,17 +630,15 @@ static int dio200_start_intr(struct comedi_device *dev,
		/* Determine interrupt sources to enable. */
		/* Determine interrupt sources to enable. */
		isn_bits = 0;
		isn_bits = 0;
		if (cmd->chanlist) {
		if (cmd->chanlist) {
			for (n = 0; n < cmd->chanlist_len; n++) {
			for (n = 0; n < cmd->chanlist_len; n++)
				isn_bits |= (1U << CR_CHAN(cmd->chanlist[n]));
				isn_bits |= (1U << CR_CHAN(cmd->chanlist[n]));
		}
		}
		}
		isn_bits &= subpriv->valid_isns;
		isn_bits &= subpriv->valid_isns;
		/* Enable interrupt sources. */
		/* Enable interrupt sources. */
		subpriv->enabled_isns = isn_bits;
		subpriv->enabled_isns = isn_bits;
		if (subpriv->has_int_sce) {
		if (subpriv->has_int_sce)
			outb(isn_bits, subpriv->iobase);
			outb(isn_bits, subpriv->iobase);
	}
	}
	}


	return retval;
	return retval;
}
}
@@ -662,14 +661,13 @@ dio200_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s,


	spin_lock_irqsave(&subpriv->spinlock, flags);
	spin_lock_irqsave(&subpriv->spinlock, flags);
	s->async->inttrig = 0;
	s->async->inttrig = 0;
	if (subpriv->active) {
	if (subpriv->active)
		event = dio200_start_intr(dev, s);
		event = dio200_start_intr(dev, s);
	}

	spin_unlock_irqrestore(&subpriv->spinlock, flags);
	spin_unlock_irqrestore(&subpriv->spinlock, flags);


	if (event) {
	if (event)
		comedi_event(dev, s);
		comedi_event(dev, s);
	}


	return 1;
	return 1;
}
}
@@ -726,9 +724,8 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
		 * Reenable them NOW to minimize the time they are disabled.
		 * Reenable them NOW to minimize the time they are disabled.
		 */
		 */
		cur_enabled = subpriv->enabled_isns;
		cur_enabled = subpriv->enabled_isns;
		if (subpriv->has_int_sce) {
		if (subpriv->has_int_sce)
			outb(cur_enabled, subpriv->iobase);
			outb(cur_enabled, subpriv->iobase);
		}


		if (subpriv->active) {
		if (subpriv->active) {
			/*
			/*
@@ -747,10 +744,9 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
				len = s->async->cmd.chanlist_len;
				len = s->async->cmd.chanlist_len;
				for (n = 0; n < len; n++) {
				for (n = 0; n < len; n++) {
					ch = CR_CHAN(s->async->cmd.chanlist[n]);
					ch = CR_CHAN(s->async->cmd.chanlist[n]);
					if (triggered & (1U << ch)) {
					if (triggered & (1U << ch))
						val |= (1U << n);
						val |= (1U << n);
				}
				}
				}
				/* Write the scan to the buffer. */
				/* Write the scan to the buffer. */
				if (comedi_buf_put(s->async, val)) {
				if (comedi_buf_put(s->async, val)) {
					s->async->events |= (COMEDI_CB_BLOCK |
					s->async->events |= (COMEDI_CB_BLOCK |
@@ -781,9 +777,8 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
	}
	}
	spin_unlock_irqrestore(&subpriv->spinlock, flags);
	spin_unlock_irqrestore(&subpriv->spinlock, flags);


	if (oldevents != s->async->events) {
	if (oldevents != s->async->events)
		comedi_event(dev, s);
		comedi_event(dev, s);
	}


	return (triggered != 0);
	return (triggered != 0);
}
}
@@ -798,9 +793,9 @@ static int dio200_subdev_intr_cancel(struct comedi_device *dev,
	unsigned long flags;
	unsigned long flags;


	spin_lock_irqsave(&subpriv->spinlock, flags);
	spin_lock_irqsave(&subpriv->spinlock, flags);
	if (subpriv->active) {
	if (subpriv->active)
		dio200_stop_intr(dev, s);
		dio200_stop_intr(dev, s);
	}

	spin_unlock_irqrestore(&subpriv->spinlock, flags);
	spin_unlock_irqrestore(&subpriv->spinlock, flags);


	return 0;
	return 0;
@@ -846,7 +841,8 @@ dio200_subdev_intr_cmdtest(struct comedi_device *dev,
	if (err)
	if (err)
		return 1;
		return 1;


	/* step 2: make sure trigger sources are unique and mutually compatible */
	/* step 2: make sure trigger sources are unique and mutually
		   compatible */


	/* these tests are true if more than one _src bit is set */
	/* these tests are true if more than one _src bit is set */
	if ((cmd->start_src & (cmd->start_src - 1)) != 0)
	if ((cmd->start_src & (cmd->start_src - 1)) != 0)
@@ -952,9 +948,8 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev,
	}
	}
	spin_unlock_irqrestore(&subpriv->spinlock, flags);
	spin_unlock_irqrestore(&subpriv->spinlock, flags);


	if (event) {
	if (event)
		comedi_event(dev, s);
		comedi_event(dev, s);
	}


	return 0;
	return 0;
}
}
@@ -980,9 +975,8 @@ dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s,
	subpriv->valid_isns = valid_isns;
	subpriv->valid_isns = valid_isns;
	spin_lock_init(&subpriv->spinlock);
	spin_lock_init(&subpriv->spinlock);


	if (has_int_sce) {
	if (has_int_sce)
		outb(0, subpriv->iobase);	/* Disable interrupt sources. */
		outb(0, subpriv->iobase);	/* Disable interrupt sources. */
	}


	s->private = subpriv;
	s->private = subpriv;
	s->type = COMEDI_SUBD_DI;
	s->type = COMEDI_SUBD_DI;
@@ -1013,11 +1007,8 @@ dio200_subdev_intr_cleanup(struct comedi_device *dev,
			   struct comedi_subdevice *s)
			   struct comedi_subdevice *s)
{
{
	struct dio200_subdev_intr *subpriv = s->private;
	struct dio200_subdev_intr *subpriv = s->private;

	if (subpriv) {
	kfree(subpriv);
	kfree(subpriv);
}
}
}


/*
/*
 * Interrupt service routine.
 * Interrupt service routine.
@@ -1027,9 +1018,8 @@ static irqreturn_t dio200_interrupt(int irq, void *d)
	struct comedi_device *dev = d;
	struct comedi_device *dev = d;
	int handled;
	int handled;


	if (!dev->attached) {
	if (!dev->attached)
		return IRQ_NONE;
		return IRQ_NONE;
	}


	if (devpriv->intr_sd >= 0) {
	if (devpriv->intr_sd >= 0) {
		handled = dio200_handle_read_intr(dev,
		handled = dio200_handle_read_intr(dev,
@@ -1266,11 +1256,8 @@ dio200_subdev_8254_cleanup(struct comedi_device *dev,
			   struct comedi_subdevice *s)
			   struct comedi_subdevice *s)
{
{
	struct dio200_subdev_intr *subpriv = s->private;
	struct dio200_subdev_intr *subpriv = s->private;

	if (subpriv) {
	kfree(subpriv);
	kfree(subpriv);
}
}
}


/*
/*
 * Attach is called by the Comedi core to configure the driver
 * Attach is called by the Comedi core to configure the driver
@@ -1348,10 +1335,9 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
#endif
#endif
	{
	{
		ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE);
		ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE);
		if (ret < 0) {
		if (ret < 0)
			return ret;
			return ret;
	}
	}
	}
	dev->iobase = iobase;
	dev->iobase = iobase;


	layout = thislayout;
	layout = thislayout;
@@ -1371,17 +1357,17 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
			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);
						      layout->has_clk_gat_sce);
			if (ret < 0) {
			if (ret < 0)
				return ret;
				return ret;
			}

			break;
			break;
		case sd_8255:
		case sd_8255:
			/* digital i/o subdevice (8255) */
			/* digital i/o subdevice (8255) */
			ret = subdev_8255_init(dev, s, 0,
			ret = subdev_8255_init(dev, s, 0,
					       iobase + layout->sdinfo[n]);
					       iobase + layout->sdinfo[n]);
			if (ret < 0) {
			if (ret < 0)
				return ret;
				return ret;
			}

			break;
			break;
		case sd_intr:
		case sd_intr:
			/* 'INTERRUPT' subdevice */
			/* 'INTERRUPT' subdevice */
@@ -1392,9 +1378,9 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
							      layout->sdinfo[n],
							      layout->sdinfo[n],
							      layout->
							      layout->
							      has_int_sce);
							      has_int_sce);
				if (ret < 0) {
				if (ret < 0)
					return ret;
					return ret;
				}

				devpriv->intr_sd = n;
				devpriv->intr_sd = n;
			} else {
			} else {
				s->type = COMEDI_SUBD_UNUSED;
				s->type = COMEDI_SUBD_UNUSED;
@@ -1407,9 +1393,8 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	}
	}


	sdx = devpriv->intr_sd;
	sdx = devpriv->intr_sd;
	if (sdx >= 0 && sdx < dev->n_subdevices) {
	if (sdx >= 0 && sdx < dev->n_subdevices)
		dev->read_subdev = &dev->subdevices[sdx];
		dev->read_subdev = &dev->subdevices[sdx];
	}


	dev->board_name = thisboard->name;
	dev->board_name = thisboard->name;


@@ -1434,11 +1419,10 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
		printk("(pci %s) ", pci_name(pci_dev));
		printk("(pci %s) ", pci_name(pci_dev));
#endif
#endif
	}
	}
	if (irq) {
	if (irq)
		printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE"));
		printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE"));
	} else {
	else
		printk("(no irq) ");
		printk("(no irq) ");
	}


	printk("attached\n");
	printk("attached\n");


@@ -1461,9 +1445,8 @@ static int dio200_detach(struct comedi_device *dev)
	printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor,
	printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor,
	       DIO200_DRIVER_NAME);
	       DIO200_DRIVER_NAME);


	if (dev->irq) {
	if (dev->irq)
		free_irq(dev->irq, dev);
		free_irq(dev->irq, dev);
	}
	if (dev->subdevices) {
	if (dev->subdevices) {
		layout = thislayout;
		layout = thislayout;
		for (n = 0; n < dev->n_subdevices; n++) {
		for (n = 0; n < dev->n_subdevices; n++) {
@@ -1486,22 +1469,19 @@ static int dio200_detach(struct comedi_device *dev)
	if (devpriv) {
	if (devpriv) {
#ifdef CONFIG_COMEDI_PCI
#ifdef CONFIG_COMEDI_PCI
		if (devpriv->pci_dev) {
		if (devpriv->pci_dev) {
			if (dev->iobase) {
			if (dev->iobase)
				comedi_pci_disable(devpriv->pci_dev);
				comedi_pci_disable(devpriv->pci_dev);
			}
			pci_dev_put(devpriv->pci_dev);
			pci_dev_put(devpriv->pci_dev);
		} else
		} else
#endif
#endif
		{
		{
			if (dev->iobase) {
			if (dev->iobase)
				release_region(dev->iobase, DIO200_IO_SIZE);
				release_region(dev->iobase, DIO200_IO_SIZE);
		}
		}
	}
	}
	}
	if (dev->board_name)
	if (dev->board_name) {
		printk(KERN_INFO "comedi%d: %s removed\n",
		printk(KERN_INFO "comedi%d: %s removed\n",
		       dev->minor, dev->board_name);
		       dev->minor, dev->board_name);
	}


	return 0;
	return 0;
}
}