at86rf230: rework irq_pol setting
authorAlexander Aring <alex.aring@gmail.com>
Wed, 2 Jul 2014 22:20:50 +0000 (00:20 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Jul 2014 04:29:25 +0000 (21:29 -0700)
This patch rework the irq_pol register setting for rising and falling
interrupt settings only. The default behaviour should be rising flag.

Also use IRQ_TYPE_* defines instead of IRQF_* defines. There is no
functionality change but irq_get_trigger_type returns IRQ_TYPE_* defines.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ieee802154/at86rf230.c

index 492fb7e7675d56415e9a31557903f62591f85ba6..46db6f8fb58f902113a18b57ecc87bee46d28b5b 100644 (file)
@@ -1276,7 +1276,7 @@ static struct at86rf2xx_chip_data at86rf212_data = {
 
 static int at86rf230_hw_init(struct at86rf230_local *lp)
 {
-       int rc, irq_pol, irq_type;
+       int rc, irq_type, irq_pol = IRQ_ACTIVE_HIGH;
        unsigned int dvdd;
        u8 csma_seed[2];
 
@@ -1285,11 +1285,8 @@ static int at86rf230_hw_init(struct at86rf230_local *lp)
                return rc;
 
        irq_type = irq_get_trigger_type(lp->spi->irq);
-       /* configure irq polarity, defaults to high active */
-       if (irq_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW))
+       if (irq_type == IRQ_TYPE_EDGE_FALLING)
                irq_pol = IRQ_ACTIVE_LOW;
-       else
-               irq_pol = IRQ_ACTIVE_HIGH;
 
        rc = at86rf230_write_subreg(lp, SR_IRQ_POLARITY, irq_pol);
        if (rc)