Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1530458imm; Fri, 6 Jul 2018 01:39:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdTcbw8xSsDg92QlngPAnzSDv9DZNsEY24pTN+GLHLX/nIF+oir3OvKhNEuh6KhP4gEYEyb X-Received: by 2002:a65:520d:: with SMTP id o13-v6mr8515831pgp.282.1530866363689; Fri, 06 Jul 2018 01:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530866363; cv=none; d=google.com; s=arc-20160816; b=qKau92sCLcGhfL1KPPLBtuucqw5RmuVawR42TRBOMWSR8lD69czuFd3hICK0R612X2 3yTqHV11oIqa8U3+NDmYRT8QmdG6dMErW1TqY3qvmKDF7e4AechoKAre7g4Y7ICD5aBC hgcG9IsXNXxOWOnADdYAe1YJPaKy1kP9mOQOve2LgWo9B5uELj9S7PdhhzFex1Q6Hgxe QibuGydHrmNbo5yhqA3KzmAPop09twR2ypzq63kWiz0gL47T+BcqWW5rmsS2mMrBH0vx KpS+eVdeiFIPMPNkhHR0vbU9/wUv/J0qJ3POSwCvfamlSanRIkSi485pJQyoHzdKevzE bnTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=YWjDrIvCsvkCA8maw0TxfcrEU/itgOcxdhvvF92BfoU=; b=SbskQmYkNYe6esu99eH93pF7VezYdoPNumR3TyL7tHAUSrjlLeXUwZStwobdrZrUEn I8pcJNLr+IkJog5ymxrXLzCd0/lBRp1OmFz3HKG5je16gtb9e1xT/QsqE8LfXMmXVen0 6q3EGWNnulDXe62piL8/MMmkTcoCgGplSkgdq4yMpZAh5/lwZIstPvorXh3pDbFVNFIt 1z6ofyAkeCGT9jUV76ZuN4luJsFXXdXCYGTuUChwUasa5hCAelPq2w/qLMOfV5mfVcQA OFDXZs6dhIbSb0pDw+lEtgnC8oCApZUsDjo5N+5O5HKv6g1XV8fKQCFCDNiBs7sS43LN RFSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x21-v6si5791340pln.319.2018.07.06.01.39.08; Fri, 06 Jul 2018 01:39:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932650AbeGFIhI (ORCPT + 99 others); Fri, 6 Jul 2018 04:37:08 -0400 Received: from bmailout3.hostsharing.net ([176.9.242.62]:48917 "EHLO bmailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932268AbeGFIgF (ORCPT ); Fri, 6 Jul 2018 04:36:05 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 95D20100DEC9C; Fri, 6 Jul 2018 10:36:03 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 4C21435E30; Fri, 6 Jul 2018 10:36:03 +0200 (CEST) Date: Fri, 6 Jul 2018 10:36:03 +0200 From: Lukas Wunner To: "Rafael J. Wysocki" Cc: Pingfan Liu , Linux Kernel Mailing List , Greg Kroah-Hartman , Grygorii Strashko , Christoph Hellwig , Bjorn Helgaas , Dave Young , Linux PCI , linuxppc-dev , Linux PM , Kishon Vijay Abraham I Subject: Re: [PATCHv3 0/4] drivers/base: bugfix for supplier<-consumer ordering in device_kset Message-ID: <20180706083603.GA9063@wunner.de> References: <1530600642-25090-1-git-send-email-kernelfans@gmail.com> <4685360.VNmeYLh0dQ@aspire.rjw.lan> <6281446.GoJLz6Hq6C@aspire.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [cc += Kishon Vijay Abraham] On Thu, Jul 05, 2018 at 11:18:28AM +0200, Rafael J. Wysocki wrote: > OK, so calling devices_kset_move_last() from really_probe() clearly is > a mistake. > > I'm not really sure what the intention of it was as the changelog of > commit 52cdbdd49853d doesn't really explain that (why would it be > insufficient without that change?) It seems 52cdbdd49853d fixed an issue with boards which have an MMC whose reset pin needs to be driven high on shutdown, lest the MMC won't be found on the next boot. The boards' devicetrees use a kludge wherein the reset pin is modelled as a regulator. The regulator is enabled when the MMC probes and disabled on driver unbind and shutdown. As a result, the pin is driven low on shutdown and the MMC is not found on the next boot. To fix this, another kludge was invented wherein the GPIO expander driving the reset pin unconditionally drives all its pins high on shutdown, see pcf857x_shutdown() in drivers/gpio/gpio-pcf857x.c (commit adc284755055, "gpio: pcf857x: restore the initial line state of all pcf lines"). For this kludge to work, the GPIO expander's ->shutdown hook needs to be executed after the MMC expander's ->shutdown hook. Commit 52cdbdd49853d achieved that by reordering devices_kset according to the probe order. Apparently the MMC probes after the GPIO expander, possibly because it returns -EPROBE_DEFER if the vmmc regulator isn't available yet, see mmc_regulator_get_supply(). Note, I'm just piecing the information together from git history, I'm not responsible for these kludges. (I'm innocent!) @Pingfan Liu, if you just remove the call to devices_kset_move_last() from really_probe(), does the issue go away? If so, it might be best to remove that call and model the dependency with a call to device_link_add() in mmc_regulator_get_supply(). Another idea would be to automatically add a device_link in the driver core if -EPROBE_DEFER is returned. Thanks, Lukas