diff options
Diffstat (limited to 'drivers/rtc')
| -rw-r--r-- | drivers/rtc/Kconfig | 42 | ||||
| -rw-r--r-- | drivers/rtc/Makefile | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-cmos.c | 9 | ||||
| -rw-r--r-- | drivers/rtc/rtc-ds1307.c | 20 | ||||
| -rw-r--r-- | drivers/rtc/rtc-ep93xx.c | 24 | ||||
| -rw-r--r-- | drivers/rtc/rtc-imxdi.c | 6 | ||||
| -rw-r--r-- | drivers/rtc/rtc-lpc32xx.c | 12 | ||||
| -rw-r--r-- | drivers/rtc/rtc-m41t93.c | 46 | ||||
| -rw-r--r-- | drivers/rtc/rtc-pcf8563.c | 44 | ||||
| -rw-r--r-- | drivers/rtc/rtc-pl031.c | 14 | ||||
| -rw-r--r-- | drivers/rtc/rtc-s3c.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-spear.c | 10 | ||||
| -rw-r--r-- | drivers/rtc/rtc-tegra.c | 50 | ||||
| -rw-r--r-- | drivers/rtc/rtc-wm831x.c | 2 | 
14 files changed, 162 insertions, 121 deletions
| diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 4161bfe462c..08cbdb900a1 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -620,27 +620,6 @@ config RTC_DRV_MSM6242  	  This driver can also be built as a module. If so, the module  	  will be called rtc-msm6242. -config RTC_DRV_IMXDI -	tristate "Freescale IMX DryIce Real Time Clock" -	depends on ARCH_MX25 -	depends on RTC_CLASS -	help -	   Support for Freescale IMX DryIce RTC - -	   This driver can also be built as a module, if so, the module -	   will be called "rtc-imxdi". - -config RTC_MXC -	tristate "Freescale MXC Real Time Clock" -	depends on ARCH_MXC -	depends on RTC_CLASS -	help -	   If you say yes here you get support for the Freescale MXC -	   RTC module. - -	   This driver can also be built as a module, if so, the module -	   will be called "rtc-mxc". -  config RTC_DRV_BQ4802  	tristate "TI BQ4802"  	help @@ -738,6 +717,16 @@ config RTC_DRV_DAVINCI  	  This driver can also be built as a module. If so, the module  	  will be called rtc-davinci. +config RTC_DRV_IMXDI +	tristate "Freescale IMX DryIce Real Time Clock" +	depends on SOC_IMX25 +	depends on RTC_CLASS +	help +	   Support for Freescale IMX DryIce RTC + +	   This driver can also be built as a module, if so, the module +	   will be called "rtc-imxdi". +  config RTC_DRV_OMAP  	tristate "TI OMAP1"  	depends on ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 || ARCH_DAVINCI_DA8XX @@ -1087,4 +1076,15 @@ config RTC_DRV_LOONGSON1  	  This driver can also be built as a module. If so, the module  	  will be called rtc-ls1x. +config RTC_DRV_MXC +	tristate "Freescale MXC Real Time Clock" +	depends on ARCH_MXC +	depends on RTC_CLASS +	help +	   If you say yes here you get support for the Freescale MXC +	   RTC module. + +	   This driver can also be built as a module, if so, the module +	   will be called "rtc-mxc". +  endif # RTC_CLASS diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 727ae7786e6..2973921c30d 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -61,7 +61,7 @@ obj-$(CONFIG_RTC_DRV_M41T94)	+= rtc-m41t94.o  obj-$(CONFIG_RTC_DRV_M48T35)	+= rtc-m48t35.o  obj-$(CONFIG_RTC_DRV_M48T59)	+= rtc-m48t59.o  obj-$(CONFIG_RTC_DRV_M48T86)	+= rtc-m48t86.o -obj-$(CONFIG_RTC_MXC)		+= rtc-mxc.o +obj-$(CONFIG_RTC_DRV_MXC)	+= rtc-mxc.o  obj-$(CONFIG_RTC_DRV_MAX6900)	+= rtc-max6900.o  obj-$(CONFIG_RTC_DRV_MAX8925)	+= rtc-max8925.o  obj-$(CONFIG_RTC_DRV_MAX8998)	+= rtc-max8998.o diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 7d5f56edb8e..4267789ca99 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -910,14 +910,17 @@ static inline int cmos_poweroff(struct device *dev)  static u32 rtc_handler(void *context)  { +	struct device *dev = context; + +	pm_wakeup_event(dev, 0);  	acpi_clear_event(ACPI_EVENT_RTC);  	acpi_disable_event(ACPI_EVENT_RTC, 0);  	return ACPI_INTERRUPT_HANDLED;  } -static inline void rtc_wake_setup(void) +static inline void rtc_wake_setup(struct device *dev)  { -	acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); +	acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, dev);  	/*  	 * After the RTC handler is installed, the Fixed_RTC event should  	 * be disabled. Only when the RTC alarm is set will it be enabled. @@ -950,7 +953,7 @@ cmos_wake_setup(struct device *dev)  	if (acpi_disabled)  		return; -	rtc_wake_setup(); +	rtc_wake_setup(dev);  	acpi_rtc_info.wake_on = rtc_wake_on;  	acpi_rtc_info.wake_off = rtc_wake_off; diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index c293d0cdb10..836710ce750 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -17,8 +17,7 @@  #include <linux/string.h>  #include <linux/rtc.h>  #include <linux/bcd.h> - - +#include <linux/rtc/ds1307.h>  /*   * We can't determine type by probing, but if we expect pre-Linux code @@ -92,7 +91,8 @@ enum ds_type {  #	define DS1337_BIT_A2I		0x02  #	define DS1337_BIT_A1I		0x01  #define DS1339_REG_ALARM1_SECS	0x07 -#define DS1339_REG_TRICKLE	0x10 + +#define DS13XX_TRICKLE_CHARGER_MAGIC	0xa0  #define RX8025_REG_CTRL1	0x0e  #	define RX8025_BIT_2412		0x20 @@ -124,6 +124,7 @@ struct chip_desc {  	unsigned		alarm:1;  	u16			nvram_offset;  	u16			nvram_size; +	u16			trickle_charger_reg;  };  static const struct chip_desc chips[last_ds_type] = { @@ -140,6 +141,13 @@ static const struct chip_desc chips[last_ds_type] = {  	},  	[ds_1339] = {  		.alarm		= 1, +		.trickle_charger_reg = 0x10, +	}, +	[ds_1340] = { +		.trickle_charger_reg = 0x08, +	}, +	[ds_1388] = { +		.trickle_charger_reg = 0x0a,  	},  	[ds_3231] = {  		.alarm		= 1, @@ -619,6 +627,7 @@ static int __devinit ds1307_probe(struct i2c_client *client,  	struct i2c_adapter	*adapter = to_i2c_adapter(client->dev.parent);  	int			want_irq = false;  	unsigned char		*buf; +	struct ds1307_platform_data *pdata = client->dev.platform_data;  	static const int	bbsqi_bitpos[] = {  		[ds_1337] = 0,  		[ds_1339] = DS1339_BIT_BBSQI, @@ -637,7 +646,10 @@ static int __devinit ds1307_probe(struct i2c_client *client,  	ds1307->client	= client;  	ds1307->type	= id->driver_data; -	ds1307->offset	= 0; + +	if (pdata && pdata->trickle_charger_setup && chip->trickle_charger_reg) +		i2c_smbus_write_byte_data(client, chip->trickle_charger_reg, +			DS13XX_TRICKLE_CHARGER_MAGIC | pdata->trickle_charger_setup);  	buf = ds1307->regs;  	if (i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c index 14a42a1edc6..9602278ff98 100644 --- a/drivers/rtc/rtc-ep93xx.c +++ b/drivers/rtc/rtc-ep93xx.c @@ -127,7 +127,7 @@ static const struct attribute_group ep93xx_rtc_sysfs_files = {  	.attrs	= ep93xx_rtc_attrs,  }; -static int __init ep93xx_rtc_probe(struct platform_device *pdev) +static int __devinit ep93xx_rtc_probe(struct platform_device *pdev)  {  	struct ep93xx_rtc *ep93xx_rtc;  	struct resource *res; @@ -174,7 +174,7 @@ exit:  	return err;  } -static int __exit ep93xx_rtc_remove(struct platform_device *pdev) +static int __devexit ep93xx_rtc_remove(struct platform_device *pdev)  {  	struct ep93xx_rtc *ep93xx_rtc = platform_get_drvdata(pdev); @@ -186,31 +186,19 @@ static int __exit ep93xx_rtc_remove(struct platform_device *pdev)  	return 0;  } -/* work with hotplug and coldplug */ -MODULE_ALIAS("platform:ep93xx-rtc"); -  static struct platform_driver ep93xx_rtc_driver = {  	.driver		= {  		.name	= "ep93xx-rtc",  		.owner	= THIS_MODULE,  	}, -	.remove		= __exit_p(ep93xx_rtc_remove), +	.probe		= ep93xx_rtc_probe, +	.remove		= __devexit_p(ep93xx_rtc_remove),  }; -static int __init ep93xx_rtc_init(void) -{ -        return platform_driver_probe(&ep93xx_rtc_driver, ep93xx_rtc_probe); -} - -static void __exit ep93xx_rtc_exit(void) -{ -	platform_driver_unregister(&ep93xx_rtc_driver); -} +module_platform_driver(ep93xx_rtc_driver);  MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");  MODULE_DESCRIPTION("EP93XX RTC driver");  MODULE_LICENSE("GPL");  MODULE_VERSION(DRV_VERSION); - -module_init(ep93xx_rtc_init); -module_exit(ep93xx_rtc_exit); +MODULE_ALIAS("platform:ep93xx-rtc"); diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c index d93a9608b1f..891cd6c61d0 100644 --- a/drivers/rtc/rtc-imxdi.c +++ b/drivers/rtc/rtc-imxdi.c @@ -405,7 +405,7 @@ static int dryice_rtc_probe(struct platform_device *pdev)  	imxdi->clk = clk_get(&pdev->dev, NULL);  	if (IS_ERR(imxdi->clk))  		return PTR_ERR(imxdi->clk); -	clk_enable(imxdi->clk); +	clk_prepare_enable(imxdi->clk);  	/*  	 * Initialize dryice hardware @@ -470,7 +470,7 @@ static int dryice_rtc_probe(struct platform_device *pdev)  	return 0;  err: -	clk_disable(imxdi->clk); +	clk_disable_unprepare(imxdi->clk);  	clk_put(imxdi->clk);  	return rc; @@ -487,7 +487,7 @@ static int __devexit dryice_rtc_remove(struct platform_device *pdev)  	rtc_device_unregister(imxdi->rtc); -	clk_disable(imxdi->clk); +	clk_disable_unprepare(imxdi->clk);  	clk_put(imxdi->clk);  	return 0; diff --git a/drivers/rtc/rtc-lpc32xx.c b/drivers/rtc/rtc-lpc32xx.c index 63c72189c64..d5218553741 100644 --- a/drivers/rtc/rtc-lpc32xx.c +++ b/drivers/rtc/rtc-lpc32xx.c @@ -19,6 +19,7 @@  #include <linux/rtc.h>  #include <linux/slab.h>  #include <linux/io.h> +#include <linux/of.h>  /*   * Clock and Power control register offsets @@ -386,13 +387,22 @@ static const struct dev_pm_ops lpc32xx_rtc_pm_ops = {  #define LPC32XX_RTC_PM_OPS NULL  #endif +#ifdef CONFIG_OF +static const struct of_device_id lpc32xx_rtc_match[] = { +	{ .compatible = "nxp,lpc3220-rtc" }, +	{ } +}; +MODULE_DEVICE_TABLE(of, lpc32xx_rtc_match); +#endif +  static struct platform_driver lpc32xx_rtc_driver = {  	.probe		= lpc32xx_rtc_probe,  	.remove		= __devexit_p(lpc32xx_rtc_remove),  	.driver = {  		.name	= RTC_NAME,  		.owner	= THIS_MODULE, -		.pm	= LPC32XX_RTC_PM_OPS +		.pm	= LPC32XX_RTC_PM_OPS, +		.of_match_table = of_match_ptr(lpc32xx_rtc_match),  	},  }; diff --git a/drivers/rtc/rtc-m41t93.c b/drivers/rtc/rtc-m41t93.c index 10f1c29436e..efab3d48cb1 100644 --- a/drivers/rtc/rtc-m41t93.c +++ b/drivers/rtc/rtc-m41t93.c @@ -48,6 +48,7 @@ static inline int m41t93_set_reg(struct spi_device *spi, u8 addr, u8 data)  static int m41t93_set_time(struct device *dev, struct rtc_time *tm)  {  	struct spi_device *spi = to_spi_device(dev); +	int tmp;  	u8 buf[9] = {0x80};        /* write cmd + 8 data bytes */  	u8 * const data = &buf[1]; /* ptr to first data byte */ @@ -62,6 +63,30 @@ static int m41t93_set_time(struct device *dev, struct rtc_time *tm)  		return -EINVAL;  	} +	tmp = spi_w8r8(spi, M41T93_REG_FLAGS); +	if (tmp < 0) +		return tmp; + +	if (tmp & M41T93_FLAG_OF) { +		dev_warn(&spi->dev, "OF bit is set, resetting.\n"); +		m41t93_set_reg(spi, M41T93_REG_FLAGS, tmp & ~M41T93_FLAG_OF); + +		tmp = spi_w8r8(spi, M41T93_REG_FLAGS); +		if (tmp < 0) { +			return tmp; +		} else if (tmp & M41T93_FLAG_OF) { +			/* OF cannot be immediately reset: oscillator has to be +			 * restarted. */ +			u8 reset_osc = buf[M41T93_REG_ST_SEC] | M41T93_FLAG_ST; + +			dev_warn(&spi->dev, +				 "OF bit is still set, kickstarting clock.\n"); +			m41t93_set_reg(spi, M41T93_REG_ST_SEC, reset_osc); +			reset_osc &= ~M41T93_FLAG_ST; +			m41t93_set_reg(spi, M41T93_REG_ST_SEC, reset_osc); +		} +	} +  	data[M41T93_REG_SSEC]		= 0;  	data[M41T93_REG_ST_SEC]		= bin2bcd(tm->tm_sec);  	data[M41T93_REG_MIN]		= bin2bcd(tm->tm_min); @@ -89,10 +114,7 @@ static int m41t93_get_time(struct device *dev, struct rtc_time *tm)  	   1. halt bit (HT) is set: the clock is running but update of readout  	      registers has been disabled due to power failure. This is normal  	      case after poweron. Time is valid after resetting HT bit. -	   2. oscillator fail bit (OF) is set. Oscillator has be stopped and -	      time is invalid: -	      a) OF can be immeditely reset. -	      b) OF cannot be immediately reset: oscillator has to be restarted. +	   2. oscillator fail bit (OF) is set: time is invalid.  	*/  	tmp = spi_w8r8(spi, M41T93_REG_ALM_HOUR_HT);  	if (tmp < 0) @@ -110,21 +132,7 @@ static int m41t93_get_time(struct device *dev, struct rtc_time *tm)  	if (tmp & M41T93_FLAG_OF) {  		ret = -EINVAL; -		dev_warn(&spi->dev, "OF bit is set, resetting.\n"); -		m41t93_set_reg(spi, M41T93_REG_FLAGS, tmp & ~M41T93_FLAG_OF); - -		tmp = spi_w8r8(spi, M41T93_REG_FLAGS); -		if (tmp < 0) -			return tmp; -		else if (tmp & M41T93_FLAG_OF) { -			u8 reset_osc = buf[M41T93_REG_ST_SEC] | M41T93_FLAG_ST; - -			dev_warn(&spi->dev, -				 "OF bit is still set, kickstarting clock.\n"); -			m41t93_set_reg(spi, M41T93_REG_ST_SEC, reset_osc); -			reset_osc &= ~M41T93_FLAG_ST; -			m41t93_set_reg(spi, M41T93_REG_ST_SEC, reset_osc); -		} +		dev_warn(&spi->dev, "OF bit is set, write time to restart.\n");  	}  	if (tmp & M41T93_FLAG_BL) diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index bc0677de199..97a3284bb7c 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c @@ -64,6 +64,7 @@ struct pcf8563 {  	 * 1970...2069.  	 */  	int c_polarity;	/* 0: MO_C=1 means 19xx, otherwise MO_C=1 means 20xx */ +	int voltage_low; /* incicates if a low_voltage was detected */  };  /* @@ -86,9 +87,11 @@ static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm)  		return -EIO;  	} -	if (buf[PCF8563_REG_SC] & PCF8563_SC_LV) +	if (buf[PCF8563_REG_SC] & PCF8563_SC_LV) { +		pcf8563->voltage_low = 1;  		dev_info(&client->dev,  			"low voltage detected, date/time is not reliable.\n"); +	}  	dev_dbg(&client->dev,  		"%s: raw data is st1=%02x, st2=%02x, sec=%02x, min=%02x, hr=%02x, " @@ -173,6 +176,44 @@ static int pcf8563_set_datetime(struct i2c_client *client, struct rtc_time *tm)  	return 0;  } +#ifdef CONFIG_RTC_INTF_DEV +static int pcf8563_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) +{ +	struct pcf8563 *pcf8563 = i2c_get_clientdata(to_i2c_client(dev)); +	struct rtc_time tm; + +	switch (cmd) { +	case RTC_VL_READ: +		if (pcf8563->voltage_low) +			dev_info(dev, "low voltage detected, date/time is not reliable.\n"); + +		if (copy_to_user((void __user *)arg, &pcf8563->voltage_low, +					sizeof(int))) +			return -EFAULT; +		return 0; +	case RTC_VL_CLR: +		/* +		 * Clear the VL bit in the seconds register in case +		 * the time has not been set already (which would +		 * have cleared it). This does not really matter +		 * because of the cached voltage_low value but do it +		 * anyway for consistency. +		 */ +		if (pcf8563_get_datetime(to_i2c_client(dev), &tm)) +			pcf8563_set_datetime(to_i2c_client(dev), &tm); + +		/* Clear the cached value. */ +		pcf8563->voltage_low = 0; + +		return 0; +	default: +		return -ENOIOCTLCMD; +	} +} +#else +#define pcf8563_rtc_ioctl NULL +#endif +  static int pcf8563_rtc_read_time(struct device *dev, struct rtc_time *tm)  {  	return pcf8563_get_datetime(to_i2c_client(dev), tm); @@ -184,6 +225,7 @@ static int pcf8563_rtc_set_time(struct device *dev, struct rtc_time *tm)  }  static const struct rtc_class_ops pcf8563_rtc_ops = { +	.ioctl		= pcf8563_rtc_ioctl,  	.read_time	= pcf8563_rtc_read_time,  	.set_time	= pcf8563_rtc_set_time,  }; diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index f027c063fb2..cc0533994f6 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c @@ -220,17 +220,9 @@ static irqreturn_t pl031_interrupt(int irq, void *dev_id)  	unsigned long events = 0;  	rtcmis = readl(ldata->base + RTC_MIS); -	if (rtcmis) { -		writel(rtcmis, ldata->base + RTC_ICR); - -		if (rtcmis & RTC_BIT_AI) -			events |= (RTC_AF | RTC_IRQF); - -		/* Timer interrupt is only available in ST variants */ -		if ((rtcmis & RTC_BIT_PI) && -			(ldata->hw_designer == AMBA_VENDOR_ST)) -			events |= (RTC_PF | RTC_IRQF); - +	if (rtcmis & RTC_BIT_AI) { +		writel(RTC_BIT_AI, ldata->base + RTC_ICR); +		events |= (RTC_AF | RTC_IRQF);  		rtc_update_irq(ldata->rtc, 1, events);  		return IRQ_HANDLED; diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 3f3a2975236..7e6af0b22f1 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -670,6 +670,7 @@ static int s3c_rtc_resume(struct platform_device *pdev)  #define s3c_rtc_resume  NULL  #endif +#ifdef CONFIG_OF  static struct s3c_rtc_drv_data s3c_rtc_drv_data_array[] = {  	[TYPE_S3C2410] = { TYPE_S3C2410 },  	[TYPE_S3C2416] = { TYPE_S3C2416 }, @@ -677,7 +678,6 @@ static struct s3c_rtc_drv_data s3c_rtc_drv_data_array[] = {  	[TYPE_S3C64XX] = { TYPE_S3C64XX },  }; -#ifdef CONFIG_OF  static const struct of_device_id s3c_rtc_dt_match[] = {  	{  		.compatible = "samsung,s3c2410-rtc", diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c index e38da0dc418..1f76320e545 100644 --- a/drivers/rtc/rtc-spear.c +++ b/drivers/rtc/rtc-spear.c @@ -16,6 +16,7 @@  #include <linux/io.h>  #include <linux/irq.h>  #include <linux/module.h> +#include <linux/of.h>  #include <linux/platform_device.h>  #include <linux/rtc.h>  #include <linux/slab.h> @@ -519,6 +520,14 @@ static void spear_rtc_shutdown(struct platform_device *pdev)  	clk_disable(config->clk);  } +#ifdef CONFIG_OF +static const struct of_device_id spear_rtc_id_table[] = { +	{ .compatible = "st,spear600-rtc" }, +	{} +}; +MODULE_DEVICE_TABLE(of, spear_rtc_id_table); +#endif +  static struct platform_driver spear_rtc_driver = {  	.probe = spear_rtc_probe,  	.remove = __devexit_p(spear_rtc_remove), @@ -527,6 +536,7 @@ static struct platform_driver spear_rtc_driver = {  	.shutdown = spear_rtc_shutdown,  	.driver = {  		.name = "rtc-spear", +		.of_match_table = of_match_ptr(spear_rtc_id_table),  	},  }; diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c index 75259fe3860..c006025cecc 100644 --- a/drivers/rtc/rtc-tegra.c +++ b/drivers/rtc/rtc-tegra.c @@ -309,7 +309,8 @@ static int __devinit tegra_rtc_probe(struct platform_device *pdev)  	struct resource *res;  	int ret; -	info = kzalloc(sizeof(struct tegra_rtc_info), GFP_KERNEL); +	info = devm_kzalloc(&pdev->dev, sizeof(struct tegra_rtc_info), +		GFP_KERNEL);  	if (!info)  		return -ENOMEM; @@ -317,29 +318,18 @@ static int __devinit tegra_rtc_probe(struct platform_device *pdev)  	if (!res) {  		dev_err(&pdev->dev,  			"Unable to allocate resources for device.\n"); -		ret = -EBUSY; -		goto err_free_info; +		return -EBUSY;  	} -	if (!request_mem_region(res->start, resource_size(res), pdev->name)) { -		dev_err(&pdev->dev, -			"Unable to request mem region for device.\n"); -		ret = -EBUSY; -		goto err_free_info; +	info->rtc_base = devm_request_and_ioremap(&pdev->dev, res); +	if (!info->rtc_base) { +		dev_err(&pdev->dev, "Unable to request mem region and grab IOs for device.\n"); +		return -EBUSY;  	}  	info->tegra_rtc_irq = platform_get_irq(pdev, 0); -	if (info->tegra_rtc_irq <= 0) { -		ret = -EBUSY; -		goto err_release_mem_region; -	} - -	info->rtc_base = ioremap_nocache(res->start, resource_size(res)); -	if (!info->rtc_base) { -		dev_err(&pdev->dev, "Unable to grab IOs for device.\n"); -		ret = -EBUSY; -		goto err_release_mem_region; -	} +	if (info->tegra_rtc_irq <= 0) +		return -EBUSY;  	/* set context info. */  	info->pdev = pdev; @@ -362,11 +352,12 @@ static int __devinit tegra_rtc_probe(struct platform_device *pdev)  		dev_err(&pdev->dev,  			"Unable to register device (err=%d).\n",  			ret); -		goto err_iounmap; +		return ret;  	} -	ret = request_irq(info->tegra_rtc_irq, tegra_rtc_irq_handler, -		IRQF_TRIGGER_HIGH, "rtc alarm", &pdev->dev); +	ret = devm_request_irq(&pdev->dev, info->tegra_rtc_irq, +			tegra_rtc_irq_handler, IRQF_TRIGGER_HIGH, +			"rtc alarm", &pdev->dev);  	if (ret) {  		dev_err(&pdev->dev,  			"Unable to request interrupt for device (err=%d).\n", @@ -380,12 +371,6 @@ static int __devinit tegra_rtc_probe(struct platform_device *pdev)  err_dev_unreg:  	rtc_device_unregister(info->rtc_dev); -err_iounmap: -	iounmap(info->rtc_base); -err_release_mem_region: -	release_mem_region(res->start, resource_size(res)); -err_free_info: -	kfree(info);  	return ret;  } @@ -393,17 +378,8 @@ err_free_info:  static int __devexit tegra_rtc_remove(struct platform_device *pdev)  {  	struct tegra_rtc_info *info = platform_get_drvdata(pdev); -	struct resource *res; - -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -	if (!res) -		return -EBUSY; -	free_irq(info->tegra_rtc_irq, &pdev->dev);  	rtc_device_unregister(info->rtc_dev); -	iounmap(info->rtc_base); -	release_mem_region(res->start, resource_size(res)); -	kfree(info);  	platform_set_drvdata(pdev, NULL); diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c index 3b6e6a67e76..59c6245e042 100644 --- a/drivers/rtc/rtc-wm831x.c +++ b/drivers/rtc/rtc-wm831x.c @@ -396,7 +396,7 @@ static int wm831x_rtc_probe(struct platform_device *pdev)  {  	struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);  	struct wm831x_rtc *wm831x_rtc; -	int alm_irq = platform_get_irq_byname(pdev, "ALM"); +	int alm_irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "ALM"));  	int ret = 0;  	wm831x_rtc = devm_kzalloc(&pdev->dev, sizeof(*wm831x_rtc), GFP_KERNEL); | 
