From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Ralf Baechle <ralf@linux-mips.org>,
Alessandro Zummo <a.zummo@towertech.it>,
Paul Burton <paul.burton@imgtec.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mips@linux-mips.org, rtc-linux@googlegroups.com
Subject: Re: [PATCH 3/5] rtc: rtc-jz4740: Add support for devicetree
Date: Thu, 17 Mar 2016 13:08:04 +0100 [thread overview]
Message-ID: <20160317120804.GD3362@piout.net> (raw)
In-Reply-To: <1457217531-26064-3-git-send-email-paul@crapouillou.net>
On 05/03/2016 at 23:38:49 +0100, Paul Cercueil wrote :
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> drivers/rtc/rtc-jz4740.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
> index 47617bd..3914b1c 100644
> --- a/drivers/rtc/rtc-jz4740.c
> +++ b/drivers/rtc/rtc-jz4740.c
> @@ -17,6 +17,7 @@
> #include <linux/io.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> +#include <linux/of_device.h>
> #include <linux/platform_device.h>
> #include <linux/rtc.h>
> #include <linux/slab.h>
> @@ -245,6 +246,13 @@ void jz4740_rtc_poweroff(struct device *dev)
> }
> EXPORT_SYMBOL_GPL(jz4740_rtc_poweroff);
>
> +static const struct of_device_id jz4740_rtc_of_match[] = {
> + { .compatible = "ingenic,jz4740-rtc", .data = (void *) ID_JZ4740 },
> + { .compatible = "ingenic,jz4780-rtc", .data = (void *) ID_JZ4780 },
ingenic is not in Documentation/devicetree/bindings/vendor-prefixes.txt,
you have to add it there before using it.
Also, no space is necessary after the "(void *)" cast.
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, jz4740_rtc_of_match);
> +
> static int jz4740_rtc_probe(struct platform_device *pdev)
> {
> int ret;
> @@ -252,12 +260,17 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
> uint32_t scratchpad;
> struct resource *mem;
> const struct platform_device_id *id = platform_get_device_id(pdev);
> + const struct of_device_id *of_id = of_match_device(
> + jz4740_rtc_of_match, &pdev->dev);
>
> rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
> if (!rtc)
> return -ENOMEM;
>
> - rtc->type = id->driver_data;
> + if (of_id)
> + rtc->type = (enum jz4740_rtc_type) of_id->data;
No space after that cast either.
> + else
> + rtc->type = id->driver_data;
>
> rtc->irq = platform_get_irq(pdev, 0);
> if (rtc->irq < 0) {
> @@ -345,6 +358,7 @@ static struct platform_driver jz4740_rtc_driver = {
> .driver = {
> .name = "jz4740-rtc",
> .pm = JZ4740_RTC_PM_OPS,
> + .of_match_table = of_match_ptr(jz4740_rtc_of_match),
> },
> .id_table = jz4740_rtc_ids,
> };
> --
> 2.7.0
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Ralf Baechle <ralf@linux-mips.org>,
Alessandro Zummo <a.zummo@towertech.it>,
Paul Burton <paul.burton@imgtec.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mips@linux-mips.org, rtc-linux@googlegroups.com
Subject: [rtc-linux] Re: [PATCH 3/5] rtc: rtc-jz4740: Add support for devicetree
Date: Thu, 17 Mar 2016 13:08:04 +0100 [thread overview]
Message-ID: <20160317120804.GD3362@piout.net> (raw)
In-Reply-To: <1457217531-26064-3-git-send-email-paul@crapouillou.net>
On 05/03/2016 at 23:38:49 +0100, Paul Cercueil wrote :
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> drivers/rtc/rtc-jz4740.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
> index 47617bd..3914b1c 100644
> --- a/drivers/rtc/rtc-jz4740.c
> +++ b/drivers/rtc/rtc-jz4740.c
> @@ -17,6 +17,7 @@
> #include <linux/io.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> +#include <linux/of_device.h>
> #include <linux/platform_device.h>
> #include <linux/rtc.h>
> #include <linux/slab.h>
> @@ -245,6 +246,13 @@ void jz4740_rtc_poweroff(struct device *dev)
> }
> EXPORT_SYMBOL_GPL(jz4740_rtc_poweroff);
>
> +static const struct of_device_id jz4740_rtc_of_match[] = {
> + { .compatible = "ingenic,jz4740-rtc", .data = (void *) ID_JZ4740 },
> + { .compatible = "ingenic,jz4780-rtc", .data = (void *) ID_JZ4780 },
ingenic is not in Documentation/devicetree/bindings/vendor-prefixes.txt,
you have to add it there before using it.
Also, no space is necessary after the "(void *)" cast.
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, jz4740_rtc_of_match);
> +
> static int jz4740_rtc_probe(struct platform_device *pdev)
> {
> int ret;
> @@ -252,12 +260,17 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
> uint32_t scratchpad;
> struct resource *mem;
> const struct platform_device_id *id = platform_get_device_id(pdev);
> + const struct of_device_id *of_id = of_match_device(
> + jz4740_rtc_of_match, &pdev->dev);
>
> rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
> if (!rtc)
> return -ENOMEM;
>
> - rtc->type = id->driver_data;
> + if (of_id)
> + rtc->type = (enum jz4740_rtc_type) of_id->data;
No space after that cast either.
> + else
> + rtc->type = id->driver_data;
>
> rtc->irq = platform_get_irq(pdev, 0);
> if (rtc->irq < 0) {
> @@ -345,6 +358,7 @@ static struct platform_driver jz4740_rtc_driver = {
> .driver = {
> .name = "jz4740-rtc",
> .pm = JZ4740_RTC_PM_OPS,
> + .of_match_table = of_match_ptr(jz4740_rtc_of_match),
> },
> .id_table = jz4740_rtc_ids,
> };
> --
> 2.7.0
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Paul Cercueil <paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Ian Campbell
<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
Ralf Baechle <ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>,
Alessandro Zummo
<a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>,
Paul Burton <paul.burton-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: [PATCH 3/5] rtc: rtc-jz4740: Add support for devicetree
Date: Thu, 17 Mar 2016 13:08:04 +0100 [thread overview]
Message-ID: <20160317120804.GD3362@piout.net> (raw)
In-Reply-To: <1457217531-26064-3-git-send-email-paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
On 05/03/2016 at 23:38:49 +0100, Paul Cercueil wrote :
> Signed-off-by: Paul Cercueil <paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>
> ---
> drivers/rtc/rtc-jz4740.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
> index 47617bd..3914b1c 100644
> --- a/drivers/rtc/rtc-jz4740.c
> +++ b/drivers/rtc/rtc-jz4740.c
> @@ -17,6 +17,7 @@
> #include <linux/io.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> +#include <linux/of_device.h>
> #include <linux/platform_device.h>
> #include <linux/rtc.h>
> #include <linux/slab.h>
> @@ -245,6 +246,13 @@ void jz4740_rtc_poweroff(struct device *dev)
> }
> EXPORT_SYMBOL_GPL(jz4740_rtc_poweroff);
>
> +static const struct of_device_id jz4740_rtc_of_match[] = {
> + { .compatible = "ingenic,jz4740-rtc", .data = (void *) ID_JZ4740 },
> + { .compatible = "ingenic,jz4780-rtc", .data = (void *) ID_JZ4780 },
ingenic is not in Documentation/devicetree/bindings/vendor-prefixes.txt,
you have to add it there before using it.
Also, no space is necessary after the "(void *)" cast.
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, jz4740_rtc_of_match);
> +
> static int jz4740_rtc_probe(struct platform_device *pdev)
> {
> int ret;
> @@ -252,12 +260,17 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
> uint32_t scratchpad;
> struct resource *mem;
> const struct platform_device_id *id = platform_get_device_id(pdev);
> + const struct of_device_id *of_id = of_match_device(
> + jz4740_rtc_of_match, &pdev->dev);
>
> rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
> if (!rtc)
> return -ENOMEM;
>
> - rtc->type = id->driver_data;
> + if (of_id)
> + rtc->type = (enum jz4740_rtc_type) of_id->data;
No space after that cast either.
> + else
> + rtc->type = id->driver_data;
>
> rtc->irq = platform_get_irq(pdev, 0);
> if (rtc->irq < 0) {
> @@ -345,6 +358,7 @@ static struct platform_driver jz4740_rtc_driver = {
> .driver = {
> .name = "jz4740-rtc",
> .pm = JZ4740_RTC_PM_OPS,
> + .of_match_table = of_match_ptr(jz4740_rtc_of_match),
> },
> .id_table = jz4740_rtc_ids,
> };
> --
> 2.7.0
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-03-17 12:08 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-05 22:38 [PATCH 1/5] rtc: rtc-jz4740: Add support for the RTC in the jz4780 SoC Paul Cercueil
2016-03-05 22:38 ` [rtc-linux] " Paul Cercueil
2016-03-05 22:38 ` [PATCH 2/5] Documentation: dt: Add binding info for jz4740-rtc driver Paul Cercueil
2016-03-05 22:38 ` [rtc-linux] " Paul Cercueil
2016-03-06 12:13 ` Sergei Shtylyov
2016-03-06 12:13 ` Sergei Shtylyov
2016-03-06 12:13 ` [rtc-linux] " Sergei Shtylyov
2016-03-17 11:52 ` Rob Herring
2016-03-17 11:52 ` Rob Herring
2016-03-17 11:52 ` [rtc-linux] " Rob Herring
2016-03-17 12:04 ` Alexandre Belloni
2016-03-17 12:04 ` Alexandre Belloni
2016-03-17 12:04 ` [rtc-linux] " Alexandre Belloni
2016-03-05 22:38 ` [PATCH 3/5] rtc: rtc-jz4740: Add support for devicetree Paul Cercueil
2016-03-05 22:38 ` [rtc-linux] " Paul Cercueil
2016-03-17 12:08 ` Alexandre Belloni [this message]
2016-03-17 12:08 ` Alexandre Belloni
2016-03-17 12:08 ` [rtc-linux] " Alexandre Belloni
2016-03-17 13:33 ` Harvey Hunt
2016-03-17 13:33 ` [rtc-linux] " Harvey Hunt
2016-03-17 13:33 ` Harvey Hunt
2016-03-17 13:56 ` Alexandre Belloni
2016-03-17 13:56 ` Alexandre Belloni
2016-03-17 13:56 ` [rtc-linux] " Alexandre Belloni
2016-03-05 22:38 ` [PATCH 4/5] rtc: jz4740_rtc: Add support for acting as the system power controller Paul Cercueil
2016-03-05 22:38 ` [rtc-linux] " Paul Cercueil
2016-03-17 12:20 ` Alexandre Belloni
2016-03-17 12:20 ` Alexandre Belloni
2016-03-17 12:20 ` [rtc-linux] " Alexandre Belloni
2016-03-05 22:38 ` [PATCH 5/5] MIPS: jz4740: Use the jz4740-rtc driver as the " Paul Cercueil
2016-03-05 22:38 ` [rtc-linux] " Paul Cercueil
2016-03-14 1:53 ` Ralf Baechle
2016-03-14 1:53 ` Ralf Baechle
2016-03-14 1:53 ` [rtc-linux] " Ralf Baechle
2016-03-17 12:22 ` Alexandre Belloni
2016-03-17 12:22 ` Alexandre Belloni
2016-03-17 12:22 ` [rtc-linux] " Alexandre Belloni
2016-03-17 12:04 ` [PATCH 1/5] rtc: rtc-jz4740: Add support for the RTC in the jz4780 SoC Alexandre Belloni
2016-03-17 12:04 ` Alexandre Belloni
2016-03-17 12:04 ` [rtc-linux] " Alexandre Belloni
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=20160317120804.GD3362@piout.net \
--to=alexandre.belloni@free-electrons.com \
--cc=a.zummo@towertech.it \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mark.rutland@arm.com \
--cc=paul.burton@imgtec.com \
--cc=paul@crapouillou.net \
--cc=pawel.moll@arm.com \
--cc=ralf@linux-mips.org \
--cc=robh+dt@kernel.org \
--cc=rtc-linux@googlegroups.com \
/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.