Skip to content

Commit 56344e2

Browse files
Akhil RAndi Shyti
authored andcommitted
i2c: tegra: Fix reset error handling with ACPI
The acpi_evaluate_object() returns an ACPI error code and not Linux one. For the some platforms the err will have positive code which may be interpreted incorrectly. Use device_reset() for reset control which handles it correctly. Fixes: bd2fded ("i2c: tegra: Add the ACPI support") Reported-by: Andy Shevchenko <[email protected]> Signed-off-by: Akhil R <[email protected]> Cc: <[email protected]> # v5.17+ Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 89be9a8 commit 56344e2

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

drivers/i2c/busses/i2c-tegra.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,6 @@ static int tegra_i2c_wait_for_config_load(struct tegra_i2c_dev *i2c_dev)
607607
static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
608608
{
609609
u32 val, clk_divisor, clk_multiplier, tsu_thd, tlow, thigh, non_hs_mode;
610-
acpi_handle handle = ACPI_HANDLE(i2c_dev->dev);
611610
struct i2c_timings *t = &i2c_dev->timings;
612611
int err;
613612

@@ -619,11 +618,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
619618
* emit a noisy warning on error, which won't stay unnoticed and
620619
* won't hose machine entirely.
621620
*/
622-
if (handle)
623-
err = acpi_evaluate_object(handle, "_RST", NULL, NULL);
624-
else
625-
err = reset_control_reset(i2c_dev->rst);
626-
621+
err = device_reset(i2c_dev->dev);
627622
WARN_ON_ONCE(err);
628623

629624
if (IS_DVC(i2c_dev))
@@ -1666,19 +1661,6 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev *i2c_dev)
16661661
i2c_dev->is_vi = true;
16671662
}
16681663

1669-
static int tegra_i2c_init_reset(struct tegra_i2c_dev *i2c_dev)
1670-
{
1671-
if (ACPI_HANDLE(i2c_dev->dev))
1672-
return 0;
1673-
1674-
i2c_dev->rst = devm_reset_control_get_exclusive(i2c_dev->dev, "i2c");
1675-
if (IS_ERR(i2c_dev->rst))
1676-
return dev_err_probe(i2c_dev->dev, PTR_ERR(i2c_dev->rst),
1677-
"failed to get reset control\n");
1678-
1679-
return 0;
1680-
}
1681-
16821664
static int tegra_i2c_init_clocks(struct tegra_i2c_dev *i2c_dev)
16831665
{
16841666
int err;
@@ -1788,10 +1770,6 @@ static int tegra_i2c_probe(struct platform_device *pdev)
17881770

17891771
tegra_i2c_parse_dt(i2c_dev);
17901772

1791-
err = tegra_i2c_init_reset(i2c_dev);
1792-
if (err)
1793-
return err;
1794-
17951773
err = tegra_i2c_init_clocks(i2c_dev);
17961774
if (err)
17971775
return err;

0 commit comments

Comments
 (0)