All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Kukjin Kim <kgene.kim@samsung.com>,
	ben-linux@fluff.org, a.zummo@towertech.it,
	'Thomas Abraham' <thomas.abraham@linaro.org>,
	Grant Likely <grant.likely@secretlab.ca>
Cc: rtc-linux@googlegroups.com, linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org
Subject: [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
Date: Fri, 9 Dec 2011 10:50:10 +0100	[thread overview]
Message-ID: <201112091050.11095.heiko@sntech.de> (raw)
In-Reply-To: <201112091046.26563.heiko@sntech.de>

Use the data field of of_device_id to hold the type for
s3c_cpu_type.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/rtc/rtc-s3c.c |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 175067a..71807a6 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -428,11 +428,18 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id s3c_rtc_dt_match[];
+#endif
+
 static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 {
 	struct rtc_device *rtc;
 	struct rtc_time rtc_tm;
 	struct resource *res;
+#ifdef CONFIG_OF
+	const struct of_device_id *match;
+#endif
 	int ret;
 
 	pr_debug("%s: probe=%p\n", __func__, pdev);
@@ -509,12 +516,15 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 	}
 
 #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
+	if (pdev->dev.of_node) {
+		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
+		s3c_rtc_cpu_type = match->data;
+	} else {
 #endif
 		s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
+#ifdef CONFIG_OF
+	}
+#endif
 
 	/* Check RTC Time */
 
@@ -638,8 +648,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);
-- 
1.7.5.4

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block
Date: Fri, 9 Dec 2011 10:50:10 +0100	[thread overview]
Message-ID: <201112091050.11095.heiko@sntech.de> (raw)
In-Reply-To: <201112091046.26563.heiko@sntech.de>

Use the data field of of_device_id to hold the type for
s3c_cpu_type.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/rtc/rtc-s3c.c |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 175067a..71807a6 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -428,11 +428,18 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id s3c_rtc_dt_match[];
+#endif
+
 static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 {
 	struct rtc_device *rtc;
 	struct rtc_time rtc_tm;
 	struct resource *res;
+#ifdef CONFIG_OF
+	const struct of_device_id *match;
+#endif
 	int ret;
 
 	pr_debug("%s: probe=%p\n", __func__, pdev);
@@ -509,12 +516,15 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 	}
 
 #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
+	if (pdev->dev.of_node) {
+		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
+		s3c_rtc_cpu_type = match->data;
+	} else {
 #endif
 		s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
+#ifdef CONFIG_OF
+	}
+#endif
 
 	/* Check RTC Time */
 
@@ -638,8 +648,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);
-- 
1.7.5.4

  parent reply	other threads:[~2011-12-09  9:50 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09  9:46 [PATCH 0/4] Implement RTC support for S3C2443/S3C2416/S3C2450 Heiko Stübner
2011-12-09  9:46 ` Heiko Stübner
2011-12-09  9:47 ` [PATCH 1/4] ARM: SAMSUNG: cleanup of rtc register definitions Heiko Stübner
2011-12-09  9:47   ` Heiko Stübner
2011-12-09  9:50 ` Heiko Stübner [this message]
2011-12-09  9:50   ` [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block Heiko Stübner
2011-12-11  5:47   ` Thomas Abraham
2011-12-11  5:47     ` Thomas Abraham
2011-12-12 12:51     ` Heiko Stübner
2011-12-12 12:51       ` Heiko Stübner
2011-12-09  9:50 ` [PATCH 3/4] rtc-s3c: add variants for S3C2443 and S3C2416 Heiko Stübner
2011-12-09  9:50   ` Heiko Stübner
2011-12-11  5:54   ` Thomas Abraham
2011-12-11  5:54     ` Thomas Abraham
2011-12-09  9:51 ` [PATCH 4/4] ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices Heiko Stübner
2011-12-09  9:51   ` Heiko Stübner
  -- strict thread matches above, loose matches on Subject: below --
2011-12-12 14:43 [PATCH v2 0/4] Implement RTC support for S3C2443/S3C2416/S3C2450 Heiko Stübner
2011-12-12 14:46 ` [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block Heiko Stübner
2011-12-12 14:46   ` Heiko Stübner
2011-12-21  9:14 [PATCH v3 0/4] Implement RTC support for S3C2443/S3C2416/S3C2450 Heiko Stübner
2011-12-21  9:16 ` [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block Heiko Stübner
2011-12-21  9:16   ` Heiko Stübner
2012-01-04 10:43   ` Sylwester Nawrocki
2012-01-04 10:43     ` Sylwester Nawrocki
2012-01-04 11:51     ` Heiko Stübner
2012-01-04 11:51       ` Heiko Stübner
2012-01-04 14:12       ` Heiko Stübner
2012-01-04 14:12         ` Heiko Stübner
2012-01-04 14:14         ` [PATCH v4 0/4] Implement RTC support for S3C2443/S3C2416/S3C2450 Heiko Stübner
2012-01-04 14:16           ` [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block Heiko Stübner
2012-01-04 14:16             ` Heiko Stübner
2012-01-05  2:32         ` Kukjin Kim
2012-01-05  2:32           ` Kukjin Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201112091050.11095.heiko@sntech.de \
    --to=heiko@sntech.de \
    --cc=a.zummo@towertech.it \
    --cc=ben-linux@fluff.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=thomas.abraham@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.