linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Finn Thain <fthain@linux-m68k.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
	kernel@pengutronix.de
Subject: Re: [PATCH 1/5] nubus: Simplify check in remove callback
Date: Sat, 31 Jul 2021 14:05:15 +0200	[thread overview]
Message-ID: <20210731120515.xkr64yvnczchxz4s@pengutronix.de> (raw)
In-Reply-To: <4b44c8a4-7d2b-83d-60fa-2d4e4f8284db@linux-m68k.org>

[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]

Hello Finn,

On Sat, Jul 31, 2021 at 08:32:38PM +1000, Finn Thain wrote:
> 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?

I'm saying that if you call device_reprobe() the remove callback is
called before dev->driver becomes NULL. So in the remove callback it's
safe to assume that dev->driver is non-NULL.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-07-31 12:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27  8:08 [PATCH 0/5] Some cleanups after making bus_type::remove return void Uwe Kleine-König
2021-07-27  8:08 ` [PATCH 1/5] nubus: Simplify check in remove callback Uwe Kleine-König
2021-07-27  9:50   ` Finn Thain
2021-07-27 10:07     ` Geert Uytterhoeven
2021-07-27 10:19       ` Finn Thain
2021-07-27 11:42     ` Uwe Kleine-König
2021-07-31 10:32       ` Finn Thain
2021-07-31 12:05         ` Uwe Kleine-König [this message]
2021-07-27  8:08 ` [PATCH 2/5] nubus: Make struct nubus_driver::remove return void Uwe Kleine-König
2021-07-27  9:47   ` Finn Thain
2021-07-27  8:08 ` [PATCH 3/5] sh: superhyway: Simplify check in remove callback Uwe Kleine-König
2021-07-27  8:08 ` [PATCH 4/5] zorro: Simplify " Uwe Kleine-König
2021-07-27  8:08 ` [PATCH 5/5] zorro: Drop useless (and hardly used) .driver member in struct zorro_dev Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210731120515.xkr64yvnczchxz4s@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=fthain@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --subject='Re: [PATCH 1/5] nubus: Simplify check in remove callback' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).