From patchwork Fri May 9 12:09:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 29889 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 173DB20534 for ; Fri, 9 May 2014 12:10:25 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id uq10sf3131047igb.9 for ; Fri, 09 May 2014 05:10:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=EI59A5Na10fs2zmyKj4tA8PXcHXEH550AbB6NmKUGQg=; b=OsLC4Z6cMaS5F8GBiT3X37nTrB580L3+VfKks3u8yWxi+X9Lqhu/RtXwsodyFnBMKk g4GsqGJ8jBrK5Qrn5LiIMjcl42+F8t5fw6ajl4A5WvS3fY+SnSbBc2ee68IdGPgKZtUx 4FzNkuKGxPUBEM7babmovwxKWdpahKbfJXDZjK1Smu8r7gWdwufeB9Zv9ULhzKDGvI5N NTLYPaaiNTbKRRXmIttMZjGxFPk5WvYJ3fUNjPL3OlIuox+4G0nxu8fkVx2pQL0srFAG jPSwiAoypK0S0ED8FnEZJwXfwArOXpbiB8FjB9ns60XlgTip7xQuI/lLflSMAYwBXiV6 A13w== X-Gm-Message-State: ALoCoQllnUcjkzRJqe7qJJwrC888jVmQLTiN5j8jVlYn5SOCtMeZMjPsBUnpBYBfunjjkK6hVvjw X-Received: by 10.42.229.194 with SMTP id jj2mr4419228icb.18.1399637425172; Fri, 09 May 2014 05:10:25 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.98.229 with SMTP id o92ls292453qge.95.gmail; Fri, 09 May 2014 05:10:25 -0700 (PDT) X-Received: by 10.58.220.161 with SMTP id px1mr8141553vec.13.1399637425068; Fri, 09 May 2014 05:10:25 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id jb7si687498vec.197.2014.05.09.05.10.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 09 May 2014 05:10:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id la4so5185178vcb.27 for ; Fri, 09 May 2014 05:10:25 -0700 (PDT) X-Received: by 10.58.116.175 with SMTP id jx15mr8091322veb.9.1399637424976; Fri, 09 May 2014 05:10:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp74060vcb; Fri, 9 May 2014 05:10:24 -0700 (PDT) X-Received: by 10.53.5.70 with SMTP id ck6mr129039vdd.74.1399637424547; Fri, 09 May 2014 05:10:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id db3si2174966pbc.15.2014.05.09.05.10.23; Fri, 09 May 2014 05:10:23 -0700 (PDT) Received-SPF: none (google.com: linux-omap-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754085AbaEIMKX (ORCPT + 6 others); Fri, 9 May 2014 08:10:23 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:49537 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752606AbaEIMKW (ORCPT ); Fri, 9 May 2014 08:10:22 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s49C9DpM023020; Fri, 9 May 2014 07:09:13 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s49C9DSx009681; Fri, 9 May 2014 07:09:13 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Fri, 9 May 2014 07:09:13 -0500 Received: from psplinux063.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s49C99T9031720; Fri, 9 May 2014 07:09:11 -0500 From: Sekhar Nori To: Alessandro Zummo , Andrew Morton CC: Linux RTC Mailing List , Linux OMAP Mailing List , Sekhar Nori Subject: [PATCH 1/3] rtc: omap: remove multiple device id checks Date: Fri, 9 May 2014 17:39:01 +0530 Message-ID: <753d23945b1de5c2c3403969d712b3b237041f83.1399635871.git.nsekhar@ti.com> X-Mailer: git-send-email 1.7.10.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nsekhar@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Remove multiple superfluous device id checks. Since an id_table is present in the driver probe() should never encounter an empty device id entry. In case of OF style match, of_match_device() returns an matching entry. For paranoia sake, check for device id entry once and fail probe() if none is found. This is much better than checking for it multiple times. Signed-off-by: Sekhar Nori --- drivers/rtc/rtc-omap.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 26de5f8..70f5149 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -352,6 +352,12 @@ static int __init omap_rtc_probe(struct platform_device *pdev) if (of_id) pdev->id_entry = of_id->data; + id_entry = platform_get_device_id(pdev); + if (!id_entry) { + dev_err(&pdev->dev, "no matching device entry\n"); + return -ENODEV; + } + omap_rtc_timer = platform_get_irq(pdev, 0); if (omap_rtc_timer <= 0) { pr_debug("%s: no update irq?\n", pdev->name); @@ -373,8 +379,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); pm_runtime_get_sync(&pdev->dev); - id_entry = platform_get_device_id(pdev); - if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) { + if (id_entry->driver_data & OMAP_RTC_HAS_KICKER) { rtc_writel(KICK0_VALUE, OMAP_RTC_KICK0_REG); rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG); } @@ -452,7 +457,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev) return 0; fail0: - if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) + if (id_entry->driver_data & OMAP_RTC_HAS_KICKER) rtc_writel(0, OMAP_RTC_KICK0_REG); pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); @@ -469,7 +474,7 @@ static int __exit omap_rtc_remove(struct platform_device *pdev) /* leave rtc running, but disable irqs */ rtc_write(0, OMAP_RTC_INTERRUPTS_REG); - if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) + if (id_entry->driver_data & OMAP_RTC_HAS_KICKER) rtc_writel(0, OMAP_RTC_KICK0_REG); /* Disable the clock/module */