linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wanlong Gao <wanlong.gao@gmail.com>
To: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: sameo@linux.intel.com, haojian.zhuang@gmail.com,
	linux-kernel@vger.kernel.org,
	Alessandro Zummo <a.zummo@towertech.it>
Subject: Re: [PATCH 10/13] rtc: avoid to use hardcoding irq number in max8925
Date: Fri, 15 Apr 2011 08:41:31 +0800	[thread overview]
Message-ID: <BANLkTimnW2qihVvux--pG7q+FYXKYuzVCw@mail.gmail.com> (raw)
In-Reply-To: <1302706264-25815-11-git-send-email-haojian.zhuang@marvell.com>

On 4/13/11, Haojian Zhuang <haojian.zhuang@marvell.com> wrote:
> Avoid to use hardcoding irq number in max8925 rtc driver. Use irq number
> from resources instead.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by:Wanlong Gao<wanlong.gao@gmail.com>
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> ---
>  drivers/rtc/rtc-max8925.c |   22 +++++++++++++---------
>  1 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c
> index 174036d..c460152 100644
> --- a/drivers/rtc/rtc-max8925.c
> +++ b/drivers/rtc/rtc-max8925.c
> @@ -69,6 +69,7 @@ struct max8925_rtc_info {
>  	struct max8925_chip	*chip;
>  	struct i2c_client	*rtc;
>  	struct device		*dev;
> +	int			irq;
>  };
>
>  static irqreturn_t rtc_update_handler(int irq, void *data)
> @@ -239,7 +240,7 @@ static int __devinit max8925_rtc_probe(struct
> platform_device *pdev)
>  {
>  	struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
>  	struct max8925_rtc_info *info;
> -	int irq, ret;
> +	int ret = -EINVAL;
>
>  	info = kzalloc(sizeof(struct max8925_rtc_info), GFP_KERNEL);
>  	if (!info)
> @@ -247,16 +248,22 @@ static int __devinit max8925_rtc_probe(struct
> platform_device *pdev)
>  	info->chip = chip;
>  	info->rtc = chip->rtc;
>  	info->dev = &pdev->dev;
> -	irq = chip->irq_base + MAX8925_IRQ_RTC_ALARM0;
> +	info->irq = platform_get_irq(pdev, 0);
> +	if (info->irq < 0) {
> +		dev_err(chip->dev, "Failed to get IRQ resource\n");
> +		goto out_irq;
> +	}
>
> -	ret = request_threaded_irq(irq, NULL, rtc_update_handler,
> +	ret = request_threaded_irq(info->irq, NULL, rtc_update_handler,
>  				   IRQF_ONESHOT, "rtc-alarm0", info);
>  	if (ret < 0) {
>  		dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n",
> -			irq, ret);
> +			info->irq, ret);
>  		goto out_irq;
>  	}
>
> +	dev_set_drvdata(&pdev->dev, info);
> +	platform_set_drvdata(pdev, info);
>  	info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev,
>  					&max8925_rtc_ops, THIS_MODULE);
>  	ret = PTR_ERR(info->rtc_dev);
> @@ -265,12 +272,9 @@ static int __devinit max8925_rtc_probe(struct
> platform_device *pdev)
>  		goto out_rtc;
>  	}
>
> -	dev_set_drvdata(&pdev->dev, info);
> -	platform_set_drvdata(pdev, info);
> -
>  	return 0;
>  out_rtc:
> -	free_irq(chip->irq_base + MAX8925_IRQ_RTC_ALARM0, info);
> +	free_irq(info->irq, info);
>  out_irq:
>  	kfree(info);
>  	return ret;
> @@ -281,7 +285,7 @@ static int __devexit max8925_rtc_remove(struct
> platform_device *pdev)
>  	struct max8925_rtc_info *info = platform_get_drvdata(pdev);
>
>  	if (info) {
> -		free_irq(info->chip->irq_base + MAX8925_IRQ_RTC_ALARM0, info);
> +		free_irq(info->irq, info);
>  		rtc_device_unregister(info->rtc_dev);
>  		kfree(info);
>  	}
Added the irq to the info , Hmm.........,seems like all good to me .
Thanks
Best regards
> --
> 1.5.6.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

  parent reply	other threads:[~2011-04-15  0:41 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2011041301>
2011-04-13 14:50 ` 1. Replace mfd_data with platform_data for 88pm860x since mfd tree is upgraded Haojian Zhuang
2011-04-13 14:50   ` [PATCH 01/13] input: touchscreen: use polling mode in 88pm860x Haojian Zhuang
2011-04-13 14:50     ` [PATCH 02/13] input: touchscreen: move initialization " Haojian Zhuang
2011-04-13 14:50       ` [PATCH 03/13] rtc: add 88pm860x rtc Haojian Zhuang
2011-04-13 14:50         ` [PATCH 04/13] input: set the long press detection in 88pm860x onkey Haojian Zhuang
2011-04-13 14:50           ` [PATCH 05/13] w1: add DS278x slave driver Haojian Zhuang
2011-04-13 14:50             ` [PATCH 06/13] mfd: pxa-w1: MFD driver for PXA 1wire control + DS1WM chip Haojian Zhuang
2011-04-13 14:50               ` [PATCH 07/13] mfd: fix build warning on 88pm860x Haojian Zhuang
2011-04-13 14:50                 ` [PATCH 08/13] mfd: use platform_data in max8925 Haojian Zhuang
2011-04-13 14:51                   ` [PATCH 09/13] input: get irq from resource in max8925 onkey Haojian Zhuang
2011-04-13 14:51                     ` [PATCH 10/13] rtc: avoid to use hardcoding irq number in max8925 Haojian Zhuang
2011-04-13 14:51                       ` [PATCH 11/13] power_supply: max8925: use platform_data from cell Haojian Zhuang
2011-04-13 14:51                         ` [PATCH 12/13] regulator: check name in initialization of max8925 Haojian Zhuang
2011-04-13 14:51                           ` [PATCH 13/13] regulator: max8925: enable i2c sequence for control Haojian Zhuang
2011-04-16 18:02                             ` Mark Brown
2011-04-16 18:01                           ` [PATCH 12/13] regulator: check name in initialization of max8925 Mark Brown
2011-04-18 13:49                             ` Haojian Zhuang
2011-04-13 15:03                         ` [PATCH 11/13] power_supply: max8925: use platform_data from cell Anton Vorontsov
2011-04-14  2:26                           ` Haojian Zhuang
2011-04-14  2:16                         ` Haojian Zhuang
2011-04-15  0:41                       ` Wanlong Gao [this message]
2011-04-15  0:35                   ` [PATCH 08/13] mfd: use platform_data in max8925 Wanlong Gao
2011-04-14 14:17               ` [PATCH 06/13] mfd: pxa-w1: MFD driver for PXA 1wire control + DS1WM chip Wanlong Gao
2011-04-14 14:21                 ` Haojian Zhuang
2011-04-14 14:29                   ` Wanlong Gao
2011-04-14 14:02     ` [PATCH 01/13] input: touchscreen: use polling mode in 88pm860x Wanlong Gao
2011-04-14 14:41       ` Haojian Zhuang
2011-04-14 14:52         ` Wanlong Gao
2011-04-16 12:46   ` Haojian Zhuang
2011-04-16 13:17     ` Wanlong Gao
2011-04-16 14:17     ` Valdis.Kletnieks
2011-04-18 13:12       ` Haojian Zhuang

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=BANLkTimnW2qihVvux--pG7q+FYXKYuzVCw@mail.gmail.com \
    --to=wanlong.gao@gmail.com \
    --cc=a.zummo@towertech.it \
    --cc=haojian.zhuang@gmail.com \
    --cc=haojian.zhuang@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.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;
as well as URLs for NNTP newsgroup(s).