Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: max732x: Drop unused support for irq and setup code via platform data

The only user of max732x_platform_data is arch/arm/mach-pxa/littleton.c
and it only uses .gpio_base. So drop the other members from the data struct
and simplify the driver accordingly.

The motivating side effect of this change is that the .remove() callback
cannot return a nonzero error code any more which prepares making i2c
remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>

authored by

Uwe Kleine-König and committed by
Bartosz Golaszewski
6d5f2207 30a35c07

+2 -47
+2 -35
drivers/gpio/gpio-max732x.c
··· 496 496 const struct i2c_device_id *id) 497 497 { 498 498 struct i2c_client *client = chip->client; 499 - struct max732x_platform_data *pdata = dev_get_platdata(&client->dev); 500 499 int has_irq = max732x_features[id->driver_data] >> 32; 501 500 int irq_base = 0; 502 501 int ret; 503 502 504 - if (((pdata && pdata->irq_base) || client->irq) 505 - && has_irq != INT_NONE) { 503 + if (client->irq && has_irq != INT_NONE) { 506 504 struct gpio_irq_chip *girq; 507 505 508 - if (pdata) 509 - irq_base = pdata->irq_base; 510 506 chip->irq_features = has_irq; 511 507 mutex_init(&chip->irq_lock); 512 508 ··· 536 540 const struct i2c_device_id *id) 537 541 { 538 542 struct i2c_client *client = chip->client; 539 - struct max732x_platform_data *pdata = dev_get_platdata(&client->dev); 540 543 int has_irq = max732x_features[id->driver_data] >> 32; 541 544 542 - if (((pdata && pdata->irq_base) || client->irq) && has_irq != INT_NONE) 545 + if (client->irq && has_irq != INT_NONE) 543 546 dev_warn(&client->dev, "interrupt support not compiled in\n"); 544 547 545 548 return 0; ··· 698 703 if (ret) 699 704 return ret; 700 705 701 - if (pdata->setup) { 702 - ret = pdata->setup(client, chip->gpio_chip.base, 703 - chip->gpio_chip.ngpio, pdata->context); 704 - if (ret < 0) 705 - dev_warn(&client->dev, "setup failed, %d\n", ret); 706 - } 707 - 708 706 i2c_set_clientdata(client, chip); 709 - return 0; 710 - } 711 - 712 - static int max732x_remove(struct i2c_client *client) 713 - { 714 - struct max732x_platform_data *pdata = dev_get_platdata(&client->dev); 715 - struct max732x_chip *chip = i2c_get_clientdata(client); 716 - 717 - if (pdata && pdata->teardown) { 718 - int ret; 719 - 720 - ret = pdata->teardown(client, chip->gpio_chip.base, 721 - chip->gpio_chip.ngpio, pdata->context); 722 - if (ret < 0) { 723 - dev_err(&client->dev, "%s failed, %d\n", 724 - "teardown", ret); 725 - return ret; 726 - } 727 - } 728 - 729 707 return 0; 730 708 } 731 709 ··· 708 740 .of_match_table = of_match_ptr(max732x_of_table), 709 741 }, 710 742 .probe = max732x_probe, 711 - .remove = max732x_remove, 712 743 .id_table = max732x_id, 713 744 }; 714 745
-12
include/linux/platform_data/max732x.h
··· 7 7 struct max732x_platform_data { 8 8 /* number of the first GPIO */ 9 9 unsigned gpio_base; 10 - 11 - /* interrupt base */ 12 - int irq_base; 13 - 14 - void *context; /* param to setup/teardown */ 15 - 16 - int (*setup)(struct i2c_client *client, 17 - unsigned gpio, unsigned ngpio, 18 - void *context); 19 - int (*teardown)(struct i2c_client *client, 20 - unsigned gpio, unsigned ngpio, 21 - void *context); 22 10 }; 23 11 #endif /* __LINUX_I2C_MAX732X_H */