lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 15 Apr 2011 08:41:31 +0800
From:	Wanlong Gao <wanlong.gao@...il.com>
To:	Haojian Zhuang <haojian.zhuang@...vell.com>
Cc:	sameo@...ux.intel.com, haojian.zhuang@...il.com,
	linux-kernel@...r.kernel.org,
	Alessandro Zummo <a.zummo@...ertech.it>
Subject: Re: [PATCH 10/13] rtc: avoid to use hardcoding irq number in max8925

On 4/13/11, Haojian Zhuang <haojian.zhuang@...vell.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@...vell.com>
Acked-by:Wanlong Gao<wanlong.gao@...il.com>
> Cc: Alessandro Zummo <a.zummo@...ertech.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@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ