From patchwork Wed Dec 21 09:16:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Stuebner X-Patchwork-Id: 132603 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-pz0-f56.google.com (mail-pz0-f56.google.com [209.85.210.56]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id DA1D0B7110 for ; Wed, 21 Dec 2011 20:17:12 +1100 (EST) Received: by dafa1 with SMTP id a1sf5478823daf.11 for ; Wed, 21 Dec 2011 01:17:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:from:to:subject:date:user-agent:cc :references:in-reply-to:mime-version:message-id:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=KdLHOR0NhsC8Y6NBalfPqZP6wRSGUSwZbdYrk6P+Y9c=; b=WbVqgGb3PP1gAjHZ2/+JnkMlNfcz/YniGCuxDf95SYrYnhk5AC0dz2VKOKewmmazf4 tgm234I61jPwee/KTjx5HzDEczC+qmgboYYRXpq+1BcfLq2bGLNIO/SVVvArCXcN1kpV kRgNfO9ZYD680IEWBdFmkGQD1yIWHt5DMnfas= Received: by 10.68.192.105 with SMTP id hf9mr1178726pbc.6.1324459029964; Wed, 21 Dec 2011 01:17:09 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.68.11.234 with SMTP id t10ls7703862pbb.3.gmail; Wed, 21 Dec 2011 01:17:09 -0800 (PST) Received: by 10.68.189.194 with SMTP id gk2mr4402776pbc.3.1324459029402; Wed, 21 Dec 2011 01:17:09 -0800 (PST) Received: by 10.68.189.194 with SMTP id gk2mr4402775pbc.3.1324459029391; Wed, 21 Dec 2011 01:17:09 -0800 (PST) Received: from h1778886.stratoserver.net (h1778886.stratoserver.net. [85.214.133.74]) by gmr-mx.google.com with ESMTPS id c2si5550158pbe.0.2011.12.21.01.17.08 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Dec 2011 01:17:09 -0800 (PST) Received-SPF: neutral (google.com: 85.214.133.74 is neither permitted nor denied by best guess record for domain of heiko@sntech.de) client-ip=85.214.133.74; Received: from p509909d9.dip0.t-ipconnect.de ([80.153.9.217] helo=nx4-rtr-0001.kes) by h1778886.stratoserver.net with esmtpa (Exim 4.69) (envelope-from ) id 1RdII9-0001GP-A5; Wed, 21 Dec 2011 10:16:53 +0100 Received: from [192.168.30.196] (helo=nx4-deb-0000.localnet) by nx4-rtr-0001.kes with esmtp (Exim 4.69) (envelope-from ) id 1RdII8-0001LA-0F; Wed, 21 Dec 2011 10:16:53 +0100 From: Heiko =?iso-8859-1?q?St=FCbner?= To: Kukjin Kim , ben-linux@fluff.org, a.zummo@towertech.it Subject: [rtc-linux] [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block Date: Wed, 21 Dec 2011 10:16:51 +0100 User-Agent: KMail/1.13.7 (Linux/2.6.39-2-amd64; KDE/4.6.4; x86_64; ; ) Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rtc-linux@googlegroups.com References: <201112211014.30695.heiko@sntech.de> In-Reply-To: <201112211014.30695.heiko@sntech.de> MIME-Version: 1.0 Message-Id: <201112211016.51956.heiko@sntech.de> X-Original-Sender: heiko@sntech.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 85.214.133.74 is neither permitted nor denied by best guess record for domain of heiko@sntech.de) smtp.mail=heiko@sntech.de Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Use the data field of of_device_id to hold the type for s3c_cpu_type. Signed-off-by: Heiko Stuebner Reviewed-by: Thomas Abraham --- drivers/rtc/rtc-s3c.c | 31 ++++++++++++++++++++++--------- 1 files changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 175067a..2885b25 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -428,6 +428,20 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) return 0; } +static const struct of_device_id s3c_rtc_dt_match[]; + +static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) +{ +#ifdef CONFIG_OF + if (pdev->dev.of_node) { + const struct of_device_id *match; + match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); + return match->data; + } +#endif + return platform_get_device_id(pdev)->driver_data; +} + static int __devinit s3c_rtc_probe(struct platform_device *pdev) { struct rtc_device *rtc; @@ -508,13 +522,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) goto err_nortc; } -#ifdef CONFIG_OF - if (pdev->dev.of_node) - s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node, - "samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410; - else -#endif - s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data; + s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev); /* Check RTC Time */ @@ -638,8 +646,13 @@ static int s3c_rtc_resume(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id s3c_rtc_dt_match[] = { - { .compatible = "samsung,s3c2410-rtc" }, - { .compatible = "samsung,s3c6410-rtc" }, + { + .compatible = "samsung,s3c2410-rtc" + .data = TYPE_S3C2410, + }, { + .compatible = "samsung,s3c6410-rtc" + .data = TYPE_S3C64XX, + }, {}, }; MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);