aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-04-24 13:09:05 -0400
committerDavid S. Miller <davem@davemloft.net>2014-04-26 12:20:32 -0400
commit4af619ae2ccf47a2b3a108e1926736484721370f (patch)
tree29357e1ff7270f4a66dcfc0911832cdb1da92128 /drivers/net
parent7f51531c11be9f6ebace405aec724ffac043a8f5 (diff)
at86rf230: use irq_get_trigger_type
This patch removes the platform data for the irq_type. We use instead the irq_get_trigger_type function to get these flags which should already configured by the interrupt controller. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ieee802154/at86rf230.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index e36f194673a4..17b9c9aea9be 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -23,6 +23,7 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/irq.h>
26#include <linux/gpio.h> 27#include <linux/gpio.h>
27#include <linux/delay.h> 28#include <linux/delay.h>
28#include <linux/mutex.h> 29#include <linux/mutex.h>
@@ -970,8 +971,7 @@ static int at86rf230_irq_polarity(struct at86rf230_local *lp, int pol)
970 971
971static int at86rf230_hw_init(struct at86rf230_local *lp) 972static int at86rf230_hw_init(struct at86rf230_local *lp)
972{ 973{
973 struct at86rf230_platform_data *pdata = lp->spi->dev.platform_data; 974 int rc, irq_pol, irq_type;
974 int rc, irq_pol;
975 u8 status; 975 u8 status;
976 u8 csma_seed[2]; 976 u8 csma_seed[2];
977 977
@@ -983,8 +983,9 @@ static int at86rf230_hw_init(struct at86rf230_local *lp)
983 if (rc) 983 if (rc)
984 return rc; 984 return rc;
985 985
986 irq_type = irq_get_trigger_type(lp->spi->irq);
986 /* configure irq polarity, defaults to high active */ 987 /* configure irq polarity, defaults to high active */
987 if (pdata->irq_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW)) 988 if (irq_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW))
988 irq_pol = IRQ_ACTIVE_LOW; 989 irq_pol = IRQ_ACTIVE_LOW;
989 else 990 else
990 irq_pol = IRQ_ACTIVE_HIGH; 991 irq_pol = IRQ_ACTIVE_HIGH;
@@ -1032,7 +1033,6 @@ static struct at86rf230_platform_data *
1032at86rf230_get_pdata(struct spi_device *spi) 1033at86rf230_get_pdata(struct spi_device *spi)
1033{ 1034{
1034 struct at86rf230_platform_data *pdata; 1035 struct at86rf230_platform_data *pdata;
1035 const char *irq_type;
1036 1036
1037 if (!IS_ENABLED(CONFIG_OF) || !spi->dev.of_node) 1037 if (!IS_ENABLED(CONFIG_OF) || !spi->dev.of_node)
1038 return spi->dev.platform_data; 1038 return spi->dev.platform_data;
@@ -1044,19 +1044,6 @@ at86rf230_get_pdata(struct spi_device *spi)
1044 pdata->rstn = of_get_named_gpio(spi->dev.of_node, "reset-gpio", 0); 1044 pdata->rstn = of_get_named_gpio(spi->dev.of_node, "reset-gpio", 0);
1045 pdata->slp_tr = of_get_named_gpio(spi->dev.of_node, "sleep-gpio", 0); 1045 pdata->slp_tr = of_get_named_gpio(spi->dev.of_node, "sleep-gpio", 0);
1046 1046
1047 pdata->irq_type = IRQF_TRIGGER_RISING;
1048 of_property_read_string(spi->dev.of_node, "irq-type", &irq_type);
1049 if (!strcmp(irq_type, "level-high"))
1050 pdata->irq_type = IRQF_TRIGGER_HIGH;
1051 else if (!strcmp(irq_type, "level-low"))
1052 pdata->irq_type = IRQF_TRIGGER_LOW;
1053 else if (!strcmp(irq_type, "edge-rising"))
1054 pdata->irq_type = IRQF_TRIGGER_RISING;
1055 else if (!strcmp(irq_type, "edge-falling"))
1056 pdata->irq_type = IRQF_TRIGGER_FALLING;
1057 else
1058 dev_warn(&spi->dev, "wrong irq-type specified using edge-rising\n");
1059
1060 spi->dev.platform_data = pdata; 1047 spi->dev.platform_data = pdata;
1061done: 1048done:
1062 return pdata; 1049 return pdata;
@@ -1071,7 +1058,7 @@ static int at86rf230_probe(struct spi_device *spi)
1071 u8 part = 0, version = 0, status; 1058 u8 part = 0, version = 0, status;
1072 irq_handler_t irq_handler; 1059 irq_handler_t irq_handler;
1073 work_func_t irq_worker; 1060 work_func_t irq_worker;
1074 int rc; 1061 int rc, irq_type;
1075 const char *chip; 1062 const char *chip;
1076 struct ieee802154_ops *ops = NULL; 1063 struct ieee802154_ops *ops = NULL;
1077 1064
@@ -1176,7 +1163,8 @@ static int at86rf230_probe(struct spi_device *spi)
1176 dev->extra_tx_headroom = 0; 1163 dev->extra_tx_headroom = 0;
1177 dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK; 1164 dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK;
1178 1165
1179 if (pdata->irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { 1166 irq_type = irq_get_trigger_type(spi->irq);
1167 if (irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
1180 irq_worker = at86rf230_irqwork; 1168 irq_worker = at86rf230_irqwork;
1181 irq_handler = at86rf230_isr; 1169 irq_handler = at86rf230_isr;
1182 } else { 1170 } else {
@@ -1203,7 +1191,7 @@ static int at86rf230_probe(struct spi_device *spi)
1203 goto err_hw_init; 1191 goto err_hw_init;
1204 1192
1205 rc = request_irq(spi->irq, irq_handler, 1193 rc = request_irq(spi->irq, irq_handler,
1206 IRQF_SHARED | pdata->irq_type, 1194 IRQF_SHARED | irq_type,
1207 dev_name(&spi->dev), lp); 1195 dev_name(&spi->dev), lp);
1208 if (rc) 1196 if (rc)
1209 goto err_hw_init; 1197 goto err_hw_init;