public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sekhar Nori <nsekhar@ti.com>
To: Hannu Heikkinen <hannuxx@iki.fi>
Cc: <linux-kernel@vger.kernel.org>, <rtc-linux@googlegroups.com>,
	<a.zummo@towertech.it>,
	<davinci-linux-open-source@linux.davincidsp.com>
Subject: Re: [PATCH] rtc: davinci: clean up probe/remove routines
Date: Sun, 14 Oct 2012 14:54:26 +0530	[thread overview]
Message-ID: <507A84CA.3080406@ti.com> (raw)
In-Reply-To: <1350166417-23434-1-git-send-email-hannuxx@iki.fi>

On 10/14/2012 3:43 AM, Hannu Heikkinen wrote:
> Use the devres managed resource functions in the probe routine.
> Also affects the remove routine where the previously used free and
> release functions are not needed.
> 
> The devm_* functions eliminate the need for manual resource releasing and
> simplify error handling.  Resources allocated by devm_* are freed
> automatically on driver detach.
> 
> Signed-off-by: Hannu Heikkinen <hannuxx@iki.fi>
> ---
>  drivers/rtc/rtc-davinci.c | 56 +++++++++++++----------------------------------
>  1 file changed, 15 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c
> index 14c2109..ffb09c2 100644
> --- a/drivers/rtc/rtc-davinci.c
> +++ b/drivers/rtc/rtc-davinci.c
> @@ -119,8 +119,6 @@ static DEFINE_SPINLOCK(davinci_rtc_lock);
>  struct davinci_rtc {
>  	struct rtc_device 		*rtc;
>  	void __iomem			*base;
> -	resource_size_t			pbase;
> -	size_t				base_size;
>  	int				irq;
>  };
>  
> @@ -482,22 +480,16 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct davinci_rtc *davinci_rtc;
> -	struct resource *res, *mem;
> +	struct resource *res;
>  	int ret = 0;
>  
> -	davinci_rtc = kzalloc(sizeof(struct davinci_rtc), GFP_KERNEL);
> +	davinci_rtc = devm_kzalloc(&pdev->dev, sizeof(struct tegra_rtc_info),

This line causes a build breakage because of wrong structure name.


> +		GFP_KERNEL);
>  	if (!davinci_rtc) {
>  		dev_dbg(dev, "could not allocate memory for private data\n");
>  		return -ENOMEM;
>  	}
>  
> -	davinci_rtc->irq = platform_get_irq(pdev, 0);
> -	if (davinci_rtc->irq < 0) {
> -		dev_err(dev, "no RTC irq\n");
> -		ret = davinci_rtc->irq;
> -		goto fail1;
> -	}
> -
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!res) {
>  		dev_err(dev, "no mem resource\n");
> @@ -505,23 +497,16 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
>  		goto fail1;

This goto target does not exist anymore after this patch. This causes
build breakage too.

I was not able to test this on a DM365 EVM though. hwclock returned with
this error:

select() to /dev/rtc to wait for clock tick timed out

but this is not related to this patch since the same error occurs even
without this patch. May something to do with the particular board I
used, need to debug and check.

Thanks,
Sekhar

      reply	other threads:[~2012-10-14  9:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-13 22:13 [PATCH] rtc: davinci: clean up probe/remove routines Hannu Heikkinen
2012-10-14  9:24 ` Sekhar Nori [this message]

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=507A84CA.3080406@ti.com \
    --to=nsekhar@ti.com \
    --cc=a.zummo@towertech.it \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=hannuxx@iki.fi \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox