diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2014-11-12 18:30:23 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-12-01 18:29:23 -0500 |
commit | 40af86a40cdcabd48ab9636fe13d6763a7d74bc9 (patch) | |
tree | 29804240c4731b4924fbc84b6e887d8d8c92575c | |
parent | 17e40107985c06cfce87f1c19346c69f00a877c3 (diff) |
NFC: st21nfca: Remove gpio_irq field in static and dts configuration
- phy->gpio_irq is never done out of the request resources.
- irq_of_parse_and_map is already done in the i2c core so client->irq is
already set when entering in st21nfca_hci_i2c_of_request_resources
- In case of static platform configuration client->irq can be set directly
- It simplifies the code a bit.
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/nfc/st21nfca/i2c.c | 30 | ||||
-rw-r--r-- | include/linux/platform_data/st21nfca.h | 1 |
2 files changed, 1 insertions, 30 deletions
diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c index 22bc8c2311c2..44e1c769e335 100644 --- a/drivers/nfc/st21nfca/i2c.c +++ b/drivers/nfc/st21nfca/i2c.c | |||
@@ -72,7 +72,6 @@ struct st21nfca_i2c_phy { | |||
72 | struct nfc_hci_dev *hdev; | 72 | struct nfc_hci_dev *hdev; |
73 | 73 | ||
74 | unsigned int gpio_ena; | 74 | unsigned int gpio_ena; |
75 | unsigned int gpio_irq; | ||
76 | unsigned int irq_polarity; | 75 | unsigned int irq_polarity; |
77 | 76 | ||
78 | struct sk_buff *pending_skb; | 77 | struct sk_buff *pending_skb; |
@@ -536,15 +535,7 @@ static int st21nfca_hci_i2c_of_request_resources(struct i2c_client *client) | |||
536 | 535 | ||
537 | phy->gpio_ena = gpio; | 536 | phy->gpio_ena = gpio; |
538 | 537 | ||
539 | /* IRQ */ | 538 | phy->irq_polarity = irq_get_trigger_type(client->irq); |
540 | r = irq_of_parse_and_map(pp, 0); | ||
541 | if (r < 0) { | ||
542 | nfc_err(&client->dev, "Unable to get irq, error: %d\n", r); | ||
543 | return r; | ||
544 | } | ||
545 | |||
546 | phy->irq_polarity = irq_get_trigger_type(r); | ||
547 | client->irq = r; | ||
548 | 539 | ||
549 | return 0; | 540 | return 0; |
550 | } | 541 | } |
@@ -560,7 +551,6 @@ static int st21nfca_hci_i2c_request_resources(struct i2c_client *client) | |||
560 | struct st21nfca_nfc_platform_data *pdata; | 551 | struct st21nfca_nfc_platform_data *pdata; |
561 | struct st21nfca_i2c_phy *phy = i2c_get_clientdata(client); | 552 | struct st21nfca_i2c_phy *phy = i2c_get_clientdata(client); |
562 | int r; | 553 | int r; |
563 | int irq; | ||
564 | 554 | ||
565 | pdata = client->dev.platform_data; | 555 | pdata = client->dev.platform_data; |
566 | if (pdata == NULL) { | 556 | if (pdata == NULL) { |
@@ -569,17 +559,9 @@ static int st21nfca_hci_i2c_request_resources(struct i2c_client *client) | |||
569 | } | 559 | } |
570 | 560 | ||
571 | /* store for later use */ | 561 | /* store for later use */ |
572 | phy->gpio_irq = pdata->gpio_irq; | ||
573 | phy->gpio_ena = pdata->gpio_ena; | 562 | phy->gpio_ena = pdata->gpio_ena; |
574 | phy->irq_polarity = pdata->irq_polarity; | 563 | phy->irq_polarity = pdata->irq_polarity; |
575 | 564 | ||
576 | r = devm_gpio_request_one(&client->dev, phy->gpio_irq, GPIOF_IN, | ||
577 | "wake_up"); | ||
578 | if (r) { | ||
579 | pr_err("%s : gpio_request failed\n", __FILE__); | ||
580 | return -ENODEV; | ||
581 | } | ||
582 | |||
583 | if (phy->gpio_ena > 0) { | 565 | if (phy->gpio_ena > 0) { |
584 | r = devm_gpio_request_one(&client->dev, phy->gpio_ena, | 566 | r = devm_gpio_request_one(&client->dev, phy->gpio_ena, |
585 | GPIOF_OUT_INIT_HIGH, "clf_enable"); | 567 | GPIOF_OUT_INIT_HIGH, "clf_enable"); |
@@ -589,16 +571,6 @@ static int st21nfca_hci_i2c_request_resources(struct i2c_client *client) | |||
589 | } | 571 | } |
590 | } | 572 | } |
591 | 573 | ||
592 | /* IRQ */ | ||
593 | irq = gpio_to_irq(phy->gpio_irq); | ||
594 | if (irq < 0) { | ||
595 | nfc_err(&client->dev, | ||
596 | "Unable to get irq number for GPIO %d error %d\n", | ||
597 | phy->gpio_irq, r); | ||
598 | return -ENODEV; | ||
599 | } | ||
600 | client->irq = irq; | ||
601 | |||
602 | return 0; | 574 | return 0; |
603 | } | 575 | } |
604 | 576 | ||
diff --git a/include/linux/platform_data/st21nfca.h b/include/linux/platform_data/st21nfca.h index 1730312398ff..5087fff96d86 100644 --- a/include/linux/platform_data/st21nfca.h +++ b/include/linux/platform_data/st21nfca.h | |||
@@ -24,7 +24,6 @@ | |||
24 | #define ST21NFCA_HCI_DRIVER_NAME "st21nfca_hci" | 24 | #define ST21NFCA_HCI_DRIVER_NAME "st21nfca_hci" |
25 | 25 | ||
26 | struct st21nfca_nfc_platform_data { | 26 | struct st21nfca_nfc_platform_data { |
27 | unsigned int gpio_irq; | ||
28 | unsigned int gpio_ena; | 27 | unsigned int gpio_ena; |
29 | unsigned int irq_polarity; | 28 | unsigned int irq_polarity; |
30 | }; | 29 | }; |