Skip to content

Commit c7035cb

Browse files
eeprom: at24: Drop at24_get_chip_data()
JIRA: https://issues.redhat.com/browse/RHEL-47160 Conflicts: * Avoiding commit <f050bb8f56c64> ("misc: Switch i2c drivers back to use .probe()") to avoid drop the .probe_new() call-back type commit 4cdc5db Author: Biju Das <biju.das.jz@bp.renesas.com> Date: Sat Sep 2 18:45:47 2023 +0100 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 <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Alessandro Carminati <acarmina@redhat.com>
1 parent 36965a3 commit c7035cb

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)
@@ -626,9 +600,9 @@ static int at24_probe(struct i2c_client *client)
626600
i2c_fn_block = i2c_check_functionality(client->adapter,
627601
I2C_FUNC_SMBUS_WRITE_I2C_BLOCK);
628602

629-
cdata = at24_get_chip_data(dev);
630-
if (IS_ERR(cdata))
631-
return PTR_ERR(cdata);
603+
cdata = i2c_get_match_data(client);
604+
if (!cdata)
605+
return -ENODEV;
632606

633607
err = device_property_read_u32(dev, "pagesize", &page_size);
634608
if (err)

0 commit comments

Comments
 (0)