Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753017AbdHKP3F (ORCPT ); Fri, 11 Aug 2017 11:29:05 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:44755 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752631AbdHKP3D (ORCPT ); Fri, 11 Aug 2017 11:29:03 -0400 X-ME-Sender: X-Sasl-enc: T7nXoAkyvILanHt1dw0l8cfLmTMpIZes37tCq2JlUXY/ 1502465340 Date: Fri, 11 Aug 2017 12:28:57 -0300 From: Henrique de Moraes Holschuh To: Michal =?iso-8859-1?Q?Such=E1nek?= Cc: Jason Gunthorpe , Greg Kroah-Hartman , Peter Huewe , Marcel Selhorst , Jarkko Sakkinen , linux-kernel@vger.kernel.org, tpmdd-devel@lists.sourceforge.net Subject: Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set. Message-ID: <20170811152857.cgjvlkiilskv76o3@khazad-dum.debian.net> References: <20170809213420.2391-1-msuchanek@suse.de> <20170809215202.GA21867@obsidianresearch.com> <20170810121811.2741dccc@kitsune.suse.cz> <20170810163057.GA21485@obsidianresearch.com> <25eaf1ea1d44f7950dbca6b3c4598c48@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <25eaf1ea1d44f7950dbca6b3c4598c48@suse.de> X-GPG-Fingerprint1: 4096R/0x0BD9E81139CB4807: C467 A717 507B BAFE D3C1 6092 0BD9 E811 39CB 4807 User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1392 Lines: 35 On Fri, 11 Aug 2017, Michal Such?nek wrote: > On 2017-08-10 18:30, Jason Gunthorpe wrote: > > On Thu, Aug 10, 2017 at 12:18:11PM +0200, Michal Such?nek wrote: > > > > Existing bus implementations do properly chain to driver shutdown (eg > > > > look at mmc_bus_shutdown) and it appears to have been written like > > > > > > Neither isa nor ibmebus does. These are two random buses I tried to > > > look at. > > > > I'm not following, I see this: > > > > static void ibmebus_bus_device_shutdown(struct device *dev) > > { > > struct platform_device *of_dev = to_platform_device(dev); > > struct platform_driver *drv = to_platform_driver(dev->driver); > > > > if (dev->driver && drv->shutdown) > > drv->shutdown(of_dev); > > } > > > > It looks to me like in this case the struct device_driver shutdown is > > not used, and instead the struct platform_driver shutdown is called. > > And it is not used even if a device driver sets it and expects it to run. Which is the kind of landmine it is best avoided in drivers/, so it would be nice to get WARN_ON() during device register when dev->shutdown() methods *that are going to be ignored* because of class/bus handlers are non-NULL... Either that, or the device->shutdown() methods should always be called, and drivers that should not/need not have them should be fixed... -- Henrique Holschuh