From patchwork Wed Jan 4 14:16:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 134261 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-wi0-f184.google.com (mail-wi0-f184.google.com [209.85.212.184]) (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 6527E1007D6 for ; Thu, 5 Jan 2012 01:16:56 +1100 (EST) Received: by wibhq12 with SMTP id hq12sf40690263wib.11 for ; Wed, 04 Jan 2012 06:16:52 -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=T98ziOzaIUX0Z58ayVZElfrokrjrLzuuiqubTqq55oc=; b=wGt5esAfh6hK69MlT6t1tEsxL0IdeE5iBbtuBLfgVVLWqjMJOP2+qs4px2xCgZ8Pk3 CpRwco4zz9ovkLbeIchlX2jZwwjisBiwRt5oyiO9vTIiFdd6g/6IgExYouPqDnw/oham /HpeGC4/iph02Z1VKZVMS2W8fEjD0fF8lifKY= Received: by 10.216.137.204 with SMTP id y54mr4803481wei.44.1325686611843; Wed, 04 Jan 2012 06:16:51 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.14.121.197 with SMTP id r45ls6598740eeh.4.canary; Wed, 04 Jan 2012 06:16:51 -0800 (PST) Received: by 10.213.35.76 with SMTP id o12mr3463353ebd.6.1325686611375; Wed, 04 Jan 2012 06:16:51 -0800 (PST) Received: by 10.213.35.76 with SMTP id o12mr3463352ebd.6.1325686611343; Wed, 04 Jan 2012 06:16:51 -0800 (PST) Received: from h1778886.stratoserver.net (h1778886.stratoserver.net. [85.214.133.74]) by gmr-mx.google.com with ESMTPS id v41si37620999eea.2.2012.01.04.06.16.51 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 04 Jan 2012 06:16:51 -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 1RiRdm-0006jd-4Y; Wed, 04 Jan 2012 15:16:30 +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 1RiRdk-0005SO-HE; Wed, 04 Jan 2012 15:16:29 +0100 From: Heiko =?windows-1252?q?St=FCbner?= To: Kukjin Kim Subject: [rtc-linux] [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block Date: Wed, 4 Jan 2012 15:16:25 +0100 User-Agent: KMail/1.13.7 (Linux/2.6.39-2-amd64; KDE/4.6.4; x86_64; ; ) Cc: Sylwester Nawrocki , ben-linux@fluff.org, a.zummo@towertech.it, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rtc-linux@googlegroups.com References: <201112211014.30695.heiko@sntech.de> <201201041512.55126.heiko@sntech.de> <201201041514.57688.heiko@sntech.de> In-Reply-To: <201201041514.57688.heiko@sntech.de> MIME-Version: 1.0 Message-Id: <201201041516.26082.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 Acked-by: Alessandro Zummo Signed-off-by: Kukjin Kim --- 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..dc0f65e 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 (int)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 = (void *)TYPE_S3C2410, + }, { + .compatible = "samsung,s3c6410-rtc", + .data = (void *)TYPE_S3C64XX, + }, {}, }; MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);