All of lore.kernel.org
 help / color / mirror / Atom feed
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: "ivan.khoronzhuk" <ivan.khoronzhuk@ti.com>, <wim@iguana.be>,
	<nsekhar@ti.com>, <linux-watchdog@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <grant.likely@linaro.org>,
	<rob.herring@calxeda.com>, <pawel.moll@arm.com>,
	<mark.rutland@arm.com>, <swarren@wwwdotorg.org>,
	<galak@kernel.crashing.org>, <ijc+devicetree@hellion.org.uk>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: Fwd: [PATCH 2/8] watchdog: davinci: use davinci_wdt_device structure to hold device data
Date: Tue, 12 Nov 2013 11:28:54 -0500	[thread overview]
Message-ID: <52825746.4090702@ti.com> (raw)
In-Reply-To: <20131112162731.GA5449@roeck-us.net>

On Tuesday 12 November 2013 11:27 AM, Guenter Roeck wrote:
> On Tue, Nov 12, 2013 at 10:37:04AM -0500, Santosh Shilimkar wrote:
>> On Wednesday 06 November 2013 06:31 AM, ivan.khoronzhuk wrote:
>>> Some SoCs, like Keystone 2, can support more than one WDT and each
>>> watchdog device has to use it's own base address, clock source,
>>> wdd device, so add new davinci_wdt_device structure to hold device
>> In commit avoid struct names ;)
>> s/wdd/watchdog device
>>> data.
>>>
>>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>>> ---
>>>  drivers/watchdog/davinci_wdt.c |   74 ++++++++++++++++++++++++++--------------
>>>  1 file changed, 48 insertions(+), 26 deletions(-)
>>>
>>> diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
>>> index a6eef71..1fc2093 100644
>>> --- a/drivers/watchdog/davinci_wdt.c
>>> +++ b/drivers/watchdog/davinci_wdt.c
>>
>> [...]
>>
>>> @@ -123,14 +135,21 @@ static int davinci_wdt_probe(struct platform_device *pdev)
>>>  	struct device *dev = &pdev->dev;
>>>  	struct resource  *wdt_mem;
>>>  	struct watchdog_device *wdd;
>>> +	struct davinci_wdt_device *davinci_wdt;
>>> +
>>> +	davinci_wdt = devm_kzalloc(dev, sizeof(*davinci_wdt), GFP_KERNEL);
>>> +	if (!davinci_wdt)
>>> +		return -ENOMEM;
>>>  
>>> -	wdt_clk = devm_clk_get(dev, NULL);
>>> -	if (WARN_ON(IS_ERR(wdt_clk)))
>>> -		return PTR_ERR(wdt_clk);
>>> +	davinci_wdt->clk = devm_clk_get(dev, NULL);
>>> +	if (WARN_ON(IS_ERR(davinci_wdt->clk)))
>>> +		return PTR_ERR(davinci_wdt->clk);
>>>  
>>> -	clk_prepare_enable(wdt_clk);
>>> +	clk_prepare_enable(davinci_wdt->clk);
>>>  
>>> -	wdd			= &wdt_wdd;
>>> +	platform_set_drvdata(pdev, davinci_wdt);
>>> +
>>> +	wdd			= &davinci_wdt->wdd;
>>>  	wdd->info		= &davinci_wdt_info;
>>>  	wdd->ops		= &davinci_wdt_ops;
>>>  	wdd->min_timeout 	= 1;
>>> @@ -142,12 +161,13 @@ static int davinci_wdt_probe(struct platform_device *pdev)
>>>  
>>>  	dev_info(dev, "heartbeat %d sec\n", wdd->timeout);
>>>  
>>> +	watchdog_set_drvdata(wdd, davinci_wdt);
>>>  	watchdog_set_nowayout(wdd, WATCHDOG_NOWAYOUT);
>>>  
>>>  	wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> -	wdt_base = devm_ioremap_resource(dev, wdt_mem);
>>> -	if (IS_ERR(wdt_base))
>>> -		return PTR_ERR(wdt_base);
>>> +	davinci_wdt->base = devm_ioremap_resource(dev, wdt_mem);
>>> +	if (IS_ERR(davinci_wdt->base))
>>> +		return PTR_ERR(davinci_wdt->base);
>> You should free up davinci_wdt memory before returning, right ?
>>
> No, devm should take care of that.
> 
You are right. I didn't pay attention about the devm_*() usage.

Regards,
Santosh

WARNING: multiple messages have this Message-ID (diff)
From: santosh.shilimkar@ti.com (Santosh Shilimkar)
To: linux-arm-kernel@lists.infradead.org
Subject: Fwd: [PATCH 2/8] watchdog: davinci: use davinci_wdt_device structure to hold device data
Date: Tue, 12 Nov 2013 11:28:54 -0500	[thread overview]
Message-ID: <52825746.4090702@ti.com> (raw)
In-Reply-To: <20131112162731.GA5449@roeck-us.net>

On Tuesday 12 November 2013 11:27 AM, Guenter Roeck wrote:
> On Tue, Nov 12, 2013 at 10:37:04AM -0500, Santosh Shilimkar wrote:
>> On Wednesday 06 November 2013 06:31 AM, ivan.khoronzhuk wrote:
>>> Some SoCs, like Keystone 2, can support more than one WDT and each
>>> watchdog device has to use it's own base address, clock source,
>>> wdd device, so add new davinci_wdt_device structure to hold device
>> In commit avoid struct names ;)
>> s/wdd/watchdog device
>>> data.
>>>
>>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>>> ---
>>>  drivers/watchdog/davinci_wdt.c |   74 ++++++++++++++++++++++++++--------------
>>>  1 file changed, 48 insertions(+), 26 deletions(-)
>>>
>>> diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
>>> index a6eef71..1fc2093 100644
>>> --- a/drivers/watchdog/davinci_wdt.c
>>> +++ b/drivers/watchdog/davinci_wdt.c
>>
>> [...]
>>
>>> @@ -123,14 +135,21 @@ static int davinci_wdt_probe(struct platform_device *pdev)
>>>  	struct device *dev = &pdev->dev;
>>>  	struct resource  *wdt_mem;
>>>  	struct watchdog_device *wdd;
>>> +	struct davinci_wdt_device *davinci_wdt;
>>> +
>>> +	davinci_wdt = devm_kzalloc(dev, sizeof(*davinci_wdt), GFP_KERNEL);
>>> +	if (!davinci_wdt)
>>> +		return -ENOMEM;
>>>  
>>> -	wdt_clk = devm_clk_get(dev, NULL);
>>> -	if (WARN_ON(IS_ERR(wdt_clk)))
>>> -		return PTR_ERR(wdt_clk);
>>> +	davinci_wdt->clk = devm_clk_get(dev, NULL);
>>> +	if (WARN_ON(IS_ERR(davinci_wdt->clk)))
>>> +		return PTR_ERR(davinci_wdt->clk);
>>>  
>>> -	clk_prepare_enable(wdt_clk);
>>> +	clk_prepare_enable(davinci_wdt->clk);
>>>  
>>> -	wdd			= &wdt_wdd;
>>> +	platform_set_drvdata(pdev, davinci_wdt);
>>> +
>>> +	wdd			= &davinci_wdt->wdd;
>>>  	wdd->info		= &davinci_wdt_info;
>>>  	wdd->ops		= &davinci_wdt_ops;
>>>  	wdd->min_timeout 	= 1;
>>> @@ -142,12 +161,13 @@ static int davinci_wdt_probe(struct platform_device *pdev)
>>>  
>>>  	dev_info(dev, "heartbeat %d sec\n", wdd->timeout);
>>>  
>>> +	watchdog_set_drvdata(wdd, davinci_wdt);
>>>  	watchdog_set_nowayout(wdd, WATCHDOG_NOWAYOUT);
>>>  
>>>  	wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> -	wdt_base = devm_ioremap_resource(dev, wdt_mem);
>>> -	if (IS_ERR(wdt_base))
>>> -		return PTR_ERR(wdt_base);
>>> +	davinci_wdt->base = devm_ioremap_resource(dev, wdt_mem);
>>> +	if (IS_ERR(davinci_wdt->base))
>>> +		return PTR_ERR(davinci_wdt->base);
>> You should free up davinci_wdt memory before returning, right ?
>>
> No, devm should take care of that.
> 
You are right. I didn't pay attention about the devm_*() usage.

Regards,
Santosh

WARNING: multiple messages have this Message-ID (diff)
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
	linux-watchdog@vger.kernel.org, pawel.moll@arm.com,
	swarren@wwwdotorg.org, ijc+devicetree@hellion.org.uk,
	nsekhar@ti.com, galak@kernel.crashing.org,
	rob.herring@calxeda.com, linux-kernel@vger.kernel.org,
	wim@iguana.be, grant.likely@linaro.org,
	"ivan.khoronzhuk" <ivan.khoronzhuk@ti.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: Fwd: [PATCH 2/8] watchdog: davinci: use davinci_wdt_device structure to hold device data
Date: Tue, 12 Nov 2013 11:28:54 -0500	[thread overview]
Message-ID: <52825746.4090702@ti.com> (raw)
In-Reply-To: <20131112162731.GA5449@roeck-us.net>

On Tuesday 12 November 2013 11:27 AM, Guenter Roeck wrote:
> On Tue, Nov 12, 2013 at 10:37:04AM -0500, Santosh Shilimkar wrote:
>> On Wednesday 06 November 2013 06:31 AM, ivan.khoronzhuk wrote:
>>> Some SoCs, like Keystone 2, can support more than one WDT and each
>>> watchdog device has to use it's own base address, clock source,
>>> wdd device, so add new davinci_wdt_device structure to hold device
>> In commit avoid struct names ;)
>> s/wdd/watchdog device
>>> data.
>>>
>>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>>> ---
>>>  drivers/watchdog/davinci_wdt.c |   74 ++++++++++++++++++++++++++--------------
>>>  1 file changed, 48 insertions(+), 26 deletions(-)
>>>
>>> diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
>>> index a6eef71..1fc2093 100644
>>> --- a/drivers/watchdog/davinci_wdt.c
>>> +++ b/drivers/watchdog/davinci_wdt.c
>>
>> [...]
>>
>>> @@ -123,14 +135,21 @@ static int davinci_wdt_probe(struct platform_device *pdev)
>>>  	struct device *dev = &pdev->dev;
>>>  	struct resource  *wdt_mem;
>>>  	struct watchdog_device *wdd;
>>> +	struct davinci_wdt_device *davinci_wdt;
>>> +
>>> +	davinci_wdt = devm_kzalloc(dev, sizeof(*davinci_wdt), GFP_KERNEL);
>>> +	if (!davinci_wdt)
>>> +		return -ENOMEM;
>>>  
>>> -	wdt_clk = devm_clk_get(dev, NULL);
>>> -	if (WARN_ON(IS_ERR(wdt_clk)))
>>> -		return PTR_ERR(wdt_clk);
>>> +	davinci_wdt->clk = devm_clk_get(dev, NULL);
>>> +	if (WARN_ON(IS_ERR(davinci_wdt->clk)))
>>> +		return PTR_ERR(davinci_wdt->clk);
>>>  
>>> -	clk_prepare_enable(wdt_clk);
>>> +	clk_prepare_enable(davinci_wdt->clk);
>>>  
>>> -	wdd			= &wdt_wdd;
>>> +	platform_set_drvdata(pdev, davinci_wdt);
>>> +
>>> +	wdd			= &davinci_wdt->wdd;
>>>  	wdd->info		= &davinci_wdt_info;
>>>  	wdd->ops		= &davinci_wdt_ops;
>>>  	wdd->min_timeout 	= 1;
>>> @@ -142,12 +161,13 @@ static int davinci_wdt_probe(struct platform_device *pdev)
>>>  
>>>  	dev_info(dev, "heartbeat %d sec\n", wdd->timeout);
>>>  
>>> +	watchdog_set_drvdata(wdd, davinci_wdt);
>>>  	watchdog_set_nowayout(wdd, WATCHDOG_NOWAYOUT);
>>>  
>>>  	wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> -	wdt_base = devm_ioremap_resource(dev, wdt_mem);
>>> -	if (IS_ERR(wdt_base))
>>> -		return PTR_ERR(wdt_base);
>>> +	davinci_wdt->base = devm_ioremap_resource(dev, wdt_mem);
>>> +	if (IS_ERR(davinci_wdt->base))
>>> +		return PTR_ERR(davinci_wdt->base);
>> You should free up davinci_wdt memory before returning, right ?
>>
> No, devm should take care of that.
> 
You are right. I didn't pay attention about the devm_*() usage.

Regards,
Santosh

  reply	other threads:[~2013-11-12 16:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1383680783-12114-3-git-send-email-ivan.khoronzhuk@ti.com>
2013-11-06 11:31 ` Fwd: [PATCH 2/8] watchdog: davinci: use davinci_wdt_device structure to hold device data ivan.khoronzhuk
2013-11-06 11:31   ` ivan.khoronzhuk
2013-11-06 11:31   ` ivan.khoronzhuk
2013-11-12 15:37   ` Santosh Shilimkar
2013-11-12 15:37     ` Santosh Shilimkar
2013-11-12 15:37     ` Santosh Shilimkar
2013-11-12 16:27     ` Guenter Roeck
2013-11-12 16:27       ` Guenter Roeck
2013-11-12 16:28       ` Santosh Shilimkar [this message]
2013-11-12 16:28         ` Santosh Shilimkar
2013-11-12 16:28         ` Santosh Shilimkar
2013-11-17  2:19   ` Guenter Roeck
2013-11-17  2:19     ` Guenter Roeck
2013-11-17  2:19     ` Guenter Roeck

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=52825746.4090702@ti.com \
    --to=santosh.shilimkar@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@kernel.crashing.org \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=ivan.khoronzhuk@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mark.rutland@arm.com \
    --cc=nsekhar@ti.com \
    --cc=pawel.moll@arm.com \
    --cc=rob.herring@calxeda.com \
    --cc=swarren@wwwdotorg.org \
    --cc=wim@iguana.be \
    /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.