lkml.org 
[lkml]   [2021]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/5] nubus: Simplify check in remove callback
On Tue, 27 Jul 2021, Uwe Kleine-König wrote:

> On Tue, Jul 27, 2021 at 07:50:39PM +1000, Finn Thain wrote:
> > On Tue, 27 Jul 2021, Uwe Kleine-König wrote:
> >
> > > The driver core only calls a remove callback when the device was
> > > successfully bound (aka probed) before. So dev->driver is never
> > > NULL.
> >
> > Are you sure dev->driver is non-NULL for the lifetime of the device? A
> > quick glance at device_reprobe() makes me wonder about that.
>
> Not for the lifetime of the device, but as long as a driver is bound to
> the device. device_reprobe() calls device_driver_detach() after which
> the driver is considered unbound and dev->driver is assigned NULL. (via
> device_driver_detach -> device_release_driver_internal ->
> __device_release_driver)
>

Are you saying that this situation does not presently apply to nubus,
zorro or superhyway? Or are you saying that the remove callback will never
be called in this situation?

Perhaps the device_reprobe() API should be documented accordingly, so that
a missing NULL check can be added if need be. Perhaps it is better to just
leave this pattern as is (i.e. keep the NULL check).
\
 
 \ /
  Last update: 2021-07-31 12:33    [W:0.047 / U:0.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site