Commit a80d0cb6 authored by Christophe Ricard's avatar Christophe Ricard Committed by Samuel Ortiz

NFC: st21nfcb: 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 st21nfcb_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: default avatarChristophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent d9b66918
...@@ -50,7 +50,6 @@ struct st21nfcb_i2c_phy { ...@@ -50,7 +50,6 @@ struct st21nfcb_i2c_phy {
struct i2c_client *i2c_dev; struct i2c_client *i2c_dev;
struct llt_ndlc *ndlc; struct llt_ndlc *ndlc;
unsigned int gpio_irq;
unsigned int gpio_reset; unsigned int gpio_reset;
unsigned int irq_polarity; unsigned int irq_polarity;
...@@ -262,15 +261,7 @@ static int st21nfcb_nci_i2c_of_request_resources(struct i2c_client *client) ...@@ -262,15 +261,7 @@ static int st21nfcb_nci_i2c_of_request_resources(struct i2c_client *client)
} }
phy->gpio_reset = gpio; phy->gpio_reset = gpio;
/* IRQ */ phy->irq_polarity = irq_get_trigger_type(client->irq);
r = irq_of_parse_and_map(pp, 0);
if (r < 0) {
nfc_err(&client->dev, "Unable to get irq, error: %d\n", r);
return r;
}
phy->irq_polarity = irq_get_trigger_type(r);
client->irq = r;
return 0; return 0;
} }
...@@ -286,7 +277,6 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client) ...@@ -286,7 +277,6 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client)
struct st21nfcb_nfc_platform_data *pdata; struct st21nfcb_nfc_platform_data *pdata;
struct st21nfcb_i2c_phy *phy = i2c_get_clientdata(client); struct st21nfcb_i2c_phy *phy = i2c_get_clientdata(client);
int r; int r;
int irq;
pdata = client->dev.platform_data; pdata = client->dev.platform_data;
if (pdata == NULL) { if (pdata == NULL) {
...@@ -295,17 +285,9 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client) ...@@ -295,17 +285,9 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client)
} }
/* store for later use */ /* store for later use */
phy->gpio_irq = pdata->gpio_irq;
phy->gpio_reset = pdata->gpio_reset; phy->gpio_reset = pdata->gpio_reset;
phy->irq_polarity = pdata->irq_polarity; phy->irq_polarity = pdata->irq_polarity;
r = devm_gpio_request_one(&client->dev, phy->gpio_irq,
GPIOF_IN, "clf_irq");
if (r) {
pr_err("%s : gpio_request failed\n", __FILE__);
return -ENODEV;
}
r = devm_gpio_request_one(&client->dev, r = devm_gpio_request_one(&client->dev,
phy->gpio_reset, GPIOF_OUT_INIT_HIGH, "clf_reset"); phy->gpio_reset, GPIOF_OUT_INIT_HIGH, "clf_reset");
if (r) { if (r) {
...@@ -313,16 +295,6 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client) ...@@ -313,16 +295,6 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client)
return -ENODEV; return -ENODEV;
} }
/* IRQ */
irq = gpio_to_irq(phy->gpio_irq);
if (irq < 0) {
nfc_err(&client->dev,
"Unable to get irq number for GPIO %d error %d\n",
phy->gpio_irq, r);
return -ENODEV;
}
client->irq = irq;
return 0; return 0;
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#define ST21NFCB_NCI_DRIVER_NAME "st21nfcb_nci" #define ST21NFCB_NCI_DRIVER_NAME "st21nfcb_nci"
struct st21nfcb_nfc_platform_data { struct st21nfcb_nfc_platform_data {
unsigned int gpio_irq;
unsigned int gpio_reset; unsigned int gpio_reset;
unsigned int irq_polarity; unsigned int irq_polarity;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment