Skip to content

Commit 2c7aa26

Browse files
andy-shevAndi Shyti
authored andcommitted
i2c: designware: Use device_is_compatible() instead of custom approach
We use MODEL_MSCC_OCELOT effectively as a flag for comparing against "compatible" property. Use device_is_compatible() directly to make it clear. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260114081954.252160-3-andriy.shevchenko@linux.intel.com
1 parent fae88e0 commit 2c7aa26

3 files changed

Lines changed: 2 additions & 7 deletions

File tree

drivers/i2c/busses/i2c-designware-common.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,10 @@ static void i2c_dw_of_configure(struct device *device)
243243
struct platform_device *pdev = to_platform_device(device);
244244
struct dw_i2c_dev *dev = dev_get_drvdata(device);
245245

246-
switch (dev->flags & MODEL_MASK) {
247-
case MODEL_MSCC_OCELOT:
246+
if (device_is_compatible(dev->dev, "mscc,ocelot-i2c")) {
248247
dev->ext = devm_platform_ioremap_resource(pdev, 1);
249248
if (!IS_ERR(dev->ext))
250249
dev->set_sda_hold_time = mscc_twi_set_sda_hold_time;
251-
break;
252-
default:
253-
break;
254250
}
255251
}
256252

drivers/i2c/busses/i2c-designware-core.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ struct dw_i2c_dev {
326326
#define ARBITRATION_SEMAPHORE BIT(2)
327327
#define ACCESS_POLLING BIT(3)
328328

329-
#define MODEL_MSCC_OCELOT BIT(8)
330329
#define MODEL_AMD_NAVI_GPU BIT(10)
331330
#define MODEL_WANGXUN_SP BIT(11)
332331
#define MODEL_MASK GENMASK(11, 8)

drivers/i2c/busses/i2c-designware-platdrv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static void dw_i2c_plat_remove(struct platform_device *pdev)
267267
}
268268

269269
static const struct of_device_id dw_i2c_of_match[] = {
270-
{ .compatible = "mscc,ocelot-i2c", .data = (void *)MODEL_MSCC_OCELOT },
270+
{ .compatible = "mscc,ocelot-i2c" },
271271
{ .compatible = "snps,designware-i2c" },
272272
{}
273273
};

0 commit comments

Comments
 (0)