From patchwork Mon Jan 28 14:23:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin GAIGNARD X-Patchwork-Id: 10783767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5B61A184E for ; Mon, 28 Jan 2019 14:24:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A5FF2A5D5 for ; Mon, 28 Jan 2019 14:24:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E7502A5FD; Mon, 28 Jan 2019 14:24:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E2D362A63F for ; Mon, 28 Jan 2019 14:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eDvZnn60bgzIFVdMmd+sft4OdXHMeeOZCG0cQdbf+NY=; b=XFzDAiibghB2Zh QjxIlFp0/NszEE1Cpk3QljulyWL7Kray93hANnAnAM7v76nDY1uPEOa40hemc+uGt+CsZD5OJ2Iwz 9wWZlD1RQpUbtdsrm9J0XJQY4+EMz2B1TgtdJAggIBPj+y11eNHhuJF19Vlb0fw/KaPcJQuyTEblo B4VXdawF+sIIpZeiwoF2SRN9LKSzNtp2LlpByxaLc2oM94ioLo1TeRcvKlls0GEP5MoRJWzA2nMal /bb6ORW4NDkYAU1fQgaAeJAl6JuaPEpuZgm6blkDh4Whv18WEJx3UTgFtHxzAqimj1XuCKqL5wZlR b/V55ofSskuVZSFsNb1Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1go7pW-0005MB-CG; Mon, 28 Jan 2019 14:24:06 +0000 Received: from mx07-00178001.pphosted.com ([62.209.51.94]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1go7p5-0004tx-IV for linux-arm-kernel@lists.infradead.org; Mon, 28 Jan 2019 14:23:41 +0000 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0SEL00d025914; Mon, 28 Jan 2019 15:23:33 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2q8dw2vy0v-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 28 Jan 2019 15:23:33 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7F11E31; Mon, 28 Jan 2019 14:23:32 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4CC7F2D38; Mon, 28 Jan 2019 14:23:32 +0000 (GMT) Received: from SAFEX1HUBCAS24.st.com (10.75.90.95) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 28 Jan 2019 15:23:31 +0100 Received: from localhost (10.201.20.122) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 28 Jan 2019 15:23:31 +0100 From: Benjamin Gaignard To: , , , , , Subject: [RFC v2 3/7] base: Add calls to domains controller Date: Mon, 28 Jan 2019 15:23:09 +0100 Message-ID: <20190128142313.17036-4-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20190128142313.17036-1-benjamin.gaignard@st.com> References: <20190128142313.17036-1-benjamin.gaignard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.20.122] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-28_08:, , signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190128_062339_910217_DA588F36 X-CRM114-Status: GOOD ( 11.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: benjamin.gaignard@linaro.org, loic.pallardy@st.com, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, Benjamin Gaignard Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP To avoid modifying all the drivers call domainsctrl_set_default_config before probe to apply the configuration define in device node (if any). When unbinding the device try to apply configuration named "unbind". Signed-off-by: Benjamin Gaignard --- drivers/base/dd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 8ac10af17c00..2880fe893096 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -478,6 +479,10 @@ static int really_probe(struct device *dev, struct device_driver *drv) re_probe: dev->driver = drv; + ret = domainsctrl_set_default_config(dev); + if (ret) + goto domainctrl_failed; + /* If using pinctrl, bind pins now before probing */ ret = pinctrl_bind_pins(dev); if (ret) @@ -548,6 +553,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) blocking_notifier_call_chain(&dev->bus->p->bus_notifier, BUS_NOTIFY_DRIVER_NOT_BOUND, dev); pinctrl_bind_failed: + domainsctrl_set_config_by_name(dev, "unbind"); +domainctrl_failed: device_links_no_driver(dev); devres_release_all(dev); driver_sysfs_remove(dev); @@ -970,6 +977,8 @@ static void __device_release_driver(struct device *dev, struct device *parent) device_links_driver_cleanup(dev); arch_teardown_dma_ops(dev); + domainsctrl_set_config_by_name(dev, "unbind"); + devres_release_all(dev); dev->driver = NULL; dev_set_drvdata(dev, NULL);