[PATCH v2 2/3] i2c: k1: add reset support
Guodong Xu
guodong at riscstar.com
Sat Dec 27 16:42:47 PST 2025
Hi, Andi
On Sun, Dec 28, 2025 at 3:26 AM Andi Shyti <andi.shyti at kernel.org> wrote:
>
> Hi Guodong,
>
> On Fri, Dec 26, 2025 at 07:38:22AM +0800, Guodong Xu wrote:
> > On Fri, Dec 26, 2025 at 5:01 AM Andi Shyti <andi.shyti at kernel.org> wrote:
> > > > + rst = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
> > > > + if (IS_ERR(rst))
> > > > + return dev_err_probe(dev, PTR_ERR(rst),
> > > > + "failed to acquire deasserted reset\n");
> > >
> > > If this is optional, why are we returning with error?
> > >
> >
> > According to include/linux/reset.h, if the requested reset is not
> > specified in the device tree, this function returns NULL instead of
> > an error. Therefore, IS_ERR(rst) will only be true for actual
> > errors (e.g probe deferral).
>
> And this is quite obvious, but you haven't answered my qestion.
>
> Why do we care of internal failures in reset? If reset fails on
> an optional reset control function why should we kill our driver?
Thanks for the clarification. I see your point now.
My reasoning is that if the resets property is explicitly listed in the
Device Tree, the driver must respect it. If the property is present but
we encounter an error (like -EPROBE_DEFER), ignoring that failure could
put the hardware in an undefined or dirty state.
> Just ignore the error and move forward as we have done until now.
I want to double-check what you mean.
I checked other drivers in drivers/i2c/busses (e.g. i2c-riic.c, i2c-mv64xxx.c,
i2c-designware-platdrv.c), and they seem to follow this pattern of returning
errors even for optional resets.
BR,
Guodong
>
> If the kernel is suffering from internal failures (say ENOMEM),
> it will fail anyway or, with some luck, recover.
>
> Andi
More information about the linux-riscv
mailing list