From patchwork Mon Dec 12 14:46:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Stuebner X-Patchwork-Id: 130757 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-bw0-f56.google.com (mail-bw0-f56.google.com [209.85.214.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 DD5B3B6FA0 for ; Tue, 13 Dec 2011 01:47:38 +1100 (EST) Received: by bkbzt4 with SMTP id zt4sf21500632bkb.11 for ; Mon, 12 Dec 2011 06:47:34 -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=XyJ/r+6mlphVNocqzT2lpcK3XClmnggjjDoeBKnbJwtypb8MBhJpSxILkL+iKbAsz8 22vowKPmXwYYyvgFZbkPIwWL4NT1KcT9AhocUvwjbfgd4rm9Rn2n4KqrPt5gzdsSTmsZ bVAkBg+FHrBMVJwgBmUs102dUPA9qq3sw0tEg= Received: by 10.205.83.143 with SMTP id ag15mr2259972bkc.8.1323701227964; Mon, 12 Dec 2011 06:47:07 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.213.102.203 with SMTP id h11ls2360743ebo.3.gmail; Mon, 12 Dec 2011 06:47:07 -0800 (PST) Received: by 10.14.5.209 with SMTP id 57mr1381102eel.14.1323701227440; Mon, 12 Dec 2011 06:47:07 -0800 (PST) Received: by 10.14.5.209 with SMTP id 57mr1381101eel.14.1323701227427; Mon, 12 Dec 2011 06:47:07 -0800 (PST) Received: from h1778886.stratoserver.net (h1778886.stratoserver.net. [85.214.133.74]) by gmr-mx.google.com with ESMTPS id q50si13034368eef.3.2011.12.12.06.47.07 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Dec 2011 06:47:07 -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 1Ra79g-00041X-Kh; Mon, 12 Dec 2011 15:47:00 +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 1Ra79S-0008Q9-Tl; Mon, 12 Dec 2011 15:46:55 +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: Mon, 12 Dec 2011 15:46:46 +0100 User-Agent: KMail/1.13.7 (Linux/2.6.39-2-amd64; KDE/4.6.4; x86_64; ; ) Cc: rtc-linux@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Thomas Abraham References: <201112121543.42299.heiko@sntech.de> In-Reply-To: <201112121543.42299.heiko@sntech.de> MIME-Version: 1.0 Message-Id: <201112121546.46953.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);