mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: Alexander Shiyan <shc_work@mail.ru>
Cc: rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org,
	Alessandro Zummo <a.zummo@towertech.it>
Subject: Re: [PATCH 1/3] rtc: ds1742: Using devm_ioremap_resource()
Date: Sat, 20 Jul 2013 18:02:56 +0400	[thread overview]
Message-ID: <20130720180256.898a6a35d8865aaf2403fba1@mail.ru> (raw)
In-Reply-To: <1372783802-6569-1-git-send-email-shc_work@mail.ru>

On Tue,  2 Jul 2013 20:50:00 +0400
Alexander Shiyan <shc_work@mail.ru> wrote:

> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/rtc/rtc-ds1742.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c
> index eccdc62..9fba0ae 100644
> --- a/drivers/rtc/rtc-ds1742.c
> +++ b/drivers/rtc/rtc-ds1742.c
> @@ -56,7 +56,6 @@ struct rtc_plat_data {
>  	void __iomem *ioaddr_nvram;
>  	void __iomem *ioaddr_rtc;
>  	size_t size_nvram;
> -	size_t size;
>  	unsigned long last_jiffies;
>  	struct bin_attribute nvram_attr;
>  };
> @@ -168,22 +167,17 @@ static int ds1742_rtc_probe(struct platform_device *pdev)
>  	void __iomem *ioaddr;
>  	int ret = 0;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res)
> -		return -ENODEV;
>  	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
>  	if (!pdata)
>  		return -ENOMEM;
> -	pdata->size = resource_size(res);
> -	if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size,
> -		pdev->name))
> -		return -EBUSY;
> -	ioaddr = devm_ioremap(&pdev->dev, res->start, pdata->size);
> -	if (!ioaddr)
> -		return -ENOMEM;
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	ioaddr = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(ioaddr))
> +		return PTR_ERR(ioaddr);
>  
>  	pdata->ioaddr_nvram = ioaddr;
> -	pdata->size_nvram = pdata->size - RTC_SIZE;
> +	pdata->size_nvram = resource_size(res) - RTC_SIZE;
>  	pdata->ioaddr_rtc = ioaddr + pdata->size_nvram;
>  
>  	sysfs_bin_attr_init(&pdata->nvram_attr);
> -- 

Ping

-- 
Alexander Shiyan <shc_work@mail.ru>

      parent reply	other threads:[~2013-07-20 14:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02 16:50 Alexander Shiyan
2013-07-02 16:50 ` [PATCH 2/3] rtc: ds1742: Remove unused field "rtc" from private structure Alexander Shiyan
2013-07-02 16:50 ` [PATCH 3/3] rtc: ds1742: Report to RTC core if retrieved time is invalid Alexander Shiyan
2013-07-20 14:02 ` Alexander Shiyan [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=20130720180256.898a6a35d8865aaf2403fba1@mail.ru \
    --to=shc_work@mail.ru \
    --cc=a.zummo@towertech.it \
    --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

all inboxes | Powered by JetHome®