[PATCH 51/60] staging: comedi: pcl816: tidy up the irq support in pcl816_attach()

Hartley Sweeten HartleyS at visionengravers.com
Wed Nov 27 17:33:40 UTC 2013


On Tuesday, November 26, 2013 4:42 PM, H Hartley Sweeten wrote:
> Tidy up the code that does the request_irq().
>
> Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
> Cc: Ian Abbott <abbotti at mev.co.uk>
> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> ---
>  drivers/staging/comedi/drivers/pcl816.c | 33 ++++++---------------------------
>  1 file changed, 6 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c
> index 149a28b..ad75bb6 100644
> --- a/drivers/staging/comedi/drivers/pcl816.c
> +++ b/drivers/staging/comedi/drivers/pcl816.c
> @@ -872,36 +872,15 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>  	if (!devpriv)
>  		return -ENOMEM;
>  
> -	/* grab our IRQ */
> -	irq = 0;
> -	if (board->IRQbits != 0) {	/* board support IRQ */
> -		irq = it->options[1];
> -		if (irq) {	/* we want to use IRQ */
> -			if (((1 << irq) & board->IRQbits) == 0) {
> -				printk
> -				    (", IRQ %u is out of allowed range, "
> -				     "DISABLING IT", irq);
> -				irq = 0;	/* Bad IRQ */
> -			} else {
> -				if (request_irq(irq, interrupt_pcl816, 0,
> -						dev->board_name, dev)) {
> -					printk
> -					    (", unable to allocate IRQ %u, "
> -					     "DISABLING IT", irq);
> -					irq = 0;	/* Can't use IRQ */
> -				} else {
> -					printk(KERN_INFO ", irq=%u", irq);
> -				}
> -			}
> +	if ((1 << it->options[1]) & board->IRQbits) {
> +		ret = request_irq(board->IRQbits, interrupt_pcl816, 0,
> +				  dev->board_name, dev);
> +		if (ret == 0) {
> +			dev->irq = irq;

I just noticed a bug in this patch. The code above should be:

+		ret = request_irq(it->options[1], interrupt_pcl816, 0,
+				  dev->board_name, dev);
+		if (ret == 0) {
+			dev->irq = it->options[1];

And the local variable 'irq' should have been removed.

The sparse output has been a bit jacked up lately and I missed this.

Greg,

Can I just fix this patch (51/60) and repost it or would you prefer to
take patches 1-50 and have me repost 51-60 after fixing this one?

Thanks,
Hartley



More information about the devel mailing list