From patchwork Fri Jul 10 15:30:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 11656873 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 CCFE613B6 for ; Fri, 10 Jul 2020 15:32:17 +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 A456E2065D for ; Fri, 10 Jul 2020 15:32:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3Zp/+X03"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="lOZpDe31" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A456E2065D 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=rqXuyyAj9olmZTvLwJYNIDmKqtHK3eg7hFXV6gVdAAU=; b=3Zp/+X03uYhI9YehgFnvRN8pJq Hil78M6lSymV7DuCE16DOyEDxQT5emunf/oBe+rUz/9GTpRQqFK0dtLn2L36BSfSRlYarHmZmuweX DZ4QoeFM1g10MzZ0AzXEPba1J3fYEOXZmS9xbIaUMENEiQrIndGZHMboOf2ksDiCiqC9eYSln5FN5 w9DZWC5cXISYuAQBGCSh8c98KH4JvDjMeff+otYyGEfSUra51Zmyw77n7ggBnc0Wd0HKNrFjGi752 dMCLeFliUWhWe9BqzoG9OWVvHg1eTkgM0Bq3tUCWc5h45MZBlyNV1YfnvwxM1aAI/sn0xmtU/eGR9 xSPN/eWA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtuz2-0000zQ-97; Fri, 10 Jul 2020 15:30:40 +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 1jtuyo-0000u2-LA for linux-arm-kernel@lists.infradead.org; Fri, 10 Jul 2020 15:30:28 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200710153024euoutp019143efeebf8c3b3569742e266959f012~gbdPl763P2103621036euoutp01C for ; Fri, 10 Jul 2020 15:30:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200710153024euoutp019143efeebf8c3b3569742e266959f012~gbdPl763P2103621036euoutp01C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594395024; bh=l2lxSqoqhRbb4X9ynL2i6rkNRlCJlfLxzfEp8Lhp6UE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lOZpDe31bwa7jADfvG7anCVHVgjcVJ15O7IOR3txNwDUKBBmQWU6GDu9jvQfPSuWb cKEUBxd/P4JQ7eJ2ceMgG2xuXyJ0+6giE9pwHLdS6hkHBLb7AytLmDx1YeOGkXrJ08 eoPtECmGCjJsZskqwCtKTepq7kjM77bc3R3rfLBA= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200710153024eucas1p2400dd1dde4c0ab042dd6c1ccb4710ac4~gbdPHE2I52487224872eucas1p24; Fri, 10 Jul 2020 15:30:24 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 29.64.06456.099880F5; Fri, 10 Jul 2020 16:30:24 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200710153023eucas1p1564ece8b49581616a5bfed978a5164f0~gbdOmfAr-1062710627eucas1p1T; Fri, 10 Jul 2020 15:30:23 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200710153023eusmtrp1e1f685ab06673404ac89b20505dc379f~gbdOluId52243522435eusmtrp1q; Fri, 10 Jul 2020 15:30:23 +0000 (GMT) X-AuditID: cbfec7f2-809ff70000001938-dd-5f088990be0b Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 6C.38.06017.F89880F5; Fri, 10 Jul 2020 16:30:23 +0100 (BST) Received: from AMDC3748.digital.local (unknown [106.120.51.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200710153023eusmtip1b455300e49a61e0ba238580d832232ea~gbdN1dLdH0686906869eusmtip1M; Fri, 10 Jul 2020 15:30:23 +0000 (GMT) From: Andrzej Hajda To: Greg Kroah-Hartman Subject: [PATCH v8 1/5] driver core: add device probe log helper Date: Fri, 10 Jul 2020 17:30:14 +0200 Message-Id: <20200710153018.12226-2-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200710153018.12226-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0VSWUwTURTN60ynA1oyFiJPUYk1xGhkS/l4BELQqJkYjSZKNBqWKh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mPrwCZvF/20TmS2ufH3PZtG8eD2bxdXvL5ktTr65ymLROXEJu8Wmx9dYLS7vmsNm cWjqXkaLtUfuslsc6ou2mPtlKrODgMflaxeZPd7faGX32PttAYvHzll32T1md8xk9di0qpPN 48SES0we++euYfe4332cyWPzknqPvi2rGD0O9E5m8fi8SS6AN0rPpii/tCRVISO/uMRWKdrQ wkjP0NJCz8jEUs/Q2DzWyshUSd/OJiU1J7MstUjfLkEvY//6DqaCXWIVfxbsY2lg3C3UxcjJ ISFgInFqw0HmLkYuDiGBpYwSt6/PZIRIiEvsnv+WGcIWlvhzrYsNougTo8SO7xPBEmwCmhJ/ N99kA7FFBIwl+s/OYgcpYhZoY5WYe/4JkMPBISzgINFz2gakhkVAVeLnw/1g9bwCFhIne59C LZCXWL3hAJjNKWAp8W5qN1iNEFDN7WXfWScw8i1gZFjFKJJaWpybnltspFecmFtcmpeul5yf u4kRGFvbjv3csoOx613wIUYBDkYlHt4FiRzxQqyJZcWVuYcYJTiYlUR4nc6ejhPiTUmsrEot yo8vKs1JLT7EaAp01ERmKdHkfGDc55XEG5oamltYGpobmxubWSiJ83YIHIwREkhPLEnNTk0t SC2C6WPi4JRqYDzJE8xYzVlwLvityIFn7ZPyXG89O/pvd3aQkubk89JMitnvJxwxnVn++4Xz jcIU1+k3XHmcvS9PvbZ4umH7oXN3P3UELE1W0Jbd9sH81POep7uMyzTX6zfNX7zn3LaHb13S 7vw9ctHaMGjekjsHcv6U1V7z+2G8j1nvvMOb9DvHfe9cmmL3vZ1TiaU4I9FQi7moOBEA4Jmr XMMCAAA= X-CMS-MailID: 20200710153023eucas1p1564ece8b49581616a5bfed978a5164f0 X-Msg-Generator: CA X-RootMTR: 20200710153023eucas1p1564ece8b49581616a5bfed978a5164f0 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200710153023eucas1p1564ece8b49581616a5bfed978a5164f0 References: <20200710153018.12226-1-a.hajda@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_113026_808839_6F77710B X-CRM114-Status: GOOD ( 19.13 ) 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -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.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: 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 Fri Jul 10 15:30:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 11656871 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 A2DB913B6 for ; Fri, 10 Jul 2020 15:32:14 +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 6C4B02065D for ; Fri, 10 Jul 2020 15:32:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tO3UpsoJ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="VMEyJ71l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C4B02065D 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=0WIWAtFK8nGYdOdPS+//VAlarDi3L3fLyG03Z7GGe1Q=; b=tO3UpsoJWNIg7KbcW9FkuVGbck xqRpagFEmRIy9CRBFWJAG71BtmYRDN08gdWT3M0fRLz3LDCcGgBJJjQy00QUl+XnyeyV9O5QFhcNi iUPQW+kn7kGktXSg7yrG2v9KXQ4JCoeGqXASzcs9chiKf2voEVQbbFq0qflJaW0nA5iKTUT4a9lGs Mzy8DlURD2TUIT8PgoTMMmrWcIBWquM9boLbxZEHeMnBCZqrJyTGbIsT3rY3GWAmug+dY3FL2FsTA YQjfYOAH8bd2HAXCMipZ6lPJQNvxcIpV3zMlM2nzt91wKcXCHJSbzz7PvvezlwBLIiIoImr58l3+o I2OyOj3g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtuyv-0000xY-Ui; Fri, 10 Jul 2020 15:30:34 +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 1jtuyo-0000uH-65 for linux-arm-kernel@lists.infradead.org; Fri, 10 Jul 2020 15:30:27 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200710153025euoutp0252e9bcd9b67b2192f061db63af4a76c7~gbdQA2lw11309713097euoutp02c for ; Fri, 10 Jul 2020 15:30:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200710153025euoutp0252e9bcd9b67b2192f061db63af4a76c7~gbdQA2lw11309713097euoutp02c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594395025; bh=Wcn/fZwn0l0I3UrXznsXGlfRgX1zzz/eHT6cU1JUJ98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VMEyJ71l0IEYsZA0NxrXLD0ICjP3hL9vF2pDnbG6WNINUPdpXCPinqupaSZ8qR8E0 XqEvx/o8MIVkplmeBQziEjl+NK7+qDCoZ3cJ8mj81jNjdQBD8QN1zLfM7SYsmI/XoS B3TQuFT7e40539DeYKQalj4Ll7y3Gd9muFoT/iUQ= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200710153025eucas1p13e63215101d621cbea138284f5fd975d~gbdPq8YN61776917769eucas1p1_; Fri, 10 Jul 2020 15:30:25 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 3A.64.06456.099880F5; Fri, 10 Jul 2020 16:30:24 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200710153024eucas1p1b0686b4acce78838db93fddb3c23939c~gbdPWHrrM1062710627eucas1p1U; Fri, 10 Jul 2020 15:30:24 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200710153024eusmtrp19f63c0e550598b61622ddee35ca63586~gbdPVbMc-2337923379eusmtrp1N; Fri, 10 Jul 2020 15:30:24 +0000 (GMT) X-AuditID: cbfec7f2-809ff70000001938-df-5f08899026a7 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 8D.38.06017.099880F5; Fri, 10 Jul 2020 16:30:24 +0100 (BST) Received: from AMDC3748.digital.local (unknown [106.120.51.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200710153023eusmtip12bae6a169a109343e875058f8b68f1aa~gbdOkmTaP0658106581eusmtip1h; Fri, 10 Jul 2020 15:30:23 +0000 (GMT) From: Andrzej Hajda To: Greg Kroah-Hartman Subject: [PATCH v8 2/5] driver core: add deferring probe reason to devices_deferred property Date: Fri, 10 Jul 2020 17:30:15 +0200 Message-Id: <20200710153018.12226-3-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200710153018.12226-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA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AAAAAAAA+NgFtrAIsWRmVeSWpSXmKPExsVy+t/xu7oTOjniDTY/ULG4te4cq8XLCYcZ LTbOWM9qMfXhEzaL/9smMltc+fqezaJ58Xo2i6vfXzJbnHxzlcWic+ISdotNj6+xWlzeNYfN 4tDUvYwWa4/cZbc41BdtMffLVGYHAY/L1y4ye7y/0crusffbAhaPnbPusnvM7pjJ6rFpVSeb x4kJl5g89s9dw+5xv/s4k8fmJfUefVtWMXoc6J3M4vF5k1wAb5SeTVF+aUmqQkZ+cYmtUrSh hZGeoaWFnpGJpZ6hsXmslZGpkr6dTUpqTmZZapG+XYJextpf7cwFR1Qq9p69ytjAeEyui5GT Q0LAROLqk24WEFtIYCmjxO2Z+hBxcYnd898yQ9jCEn+udbF1MXIB1XxilNj59RNYA5uApsTf zTfZQGwRAWOJ/rOz2EGKmAXaWCXmnn/CDpIQFoiR+HvjHSOIzSKgKnFt6xKwZl4BC4lry6az QmyQl1i94QDYNk4BS4l3U7vZIC6ykLi97DvrBEa+BYwMqxhFUkuLc9Nzi430ihNzi0vz0vWS 83M3MQJja9uxn1t2MHa9Cz7EKMDBqMTDuyCRI16INbGsuDL3EKMEB7OSCK/T2dNxQrwpiZVV qUX58UWlOanFhxhNgY6ayCwlmpwPjPu8knhDU0NzC0tDc2NzYzMLJXHeDoGDMUIC6Yklqdmp qQWpRTB9TBycUg2M3sKNZ+MW/vgaaXrujYbR7gebrRTfblkQddLM//WLZMfoW6GZ++2bDp+6 kaJW+HFKDCtXc2zl1wtfz65/vGra0gXyz67PO27D+iT/LqvT/Rr7a3VpV/LdH9j+Z2/UOb3o s82vb3dOtolV7lWIu+x11m9fkl4eS25m2ckrV8+vmJ4ktJx9g80OWyWW4oxEQy3mouJEANLo JYXDAgAA X-CMS-MailID: 20200710153024eucas1p1b0686b4acce78838db93fddb3c23939c X-Msg-Generator: CA X-RootMTR: 20200710153024eucas1p1b0686b4acce78838db93fddb3c23939c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200710153024eucas1p1b0686b4acce78838db93fddb3c23939c References: <20200710153018.12226-1-a.hajda@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_113026_350296_C0FE203A X-CRM114-Status: GOOD ( 22.57 ) 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -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.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 a deferred device and printed when user reads 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 --- v8: - improved commit message --- 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 Fri Jul 10 15:30:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 11656875 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 046F413B6 for ; Fri, 10 Jul 2020 15:32:20 +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 D019B2065D for ; Fri, 10 Jul 2020 15:32:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VEM3msG8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="UbVqW0Z+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D019B2065D 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=VEM3msG8A74HLVnclyFl/DeQdF 6dG4bwb9b73YPyZ9hVQfgI9zT4yVAUmG8OdTU6wNP5erbllgOUhDzaHJTX7r2/82+orRMA8vKPD9b vdqGVGPXn00cs0CqQ0/PLd7TuLltcZPiyw0HUtY/7vef5azv09/zgrFF4mscANkM6L1prZTwvq83I Pj367zLeukGECbSxMUMFix4wn6gVQDnwrCfb3zp5kXrbiFTKiLdn7cNc6n5DWc1Sa/le5JdrEMNyB jVn3MD8sqyUKGQPpW2uXSAT1DfJHUTpTOVg6TMDH1VB63vIbty0TKH/Ffv1GlBGt/LFdmaNIBO9UE QPSFM35A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtuz8-00011Q-LX; Fri, 10 Jul 2020 15:30:46 +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 1jtuyp-0000uw-As for linux-arm-kernel@lists.infradead.org; Fri, 10 Jul 2020 15:30:28 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200710153026euoutp02a384ff7532547b3da213ad61792f374b~gbdRD_nwz1342513425euoutp02Z for ; Fri, 10 Jul 2020 15:30:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200710153026euoutp02a384ff7532547b3da213ad61792f374b~gbdRD_nwz1342513425euoutp02Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594395026; bh=ldZknbF9TPUSQxdpO3ouuzcL7PaF+JDqisngEE3mM30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UbVqW0Z+DfvX7F4yzUW7F+pfK1zS7ZvvTBXGktbYbi0yDkqWqL8m69UwY0lcDzRxe Q689JeWOYkn9qjiQ+kEi2h9VVRha9G8F3NEl+Do8viPDQZ5Pj77v8ryK2xXQ4+qQPa R7nEmXoz+B3a3/qGAL2GJBwCV5gnjipsDW5E+iWc= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200710153026eucas1p2c477ee612f0115d6510dba2551bd36f0~gbdQumKX_2486024860eucas1p2Z; Fri, 10 Jul 2020 15:30:26 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 3F.16.06318.299880F5; Fri, 10 Jul 2020 16:30:26 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200710153025eucas1p141ae47938b5f41c835759e7345f0e625~gbdQLBvef2844728447eucas1p1l; Fri, 10 Jul 2020 15:30:25 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200710153025eusmtrp18c1927a42a089179b4e68f175bda4aa4~gbdQFKxpk2243522435eusmtrp1t; Fri, 10 Jul 2020 15:30:25 +0000 (GMT) X-AuditID: cbfec7f5-38bff700000018ae-d4-5f0889920cc0 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id EE.38.06017.199880F5; Fri, 10 Jul 2020 16:30:25 +0100 (BST) Received: from AMDC3748.digital.local (unknown [106.120.51.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200710153024eusmtip15e7120f4c2f4cb71eb78a470c482f9c8~gbdPUZxoN1261412614eusmtip1X; Fri, 10 Jul 2020 15:30:24 +0000 (GMT) From: Andrzej Hajda To: Greg Kroah-Hartman Subject: [PATCH v8 3/5] drm/bridge/sii8620: fix resource acquisition error handling Date: Fri, 10 Jul 2020 17:30:16 +0200 Message-Id: <20200710153018.12226-4-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200710153018.12226-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0VSa0hTYRjm2zk75zhcHae4D5XEhZBWmij0RfcMOkFQfyrQ0lae1PK6eSu6 aBfzVi5tmavIpqZtlndxkrdpm7qm5Q0TRbtALFIJtXJU5i7Vv+d93ufy/ngpTDDAdaOi45JY SZw4RkTw8Cbd0sDGgmwqfFPGYxKNP+/nIpOsC6Dae9VcJH/3kUDLTbcxNLw4R6CrpdUEGvlu wlDvlxEcZd8uI1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vi2rGD0O9E5m8fi8SS6AN0rPpii/tCRVISO/uMRWKdrQ wkjP0NJCz8jEUs/Q2DzWyshUSd/OJiU1J7MstUjfLkEvY9WxY0wFi/krZm08ztTAeIKni5GT Q0LARKJr5yXGLkYuDiGBpYwS836fYIFIiEvsnv+WGcIWlvhzrYsNougTo8SWz0fAEmwCmhJ/ N99kA7FFBIwl+s/OYgcpYhZoY5WYe/4JO0hCWCBY4v6CnUwgNouAqsT+zfPBmnkFLCQWLTnM BrFBXmL1hgNgcU4BS4l3U7vB4kJANbeXfWedwMi3gJFhFaNIamlxbnpusZFecWJucWleul5y fu4mRmB0bTv2c8sOxq53wYcYBTgYlXh4FyRyxAuxJpYVV+YeYpTgYFYS4XU6ezpOiDclsbIq tSg/vqg0J7X4EKMp0FETmaVEk/OBkZ9XEm9oamhuYWlobmxubGahJM7bIXAwRkggPbEkNTs1 tSC1CKaPiYNTqoHRWcN6m7q5/sKt5SbqZyXWs7/qC1GzuHB69YQao7OeYQy/Y4usjrt9udi5 YIdicGHSIne/GYL/OMpjrl64LKB9+bwv53p7Uxf/XzwG+9p3H1Wfb8n8YP0py3X3wzjZ1Ffv XL/s1jLDpd/WVnnZ3/FZ4cby9qd7yO6MlhPubK3tRzV2817+fG61EktxRqKhFnNRcSIAIDy9 T8QCAAA= X-CMS-MailID: 20200710153025eucas1p141ae47938b5f41c835759e7345f0e625 X-Msg-Generator: CA X-RootMTR: 20200710153025eucas1p141ae47938b5f41c835759e7345f0e625 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200710153025eucas1p141ae47938b5f41c835759e7345f0e625 References: <20200710153018.12226-1-a.hajda@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_113027_481050_CC32FF3D X-CRM114-Status: GOOD ( 15.37 ) 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -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.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 Fri Jul 10 15:30:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 11656877 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 4964813B6 for ; Fri, 10 Jul 2020 15:32:22 +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 212D92065D for ; Fri, 10 Jul 2020 15:32:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KTbPfASJ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="i5f0uUoQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 212D92065D 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=KTbPfASJBgB4qG/1GMstZXQvt7 mFvVgZt6WTreh4YAxHBp/MNDpsN4Hxyz1psmA/1ms4rQ4s9wFse+bhMMCx6LuVZiLxW6t5o4V4qIx 8jdrmPQU1PrkSeBqfTQRnN6mHJXvb87ZMx1hQedXX5gSK2gJS/GkVUYom3QtRupod+Sjyz642s74P NSMD2WBevI3CfO8Y2PbhmTSZs8+l+hMQGEgou4B4U+/eJU6jIYqqmgxUZv9XFHw7C3UpBVwVBGMbM 2dX/EHSm3zfxZ3HlZcNtWikExZ2SBz29h2C4GLyOycWSlgn54JhotpOKmcQlwP6m3x6jrBC67K3XJ u3D1bmKg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtuzF-00013m-9R; Fri, 10 Jul 2020 15:30:53 +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 1jtuyp-0000v8-UJ for linux-arm-kernel@lists.infradead.org; Fri, 10 Jul 2020 15:30:30 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200710153027euoutp01e140953363ff2de4aa0b797b4f028195~gbdRnXAJi1950919509euoutp01m for ; Fri, 10 Jul 2020 15:30:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200710153027euoutp01e140953363ff2de4aa0b797b4f028195~gbdRnXAJi1950919509euoutp01m DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594395027; bh=B440VBDLdLWidVVzamEgT8cxdzc8DwUiqZOX84CTZVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i5f0uUoQ7ZR/lmT8DV8Ur5GoXgnkpZxKkpWkonx8e+aSgdxKiOtGPM6ysC2fgP5CV uxyfrzxK7XDW2SsjZ9vk65SJPE9RG0XBj0yZLwbL3jdtaDRliQIZiY32TVa+XC+uOi YZctEST0sMeQoXccz45vFkUOw66gzn8a32I/7V/I= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200710153026eucas1p1d277077a856967448ceb2c8ef06d4307~gbdRMgux-2715527155eucas1p1d; Fri, 10 Jul 2020 15:30:26 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 40.26.06318.299880F5; Fri, 10 Jul 2020 16:30:26 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200710153026eucas1p208e5850ddd9e7f376c4d56f892b05233~gbdQ1mvuI2493924939eucas1p2s; Fri, 10 Jul 2020 15:30:26 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200710153026eusmtrp11fbd8efa90c6d8b454a6933eebba61e3~gbdQ072S22243522435eusmtrp1u; Fri, 10 Jul 2020 15:30:26 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-d5-5f088992fc78 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 10.48.06017.299880F5; Fri, 10 Jul 2020 16:30:26 +0100 (BST) Received: from AMDC3748.digital.local (unknown [106.120.51.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200710153025eusmtip1c92b174adfcb32307df709cdaf7dd4b7~gbdQEhRTv0878108781eusmtip1t; Fri, 10 Jul 2020 15:30:25 +0000 (GMT) From: Andrzej Hajda To: Greg Kroah-Hartman Subject: [PATCH v8 4/5] drm/bridge: lvds-codec: simplify error handling Date: Fri, 10 Jul 2020 17:30:17 +0200 Message-Id: <20200710153018.12226-5-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200710153018.12226-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSaUhUURzFufNWBydeT8Gb1UhjggqlYeQNow3B96EwghYSl1c9zNRR5rn2 JatxbZrUSXLJGktJbNFc07JiCicRrdwLdRRDmMqFUiNRy+ez+va795z//1wOl8bYTsKVjtIm CDotH6MhlXhj26+ubfnZdLjv6IA7+vS4i0D23NcAPSmsJlDB2GcS/W7Mw1Dv3DSJrtyrJlHf TzuG2r/14Sg7r5xCteP9BOppuUUiS0ErQI/eDFPIYgxBpbMF2H6G6+n/gHHTg+kU1zpvxrnm 4mGKK8kqIrjaqmySe5vbreBelj6kONtVq4KrK7/IGeurAPfqmgnnftSqj6hOKfecFWKikgSd z94I5bnCuhFFfKkyJXd+RJEG+ukcQNOQ2Qn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MRmE9CU +Lv5JlhcRMBYov/sLHaQQcwCbawSc88/YQdJCAu4S7S1XGIFsVkEVCX+nLwHtoBXwEKi5/pr RogF8hKrNxwAW8YpYCnxbmo31DILidvLvrNOYORbwMiwilEktbQ4Nz232EivODG3uDQvXS85 P3cTIzC2th37uWUHY9e74EOMAhyMSjy8CxI54oVYE8uKK3MPMUpwMCuJ8DqdPR0nxJuSWFmV WpQfX1Sak1p8iNEU6KiJzFKiyfnAuM8riTc0NTS3sDQ0NzY3NrNQEuftEDgYIySQnliSmp2a WpBaBNPHxMEp1cC44fjrpRHTOo2UHLjUipeLTpf8PeuSj5fkAufop0LH+jxk5FOC6pamxaeZ f3Kcptyev+9T+B19CW3tN5yBUcu7o7YeO6KY//FAZNr7KZ+1d7n+rTklf3+vwQbr769NhaPO vnfQmNc1r4wp9u9p9rpjfzaF78i+UJa0fNKmC//KCzj3iTeemXpeiaU4I9FQi7moOBEAPT6F 38MCAAA= X-CMS-MailID: 20200710153026eucas1p208e5850ddd9e7f376c4d56f892b05233 X-Msg-Generator: CA X-RootMTR: 20200710153026eucas1p208e5850ddd9e7f376c4d56f892b05233 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200710153026eucas1p208e5850ddd9e7f376c4d56f892b05233 References: <20200710153018.12226-1-a.hajda@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_113028_177840_EE5E64A8 X-CRM114-Status: GOOD ( 14.59 ) 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -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.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); From patchwork Fri Jul 10 15:30:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 11656879 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 1DD9313B6 for ; Fri, 10 Jul 2020 15:32:36 +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 DCC1A2065D for ; Fri, 10 Jul 2020 15:32:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NHO46gRA"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="sIhsjpID" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCC1A2065D 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=o0mf54zTpNcnPm0NksfD+j/AR+QSMRAnNBYn23lGTUg=; b=NHO46gRAvp7n5Vo8HG88Omkma4 019O954ycObc3EBSjc2mCBAZ+CT2tYxQtA10J+aDBV3JDXWRoTpLyOKjM21CXRyJyCSyf+ZPhA+YF NJSWfmS0rpUrT+bYrMbOnAMCfrjXNB88OHPvc4qXr+/7jQ/oaJpy6pFMvTaxN5XUzEfCH4Kg9M4ww MSZaZVUWm3nZR80VCOzPQLRPro4+SKZOKzIUBrYmfF2GgblG3p6k0m+1Q0bD+LyLPF7tDRLiLTrb2 sYnUeYLYCIPAHupjj2h2zxEtQTNdRS5HWYvBx2zWkIQVfkRlm7pa1Pnr9OPuLIrQzNr+HRmd0745H cXVALr2A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtuzI-00014s-Ff; Fri, 10 Jul 2020 15:30:56 +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 1jtuyr-0000vs-2A for linux-arm-kernel@lists.infradead.org; Fri, 10 Jul 2020 15:30:32 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200710153028euoutp01670d56b37726598f1ecbf92be644eca6~gbdSoBkNi1966219662euoutp01i for ; Fri, 10 Jul 2020 15:30:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200710153028euoutp01670d56b37726598f1ecbf92be644eca6~gbdSoBkNi1966219662euoutp01i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594395028; bh=/GuB4fVLrH0EVz7PTsFzmWXh5JX3KwLVO+RWvFi1gMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sIhsjpIDa+BYbAWCH2LHQt1wkGFufh6Od5H0PJPlCyj+OcV/mrNPxSf1uVkwM6vI9 LcXgWHw+GVHVco11us42UCmCSkb5sPaft+krKXjIoubMqrej69jtJqJF6d9RbzU656 0MPgjTeb059ZSS0ccESHiv3XiaEtM00jMJE+8SSQ= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200710153027eucas1p2d0cab0e693a1a0fbc69852bf6bcbc98c~gbdSF-3jT2486824868eucas1p2v; Fri, 10 Jul 2020 15:30:27 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id DB.64.06456.399880F5; Fri, 10 Jul 2020 16:30:27 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200710153027eucas1p1c893327b918e99a9b0cbd7b0a00af96b~gbdRjCRmP1062810628eucas1p1E; Fri, 10 Jul 2020 15:30:27 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200710153027eusmtrp1a432c1479ae923017dc8ba9ba83267fd~gbdRiYGjr2243522435eusmtrp1v; Fri, 10 Jul 2020 15:30:27 +0000 (GMT) X-AuditID: cbfec7f2-809ff70000001938-e5-5f088993e039 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 23.D8.06314.299880F5; Fri, 10 Jul 2020 16:30:27 +0100 (BST) Received: from AMDC3748.digital.local (unknown [106.120.51.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200710153026eusmtip19a1e45e8ac77cd6755cf6598008ec3e2~gbdQzdtzI0686906869eusmtip1N; Fri, 10 Jul 2020 15:30:26 +0000 (GMT) From: Andrzej Hajda To: Greg Kroah-Hartman Subject: [PATCH v8 5/5] coccinelle: add script looking for cases where probe__err can be used Date: Fri, 10 Jul 2020 17:30:18 +0200 Message-Id: <20200710153018.12226-6-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200710153018.12226-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSa0hTYRjHe3euWrPjNHyxyJr0wUpNK3hD6SIRJwgqCqLC1tLjlNy0TUvr g1pmmpc0sUwTLGeKVpr3C16a0tQ1y3kpxQtdKCea5VyRkebxKH37Pc//+T/Pn5eXxiRGwpkO UUVwapU8VEra4jWvfr9xz0yiZTv0BZvQ0PNuApnT2wB6kV1GoKwPn0m0UJOBoT7rNIluFJSR qP+XGUOdk/04SsrQUqji0wCBehsekkiX1QTQs/YRCunSzqK82SxsP8P2DvRg7PT7mxTb9DMf Z+tzRig2N/EBwVaUJJFsR7pJxLbkPaXYsWS9iK3UxrBpVSWAbU3NxFlLxcZj4jO2voFcaMhl Tu2597xtsKG5mQzPdo8a/1MsigVW19vAhobMLphQOS+6DWxpCVMMYIbBRAjFLIDWxAekUFgA zCzrwlcs5t47y5YiAGdyWyheWLK8HlLxTDJu8G/lIMmzI7MT3jHmULwBY+Zw2H8rgeAFB0YG 40e7FjfRNM5sgTnNq3kUMwi21fsIt1xgaXkrxrMNswd+y0peCgSZKQoWpdYtBzoIrxdqRQI7 wAl9FSXwBmjITFmeiYFjxfGYYE4EsLq8HhMEHzjcPUfyh7HF0GUNnkL7AGxI+7oUDTJ28P2U Pd/GFvFuzX1MaIthYoJEmN4Mx4zVywudYOFbKykwC5909ODCU6UA+HnyJZYOXHL+H8sHoAQ4 cZEapYLTeKm4Kx4auVITqVJ4BIQpK8DiJzPM62fqgNV0QQcYGkjXiPPltExCyC9ropU6AGlM 6ij2MxrOScSB8uirnDpMpo4M5TQ6sJ7GpU7inY/N/hJGIY/gLnJcOKdeUUW0jXMsOBYw/Kgx 4vjue6fsneeCUqJcfUs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Wsw/xoWbKKn8WPazH7V/Ku93hYKZJ1pVmJpTgj0VCLuag4EQAeZ83F wQIAAA== X-CMS-MailID: 20200710153027eucas1p1c893327b918e99a9b0cbd7b0a00af96b X-Msg-Generator: CA X-RootMTR: 20200710153027eucas1p1c893327b918e99a9b0cbd7b0a00af96b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200710153027eucas1p1c893327b918e99a9b0cbd7b0a00af96b References: <20200710153018.12226-1-a.hajda@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_113029_257047_FBF12B48 X-CRM114-Status: GOOD ( 16.36 ) 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -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.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 This is AD-HOC script, it should nt be merged. Signed-off-by: Andrzej Hajda --- probe_err.cocci | 247 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 probe_err.cocci diff --git a/probe_err.cocci b/probe_err.cocci new file mode 100644 index 000000000000..0ef9a9b4c9bc --- /dev/null +++ b/probe_err.cocci @@ -0,0 +1,247 @@ +virtual context +virtual patch + +@initialize:python@ +@@ + +import re + +@@ +expression err, dev; +constant char [] fmt; +expression list args; +@@ + +- if (err != -EPROBE_DEFER) { dev_err(dev, fmt, args); } ++ dev_err_probe(dev, err, fmt, args); + +@@ +expression ptr, dev; +constant char [] fmt; +expression list args; +@@ + +- if (ptr != ERR_PTR(-EPROBE_DEFER)) { dev_err(dev, fmt, args); } ++ dev_err_probe(dev, PTR_ERR(ptr), fmt, args); + +@@ +expression e, dev; +identifier err; +identifier fget =~ "^(devm_)?(clk_get|gpiod_get|gpiod_get_optional|gpiod_get_index|gpiod_get_index_optional|regulator_get|regulator_get_optional|reset_control_get|reset_control_get_exclusive|reset_control_get_shared|phy_get|pinctrl_get|iio_channel_get|pwm_get)$"; +identifier flog =~ "^(dev_err|dev_warn|dev_info)$"; +expression list args; +@@ + e = fget(...); + if (IS_ERR(e)) { +( + err = PTR_ERR(e); +- flog(dev, args); ++ dev_err_probe(dev, err, args); +| +- flog(dev, args); ++ dev_err_probe(dev, PTR_ERR(e), args); +) + ... + } + +@@ +expression dev; +identifier err; +identifier fget =~ "^(devm_)?(request_irq|request_threaded_irq|regulator_bulk_get)$"; +identifier flog =~ "^(dev_err|dev_warn|dev_info)$"; +expression list args; +@@ + err = fget(...); + if ( \( err \| err < 0 \) ) { + ... +- flog(dev, args); ++ dev_err_probe(dev, err, args); + ... + } + +@catch_no_nl@ +expression dev, err; +constant char [] fmt !~ "\\n$"; +@@ + dev_err_probe(dev, err, fmt, ...) + +@script:python add_nl depends on catch_no_nl@ +fmt << catch_no_nl.fmt; +nfmt; +@@ +print "add_nl " + fmt +coccinelle.nfmt = fmt[:-1] + '\\n"'; + +@fix_no_nl depends on catch_no_nl@ +constant char [] catch_no_nl.fmt; +identifier add_nl.nfmt; +@@ +- fmt ++ nfmt + +@catch_fmt@ +expression err, dev; +expression fmt; +position p; +@@ + + dev_err_probe@p(dev, err, fmt, ..., \( (int)err \| err \) ) + +@script:python trim_fmt@ +fmt << catch_fmt.fmt; +new_fmt; +@@ + +tmp = fmt +tmp = re.sub('failed: irq request (IRQ: %d, error :%d)', 'irq request %d', tmp) +tmp = re.sub('Error %l?[di] ', 'Error ', tmp) +tmp = re.sub(' as irq = %d\\\\n', ', bad irq\\\\n', tmp) +tmp = re.sub('[:,]? ?((ret|err|with|error)[ =]?)?%l?[di]\.?\\\\n', '\\\\n', tmp) +tmp = re.sub(' ?\(((err|ret|error)\s*=?\s*)?%l?[diu]\)[!.]?\\\\n', '\\\\n', tmp) + +assert tmp != fmt, "cannot trim_fmt in: " + fmt +print "trim_fmt " + fmt + " " + tmp +coccinelle.new_fmt = tmp + +@fix_fmt@ +expression err, err1, dev; +expression fmt; +expression list l; +identifier trim_fmt.new_fmt; +position catch_fmt.p; +@@ + +- dev_err_probe@p(dev, err, fmt, l, err1) ++ dev_err_probe(dev, err, new_fmt, l) + +@err_ass1@ +identifier err; +expression dev, ptr; +expression list args; +@@ + +- err = PTR_ERR(ptr); +- dev_err_probe(dev, err, args); +- return ERR_PTR(err); ++ dev_err_probe(dev, PTR_ERR(ptr), args); ++ return ERR_CAST(ptr); + +@err_ass2@ +identifier err, f1, f2; +expression dev, e; +expression list args; +@@ +- err = PTR_ERR(e); +- dev_err_probe(dev, err, args); +( +| + f1(...); +| + f1(...); + f2(...); +) +- return err; ++ return dev_err_probe(dev, PTR_ERR(e), args); + +@@ +identifier err; +expression dev, e; +expression list args; +@@ + +- int err = e; +- dev_err_probe(dev, err, args); +- return err; ++ return dev_err_probe(dev, e, args); + +@@ +expression err, dev; +expression list args; +@@ + +- dev_err_probe(dev, err, args); +- return err; ++ return dev_err_probe(dev, err, args); + +@@ +expression err, dev, ptr; +expression list args; +@@ + +- dev_err_probe(dev, PTR_ERR(ptr), args); + err = PTR_ERR(ptr); ++ dev_err_probe(dev, err, args); + +@@ +expression e; +expression list args; +statement s, s1; +@@ + +// without s1 spatch generates extra empty line after s +- if (e) { return dev_err_probe(args); } else s s1 ++ if (e) return dev_err_probe(args); s s1 + +@@ +expression e; +expression list args; +@@ + +- if (e) { return dev_err_probe(args); } ++ if (e) return dev_err_probe(args); + +@@ +expression e, s, v; +expression list args; +@@ + +- if (e == v) { s; } else { return dev_err_probe(args); } ++ if (e != v) return dev_err_probe(args); s; + +@err_ass3@ +identifier err; +expression dev, ptr; +expression list args; +@@ + +- err = PTR_ERR_OR_ZERO(ptr); +- if (err) return dev_err_probe(dev, err, args); ++ if (IS_ERR(ptr)) return dev_err_probe(dev, PTR_ERR(ptr), args); + +@@ +expression dev, ptr; +expression list args; +@@ + +- DROP_probe_err(dev, PTR_ERR(ptr), args) ++ probe_err(dev, ptr, args) + +@@ +identifier err_ass1.err; +expression e; +identifier f =~ "^(dev_err_probe|probe_err_ptr)$"; +@@ +- \( int err; \| int err = e; \) + <+... when != err + f + ...+> + +@@ +identifier err_ass2.err; +expression e; +identifier f =~ "^(dev_err_probe|probe_err_ptr)$"; +@@ +- \( int err; \| int err = e; \) + <+... when != err + f + ...+> + +@@ +identifier err_ass3.err; +expression e; +identifier f =~ "^(dev_err_probe|probe_err_ptr)$"; +@@ +- \( int err; \| int err = e; \) + <+... when != err + f + ...+>