diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-09-14 18:24:00 +0200 | 
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-09-14 18:24:00 +0200 | 
| commit | 83bd6998b04fc1bb7280b14f16b2bdbdc07c914b (patch) | |
| tree | af1bbe2bac5752b69b1ac58bf5d822c735da439b /drivers/rtc | |
| parent | e7250b8ae3870f37f660c2f65cafcaba85e3bfd3 (diff) | |
| parent | adee14b2e1557d0a8559f29681732d05a89dfc35 (diff) | |
Merge commit 'v2.6.27-rc6' into timers/hpet
Diffstat (limited to 'drivers/rtc')
| -rw-r--r-- | drivers/rtc/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/rtc/interface.c | 10 | ||||
| -rw-r--r-- | drivers/rtc/rtc-at91rm9200.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-at91sam9.c | 4 | ||||
| -rw-r--r-- | drivers/rtc/rtc-bfin.c | 153 | ||||
| -rw-r--r-- | drivers/rtc/rtc-cmos.c | 38 | ||||
| -rw-r--r-- | drivers/rtc/rtc-dev.c | 21 | ||||
| -rw-r--r-- | drivers/rtc/rtc-ds1374.c | 10 | ||||
| -rw-r--r-- | drivers/rtc/rtc-ep93xx.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-isl1208.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-lib.c | 5 | ||||
| -rw-r--r-- | drivers/rtc/rtc-max6902.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-r9701.c | 1 | ||||
| -rw-r--r-- | drivers/rtc/rtc-s3c.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-sa1100.c | 4 | 
15 files changed, 141 insertions, 117 deletions
| diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 90ab7382540..9a9755c92fa 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -561,7 +561,7 @@ config RTC_DRV_AT91SAM9_GPBR  config RTC_DRV_BFIN  	tristate "Blackfin On-Chip RTC" -	depends on BLACKFIN +	depends on BLACKFIN && !BF561  	help  	  If you say yes here you will get support for the  	  Blackfin On-Chip Real Time Clock. diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index d397fa5f3a9..7af60b98d8a 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -20,7 +20,7 @@ int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm)  	err = mutex_lock_interruptible(&rtc->ops_lock);  	if (err) -		return -EBUSY; +		return err;  	if (!rtc->ops)  		err = -ENODEV; @@ -46,7 +46,7 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)  	err = mutex_lock_interruptible(&rtc->ops_lock);  	if (err) -		return -EBUSY; +		return err;  	if (!rtc->ops)  		err = -ENODEV; @@ -66,7 +66,7 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs)  	err = mutex_lock_interruptible(&rtc->ops_lock);  	if (err) -		return -EBUSY; +		return err;  	if (!rtc->ops)  		err = -ENODEV; @@ -106,7 +106,7 @@ static int rtc_read_alarm_internal(struct rtc_device *rtc, struct rtc_wkalrm *al  	err = mutex_lock_interruptible(&rtc->ops_lock);  	if (err) -		return -EBUSY; +		return err;  	if (rtc->ops == NULL)  		err = -ENODEV; @@ -293,7 +293,7 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)  	err = mutex_lock_interruptible(&rtc->ops_lock);  	if (err) -		return -EBUSY; +		return err;  	if (!rtc->ops)  		err = -ENODEV; diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index cd32d05db77..4e888cc8be5 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c @@ -29,7 +29,7 @@  #include <linux/completion.h>  #include <asm/uaccess.h> -#include <asm/arch/at91_rtc.h> +#include <mach/at91_rtc.h>  #define AT91_RTC_FREQ		1 diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index f0246ef413a..2133f37906f 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c @@ -19,8 +19,8 @@  #include <linux/interrupt.h>  #include <linux/ioctl.h> -#include <asm/arch/board.h> -#include <asm/arch/at91_rtt.h> +#include <mach/board.h> +#include <mach/at91_rtt.h>  /* diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index 8624f55d056..34439ce3967 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c @@ -2,7 +2,7 @@   * Blackfin On-Chip Real Time Clock Driver   *  Supports BF52[257]/BF53[123]/BF53[467]/BF54[24789]   * - * Copyright 2004-2007 Analog Devices Inc. + * Copyright 2004-2008 Analog Devices Inc.   *   * Enter bugs at http://blackfin.uclinux.org/   * @@ -32,6 +32,15 @@   * writes to clear status registers complete immediately.   */ +/* It may seem odd that there is no SWCNT code in here (which would be exposed + * via the periodic interrupt event, or PIE).  Since the Blackfin RTC peripheral + * runs in units of seconds (N/HZ) but the Linux framework runs in units of HZ + * (2^N HZ), there is no point in keeping code that only provides 1 HZ PIEs. + * The same exact behavior can be accomplished by using the update interrupt + * event (UIE).  Maybe down the line the RTC peripheral will suck less in which + * case we can re-introduce PIE support. + */ +  #include <linux/bcd.h>  #include <linux/completion.h>  #include <linux/delay.h> @@ -144,14 +153,13 @@ static void bfin_rtc_sync_pending(struct device *dev)   * Initialize the RTC.  Enable pre-scaler to scale RTC clock   * to 1Hz and clear interrupt/status registers.   */ -static void bfin_rtc_reset(struct device *dev) +static void bfin_rtc_reset(struct device *dev, u16 rtc_ictl)  {  	struct bfin_rtc *rtc = dev_get_drvdata(dev);  	dev_dbg_stamp(dev);  	bfin_rtc_sync_pending(dev);  	bfin_write_RTC_PREN(0x1); -	bfin_write_RTC_ICTL(RTC_ISTAT_WRITE_COMPLETE); -	bfin_write_RTC_SWCNT(0); +	bfin_write_RTC_ICTL(rtc_ictl);  	bfin_write_RTC_ALARM(0);  	bfin_write_RTC_ISTAT(0xFFFF);  	rtc->rtc_wrote_regs = 0; @@ -194,14 +202,6 @@ static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id)  		}  	} -	if (rtc_ictl & RTC_ISTAT_STOPWATCH) { -		if (rtc_istat & RTC_ISTAT_STOPWATCH) { -			bfin_write_RTC_ISTAT(RTC_ISTAT_STOPWATCH); -			events |= RTC_PF | RTC_IRQF; -			bfin_write_RTC_SWCNT(rtc->rtc_dev->irq_freq); -		} -	} -  	if (rtc_ictl & RTC_ISTAT_SEC) {  		if (rtc_istat & RTC_ISTAT_SEC) {  			bfin_write_RTC_ISTAT(RTC_ISTAT_SEC); @@ -218,32 +218,12 @@ static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id)  		return IRQ_NONE;  } -static int bfin_rtc_open(struct device *dev) -{ -	int ret; - -	dev_dbg_stamp(dev); - -	ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, to_platform_device(dev)->name, dev); -	if (!ret) -		bfin_rtc_reset(dev); - -	return ret; -} - -static void bfin_rtc_release(struct device *dev) -{ -	dev_dbg_stamp(dev); -	bfin_rtc_reset(dev); -	free_irq(IRQ_RTC, dev); -} - -static void bfin_rtc_int_set(struct bfin_rtc *rtc, u16 rtc_int) +static void bfin_rtc_int_set(u16 rtc_int)  {  	bfin_write_RTC_ISTAT(rtc_int);  	bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() | rtc_int);  } -static void bfin_rtc_int_clear(struct bfin_rtc *rtc, u16 rtc_int) +static void bfin_rtc_int_clear(u16 rtc_int)  {  	bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() & rtc_int);  } @@ -252,7 +232,7 @@ static void bfin_rtc_int_set_alarm(struct bfin_rtc *rtc)  	/* Blackfin has different bits for whether the alarm is  	 * more than 24 hours away.  	 */ -	bfin_rtc_int_set(rtc, (rtc->rtc_alarm.tm_yday == -1 ? RTC_ISTAT_ALARM : RTC_ISTAT_ALARM_DAY)); +	bfin_rtc_int_set(rtc->rtc_alarm.tm_yday == -1 ? RTC_ISTAT_ALARM : RTC_ISTAT_ALARM_DAY);  }  static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)  { @@ -264,23 +244,13 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar  	bfin_rtc_sync_pending(dev);  	switch (cmd) { -	case RTC_PIE_ON: -		dev_dbg_stamp(dev); -		bfin_rtc_int_set(rtc, RTC_ISTAT_STOPWATCH); -		bfin_write_RTC_SWCNT(rtc->rtc_dev->irq_freq); -		break; -	case RTC_PIE_OFF: -		dev_dbg_stamp(dev); -		bfin_rtc_int_clear(rtc, ~RTC_ISTAT_STOPWATCH); -		break; -  	case RTC_UIE_ON:  		dev_dbg_stamp(dev); -		bfin_rtc_int_set(rtc, RTC_ISTAT_SEC); +		bfin_rtc_int_set(RTC_ISTAT_SEC);  		break;  	case RTC_UIE_OFF:  		dev_dbg_stamp(dev); -		bfin_rtc_int_clear(rtc, ~RTC_ISTAT_SEC); +		bfin_rtc_int_clear(~RTC_ISTAT_SEC);  		break;  	case RTC_AIE_ON: @@ -289,7 +259,7 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar  		break;  	case RTC_AIE_OFF:  		dev_dbg_stamp(dev); -		bfin_rtc_int_clear(rtc, ~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY)); +		bfin_rtc_int_clear(~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));  		break;  	default: @@ -371,64 +341,64 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq)  	seq_printf(seq,  		"alarm_IRQ\t: %s\n"  		"wkalarm_IRQ\t: %s\n" -		"seconds_IRQ\t: %s\n" -		"periodic_IRQ\t: %s\n", +		"seconds_IRQ\t: %s\n",  		yesno(ictl & RTC_ISTAT_ALARM),  		yesno(ictl & RTC_ISTAT_ALARM_DAY), -		yesno(ictl & RTC_ISTAT_SEC), -		yesno(ictl & RTC_ISTAT_STOPWATCH)); +		yesno(ictl & RTC_ISTAT_SEC));  	return 0;  #undef yesno  } -/** - *	bfin_irq_set_freq - make sure hardware supports requested freq - *	@dev: pointer to RTC device structure - *	@freq: requested frequency rate - * - *	The Blackfin RTC can only generate periodic events at 1 per - *	second (1 Hz), so reject any attempt at changing it. - */ -static int bfin_irq_set_freq(struct device *dev, int freq) -{ -	dev_dbg_stamp(dev); -	return -ENOTTY; -} -  static struct rtc_class_ops bfin_rtc_ops = { -	.open          = bfin_rtc_open, -	.release       = bfin_rtc_release,  	.ioctl         = bfin_rtc_ioctl,  	.read_time     = bfin_rtc_read_time,  	.set_time      = bfin_rtc_set_time,  	.read_alarm    = bfin_rtc_read_alarm,  	.set_alarm     = bfin_rtc_set_alarm,  	.proc          = bfin_rtc_proc, -	.irq_set_freq  = bfin_irq_set_freq,  };  static int __devinit bfin_rtc_probe(struct platform_device *pdev)  {  	struct bfin_rtc *rtc; +	struct device *dev = &pdev->dev;  	int ret = 0; +	unsigned long timeout; -	dev_dbg_stamp(&pdev->dev); +	dev_dbg_stamp(dev); +	/* Allocate memory for our RTC struct */  	rtc = kzalloc(sizeof(*rtc), GFP_KERNEL);  	if (unlikely(!rtc))  		return -ENOMEM; +	platform_set_drvdata(pdev, rtc); +	device_init_wakeup(dev, 1); -	rtc->rtc_dev = rtc_device_register(pdev->name, &pdev->dev, &bfin_rtc_ops, THIS_MODULE); -	if (IS_ERR(rtc)) { -		ret = PTR_ERR(rtc->rtc_dev); +	/* Grab the IRQ and init the hardware */ +	ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, pdev->name, dev); +	if (unlikely(ret))  		goto err; -	} -	rtc->rtc_dev->irq_freq = 1; +	/* sometimes the bootloader touched things, but the write complete was not +	 * enabled, so let's just do a quick timeout here since the IRQ will not fire ... +	 */ +	timeout = jiffies + HZ; +	while (bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING) +		if (time_after(jiffies, timeout)) +			break; +	bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE); +	bfin_write_RTC_SWCNT(0); -	platform_set_drvdata(pdev, rtc); +	/* Register our RTC with the RTC framework */ +	rtc->rtc_dev = rtc_device_register(pdev->name, dev, &bfin_rtc_ops, THIS_MODULE); +	if (unlikely(IS_ERR(rtc))) { +		ret = PTR_ERR(rtc->rtc_dev); +		goto err_irq; +	}  	return 0; + err_irq: +	free_irq(IRQ_RTC, dev);   err:  	kfree(rtc);  	return ret; @@ -437,7 +407,10 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)  static int __devexit bfin_rtc_remove(struct platform_device *pdev)  {  	struct bfin_rtc *rtc = platform_get_drvdata(pdev); +	struct device *dev = &pdev->dev; +	bfin_rtc_reset(dev, 0); +	free_irq(IRQ_RTC, dev);  	rtc_device_unregister(rtc->rtc_dev);  	platform_set_drvdata(pdev, NULL);  	kfree(rtc); @@ -445,6 +418,32 @@ static int __devexit bfin_rtc_remove(struct platform_device *pdev)  	return 0;  } +#ifdef CONFIG_PM +static int bfin_rtc_suspend(struct platform_device *pdev, pm_message_t state) +{ +	if (device_may_wakeup(&pdev->dev)) { +		enable_irq_wake(IRQ_RTC); +		bfin_rtc_sync_pending(&pdev->dev); +	} else +		bfin_rtc_int_clear(-1); + +	return 0; +} + +static int bfin_rtc_resume(struct platform_device *pdev) +{ +	if (device_may_wakeup(&pdev->dev)) +		disable_irq_wake(IRQ_RTC); +	else +		bfin_write_RTC_ISTAT(-1); + +	return 0; +} +#else +# define bfin_rtc_suspend NULL +# define bfin_rtc_resume  NULL +#endif +  static struct platform_driver bfin_rtc_driver = {  	.driver		= {  		.name	= "rtc-bfin", @@ -452,6 +451,8 @@ static struct platform_driver bfin_rtc_driver = {  	},  	.probe		= bfin_rtc_probe,  	.remove		= __devexit_p(bfin_rtc_remove), +	.suspend	= bfin_rtc_suspend, +	.resume		= bfin_rtc_resume,  };  static int __init bfin_rtc_init(void) diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 6ea349aba3b..b184367637d 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -800,7 +800,6 @@ static void __exit cmos_do_remove(struct device *dev)  static int cmos_suspend(struct device *dev, pm_message_t mesg)  {  	struct cmos_rtc	*cmos = dev_get_drvdata(dev); -	int		do_wake = device_may_wakeup(dev);  	unsigned char	tmp;  	/* only the alarm might be a wakeup event source */ @@ -809,7 +808,7 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg)  	if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) {  		unsigned char	mask; -		if (do_wake) +		if (device_may_wakeup(dev))  			mask = RTC_IRQMASK & ~RTC_AIE;  		else  			mask = RTC_IRQMASK; @@ -837,6 +836,17 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg)  	return 0;  } +/* We want RTC alarms to wake us from e.g. ACPI G2/S5 "soft off", even + * after a detour through G3 "mechanical off", although the ACPI spec + * says wakeup should only work from G1/S4 "hibernate".  To most users, + * distinctions between S4 and S5 are pointless.  So when the hardware + * allows, don't draw that distinction. + */ +static inline int cmos_poweroff(struct device *dev) +{ +	return cmos_suspend(dev, PMSG_HIBERNATE); +} +  static int cmos_resume(struct device *dev)  {  	struct cmos_rtc	*cmos = dev_get_drvdata(dev); @@ -884,6 +894,12 @@ static int cmos_resume(struct device *dev)  #else  #define	cmos_suspend	NULL  #define	cmos_resume	NULL + +static inline int cmos_poweroff(struct device *dev) +{ +	return -ENOSYS; +} +  #endif  /*----------------------------------------------------------------*/ @@ -903,10 +919,6 @@ static int cmos_resume(struct device *dev)  static int __devinit  cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)  { -	/* REVISIT paranoia argues for a shutdown notifier, since PNP -	 * drivers can't provide shutdown() methods to disable IRQs. -	 * Or better yet, fix PNP to allow those methods... -	 */  	if (pnp_port_start(pnp,0) == 0x70 && !pnp_irq_valid(pnp,0))  		/* Some machines contain a PNP entry for the RTC, but  		 * don't define the IRQ. It should always be safe to @@ -942,6 +954,13 @@ static int cmos_pnp_resume(struct pnp_dev *pnp)  #define	cmos_pnp_resume		NULL  #endif +static void cmos_pnp_shutdown(struct device *pdev) +{ +	if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(pdev)) +		return; + +	cmos_do_shutdown(); +}  static const struct pnp_device_id rtc_ids[] = {  	{ .id = "PNP0b00", }, @@ -961,6 +980,10 @@ static struct pnp_driver cmos_pnp_driver = {  	.flags		= PNP_DRIVER_RES_DO_NOT_CHANGE,  	.suspend	= cmos_pnp_suspend,  	.resume		= cmos_pnp_resume, +	.driver		= { +		.name	  = (char *)driver_name, +		.shutdown = cmos_pnp_shutdown, +	}  };  #endif	/* CONFIG_PNP */ @@ -986,6 +1009,9 @@ static int __exit cmos_platform_remove(struct platform_device *pdev)  static void cmos_platform_shutdown(struct platform_device *pdev)  { +	if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(&pdev->dev)) +		return; +  	cmos_do_shutdown();  } diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 0a870b7e5c3..f118252f3a9 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c @@ -13,7 +13,6 @@  #include <linux/module.h>  #include <linux/rtc.h> -#include <linux/smp_lock.h>  #include "rtc-core.h"  static dev_t rtc_devt; @@ -27,11 +26,8 @@ static int rtc_dev_open(struct inode *inode, struct file *file)  					struct rtc_device, char_dev);  	const struct rtc_class_ops *ops = rtc->ops; -	lock_kernel(); -	if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) { -		err = -EBUSY; -		goto out; -	} +	if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) +		return -EBUSY;  	file->private_data = rtc; @@ -41,13 +37,11 @@ static int rtc_dev_open(struct inode *inode, struct file *file)  		rtc->irq_data = 0;  		spin_unlock_irq(&rtc->irq_lock); -		goto out; +		return 0;  	}  	/* something has gone wrong */  	clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); -out: -	unlock_kernel();  	return err;  } @@ -221,7 +215,7 @@ static long rtc_dev_ioctl(struct file *file,  	err = mutex_lock_interruptible(&rtc->ops_lock);  	if (err) -		return -EBUSY; +		return err;  	/* check that the calling task has appropriate permissions  	 * for certain ioctls. doing this check here is useful @@ -409,11 +403,14 @@ static long rtc_dev_ioctl(struct file *file,  #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL  	case RTC_UIE_OFF: +		mutex_unlock(&rtc->ops_lock);  		clear_uie(rtc); -		break; +		return 0;  	case RTC_UIE_ON: +		mutex_unlock(&rtc->ops_lock);  		err = set_uie(rtc); +		return err;  #endif  	default:  		err = -ENOTTY; @@ -432,6 +429,8 @@ static int rtc_dev_release(struct inode *inode, struct file *file)  #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL  	clear_uie(rtc);  #endif +	rtc_irq_set_state(rtc, NULL, 0); +  	if (rtc->ops->release)  		rtc->ops->release(rtc->dev.parent); diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 640acd20fdd..a150418fba7 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c @@ -173,7 +173,7 @@ static int ds1374_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)  	int cr, sr;  	int ret = 0; -	if (client->irq < 0) +	if (client->irq <= 0)  		return -EINVAL;  	mutex_lock(&ds1374->mutex); @@ -212,7 +212,7 @@ static int ds1374_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)  	int cr;  	int ret = 0; -	if (client->irq < 0) +	if (client->irq <= 0)  		return -EINVAL;  	ret = ds1374_read_time(dev, &now); @@ -381,7 +381,7 @@ static int ds1374_probe(struct i2c_client *client,  	if (ret)  		goto out_free; -	if (client->irq >= 0) { +	if (client->irq > 0) {  		ret = request_irq(client->irq, ds1374_irq, 0,  		                  "ds1374", client);  		if (ret) { @@ -401,7 +401,7 @@ static int ds1374_probe(struct i2c_client *client,  	return 0;  out_irq: -	if (client->irq >= 0) +	if (client->irq > 0)  		free_irq(client->irq, client);  out_free: @@ -414,7 +414,7 @@ static int __devexit ds1374_remove(struct i2c_client *client)  {  	struct ds1374 *ds1374 = i2c_get_clientdata(client); -	if (client->irq >= 0) { +	if (client->irq > 0) {  		mutex_lock(&ds1374->mutex);  		ds1374->exiting = 1;  		mutex_unlock(&ds1374->mutex); diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c index 1e99325270d..36e4ac0bd69 100644 --- a/drivers/rtc/rtc-ep93xx.c +++ b/drivers/rtc/rtc-ep93xx.c @@ -12,7 +12,7 @@  #include <linux/module.h>  #include <linux/rtc.h>  #include <linux/platform_device.h> -#include <asm/hardware.h> +#include <mach/hardware.h>  #define EP93XX_RTC_REG(x)	(EP93XX_RTC_BASE + (x))  #define EP93XX_RTC_DATA		EP93XX_RTC_REG(0x0000) diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index fbb90b1e409..a81adab6e51 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -482,7 +482,7 @@ isl1208_sysfs_register(struct device *dev)  static int  isl1208_sysfs_unregister(struct device *dev)  { -	device_remove_file(dev, &dev_attr_atrim); +	device_remove_file(dev, &dev_attr_dtrim);  	device_remove_file(dev, &dev_attr_atrim);  	device_remove_file(dev, &dev_attr_usr); diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c index 9f996ec881c..dd70bf73ce9 100644 --- a/drivers/rtc/rtc-lib.c +++ b/drivers/rtc/rtc-lib.c @@ -51,10 +51,11 @@ EXPORT_SYMBOL(rtc_year_days);   */  void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)  { -	unsigned int days, month, year; +	unsigned int month, year; +	int days;  	days = time / 86400; -	time -= days * 86400; +	time -= (unsigned int) days * 86400;  	/* day of the week, 1970-01-01 was a Thursday */  	tm->tm_wday = (days + 4) % 7; diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index 12f0310ae89..78b2551fb19 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c @@ -20,8 +20,6 @@   */  #include <linux/module.h> -#include <linux/version.h> -  #include <linux/kernel.h>  #include <linux/platform_device.h>  #include <linux/init.h> diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c index b35f9bfa2af..395985b339c 100644 --- a/drivers/rtc/rtc-r9701.c +++ b/drivers/rtc/rtc-r9701.c @@ -14,7 +14,6 @@   */  #include <linux/module.h> -#include <linux/version.h>  #include <linux/kernel.h>  #include <linux/platform_device.h>  #include <linux/device.h> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 54b1ebb0150..e7d19b6c265 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -22,7 +22,7 @@  #include <linux/clk.h>  #include <linux/log2.h> -#include <asm/hardware.h> +#include <mach/hardware.h>  #include <asm/uaccess.h>  #include <asm/io.h>  #include <asm/irq.h> diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index f47294c6014..66a9bb85bbe 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c @@ -31,11 +31,11 @@  #include <linux/pm.h>  #include <linux/bitops.h> -#include <asm/hardware.h> +#include <mach/hardware.h>  #include <asm/irq.h>  #ifdef CONFIG_ARCH_PXA -#include <asm/arch/pxa-regs.h> +#include <mach/pxa-regs.h>  #endif  #define TIMER_FREQ		CLOCK_TICK_RATE | 
