mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
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>
This commit is contained in:
parent
17e4010798
commit
40af86a40c
2 changed files with 1 additions and 30 deletions
|
@ -72,7 +72,6 @@ struct st21nfca_i2c_phy {
|
||||||
struct nfc_hci_dev *hdev;
|
struct nfc_hci_dev *hdev;
|
||||||
|
|
||||||
unsigned int gpio_ena;
|
unsigned int gpio_ena;
|
||||||
unsigned int gpio_irq;
|
|
||||||
unsigned int irq_polarity;
|
unsigned int irq_polarity;
|
||||||
|
|
||||||
struct sk_buff *pending_skb;
|
struct sk_buff *pending_skb;
|
||||||
|
@ -536,15 +535,7 @@ static int st21nfca_hci_i2c_of_request_resources(struct i2c_client *client)
|
||||||
|
|
||||||
phy->gpio_ena = gpio;
|
phy->gpio_ena = 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;
|
||||||
}
|
}
|
||||||
|
@ -560,7 +551,6 @@ static int st21nfca_hci_i2c_request_resources(struct i2c_client *client)
|
||||||
struct st21nfca_nfc_platform_data *pdata;
|
struct st21nfca_nfc_platform_data *pdata;
|
||||||
struct st21nfca_i2c_phy *phy = i2c_get_clientdata(client);
|
struct st21nfca_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) {
|
||||||
|
@ -569,17 +559,9 @@ static int st21nfca_hci_i2c_request_resources(struct i2c_client *client)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* store for later use */
|
/* store for later use */
|
||||||
phy->gpio_irq = pdata->gpio_irq;
|
|
||||||
phy->gpio_ena = pdata->gpio_ena;
|
phy->gpio_ena = pdata->gpio_ena;
|
||||||
phy->irq_polarity = pdata->irq_polarity;
|
phy->irq_polarity = pdata->irq_polarity;
|
||||||
|
|
||||||
r = devm_gpio_request_one(&client->dev, phy->gpio_irq, GPIOF_IN,
|
|
||||||
"wake_up");
|
|
||||||
if (r) {
|
|
||||||
pr_err("%s : gpio_request failed\n", __FILE__);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (phy->gpio_ena > 0) {
|
if (phy->gpio_ena > 0) {
|
||||||
r = devm_gpio_request_one(&client->dev, phy->gpio_ena,
|
r = devm_gpio_request_one(&client->dev, phy->gpio_ena,
|
||||||
GPIOF_OUT_INIT_HIGH, "clf_enable");
|
GPIOF_OUT_INIT_HIGH, "clf_enable");
|
||||||
|
@ -589,16 +571,6 @@ static int st21nfca_hci_i2c_request_resources(struct i2c_client *client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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 @@
|
||||||
#define ST21NFCA_HCI_DRIVER_NAME "st21nfca_hci"
|
#define ST21NFCA_HCI_DRIVER_NAME "st21nfca_hci"
|
||||||
|
|
||||||
struct st21nfca_nfc_platform_data {
|
struct st21nfca_nfc_platform_data {
|
||||||
unsigned int gpio_irq;
|
|
||||||
unsigned int gpio_ena;
|
unsigned int gpio_ena;
|
||||||
unsigned int irq_polarity;
|
unsigned int irq_polarity;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue