From patchwork Mon Jun 29 11:22:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 11630759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4BAF739 for ; Mon, 29 Jun 2020 11:24:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E3F123A01 for ; Mon, 29 Jun 2020 11:24:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nXNCgA98"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="OP7uzmLK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E3F123A01 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=dWXNFAFDhNXzAnm4WTmkrc92GuirzVBhFPNbXJ7MvSM=; b=nXNCgA9853D2IHyRZpWRqe5Wyw 3QYvhOdi7wqp7ja/eDqZMHEbHpPvDHxTVGF5CSZIuIUKPkEXyrVRAsZAdDLEIhg+2nLd65Pws5FQb eMNGLEXY+B++zSiqH7JFwjO0YE9M1I6FYJV8SgmyAcNq+nwFk2UYdg1tEDZK/dq5z0n4PMckz90EC 5SQQvm2uCGP/XCY66LcMyj/i2EaAZp5+6aqSaPZ93MZejOFjtF8O/FXs+sh9xXFBVbmBcghcOEE/e WgV2/msbNAW749A/lvvAyLIZPUfcv5uiL+j6fMwjal4iPTZ33R+I6kOFEIbmRKhQAE/BbFipQblq9 GBc6IDrA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jprsh-0007Xk-5V; Mon, 29 Jun 2020 11:23:23 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jprsB-0007Mo-Qx for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 11:22:56 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200629112249euoutp02fcff03b9fbe532f1057b4df28abc7d18~c-_7PNLTj1877518775euoutp02W for ; Mon, 29 Jun 2020 11:22:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200629112249euoutp02fcff03b9fbe532f1057b4df28abc7d18~c-_7PNLTj1877518775euoutp02W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1593429769; bh=wssmSSMaPF7CImaevv1vsgWSyL4FhXmVP1cwotetOaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OP7uzmLKmDoWUpOXcxFCcZPP+3izi1IaDsNnlTYOpyV7Vt8jcXLvKVUX62U7tZLqr 8/5ogTTZyMKhLi7IXTupVO/jc5byWpH+m3fwGgX2hPv/JbEJOb5l1Mm4z/erFcTzW4 JCAiSniFH44G0WCMTGxPs0JzNOaUabR2o9Pyqe5Y= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200629112248eucas1p1e955f3406a049db1026fd70bf7b7cf37~c-_6su_Ni1033510335eucas1p1l; Mon, 29 Jun 2020 11:22:48 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id BC.A7.06456.80FC9FE5; Mon, 29 Jun 2020 12:22:48 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200629112248eucas1p187e5dac2f4f6120aacbc86e48ad0fff9~c-_6SUG4N1890518905eucas1p1T; Mon, 29 Jun 2020 11:22:48 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200629112248eusmtrp2595e9175d804508d8e50c56bf97ec1bf~c-_6Rjh9M1939019390eusmtrp2b; Mon, 29 Jun 2020 11:22:48 +0000 (GMT) X-AuditID: cbfec7f2-7efff70000001938-c1-5ef9cf08013f Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id DA.EC.06017.80FC9FE5; Mon, 29 Jun 2020 12:22:48 +0100 (BST) Received: from AMDC3748.digital.local (unknown [106.120.51.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200629112247eusmtip109ae075f9a8cb05d25252e50db7e5a84~c-_5f8y2e2177921779eusmtip13; Mon, 29 Jun 2020 11:22:47 +0000 (GMT) From: Andrzej Hajda To: Greg Kroah-Hartman Subject: [PATCH v7 1/4] driver core: add device probe log helper Date: Mon, 29 Jun 2020 13:22:39 +0200 Message-Id: <20200629112242.18380-2-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629112242.18380-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSWUxT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FlrPIsWRmVeSWpSXmKPExsVy+t/xu7oc53/GGTQ18VjcWneO1eLlhMOM FhtnrGe1mPrwCZvF/20TmS2ufH3PZtG8eD2bxdXvL5ktTr65ymLROXEJu8Wmx9dYLS7vmsNm cWjqXkaLtUfuslsc6ou2mPtlKrODgMflaxeZPd7faGX32PttAYvHzll32T1md8xk9di0qpPN 48SES0we++euYfe4332cyWPzknqPvi2rGD0O9E5m8fi8SS6AN0rPpii/tCRVISO/uMRWKdrQ wkjP0NJCz8jEUs/Q2DzWyshUSd/OJiU1J7MstUjfLkEv49SlV6wFPWIVHY9uMjcwThLqYmTn kBAwkdgQ1cXIxSEksJRRYtXu26xdjJxAYXGJ3fPfMkPYwhJ/rnWxQRR9YpToXH4KrIhNQFPi 7+abbCC2iICxRP/ZWewgRcwCbawSc88/YQdJCAs4ADXcBZvEIqAqMXntRLA4r4CFxNMPr6G2 yUus3nAArIZTwFLi8oWZjCC2EFDNhaOd7BMY+RYwMqxiFEktLc5Nzy020itOzC0uzUvXS87P 3cQIjKxtx35u2cHY9S74EKMAB6MSD2/CuZ9xQqyJZcWVuYcYJTiYlUR4nc6ejhPiTUmsrEot yo8vKs1JLT7EaAp01ERmKdHkfGDU55XEG5oamltYGpobmxubWSiJ83YIHIwREkhPLEnNTk0t SC2C6WPi4JRqYEzp2lpw5MyN/f8zTk8OlVp4d9rjVWYxlWw/P68UDhbomxn/P3Hxi68G0Qoh JqF5ulxpYlWBR69cE2FQllGUPXE/VOzigaVWS89eiHn0syfmFVOke6PD1X+f3t06GGslqKVZ p2ZZtKd/mcvZqFshESXa3bpdtxya3XMDLq+K7XnROOG9iYhdoBJLcUaioRZzUXEiAFiu5E7C AgAA X-CMS-MailID: 20200629112248eucas1p187e5dac2f4f6120aacbc86e48ad0fff9 X-Msg-Generator: CA X-RootMTR: 20200629112248eucas1p187e5dac2f4f6120aacbc86e48ad0fff9 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200629112248eucas1p187e5dac2f4f6120aacbc86e48ad0fff9 References: <20200629112242.18380-1-a.hajda@samsung.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [210.118.77.12 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [210.118.77.12 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , "Rafael J. Wysocki" , Jonas Karlman , Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org, "open list:DRM DRIVERS" , Russell King - ARM Linux , Neil Armstrong , Andrzej Hajda , andy.shevchenko@gmail.com, Mark Brown , Laurent Pinchart , Daniel Vetter , linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org During probe every time driver gets resource it should usually check for error printk some message if it is not -EPROBE_DEFER and return the error. This pattern is simple but requires adding few lines after any resource acquisition code, as a result it is often omitted or implemented only partially. dev_err_probe helps to replace such code sequences with simple call, so code: if (err != -EPROBE_DEFER) dev_err(dev, ...); return err; becomes: return dev_err_probe(dev, err, ...); Signed-off-by: Andrzej Hajda Reviewed-by: Rafael J. Wysocki Reviewed-by: Andy Shevchenko Reviewed-by: Mark Brown --- drivers/base/core.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/linux/device.h | 3 +++ 2 files changed, 45 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 67d39a90b45c..3a827c82933f 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3953,6 +3953,48 @@ define_dev_printk_level(_dev_info, KERN_INFO); #endif +/** + * dev_err_probe - probe error check and log helper + * @dev: the pointer to the struct device + * @err: error value to test + * @fmt: printf-style format string + * @...: arguments as specified in the format string + * + * This helper implements common pattern present in probe functions for error + * checking: print debug or error message depending if the error value is + * -EPROBE_DEFER and propagate error upwards. + * It replaces code sequence: + * if (err != -EPROBE_DEFER) + * dev_err(dev, ...); + * else + * dev_dbg(dev, ...); + * return err; + * with + * return dev_err_probe(dev, err, ...); + * + * Returns @err. + * + */ +int dev_err_probe(const struct device *dev, int err, const char *fmt, ...) +{ + struct va_format vaf; + va_list args; + + va_start(args, fmt); + vaf.fmt = fmt; + vaf.va = &args; + + if (err != -EPROBE_DEFER) + dev_err(dev, "error %d: %pV", err, &vaf); + else + dev_dbg(dev, "error %d: %pV", err, &vaf); + + va_end(args); + + return err; +} +EXPORT_SYMBOL_GPL(dev_err_probe); + static inline bool fwnode_is_primary(struct fwnode_handle *fwnode) { return fwnode && !IS_ERR(fwnode->secondary); diff --git a/include/linux/device.h b/include/linux/device.h index 15460a5ac024..6b2272ae9af8 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -964,6 +964,9 @@ void device_link_remove(void *consumer, struct device *supplier); void device_links_supplier_sync_state_pause(void); void device_links_supplier_sync_state_resume(void); +extern __printf(3, 4) +int dev_err_probe(const struct device *dev, int err, const char *fmt, ...); + /* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV(major,minor) \ MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) From patchwork Mon Jun 29 11:22:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 11630755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28B26174A for ; Mon, 29 Jun 2020 11:24:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F3C4623A01 for ; Mon, 29 Jun 2020 11:24:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lYveeb8n"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="kVgkPGL4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3C4623A01 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=DbUi46A4B/GGDldlShqDev7osKm6dLjeBfg66KjcKVo=; b=lYveeb8nwJmPFBScIVRIPDebbM gfTUh3Pwq52cEHu0EX6uWgFnRywRIQ3H8LVhcvmPwRFD7IZUWD96ekBC9thdwJKzi+KL2EbQoMs39 xQxIRUFJiXN0VrKfiG5Zr/So43H6r4IUYu/JW96c4ozhkzWnqU876eoi1eolq2kksp7W2GmvycdjT 1tMDMV/TjW2GS7Z15utExDSBtJmQsgfbWPDvdYiJhI3vCYBjZ36rZBJN9ZbSCuaLCtJIEX0etcDL0 uxla7HMGzkY+JbjG0Mio6YGYB9dclXAFVI91afaLMLqwWWnMklqzPviRqaDM0f3kHOkm6r5P5PoMk quzPV5cg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jprsZ-0007VL-4F; Mon, 29 Jun 2020 11:23:15 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jprsB-0007Mx-Qx for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 11:22:56 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200629112249euoutp029653430a9d48c4827c864734493c4f7c~c-_7u-6EG1862518625euoutp02e for ; Mon, 29 Jun 2020 11:22:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200629112249euoutp029653430a9d48c4827c864734493c4f7c~c-_7u-6EG1862518625euoutp02e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1593429769; bh=CMERx4lgHtPROTVbuhhkyjsE+9cW7GAD7BGwlyn84mI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kVgkPGL4+wxH+Z0JxL+EtsiTIFaJtSxVI4hyDag1e/eNU2hDvmOwMrRZzHxgiZ7OW 7n3NaX9khYVPSujbsWw2I/0Iip5AD45mOrlzD7EiwrjQ+/S+ORpCfdinuUiMHh+4fh +jTB3s/f363QTcfmLgh6buum2pOIA2REEP0zhrZA= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200629112249eucas1p2fbd5791c8128b15d691229df630f96b4~c-_7WiTKj0840608406eucas1p2U; Mon, 29 Jun 2020 11:22:49 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 2E.A7.06456.90FC9FE5; Mon, 29 Jun 2020 12:22:49 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200629112249eucas1p160b845444f8fbad96bdec41e9d3938da~c-_673odH1893118931eucas1p1a; Mon, 29 Jun 2020 11:22:49 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200629112248eusmtrp2b89ff42eb1242f6b3f9794b94694cf28~c-_67L5Vj1960419604eusmtrp2o; Mon, 29 Jun 2020 11:22:48 +0000 (GMT) X-AuditID: cbfec7f2-809ff70000001938-c4-5ef9cf09a0a9 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id EB.EC.06017.80FC9FE5; Mon, 29 Jun 2020 12:22:48 +0100 (BST) Received: from AMDC3748.digital.local (unknown [106.120.51.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200629112248eusmtip12146d8bc48fb9f86c4b5af32af8ff859~c-_6OPabQ2279922799eusmtip1A; Mon, 29 Jun 2020 11:22:48 +0000 (GMT) From: Andrzej Hajda To: Greg Kroah-Hartman Subject: [PATCH v7 2/4] driver core: add deferring probe reason to devices_deferred property Date: Mon, 29 Jun 2020 13:22:40 +0200 Message-Id: <20200629112242.18380-3-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629112242.18380-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0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WpSXmKPExsVy+t/xu7oc53/GGexdaG1xa905VouXEw4z WmycsZ7VYurDJ2wW/7dNZLa48vU9m0Xz4vVsFle/v2S2OPnmKotF58Ql7BabHl9jtbi8aw6b xaGpexkt1h65y25xqC/aYu6XqcwOAh6Xr11k9nh/o5XdY++3BSweO2fdZfeY3TGT1WPTqk42 jxMTLjF57J+7ht3jfvdxJo/NS+o9+rasYvQ40DuZxePzJrkA3ig9m6L80pJUhYz84hJbpWhD CyM9Q0sLPSMTSz1DY/NYKyNTJX07m5TUnMyy1CJ9uwS9jIcXFjEVzFGpmPTnGWsD4wq5LkZO DgkBE4mdj/+wdzFycQgJLGWUuPysnxkiIS6xe/5bKFtY4s+1LjaIok+MElfPzmUDSbAJaEr8 3XwTzBYRMJboPzsLbBKzQBurxNzzT9hBEsICMRJXp89j6WLk4GARUJW4e1EEJMwrYCHRfn4y G8QCeYnVGw6ALeMUsJS4fGEmI4gtBFRz4Wgn+wRGvgWMDKsYRVJLi3PTc4uN9IoTc4tL89L1 kvNzNzECY2vbsZ9bdjB2vQs+xCjAwajEw5tw7mecEGtiWXFl7iFGCQ5mJRFep7On44R4UxIr q1KL8uOLSnNSiw8xmgLdNJFZSjQ5Hxj3eSXxhqaG5haWhubG5sZmFkrivB0CB2OEBNITS1Kz U1MLUotg+pg4OKUaGJW1jmdt6Z2qXCMfv1bo3ycvf/2qx+cP9Wn1S4dcLji4qnbdpfNz+e+l Bbt/3XU8McNl+n6Pd7x/rnlpTVSYxhtYm5Zf+IPxhsM2+4AHjTfyei8XR4VmLzRm4JrZc01F hbm0Z0Nd2MHLbZ4zrcw1RQUDN7M5bk95urJ3J+cLm77Qmb82T/ogqcRSnJFoqMVcVJwIAG3q 8PXDAgAA X-CMS-MailID: 20200629112249eucas1p160b845444f8fbad96bdec41e9d3938da X-Msg-Generator: CA X-RootMTR: 20200629112249eucas1p160b845444f8fbad96bdec41e9d3938da X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200629112249eucas1p160b845444f8fbad96bdec41e9d3938da References: <20200629112242.18380-1-a.hajda@samsung.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [210.118.77.12 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [210.118.77.12 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , "Rafael J. Wysocki" , Jonas Karlman , Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org, "open list:DRM DRIVERS" , Russell King - ARM Linux , Neil Armstrong , Andrzej Hajda , andy.shevchenko@gmail.com, Mark Brown , Laurent Pinchart , Daniel Vetter , linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org /sys/kernel/debug/devices_deferred property contains list of deferred devices. This list does not contain reason why the driver deferred probe, the patch improves it. The natural place to set the reason is dev_err_probe function introduced recently, ie. if dev_err_probe will be called with -EPROBE_DEFER instead of printk the message will be attached to deferred device and printed when user read devices_deferred property. Signed-off-by: Andrzej Hajda Reviewed-by: Mark Brown Reviewed-by: Javier Martinez Canillas Reviewed-by: Andy Shevchenko Reviewed-by: Rafael J. Wysocki --- drivers/base/base.h | 3 +++ drivers/base/core.c | 8 ++++++-- drivers/base/dd.c | 23 ++++++++++++++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/base/base.h b/drivers/base/base.h index 95c22c0f9036..6954fccab3d7 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h @@ -93,6 +93,7 @@ struct device_private { struct klist_node knode_class; struct list_head deferred_probe; struct device_driver *async_driver; + char *deferred_probe_reason; struct device *device; u8 dead:1; }; @@ -134,6 +135,8 @@ extern void device_release_driver_internal(struct device *dev, extern void driver_detach(struct device_driver *drv); extern int driver_probe_device(struct device_driver *drv, struct device *dev); extern void driver_deferred_probe_del(struct device *dev); +extern void device_set_deferred_probe_reson(const struct device *dev, + struct va_format *vaf); static inline int driver_match_device(struct device_driver *drv, struct device *dev) { diff --git a/drivers/base/core.c b/drivers/base/core.c index 3a827c82933f..fee047f03681 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3963,6 +3963,8 @@ define_dev_printk_level(_dev_info, KERN_INFO); * This helper implements common pattern present in probe functions for error * checking: print debug or error message depending if the error value is * -EPROBE_DEFER and propagate error upwards. + * In case of -EPROBE_DEFER it sets also defer probe reason, which can be + * checked later by reading devices_deferred debugfs attribute. * It replaces code sequence: * if (err != -EPROBE_DEFER) * dev_err(dev, ...); @@ -3984,10 +3986,12 @@ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...) vaf.fmt = fmt; vaf.va = &args; - if (err != -EPROBE_DEFER) + if (err != -EPROBE_DEFER) { dev_err(dev, "error %d: %pV", err, &vaf); - else + } else { + device_set_deferred_probe_reson(dev, &vaf); dev_dbg(dev, "error %d: %pV", err, &vaf); + } va_end(args); diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 9a1d940342ac..dd5683b61f74 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "base.h" #include "power/power.h" @@ -136,6 +137,8 @@ void driver_deferred_probe_del(struct device *dev) if (!list_empty(&dev->p->deferred_probe)) { dev_dbg(dev, "Removed from deferred list\n"); list_del_init(&dev->p->deferred_probe); + kfree(dev->p->deferred_probe_reason); + dev->p->deferred_probe_reason = NULL; } mutex_unlock(&deferred_probe_mutex); } @@ -211,6 +214,23 @@ void device_unblock_probing(void) driver_deferred_probe_trigger(); } +/** + * device_set_deferred_probe_reson() - Set defer probe reason message for device + * @dev: the pointer to the struct device + * @vaf: the pointer to va_format structure with message + */ +void device_set_deferred_probe_reson(const struct device *dev, struct va_format *vaf) +{ + const char *drv = dev_driver_string(dev); + + mutex_lock(&deferred_probe_mutex); + + kfree(dev->p->deferred_probe_reason); + dev->p->deferred_probe_reason = kasprintf(GFP_KERNEL, "%s: %pV", drv, vaf); + + mutex_unlock(&deferred_probe_mutex); +} + /* * deferred_devs_show() - Show the devices in the deferred probe pending list. */ @@ -221,7 +241,8 @@ static int deferred_devs_show(struct seq_file *s, void *data) mutex_lock(&deferred_probe_mutex); list_for_each_entry(curr, &deferred_probe_pending_list, deferred_probe) - seq_printf(s, "%s\n", dev_name(curr->device)); + seq_printf(s, "%s\t%s", dev_name(curr->device), + curr->device->p->deferred_probe_reason ?: "\n"); mutex_unlock(&deferred_probe_mutex); From patchwork Mon Jun 29 11:22:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 11630753 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA333739 for ; Mon, 29 Jun 2020 11:24:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C26A023A51 for ; Mon, 29 Jun 2020 11:24:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bwAEy1ie"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="CvYNjDi7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C26A023A51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=AYxE18rNGP+HENsxmLcINBn8WrFwLk3oYS2SMA3gXWA=; b=bwAEy1ieTi62mQnEP6Vp4S9p/e +VmVs2cXxcOL+JHtLSuZzTVVa6MHBLW/orkDW10YFyz1BYZ70o0DAUjg9P5JrISTDIy296WxOExPD w94rm8s7w5BKD/s4pP+1A/KX8j30JTKzxOvKfJFsem/NT8pxbQqga/Kl4zhnmjShR5wjbyqnUyF2m erGQRQs8FOK/nBf54Eby+llmE+ncmbFIihriRVBdqZEf9OoA+/0ccN8AZ9ruUIsy0hBx3fq+QwznP kIc42FK46Rz50Vr70voS9TVjxI/Ta5V2+M3hFfUTTvJ6pd0xVdllKBj949IcuRnEoMqIquGMs/sex CdCHWaJg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jprsS-0007Sp-5Y; Mon, 29 Jun 2020 11:23:08 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jprsB-0007NJ-HV for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 11:22:54 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200629112250euoutp01e07f6fe4ae20aa4d7ec2125d7cd70831~c-_8kJhoD2846828468euoutp01M for ; Mon, 29 Jun 2020 11:22:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200629112250euoutp01e07f6fe4ae20aa4d7ec2125d7cd70831~c-_8kJhoD2846828468euoutp01M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1593429770; bh=ldZknbF9TPUSQxdpO3ouuzcL7PaF+JDqisngEE3mM30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CvYNjDi7vD5kVixtnoYzJ5QHtkc5b0JLF38t3tzPF5vMfbZ+XPjnc2pNFcgqmO3yN F9qwv2bSLt0xS8tfzQjD38ikhJxnqBoCOHjlSe4c9Pmj1XfaLE1161KFR1d6SQgctp qvdXaHDv6pUkxrjwiDyFMSp9XCn/KBd9paM9tIdg= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200629112250eucas1p207dd9dd07c8d2b62bce2b9d6ec01e958~c-_8MJKeT2471224712eucas1p2X; Mon, 29 Jun 2020 11:22:50 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id AF.A7.06456.A0FC9FE5; Mon, 29 Jun 2020 12:22:50 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200629112249eucas1p12fc95f88729c12c78b1a5bfe32afad8f~c-_7wyhDZ0555905559eucas1p1Q; Mon, 29 Jun 2020 11:22:49 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200629112249eusmtrp24df70e7112ccbe125aeb79667a9e74b2~c-_7wDt6k1939019390eusmtrp2f; Mon, 29 Jun 2020 11:22:49 +0000 (GMT) X-AuditID: cbfec7f2-7efff70000001938-c7-5ef9cf0aab3b Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 4E.0F.06314.90FC9FE5; Mon, 29 Jun 2020 12:22:49 +0100 (BST) Received: from AMDC3748.digital.local (unknown [106.120.51.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200629112249eusmtip169921d0a84a53bece075ad7bc3dcd372~c-_69HRf-2279622796eusmtip1I; Mon, 29 Jun 2020 11:22:48 +0000 (GMT) From: Andrzej Hajda To: Greg Kroah-Hartman Subject: [PATCH v7 3/4] drm/bridge/sii8620: fix resource acquisition error handling Date: Mon, 29 Jun 2020 13:22:41 +0200 Message-Id: <20200629112242.18380-4-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629112242.18380-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0VSWUwTURT1daYzQ0N1KCo3aCRW/YAEKlHjMxKjSOIk/vihidGIFJkAKZsd qmJiJK5ABQElCkhFxYgFpC2bYECshoKVgkUaXHGNYsStLEJEpEyNf+eec+695748hlA4pIFM Yko6r01RJykpGdnYMeEIlfVMRK9srpyLn91ySPFQ/n2EzRdrpbjozXsKTzcWEPjJ6DcKH79W S+H+8SECd33pJ3F2QQWNLe9cUtzXconC1qJWhGsevKSxNW83LhspIjayXJ/rMcF9GzhJc61j 5STXXPKS5kqziqWcxZhNcZ35Tgl3t6ya5gb1NglXV3G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FMD4wmeLkZO DgkBE4mNN34xdTFycQgJLGWU+LqohRUiIS6xe/5bZghbWOLPtS42iKJPjBIr181nAUmwCWhK /N18kw3EFhEwlug/O4sdpIhZoI1VYu75J+wgCWGBYInrC+eATWIRUJXYfG0SWAOvgIXEsY5T bBAb5CVWbzgAVsMpYClx+cJMRhBbCKjmwtFO9gmMfAsYGVYxiqSWFuem5xYb6hUn5haX5qXr JefnbmIERte2Yz8372C8tDH4EKMAB6MSD2/CuZ9xQqyJZcWVuYcYJTiYlUR4nc6ejhPiTUms rEotyo8vKs1JLT7EaAp01ERmKdHkfGDk55XEG5oamltYGpobmxubWSiJ83YIHIwREkhPLEnN Tk0tSC2C6WPi4JRqYAy04etaYaPrdlN87dtPq5qOhnF5MDNVvpsrve1H54Pfgb//y5YUZ9qU VfFIurEoul78MOdx8B+jONdTfFVGsuUfdlkvWTO56fibquy9ny1KtxzT3uLIFXvkTo6k1Nvw STc3nmiLOnexx7vn9re+81uMM34+PFNR3dDzqO5lr3eZ+9W1VQ2hgUosxRmJhlrMRcWJAPqX CKDEAgAA X-CMS-MailID: 20200629112249eucas1p12fc95f88729c12c78b1a5bfe32afad8f X-Msg-Generator: CA X-RootMTR: 20200629112249eucas1p12fc95f88729c12c78b1a5bfe32afad8f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200629112249eucas1p12fc95f88729c12c78b1a5bfe32afad8f References: <20200629112242.18380-1-a.hajda@samsung.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [210.118.77.11 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [210.118.77.11 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , "Rafael J. Wysocki" , Jonas Karlman , Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org, "open list:DRM DRIVERS" , Russell King - ARM Linux , Neil Armstrong , Andrzej Hajda , andy.shevchenko@gmail.com, Mark Brown , Laurent Pinchart , Daniel Vetter , linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In case of error during resource acquisition driver should print error message only in case it is not deferred probe, using dev_err_probe helper solves the issue. Moreover it records defer probe reason for debugging. Signed-off-by: Andrzej Hajda Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/sil-sii8620.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c index 92acd336aa89..389c1f029774 100644 --- a/drivers/gpu/drm/bridge/sil-sii8620.c +++ b/drivers/gpu/drm/bridge/sil-sii8620.c @@ -2299,10 +2299,9 @@ static int sii8620_probe(struct i2c_client *client, INIT_LIST_HEAD(&ctx->mt_queue); ctx->clk_xtal = devm_clk_get(dev, "xtal"); - if (IS_ERR(ctx->clk_xtal)) { - dev_err(dev, "failed to get xtal clock from DT\n"); - return PTR_ERR(ctx->clk_xtal); - } + if (IS_ERR(ctx->clk_xtal)) + return dev_err_probe(dev, PTR_ERR(ctx->clk_xtal), + "failed to get xtal clock from DT\n"); if (!client->irq) { dev_err(dev, "no irq provided\n"); @@ -2313,16 +2312,14 @@ static int sii8620_probe(struct i2c_client *client, sii8620_irq_thread, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "sii8620", ctx); - if (ret < 0) { - dev_err(dev, "failed to install IRQ handler\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, + "failed to install IRQ handler\n"); ctx->gpio_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); - if (IS_ERR(ctx->gpio_reset)) { - dev_err(dev, "failed to get reset gpio from DT\n"); - return PTR_ERR(ctx->gpio_reset); - } + if (IS_ERR(ctx->gpio_reset)) + return dev_err_probe(dev, PTR_ERR(ctx->gpio_reset), + "failed to get reset gpio from DT\n"); ctx->supplies[0].supply = "cvcc10"; ctx->supplies[1].supply = "iovcc18"; From patchwork Mon Jun 29 11:22:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 11630757 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7AF3F14B7 for ; Mon, 29 Jun 2020 11:24:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5444A23A01 for ; Mon, 29 Jun 2020 11:24:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Xv4UNgyQ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="n8C0XkJJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5444A23A01 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=juLsS2h8BC14NkEsusVz01b3LZuno4BRZm4pQzlIubo=; b=Xv4UNgyQIRdDJyQuhgyTbm87Gk pH1qXCViKKzWpTAfGCxLzJ3nJvT+XU1TXq8VIRy3CeqAMNG5XJREajxcuqF9Bj1Yq06OG2vS7O1Tt guK5X1PMR93vnB76abFxggbeunimNSPnBeq4KpbABaqlz/LJws5HJEJVcEByVMkrSN6+PwPI0G3YZ CULz9s/nThezjqOPMm8Ua7yy0Au3N4/fuZpgRi4+B4trNV3ONzz+2nNajupd9XdO1aRBm8Suyp1aU bDh/v65z0htKO/FN/AFQ/AhKTFuoVglK6qgfPnpONWAxJ4xneajpDD7pZc3zDcuYMUqKwrnMjIj5F IxSi4aAQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jprsb-0007W8-E8; Mon, 29 Jun 2020 11:23:17 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jprsC-0007NS-5r for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 11:22:56 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200629112251euoutp01346d0ef45808eed694381923d05e8de8~c-_9HM-zG2846828468euoutp01O for ; Mon, 29 Jun 2020 11:22:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200629112251euoutp01346d0ef45808eed694381923d05e8de8~c-_9HM-zG2846828468euoutp01O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1593429771; bh=B440VBDLdLWidVVzamEgT8cxdzc8DwUiqZOX84CTZVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n8C0XkJJUibVAhAvnSkzGmbewZuChMGVQjfjeMcWkOpx3an4KqCe64AcdUhwSLoO8 DIILivtoUTmEZ9F7iAyL75dgWa/IVRm5gSiDSy5VpzHAW1ZBRKuu/c1KmHnT6Ecwmd +4ILMSV5O7jl+WSa6Y0v6MHDdn4B5i2VL3w653tk= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200629112250eucas1p2c61b6686a340a5f63cf3fc732e77ed4c~c-_8y6McG0721607216eucas1p2l; Mon, 29 Jun 2020 11:22:50 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 3C.68.06318.A0FC9FE5; Mon, 29 Jun 2020 12:22:50 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200629112250eucas1p162ce47eab8946c45357a7e2c03a6da9a~c-_8bV1tt1693516935eucas1p1m; Mon, 29 Jun 2020 11:22:50 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200629112250eusmtrp2c127127c787ab37d16fb4aea0a2cc84c~c-_8au3BK1960419604eusmtrp2s; Mon, 29 Jun 2020 11:22:50 +0000 (GMT) X-AuditID: cbfec7f5-38bff700000018ae-d8-5ef9cf0a647f Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 9D.EC.06017.A0FC9FE5; Mon, 29 Jun 2020 12:22:50 +0100 (BST) Received: from AMDC3748.digital.local (unknown [106.120.51.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200629112249eusmtip19ca9d250ad2f68834f5b4750386400a9~c-_7sJRpH2177921779eusmtip14; Mon, 29 Jun 2020 11:22:49 +0000 (GMT) From: Andrzej Hajda To: Greg Kroah-Hartman Subject: [PATCH v7 4/4] drm/bridge: lvds-codec: simplify error handling Date: Mon, 29 Jun 2020 13:22:42 +0200 Message-Id: <20200629112242.18380-5-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200629112242.18380-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSf0yMcRzH973nued5ujw8rug7xJwfG5timX39nG5+PGM2s7bIOo6eEv1y 10XGCqm7Ildp9AujaBXX3bnjmpRjHVJ39FMoTWMZE+7oIul6wn+vz/vz/vz67kthYrtwGhUd l8gp4uQxEkKEmxvc9kUiu1u2WPN+Beq62SxE/doHAOkv6IQov7ePQCPmHAy1uj4T6ORVHYHa fvRj6PHHNhxpckpJZHjbLkQtNcUEsubXAnTj4WsSWbN3ohJnPraWYVvan2Hs585TJFv7/TLO Wgpfk2yRukDIGio0BPtI+1zA1pVUkWxPlk3AGktT2OxbFYCtP5OHs98MM7fSYaJVEVxMdBKn CFyzW7TvgrFbkFAiOqz93i1IBe1UJvCiILMU6u8Xg0wgosRMOYBa5xucD5wA/qyswvjgG4Bp lpJRGzVWMjy8kdevA9hgHiD/VQwU9eGevgSzAA4bXxAe9mWC4NmmwjETxgzhsC0jXehJ+DAb YVrrO+BhnJkHX/alCzxMMwhmNGoxfsFZsLK6foy9mOWwxVEwtixkvpDQ8Kqe4E3r4KCuW8iz D/x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Fvbjv3csoOx613wIUYBDkYlHt6Ecz/jhFgTy4orcw8xSnAwK4nwOp09HSfEm5JY WZValB9fVJqTWnyI0RToqInMUqLJ+cC4zyuJNzQ1NLewNDQ3Njc2s1AS5+0QOBgjJJCeWJKa nZpakFoE08fEwSnVwCgxY9fDTfd2Gez99WXz2rqmGVrxU4WfLM2edOOqjbiu3wevrVHT1j12 dmTKyTry9/+MbxwVX3cf/JvOfWFS4m9ntUNBfluO/i03KT31/2GIgJvNZoVHMsfPa6jtul75 8ZtO3+7SMO5bqj/y4yz+ie/9YxbV1ZDzYO2/suyT8Sc8imrE/sRxbM1QYinOSDTUYi4qTgQA oBEyssMCAAA= X-CMS-MailID: 20200629112250eucas1p162ce47eab8946c45357a7e2c03a6da9a X-Msg-Generator: CA X-RootMTR: 20200629112250eucas1p162ce47eab8946c45357a7e2c03a6da9a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200629112250eucas1p162ce47eab8946c45357a7e2c03a6da9a References: <20200629112242.18380-1-a.hajda@samsung.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [210.118.77.11 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [210.118.77.11 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , "Rafael J. Wysocki" , Jonas Karlman , Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org, "open list:DRM DRIVERS" , Russell King - ARM Linux , Neil Armstrong , Andrzej Hajda , andy.shevchenko@gmail.com, Mark Brown , Laurent Pinchart , Daniel Vetter , linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Using dev_err_probe code has following advantages: - shorter code, - recorded defer probe reason for debugging, - uniform error code logging. Signed-off-by: Andrzej Hajda Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lvds-codec.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/lvds-codec.c b/drivers/gpu/drm/bridge/lvds-codec.c index 24fb1befdfa2..f19d9f7a5db2 100644 --- a/drivers/gpu/drm/bridge/lvds-codec.c +++ b/drivers/gpu/drm/bridge/lvds-codec.c @@ -71,13 +71,9 @@ static int lvds_codec_probe(struct platform_device *pdev) lvds_codec->connector_type = (uintptr_t)of_device_get_match_data(dev); lvds_codec->powerdown_gpio = devm_gpiod_get_optional(dev, "powerdown", GPIOD_OUT_HIGH); - if (IS_ERR(lvds_codec->powerdown_gpio)) { - int err = PTR_ERR(lvds_codec->powerdown_gpio); - - if (err != -EPROBE_DEFER) - dev_err(dev, "powerdown GPIO failure: %d\n", err); - return err; - } + if (IS_ERR(lvds_codec->powerdown_gpio)) + return dev_err_probe(dev, PTR_ERR(lvds_codec->powerdown_gpio), + "powerdown GPIO failure\n"); /* Locate the panel DT node. */ panel_node = of_graph_get_remote_node(dev->of_node, 1, 0);