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

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Andy Shevchenko and committed by
Andi Shyti
2c7aa268 fae88e03

+2 -7
+1 -5
drivers/i2c/busses/i2c-designware-common.c
··· 243 243 struct platform_device *pdev = to_platform_device(device); 244 244 struct dw_i2c_dev *dev = dev_get_drvdata(device); 245 245 246 - switch (dev->flags & MODEL_MASK) { 247 - case MODEL_MSCC_OCELOT: 246 + if (device_is_compatible(dev->dev, "mscc,ocelot-i2c")) { 248 247 dev->ext = devm_platform_ioremap_resource(pdev, 1); 249 248 if (!IS_ERR(dev->ext)) 250 249 dev->set_sda_hold_time = mscc_twi_set_sda_hold_time; 251 - break; 252 - default: 253 - break; 254 250 } 255 251 } 256 252
-1
drivers/i2c/busses/i2c-designware-core.h
··· 326 326 #define ARBITRATION_SEMAPHORE BIT(2) 327 327 #define ACCESS_POLLING BIT(3) 328 328 329 - #define MODEL_MSCC_OCELOT BIT(8) 330 329 #define MODEL_AMD_NAVI_GPU BIT(10) 331 330 #define MODEL_WANGXUN_SP BIT(11) 332 331 #define MODEL_MASK GENMASK(11, 8)
+1 -1
drivers/i2c/busses/i2c-designware-platdrv.c
··· 267 267 } 268 268 269 269 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" }, 271 271 { .compatible = "snps,designware-i2c" }, 272 272 {} 273 273 };