[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210727114220.7drjl6xvvlwetaod@pengutronix.de>
Date: Tue, 27 Jul 2021 13:42:20 +0200
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To: Finn Thain <fthain@...ux-m68k.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-m68k@...ts.linux-m68k.org, linux-kernel@...r.kernel.org,
kernel@...gutronix.de
Subject: Re: [PATCH 1/5] nubus: Simplify check in remove callback
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)
> > Apart from that, the compiler might already assume dev->driver being
> > non-NULL after to_nubus_driver(dev->driver) was called.
>
> I don't understand how a compiler can make that assumption. But then, I
> don't know why compilers do a lot of the things they do...
Ah, you're right, there is no dereference in container_of, so I might
also be wrong here. I will send a v2 without this last sentence in the
commit log.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists