[4/7] watchdog: s3c2410: Add support for device tree based probe

Message ID 1297514825-10345-5-git-send-email-thomas.abraham@linaro.org
State New
Headers show

Commit Message

thomas.abraham@linaro.org Feb. 12, 2011, 12:47 p.m.
This patch adds the of_match_table to enable s3c2410-wdt driver
to be probed when watchdog device node is found in the device tree.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
---
 drivers/watchdog/s3c2410_wdt.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

Comments

Grant Likely Feb. 17, 2011, 12:17 a.m. | #1
On Sat, Feb 12, 2011 at 06:17:02PM +0530, Thomas Abraham wrote:
> This patch adds the of_match_table to enable s3c2410-wdt driver
> to be probed when watchdog device node is found in the device tree.
> 
> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
> ---
>  drivers/watchdog/s3c2410_wdt.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)

Need to add documentation for compatible = "samsung,s3c2410-wdt" to
Documentation/devicetree/bindings/wdt before this patch can be merged.

A couple more comments below, but I'm okay with this one.  I'd go
ahead and submit it to the linux-watchdog@vger.kernel.org list and cc:
Wim.  It can be mainlined right away after fixing up the comments.
I'll ack it when you repost and then work out with Wim if it should be
merged through his tree or through mine.

> 
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index ae53662..a9edd50 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -592,6 +592,13 @@ static int s3c2410wdt_resume(struct platform_device *dev)
>  #define s3c2410wdt_resume  NULL
>  #endif /* CONFIG_PM */
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id s3c2410_wdt_match[] = {
> +	{ .compatible = "samsung,s3c2410-wdt" },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, s3c2410_wdt_match);
> +#endif

#else
#define s3c2410_wdt_match NULL
#endif

>  
>  static struct platform_driver s3c2410wdt_driver = {
>  	.probe		= s3c2410wdt_probe,
> @@ -602,6 +609,9 @@ static struct platform_driver s3c2410wdt_driver = {
>  	.driver		= {
>  		.owner	= THIS_MODULE,
>  		.name	= "s3c2410-wdt",
> +#ifdef CONFIG_OF
> +		.of_match_table	= s3c2410_wdt_match,
> +#endif

The #ifdef can be dropped here now.  .of_match_table is no longer conditional.


>  	},
>  };
>  
> -- 
> 1.6.6.rc2
>
thomas.abraham@linaro.org Feb. 17, 2011, 2:04 p.m. | #2
Hi Grant,

On 17 February 2011 05:47, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Sat, Feb 12, 2011 at 06:17:02PM +0530, Thomas Abraham wrote:
>> This patch adds the of_match_table to enable s3c2410-wdt driver
>> to be probed when watchdog device node is found in the device tree.
>>
>> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
>> ---
>>  drivers/watchdog/s3c2410_wdt.c |   10 ++++++++++
>>  1 files changed, 10 insertions(+), 0 deletions(-)
>
> Need to add documentation for compatible = "samsung,s3c2410-wdt" to
> Documentation/devicetree/bindings/wdt before this patch can be merged.
>
> A couple more comments below, but I'm okay with this one.  I'd go
> ahead and submit it to the linux-watchdog@vger.kernel.org list and cc:
> Wim.  It can be mainlined right away after fixing up the comments.
> I'll ack it when you repost and then work out with Wim if it should be
> merged through his tree or through mine.
>
>>
>> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
>> index ae53662..a9edd50 100644
>> --- a/drivers/watchdog/s3c2410_wdt.c
>> +++ b/drivers/watchdog/s3c2410_wdt.c
>> @@ -592,6 +592,13 @@ static int s3c2410wdt_resume(struct platform_device *dev)
>>  #define s3c2410wdt_resume  NULL
>>  #endif /* CONFIG_PM */
>>
>> +#ifdef CONFIG_OF
>> +static const struct of_device_id s3c2410_wdt_match[] = {
>> +     { .compatible = "samsung,s3c2410-wdt" },
>> +     {},
>> +};
>> +MODULE_DEVICE_TABLE(of, s3c2410_wdt_match);
>> +#endif
>
> #else
> #define s3c2410_wdt_match NULL
> #endif
>
>>
>>  static struct platform_driver s3c2410wdt_driver = {
>>       .probe          = s3c2410wdt_probe,
>> @@ -602,6 +609,9 @@ static struct platform_driver s3c2410wdt_driver = {
>>       .driver         = {
>>               .owner  = THIS_MODULE,
>>               .name   = "s3c2410-wdt",
>> +#ifdef CONFIG_OF
>> +             .of_match_table = s3c2410_wdt_match,
>> +#endif
>
> The #ifdef can be dropped here now.  .of_match_table is no longer conditional.
>

The of_match_table is conditional in devicetree/arm and
devicetree/test branches. Are you referring to any other branch?

Thanks,
Thomas.

>
>>       },
>>  };
>>
>> --
>> 1.6.6.rc2
>>
>
Grant Likely Feb. 17, 2011, 4:55 p.m. | #3
On Thu, Feb 17, 2011 at 7:04 AM, Thomas Abraham
<thomas.abraham@linaro.org> wrote:
> Hi Grant,
>
> On 17 February 2011 05:47, Grant Likely <grant.likely@secretlab.ca> wrote:
>> On Sat, Feb 12, 2011 at 06:17:02PM +0530, Thomas Abraham wrote:
>>> This patch adds the of_match_table to enable s3c2410-wdt driver
>>> to be probed when watchdog device node is found in the device tree.
>>>
>>> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
>>> ---
>>>  drivers/watchdog/s3c2410_wdt.c |   10 ++++++++++
>>>  1 files changed, 10 insertions(+), 0 deletions(-)
>>
>> Need to add documentation for compatible = "samsung,s3c2410-wdt" to
>> Documentation/devicetree/bindings/wdt before this patch can be merged.
>>
>> A couple more comments below, but I'm okay with this one.  I'd go
>> ahead and submit it to the linux-watchdog@vger.kernel.org list and cc:
>> Wim.  It can be mainlined right away after fixing up the comments.
>> I'll ack it when you repost and then work out with Wim if it should be
>> merged through his tree or through mine.
>>
>>>
>>> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
>>> index ae53662..a9edd50 100644
>>> --- a/drivers/watchdog/s3c2410_wdt.c
>>> +++ b/drivers/watchdog/s3c2410_wdt.c
>>> @@ -592,6 +592,13 @@ static int s3c2410wdt_resume(struct platform_device *dev)
>>>  #define s3c2410wdt_resume  NULL
>>>  #endif /* CONFIG_PM */
>>>
>>> +#ifdef CONFIG_OF
>>> +static const struct of_device_id s3c2410_wdt_match[] = {
>>> +     { .compatible = "samsung,s3c2410-wdt" },
>>> +     {},
>>> +};
>>> +MODULE_DEVICE_TABLE(of, s3c2410_wdt_match);
>>> +#endif
>>
>> #else
>> #define s3c2410_wdt_match NULL
>> #endif
>>
>>>
>>>  static struct platform_driver s3c2410wdt_driver = {
>>>       .probe          = s3c2410wdt_probe,
>>> @@ -602,6 +609,9 @@ static struct platform_driver s3c2410wdt_driver = {
>>>       .driver         = {
>>>               .owner  = THIS_MODULE,
>>>               .name   = "s3c2410-wdt",
>>> +#ifdef CONFIG_OF
>>> +             .of_match_table = s3c2410_wdt_match,
>>> +#endif
>>
>> The #ifdef can be dropped here now.  .of_match_table is no longer conditional.
>>
>
> The of_match_table is conditional in devicetree/arm and
> devicetree/test branches. Are you referring to any other branch?

Ah, right.  I've got that change in devicetree/next, but I've not put
it into devicetree/{test,arm}.  I'll fix that and push out an update.

g.

Patch

diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index ae53662..a9edd50 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -592,6 +592,13 @@  static int s3c2410wdt_resume(struct platform_device *dev)
 #define s3c2410wdt_resume  NULL
 #endif /* CONFIG_PM */
 
+#ifdef CONFIG_OF
+static const struct of_device_id s3c2410_wdt_match[] = {
+	{ .compatible = "samsung,s3c2410-wdt" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, s3c2410_wdt_match);
+#endif
 
 static struct platform_driver s3c2410wdt_driver = {
 	.probe		= s3c2410wdt_probe,
@@ -602,6 +609,9 @@  static struct platform_driver s3c2410wdt_driver = {
 	.driver		= {
 		.owner	= THIS_MODULE,
 		.name	= "s3c2410-wdt",
+#ifdef CONFIG_OF
+		.of_match_table	= s3c2410_wdt_match,
+#endif
 	},
 };