Re: [PATCH 2/2] RTC MXC: Make alarm working

From: Andrew Morton
Date: Mon Nov 28 2011 - 17:56:18 EST


On Sun, 6 Nov 2011 19:46:46 +0300
Yauhen Kharuzhy <jekhor@xxxxxxxxx> wrote:

> Fix alarm IRQ handling, make the alarm one-shot. Cleanup black magick with
> a validation of already validated time data.
>
> Add ability to wake the system with alarm.
>
> ...
>
> +#ifdef CONFIG_PM
> +static int mxc_rtc_suspend(struct device *dev)
> +{
> + struct rtc_plat_data *pdata = dev_get_drvdata(dev);
> +
> + if (device_may_wakeup(dev))
> + enable_irq_wake(pdata->irq);
> +
> + return 0;
> +}
> +
> +static int mxc_rtc_resume(struct device *dev)
> +{
> + struct rtc_plat_data *pdata = dev_get_drvdata(dev);
> +
> + if (device_may_wakeup(dev))
> + disable_irq_wake(pdata->irq);
> +
> + return 0;
> +}
> +#endif
> +
> +static struct dev_pm_ops mxc_rtc_pm_ops = {
> + .suspend = mxc_rtc_suspend,
> + .resume = mxc_rtc_resume,
> +};
> +
> static struct platform_driver mxc_rtc_driver = {
> .driver = {
> .name = "mxc_rtc",
> +#ifdef CONFIG_PM
> + .pm = &mxc_rtc_pm_ops,
> +#endif
> .owner = THIS_MODULE,
> },
> .remove = __exit_p(mxc_rtc_remove),

This won't compile with CONFIG_PM=n. Fix:

--- a/drivers/rtc/rtc-mxc.c~drivers-rtc-rtc-mxcc-make-alarm-work-fix
+++ a/drivers/rtc/rtc-mxc.c
@@ -466,12 +466,12 @@ static int mxc_rtc_resume(struct device

return 0;
}
-#endif

static struct dev_pm_ops mxc_rtc_pm_ops = {
.suspend = mxc_rtc_suspend,
.resume = mxc_rtc_resume,
};
+#endif

static struct platform_driver mxc_rtc_driver = {
.driver = {
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/