Merge "NFC: Fix unbalanced irq warning stack trace"

This commit is contained in:
Linux Build Service Account 2016-08-18 04:59:14 -07:00 committed by Gerrit - the friendly Code Review server
commit b2397d388f

View file

@ -63,6 +63,8 @@ struct nqx_dev {
bool nfc_ven_enabled; bool nfc_ven_enabled;
/* NFC_IRQ state */ /* NFC_IRQ state */
bool irq_enabled; bool irq_enabled;
/* NFC_IRQ wake-up state */
bool irq_wake_up;
spinlock_t irq_enabled_lock; spinlock_t irq_enabled_lock;
unsigned int count_irq; unsigned int count_irq;
/* Initial CORE RESET notification */ /* Initial CORE RESET notification */
@ -372,6 +374,9 @@ int nfc_ioctl_power_states(struct file *filp, unsigned long arg)
} else { } else {
dev_dbg(&nqx_dev->client->dev, "keeping en_gpio high\n"); dev_dbg(&nqx_dev->client->dev, "keeping en_gpio high\n");
} }
} else {
dev_dbg(&nqx_dev->client->dev, "ese_gpio invalid, set en_gpio to low\n");
gpio_set_value(nqx_dev->en_gpio, 0);
} }
r = nqx_clock_deselect(nqx_dev); r = nqx_clock_deselect(nqx_dev);
if (r < 0) if (r < 0)
@ -777,21 +782,29 @@ static int nqx_probe(struct i2c_client *client,
r = gpio_request(platform_data->ese_gpio, r = gpio_request(platform_data->ese_gpio,
"nfc-ese_pwr"); "nfc-ese_pwr");
if (r) { if (r) {
nqx_dev->ese_gpio = -EINVAL;
dev_err(&client->dev, dev_err(&client->dev,
"%s: unable to request nfc ese gpio [%d]\n", "%s: unable to request nfc ese gpio [%d]\n",
__func__, platform_data->ese_gpio); __func__, platform_data->ese_gpio);
/* ese gpio optional so we should continue */ /* ese gpio optional so we should continue */
} else { } else {
nqx_dev->ese_gpio = platform_data->ese_gpio; nqx_dev->ese_gpio = platform_data->ese_gpio;
} r = gpio_direction_output(platform_data->ese_gpio, 0);
r = gpio_direction_output(platform_data->ese_gpio, 0); if (r) {
if (r) { /*
dev_err(&client->dev, * free ese gpio and set invalid
"%s: cannot set direction for nfc ese gpio [%d]\n", * to avoid further use
__func__, platform_data->ese_gpio); */
/* ese gpio optional so we should continue */ gpio_free(platform_data->ese_gpio);
nqx_dev->ese_gpio = -EINVAL;
dev_err(&client->dev,
"%s: cannot set direction for nfc ese gpio [%d]\n",
__func__, platform_data->ese_gpio);
/* ese gpio optional so we should continue */
}
} }
} else { } else {
nqx_dev->ese_gpio = -EINVAL;
dev_err(&client->dev, dev_err(&client->dev,
"%s: ese gpio not provided\n", __func__); "%s: ese gpio not provided\n", __func__);
/* ese gpio optional so we should continue */ /* ese gpio optional so we should continue */
@ -821,7 +834,6 @@ static int nqx_probe(struct i2c_client *client,
nqx_dev->en_gpio = platform_data->en_gpio; nqx_dev->en_gpio = platform_data->en_gpio;
nqx_dev->irq_gpio = platform_data->irq_gpio; nqx_dev->irq_gpio = platform_data->irq_gpio;
nqx_dev->firm_gpio = platform_data->firm_gpio; nqx_dev->firm_gpio = platform_data->firm_gpio;
nqx_dev->ese_gpio = platform_data->ese_gpio;
nqx_dev->clkreq_gpio = platform_data->clkreq_gpio; nqx_dev->clkreq_gpio = platform_data->clkreq_gpio;
nqx_dev->pdata = platform_data; nqx_dev->pdata = platform_data;
@ -889,6 +901,7 @@ static int nqx_probe(struct i2c_client *client,
device_init_wakeup(&client->dev, true); device_init_wakeup(&client->dev, true);
device_set_wakeup_capable(&client->dev, true); device_set_wakeup_capable(&client->dev, true);
i2c_set_clientdata(client, nqx_dev); i2c_set_clientdata(client, nqx_dev);
nqx_dev->irq_wake_up = false;
dev_err(&client->dev, dev_err(&client->dev,
"%s: probing NFCC NQxxx exited successfully\n", "%s: probing NFCC NQxxx exited successfully\n",
@ -909,7 +922,7 @@ err_clkreq_gpio:
gpio_free(platform_data->clkreq_gpio); gpio_free(platform_data->clkreq_gpio);
err_ese_gpio: err_ese_gpio:
/* optional gpio, not sure was configured in probe */ /* optional gpio, not sure was configured in probe */
if (nqx_dev->ese_gpio) if (nqx_dev->ese_gpio > 0)
gpio_free(platform_data->ese_gpio); gpio_free(platform_data->ese_gpio);
err_firm_gpio: err_firm_gpio:
gpio_free(platform_data->firm_gpio); gpio_free(platform_data->firm_gpio);
@ -950,7 +963,7 @@ static int nqx_remove(struct i2c_client *client)
mutex_destroy(&nqx_dev->read_mutex); mutex_destroy(&nqx_dev->read_mutex);
gpio_free(nqx_dev->clkreq_gpio); gpio_free(nqx_dev->clkreq_gpio);
/* optional gpio, not sure was configured in probe */ /* optional gpio, not sure was configured in probe */
if (nqx_dev->ese_gpio) if (nqx_dev->ese_gpio > 0)
gpio_free(nqx_dev->ese_gpio); gpio_free(nqx_dev->ese_gpio);
gpio_free(nqx_dev->firm_gpio); gpio_free(nqx_dev->firm_gpio);
gpio_free(nqx_dev->irq_gpio); gpio_free(nqx_dev->irq_gpio);
@ -969,17 +982,22 @@ static int nqx_suspend(struct device *device)
struct i2c_client *client = to_i2c_client(device); struct i2c_client *client = to_i2c_client(device);
struct nqx_dev *nqx_dev = i2c_get_clientdata(client); struct nqx_dev *nqx_dev = i2c_get_clientdata(client);
if (device_may_wakeup(&client->dev) && nqx_dev->irq_enabled) if (device_may_wakeup(&client->dev) && nqx_dev->irq_enabled) {
enable_irq_wake(client->irq); if (!enable_irq_wake(client->irq))
nqx_dev->irq_wake_up = true;
}
return 0; return 0;
} }
static int nqx_resume(struct device *device) static int nqx_resume(struct device *device)
{ {
struct i2c_client *client = to_i2c_client(device); struct i2c_client *client = to_i2c_client(device);
struct nqx_dev *nqx_dev = i2c_get_clientdata(client);
if (device_may_wakeup(&client->dev)) if (device_may_wakeup(&client->dev) && nqx_dev->irq_wake_up) {
disable_irq_wake(client->irq); if (!disable_irq_wake(client->irq))
nqx_dev->irq_wake_up = false;
}
return 0; return 0;
} }