Skip to content

Commit 8abbc71

Browse files
Bartosz GolaszewskiAndi Shyti
authored andcommitted
i2c: davinci: use generic device property accessors
Don't use generic OF APIs if the generic device-level ones will do. Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andi Shyti <[email protected]>
1 parent 7d2b31f commit 8abbc71

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/i2c/busses/i2c-davinci.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
#include <linux/io.h>
2424
#include <linux/kernel.h>
2525
#include <linux/module.h>
26-
#include <linux/of.h>
2726
#include <linux/platform_device.h>
2827
#include <linux/pm_runtime.h>
28+
#include <linux/property.h>
2929
#include <linux/sched.h>
3030
#include <linux/slab.h>
3131

@@ -173,7 +173,6 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev)
173173
u32 clkh;
174174
u32 clkl;
175175
u32 input_clock = clk_get_rate(dev->clk);
176-
struct device_node *of_node = dev->dev->of_node;
177176

178177
/* NOTE: I2C Clock divider programming info
179178
* As per I2C specs the following formulas provide prescaler
@@ -207,7 +206,7 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev)
207206
psc++; /* better to run under spec than over */
208207
d = (psc >= 2) ? 5 : 7 - psc;
209208

210-
if (of_node && of_device_is_compatible(of_node, "ti,keystone-i2c"))
209+
if (device_is_compatible(dev->dev, "ti,keystone-i2c"))
211210
d = 6;
212211

213212
clk = ((input_clock / (psc + 1)) / (dev->bus_freq * 1000));
@@ -811,7 +810,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
811810
adap->algo = &i2c_davinci_algo;
812811
adap->dev.parent = &pdev->dev;
813812
adap->timeout = DAVINCI_I2C_TIMEOUT;
814-
adap->dev.of_node = pdev->dev.of_node;
813+
adap->dev.of_node = dev_of_node(&pdev->dev);
815814

816815
if (dev->has_pfunc)
817816
adap->bus_recovery_info = &davinci_i2c_scl_recovery_info;

0 commit comments

Comments
 (0)