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: xiic: switch to generic device property accessors

Use generic device property accessors making them work for ACPI
platforms.

Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260223-i2c-xiic-v12-3-b6c9ce4e4f3c@nexthop.ai

authored by

Abdurrahman Hussain and committed by
Andi Shyti
b621a966 e1d98e42

+7 -14
+7 -14
drivers/i2c/busses/i2c-xiic.c
··· 27 27 #include <linux/platform_data/i2c-xiic.h> 28 28 #include <linux/io.h> 29 29 #include <linux/slab.h> 30 - #include <linux/of.h> 31 30 #include <linux/clk.h> 32 31 #include <linux/pm_runtime.h> 33 32 #include <linux/iopoll.h> ··· 1407 1408 .algo = &xiic_algorithm, 1408 1409 }; 1409 1410 1410 - #if defined(CONFIG_OF) 1411 1411 static const struct xiic_version_data xiic_2_00 = { 1412 1412 .quirks = DYNAMIC_MODE_READ_BROKEN_BIT, 1413 1413 }; ··· 1417 1419 {}, 1418 1420 }; 1419 1421 MODULE_DEVICE_TABLE(of, xiic_of_match); 1420 - #endif 1421 1422 1422 1423 static int xiic_i2c_probe(struct platform_device *pdev) 1423 1424 { 1424 1425 struct device *dev = &pdev->dev; 1426 + struct fwnode_handle *fwnode = dev_fwnode(dev); 1425 1427 struct xiic_i2c *i2c; 1426 1428 struct xiic_i2c_platform_data *pdata; 1427 - const struct of_device_id *match; 1429 + const struct xiic_version_data *data; 1428 1430 struct resource *res; 1429 1431 int ret, irq; 1430 1432 u8 i; ··· 1434 1436 if (!i2c) 1435 1437 return -ENOMEM; 1436 1438 1437 - match = of_match_node(xiic_of_match, pdev->dev.of_node); 1438 - if (match && match->data) { 1439 - const struct xiic_version_data *data = match->data; 1440 - 1439 + data = device_get_match_data(dev); 1440 + if (data) 1441 1441 i2c->quirks = data->quirks; 1442 - } 1443 1442 1444 1443 i2c->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); 1445 1444 if (IS_ERR(i2c->base)) ··· 1453 1458 i2c->adap = xiic_adapter; 1454 1459 i2c_set_adapdata(&i2c->adap, i2c); 1455 1460 i2c->adap.dev.parent = &pdev->dev; 1456 - i2c->adap.dev.of_node = pdev->dev.of_node; 1461 + device_set_node(&i2c->adap.dev, fwnode); 1457 1462 snprintf(i2c->adap.name, sizeof(i2c->adap.name), 1458 1463 DRIVER_NAME " %s", pdev->name); 1459 1464 ··· 1477 1482 1478 1483 /* SCL frequency configuration */ 1479 1484 i2c->input_clk = clk_get_rate(i2c->clk); 1480 - ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", 1481 - &i2c->i2c_clk); 1485 + ret = device_property_read_u32(dev, "clock-frequency", &i2c->i2c_clk); 1482 1486 /* If clock-frequency not specified in DT, do not configure in SW */ 1483 1487 if (ret || i2c->i2c_clk > I2C_MAX_FAST_MODE_PLUS_FREQ) 1484 1488 i2c->i2c_clk = 0; ··· 1488 1494 if (ret) 1489 1495 return ret; 1490 1496 1491 - i2c->singlemaster = 1492 - of_property_read_bool(pdev->dev.of_node, "single-master"); 1497 + i2c->singlemaster = device_property_read_bool(dev, "single-master"); 1493 1498 1494 1499 /* 1495 1500 * Detect endianness