[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHQ1cqEWCib3tOFAEy_iGj2RkM1VdLx78EPR_V2BPm_TmUjXbA@mail.gmail.com>
Date: Sat, 13 Apr 2019 18:04:08 -0700
From: Andrey Smirnov <andrew.smirnov@...il.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: linux-iio@...r.kernel.org, Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
Chris Healy <cphealy@...il.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/6] iio: imx7d_adc: Use devm_iio_device_register()
On Sun, Apr 7, 2019 at 4:07 AM Jonathan Cameron <jic23@...nel.org> wrote:
>
> On Wed, 3 Apr 2019 00:03:22 -0700
> Andrey Smirnov <andrew.smirnov@...il.com> wrote:
>
> > Use devm_iio_device_register() and drop explicit call to
> > iio_device_unregister().
> >
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@...il.com>
> > Cc: Jonathan Cameron <jic23@...nel.org>
> > Cc: Hartmut Knaack <knaack.h@....de>
> > Cc: Lars-Peter Clausen <lars@...afoo.de>
> > Cc: Peter Meerwald-Stadler <pmeerw@...erw.net>
> > Cc: Chris Healy <cphealy@...il.com>
> > Cc: linux-iio@...r.kernel.org
> > Cc: linux-kernel@...r.kernel.org
> No to this one. The thing to think about is the resulting order
> of the unwinding that happens in remove.
>
> Do take a look at the code flow, but in short what happens is:
>
> 1. driver.remove()
> 2. Devm release functions run in the opposite order to they were
> called during setup.
>
> The upshot of the change you just made here is that we turn the power
> off to the device before we remove the userspace interfaces, giving
> potentially interesting failures..
>
> There are two options to avoid this:
>
> 1. Make everything use devm_ calls (often using devm_add_action_or_reset
> for the ones that don't have their own versions).
>
> 2. Stop using devm managed functions at the first non devm_ call that needs
> unwinding. From that point onwards in probe / remove you have to do everything
> manually.
>
Yeah, missed the ordering proble, sorry about that. I'll re-order
changes such that this conversion happens last to avoid said problem
in v2.
Thanks,
Andrey Smirnov
Powered by blists - more mailing lists