Skip to content

Commit 4cdc5db

Browse files
bijudasBartosz Golaszewski
authored andcommitted
eeprom: at24: Drop at24_get_chip_data()
Replace at24_get_chip_data()->i2c_get_match_data() as it is redundant. Signed-off-by: Biju Das <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 0bb80ec commit 4cdc5db

File tree

1 file changed

+3
-29
lines changed

1 file changed

+3
-29
lines changed

drivers/misc/eeprom/at24.c

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -509,32 +509,6 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
509509
return 0;
510510
}
511511

512-
static const struct at24_chip_data *at24_get_chip_data(struct device *dev)
513-
{
514-
struct device_node *of_node = dev->of_node;
515-
const struct at24_chip_data *cdata;
516-
const struct i2c_device_id *id;
517-
518-
id = i2c_match_id(at24_ids, to_i2c_client(dev));
519-
520-
/*
521-
* The I2C core allows OF nodes compatibles to match against the
522-
* I2C device ID table as a fallback, so check not only if an OF
523-
* node is present but also if it matches an OF device ID entry.
524-
*/
525-
if (of_node && of_match_device(at24_of_match, dev))
526-
cdata = of_device_get_match_data(dev);
527-
else if (id)
528-
cdata = (void *)id->driver_data;
529-
else
530-
cdata = acpi_device_get_match_data(dev);
531-
532-
if (!cdata)
533-
return ERR_PTR(-ENODEV);
534-
535-
return cdata;
536-
}
537-
538512
static int at24_make_dummy_client(struct at24_data *at24, unsigned int index,
539513
struct i2c_client *base_client,
540514
struct regmap_config *regmap_config)
@@ -601,9 +575,9 @@ static int at24_probe(struct i2c_client *client)
601575
i2c_fn_block = i2c_check_functionality(client->adapter,
602576
I2C_FUNC_SMBUS_WRITE_I2C_BLOCK);
603577

604-
cdata = at24_get_chip_data(dev);
605-
if (IS_ERR(cdata))
606-
return PTR_ERR(cdata);
578+
cdata = i2c_get_match_data(client);
579+
if (!cdata)
580+
return -ENODEV;
607581

608582
err = device_property_read_u32(dev, "pagesize", &page_size);
609583
if (err)

0 commit comments

Comments
 (0)