From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936745AbdJRKKs (ORCPT ); Wed, 18 Oct 2017 06:10:48 -0400 Received: from cloudserver094114.home.net.pl ([79.96.170.134]:48547 "EHLO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936628AbdJRKKr (ORCPT ); Wed, 18 Oct 2017 06:10:47 -0400 From: "Rafael J. Wysocki" To: Mark Brown Cc: Greg Kroah-Hartman , Jeffy Chen , linux-kernel@vger.kernel.org, dmitry.torokhov@gmail.com, heiko@sntech.de, briannorris@chromium.org, dianders@chromium.org, tfiga@chromium.org, seanpaul@chromium.org, thierry.reding@gmail.com Subject: Re: [PATCH] driver core: Make sure device detached from driver before deleting it Date: Wed, 18 Oct 2017 12:01:09 +0200 Message-ID: <2372472.Y1TOlSNE40@aspire.rjw.lan> In-Reply-To: <20171018094721.s56qkx4m7gswvpc3@sirena.co.uk> References: <20171018054926.4756-1-jeffy.chen@rock-chips.com> <20171018061952.GA18857@kroah.com> <20171018094721.s56qkx4m7gswvpc3@sirena.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday, October 18, 2017 11:47:21 AM CEST Mark Brown wrote: > > --3mkxuqf5z23bfztf > Content-Type: text/plain; charset=us-ascii > Content-Disposition: inline > > On Wed, Oct 18, 2017 at 08:19:52AM +0200, Greg Kroah-Hartman wrote: > > On Wed, Oct 18, 2017 at 01:49:26PM +0800, Jeffy Chen wrote: > > > There are cases we call device_del() without detaching it from the > > > driver(e.g. spi core del children devices). > > > Why would you do that? Shouldn't that be fixed instead of this odd > > work-around for a broken bus? > > Not that I ever looked at that bit of the SPI stack before but this > feels like an interface bug in the driver core, it's really surprising > that unregistering a device doesn't clean it up. That's what other > unregister interfaces do. If this is buggy it looks like the platform > bus will also be buggy, it's just doing a del and a put (plus some stuff > to free resources) which is all device_unregster() does. device_del() calls bus_remove_device() which then calls device_release_driver() eventually. So there is something going wrong, but that's not a missing device_release_driver() call. :-)