Skip to content

Commit 687fe7d

Browse files
committed
Input: tca6416-keypad - always expect proper IRQ number in i2c client
Remove option having i2c client contain raw gpio number instead of proper IRQ number. There are no users of this facility in mainline and it will allow cleaning up the driver code with regard to wakeup handling, etc. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent fe45d12 commit 687fe7d

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

drivers/input/keyboard/tca6416-keypad.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static int tca6416_keys_open(struct input_dev *dev)
148148
if (chip->use_polling)
149149
schedule_delayed_work(&chip->dwork, msecs_to_jiffies(100));
150150
else
151-
enable_irq(chip->irqnum);
151+
enable_irq(chip->client->irq);
152152

153153
return 0;
154154
}
@@ -160,7 +160,7 @@ static void tca6416_keys_close(struct input_dev *dev)
160160
if (chip->use_polling)
161161
cancel_delayed_work_sync(&chip->dwork);
162162
else
163-
disable_irq(chip->irqnum);
163+
disable_irq(chip->client->irq);
164164
}
165165

166166
static int tca6416_setup_registers(struct tca6416_keypad_chip *chip)
@@ -266,20 +266,15 @@ static int tca6416_keypad_probe(struct i2c_client *client)
266266
goto fail1;
267267

268268
if (!chip->use_polling) {
269-
if (pdata->irq_is_gpio)
270-
chip->irqnum = gpio_to_irq(client->irq);
271-
else
272-
chip->irqnum = client->irq;
273-
274-
error = request_threaded_irq(chip->irqnum, NULL,
269+
error = request_threaded_irq(client->irq, NULL,
275270
tca6416_keys_isr,
276271
IRQF_TRIGGER_FALLING |
277272
IRQF_ONESHOT | IRQF_NO_AUTOEN,
278273
"tca6416-keypad", chip);
279274
if (error) {
280275
dev_dbg(&client->dev,
281276
"Unable to claim irq %d; error %d\n",
282-
chip->irqnum, error);
277+
client->irq, error);
283278
goto fail1;
284279
}
285280
}
@@ -298,8 +293,8 @@ static int tca6416_keypad_probe(struct i2c_client *client)
298293

299294
fail2:
300295
if (!chip->use_polling) {
301-
free_irq(chip->irqnum, chip);
302-
enable_irq(chip->irqnum);
296+
free_irq(client->irq, chip);
297+
enable_irq(client->irq);
303298
}
304299
fail1:
305300
input_free_device(input);
@@ -312,8 +307,8 @@ static void tca6416_keypad_remove(struct i2c_client *client)
312307
struct tca6416_keypad_chip *chip = i2c_get_clientdata(client);
313308

314309
if (!chip->use_polling) {
315-
free_irq(chip->irqnum, chip);
316-
enable_irq(chip->irqnum);
310+
free_irq(client->irq, chip);
311+
enable_irq(client->irq);
317312
}
318313

319314
input_unregister_device(chip->input);
@@ -323,21 +318,19 @@ static void tca6416_keypad_remove(struct i2c_client *client)
323318
static int tca6416_keypad_suspend(struct device *dev)
324319
{
325320
struct i2c_client *client = to_i2c_client(dev);
326-
struct tca6416_keypad_chip *chip = i2c_get_clientdata(client);
327321

328322
if (device_may_wakeup(dev))
329-
enable_irq_wake(chip->irqnum);
323+
enable_irq_wake(client->irq);
330324

331325
return 0;
332326
}
333327

334328
static int tca6416_keypad_resume(struct device *dev)
335329
{
336330
struct i2c_client *client = to_i2c_client(dev);
337-
struct tca6416_keypad_chip *chip = i2c_get_clientdata(client);
338331

339332
if (device_may_wakeup(dev))
340-
disable_irq_wake(chip->irqnum);
333+
disable_irq_wake(client->irq);
341334

342335
return 0;
343336
}

include/linux/tca6416_keypad.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ struct tca6416_keys_platform_data {
2525
unsigned int rep:1; /* enable input subsystem auto repeat */
2626
uint16_t pinmask;
2727
uint16_t invert;
28-
int irq_is_gpio;
2928
int use_polling; /* use polling if Interrupt is not connected*/
3029
};
3130
#endif

0 commit comments

Comments
 (0)