From patchwork Mon Mar 13 19:07:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 9621873 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 645BB60244 for ; Mon, 13 Mar 2017 19:09:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5006B28502 for ; Mon, 13 Mar 2017 19:09:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44D372850D; Mon, 13 Mar 2017 19:09:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CEEA928502 for ; Mon, 13 Mar 2017 19:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wZ/Owzqbo1l6JihNuOtBwvOaU6A/SfXZoIXF1bndziU=; b=SGeiH8G6cXIsCN PJqjp+DHPI/uiNVwRxRHxMC6rgY2wmhSCFFEGi3fUHZB69F+YRmHMrE4GnhnDkAcDkcn4/loVmRMq /xqUvQvmTeJRbigHmxfHaqWBKGl+hBYDyUFPwL+GmMuqVoUntCO6wiOsHelerm7bhoXRPuc835qlh 9timSwrusVyfjNkEZa0ELRrSZ5sNFT6QilfytnAGZPZVRV4ZvIpbqpre+6fm7rb00ZgmXy5eEc8vg SDtTP4xWVC9PjHDMS0QTfWlH2x/QgR+PV2zTH+8O1qidoMQqJPfXXS1DDku+eP/B5hb/e9A5m/Zy3 f/l8othZS0SuaGGHefTA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cnVL8-000749-48; Mon, 13 Mar 2017 19:09:06 +0000 Received: from mail.kernel.org ([198.145.29.136]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cnVK7-0006Ud-I7 for linux-arm-kernel@lists.infradead.org; Mon, 13 Mar 2017 19:08:05 +0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9AF85203EB; Mon, 13 Mar 2017 19:07:45 +0000 (UTC) Received: from localhost.localdomain (bzq-79-180-56-222.red.bezeqint.net [79.180.56.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E7DA6203EC; Mon, 13 Mar 2017 19:07:41 +0000 (UTC) From: Krzysztof Kozlowski To: Kukjin Kim , Krzysztof Kozlowski , Javier Martinez Canillas , Wim Van Sebroeck , Guenter Roeck , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] watchdog: s3c2410: Simplify getting driver data Date: Mon, 13 Mar 2017 21:07:25 +0200 Message-Id: <20170313190726.2988-3-krzk@kernel.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170313190726.2988-1-krzk@kernel.org> References: <20170313190726.2988-1-krzk@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170313_120803_654733_E5363E17 X-CRM114-Status: GOOD ( 16.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify the flow in helper function for getting the driver data by using of_device_get_match_data() and only one if() branch. The code should be equivalent. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Guenter Roeck --- drivers/watchdog/s3c2410_wdt.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 52b66bcdd1ef..0532dc93e600 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -510,14 +511,16 @@ static inline unsigned int s3c2410wdt_get_bootstatus(struct s3c2410_wdt *wdt) static inline const struct s3c2410_wdt_variant * s3c2410_get_wdt_drv_data(struct platform_device *pdev) { - if (pdev->dev.of_node) { - const struct of_device_id *match; - match = of_match_node(s3c2410_wdt_match, pdev->dev.of_node); - return (struct s3c2410_wdt_variant *)match->data; - } else { - return (struct s3c2410_wdt_variant *) - platform_get_device_id(pdev)->driver_data; + const struct s3c2410_wdt_variant *variant; + + variant = of_device_get_match_data(&pdev->dev); + if (!variant) { + /* Device matched by platform_device_id */ + variant = (struct s3c2410_wdt_variant *) + platform_get_device_id(pdev)->driver_data; } + + return variant; } static int s3c2410wdt_probe(struct platform_device *pdev)