Skip to content

Commit

Permalink
i2c: riic: Make use of devres helper to request deasserted reset line
Browse files Browse the repository at this point in the history
Simplify the `riic_i2c_probe()` function by using the
`devm_reset_control_get_optional_exclusive_deasserted()` API to request a
deasserted reset line. This eliminates the need to manually deassert the
reset control and the additional cleanup.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
  • Loading branch information
Lad Prabhakar authored and Wolfram Sang committed Jan 14, 2025
1 parent 7225216 commit 3d9e63c
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions drivers/i2c/busses/i2c-riic.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,6 @@ static struct riic_irq_desc riic_irqs[] = {
{ .res_num = 5, .isr = riic_tend_isr, .name = "riic-nack" },
};

static void riic_reset_control_assert(void *data)
{
reset_control_assert(data);
}

static int riic_i2c_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
Expand All @@ -448,18 +443,10 @@ static int riic_i2c_probe(struct platform_device *pdev)
return dev_err_probe(dev, PTR_ERR(riic->clk),
"missing controller clock");

riic->rstc = devm_reset_control_get_optional_exclusive(dev, NULL);
riic->rstc = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
if (IS_ERR(riic->rstc))
return dev_err_probe(dev, PTR_ERR(riic->rstc),
"Error: missing reset ctrl\n");

ret = reset_control_deassert(riic->rstc);
if (ret)
return ret;

ret = devm_add_action_or_reset(dev, riic_reset_control_assert, riic->rstc);
if (ret)
return ret;
"failed to acquire deasserted reset\n");

for (i = 0; i < ARRAY_SIZE(riic_irqs); i++) {
int irq;
Expand Down

0 comments on commit 3d9e63c

Please sign in to comment.