History

gpio: adp5588: Remove support for platform setup and teardown callbacks

If the teardown callback failed in the gpio driver, it fails to free the irq (if there is one). The device is removed anyhow. If later on the irq triggers, all sorts of unpleasant things might happen (e.g. accessing the struct adp5588_gpio which is already freed in the meantime or starting i2c bus transfers for an unregistered device). Even before irq support was added to this driver, exiting early was wrong; back then it failed to unregister the gpiochip. Fortunately these callbacks aren't used any more since at least blackfin was removed in 2018. So just drop them. Note that they are not removed from struct adp5588_gpio_platform_data because the keyboard driver adp5588-keys.c also makes use of them. (I didn't check if the callbacks might have been called twice, maybe there is another reason hidden to better not call these functions.) This patch is a preparation for making i2c remove callbacks return void.

Uwe Kleine-König committed 4 years ago

Commit 7bb8a0c1 parent 43624ed1 file · +0 −19Browse files

Unified · Split

drivers/gpio/gpio-adp5588.c+0−19
@@ -406,12 +406,6 @@ static int adp5588_gpio_probe(struct i2c_client *client) · 405 unmodified lines
406406 if (ret)
407407 return ret;
408408
409− if (pdata && pdata->setup) {
410− ret = pdata->setup(client, gc->base, gc->ngpio, pdata->context);
411− if (ret < 0)
412− dev_warn(&client->dev, "setup failed, %d\n", ret);
413− }
414−
415409 i2c_set_clientdata(client, dev);
416410
417411 return 0;
@@ -419,20 +413,7 @@ static int adp5588_gpio_probe(struct i2c_client *client) · 1 unmodified line
419413
420414 static int adp5588_gpio_remove(struct i2c_client *client)
421415 {
422− struct adp5588_gpio_platform_data *pdata =
423− dev_get_platdata(&client->dev);
424416 struct adp5588_gpio *dev = i2c_get_clientdata(client);
425− int ret;
426−
427− if (pdata && pdata->teardown) {
428− ret = pdata->teardown(client,
429− dev->gpio_chip.base, dev->gpio_chip.ngpio,
430− pdata->context);
431− if (ret < 0) {
432− dev_err(&client->dev, "teardown failed %d\n", ret);
433− return ret;
434− }
435− }
436417
437418 if (dev->client->irq)
438419 free_irq(dev->client->irq, dev);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t