Skip to content

Commit 91a0192

Browse files
andy-shevBartosz Golaszewski
authored andcommitted
gpio: pcf857x: Get rid of legacy platform data
Platform data is a legacy interface to supply device properties to the driver. In this case we don't have in-kernel users for it. Moreover it uses plain GPIO numbers which is no-no for a new code. Just remove it for good. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent b0047b9 commit 91a0192

File tree

2 files changed

+2
-77
lines changed

2 files changed

+2
-77
lines changed

drivers/gpio/gpio-pcf857x.c

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#include <linux/gpio/driver.h>
99
#include <linux/i2c.h>
10-
#include <linux/platform_data/pcf857x.h>
1110
#include <linux/interrupt.h>
1211
#include <linux/irq.h>
1312
#include <linux/irqdomain.h>
@@ -18,7 +17,6 @@
1817
#include <linux/slab.h>
1918
#include <linux/spinlock.h>
2019

21-
2220
static const struct i2c_device_id pcf857x_id[] = {
2321
{ "pcf8574", 8 },
2422
{ "pcf8574a", 8 },
@@ -277,18 +275,12 @@ static const struct irq_chip pcf857x_irq_chip = {
277275
static int pcf857x_probe(struct i2c_client *client)
278276
{
279277
const struct i2c_device_id *id = i2c_client_get_device_id(client);
280-
struct pcf857x_platform_data *pdata = dev_get_platdata(&client->dev);
281278
struct device_node *np = client->dev.of_node;
282279
struct pcf857x *gpio;
283280
unsigned int n_latch = 0;
284281
int status;
285282

286-
if (IS_ENABLED(CONFIG_OF) && np)
287-
of_property_read_u32(np, "lines-initial-states", &n_latch);
288-
else if (pdata)
289-
n_latch = pdata->n_latch;
290-
else
291-
dev_dbg(&client->dev, "no platform data\n");
283+
of_property_read_u32(np, "lines-initial-states", &n_latch);
292284

293285
/* Allocate, initialize, and register this gpio_chip. */
294286
gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL);
@@ -297,7 +289,7 @@ static int pcf857x_probe(struct i2c_client *client)
297289

298290
mutex_init(&gpio->lock);
299291

300-
gpio->chip.base = pdata ? pdata->gpio_base : -1;
292+
gpio->chip.base = -1;
301293
gpio->chip.can_sleep = true;
302294
gpio->chip.parent = &client->dev;
303295
gpio->chip.owner = THIS_MODULE;
@@ -406,17 +398,6 @@ static int pcf857x_probe(struct i2c_client *client)
406398
if (status < 0)
407399
goto fail;
408400

409-
/* Let platform code set up the GPIOs and their users.
410-
* Now is the first time anyone could use them.
411-
*/
412-
if (pdata && pdata->setup) {
413-
status = pdata->setup(client,
414-
gpio->chip.base, gpio->chip.ngpio,
415-
pdata->context);
416-
if (status < 0)
417-
dev_warn(&client->dev, "setup --> %d\n", status);
418-
}
419-
420401
dev_info(&client->dev, "probed\n");
421402

422403
return 0;
@@ -428,16 +409,6 @@ static int pcf857x_probe(struct i2c_client *client)
428409
return status;
429410
}
430411

431-
static void pcf857x_remove(struct i2c_client *client)
432-
{
433-
struct pcf857x_platform_data *pdata = dev_get_platdata(&client->dev);
434-
struct pcf857x *gpio = i2c_get_clientdata(client);
435-
436-
if (pdata && pdata->teardown)
437-
pdata->teardown(client, gpio->chip.base, gpio->chip.ngpio,
438-
pdata->context);
439-
}
440-
441412
static void pcf857x_shutdown(struct i2c_client *client)
442413
{
443414
struct pcf857x *gpio = i2c_get_clientdata(client);
@@ -452,7 +423,6 @@ static struct i2c_driver pcf857x_driver = {
452423
.of_match_table = of_match_ptr(pcf857x_of_table),
453424
},
454425
.probe_new = pcf857x_probe,
455-
.remove = pcf857x_remove,
456426
.shutdown = pcf857x_shutdown,
457427
.id_table = pcf857x_id,
458428
};

include/linux/platform_data/pcf857x.h

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)