diff options
Diffstat (limited to 'drivers/rtc/rtc-efi.c')
| -rw-r--r-- | drivers/rtc/rtc-efi.c | 38 | 
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 550292304b0..c4c38431012 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c @@ -13,6 +13,8 @@   *   */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +  #include <linux/kernel.h>  #include <linux/module.h>  #include <linux/time.h> @@ -33,7 +35,7 @@ static inline int  compute_yday(efi_time_t *eft)  {  	/* efi_time_t.month is in the [1-12] so, we need -1 */ -	return rtc_year_days(eft->day - 1, eft->month - 1, eft->year); +	return rtc_year_days(eft->day, eft->month - 1, eft->year);  }  /*   * returns day of the week [0-6] 0=Sunday @@ -47,7 +49,7 @@ compute_wday(efi_time_t *eft)  	int ndays = 0;  	if (eft->year < 1998) { -		printk(KERN_ERR "efirtc: EFI year < 1998, invalid date\n"); +		pr_err("EFI year < 1998, invalid date\n");  		return -1;  	} @@ -70,7 +72,7 @@ convert_to_efi_time(struct rtc_time *wtime, efi_time_t *eft)  	eft->day	= wtime->tm_mday;  	eft->hour	= wtime->tm_hour;  	eft->minute	= wtime->tm_min; -	eft->second 	= wtime->tm_sec; +	eft->second	= wtime->tm_sec;  	eft->nanosecond = 0;  	eft->daylight	= wtime->tm_isdst ? EFI_ISDST : 0;  	eft->timezone	= EFI_UNSPECIFIED_TIMEZONE; @@ -142,7 +144,7 @@ static int efi_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)  	 */  	status = efi.set_wakeup_time((efi_bool_t)wkalrm->enabled, &eft); -	printk(KERN_WARNING "write status is %d\n", (int)status); +	dev_warn(dev, "write status is %d\n", (int)status);  	return status == EFI_SUCCESS ? 0 : -EINVAL;  } @@ -157,7 +159,7 @@ static int efi_read_time(struct device *dev, struct rtc_time *tm)  	if (status != EFI_SUCCESS) {  		/* should never happen */ -		printk(KERN_ERR "efitime: can't read time\n"); +		dev_err(dev, "can't read time\n");  		return -EINVAL;  	} @@ -189,7 +191,7 @@ static int __init efi_rtc_probe(struct platform_device *dev)  {  	struct rtc_device *rtc; -	rtc = rtc_device_register("rtc-efi", &dev->dev, &efi_rtc_ops, +	rtc = devm_rtc_device_register(&dev->dev, "rtc-efi", &efi_rtc_ops,  					THIS_MODULE);  	if (IS_ERR(rtc))  		return PTR_ERR(rtc); @@ -199,36 +201,14 @@ static int __init efi_rtc_probe(struct platform_device *dev)  	return 0;  } -static int __exit efi_rtc_remove(struct platform_device *dev) -{ -	struct rtc_device *rtc = platform_get_drvdata(dev); - -	rtc_device_unregister(rtc); - -	return 0; -} -  static struct platform_driver efi_rtc_driver = {  	.driver = {  		.name = "rtc-efi",  		.owner = THIS_MODULE,  	}, -	.probe = efi_rtc_probe, -	.remove = __exit_p(efi_rtc_remove),  }; -static int __init efi_rtc_init(void) -{ -	return platform_driver_probe(&efi_rtc_driver, efi_rtc_probe); -} - -static void __exit efi_rtc_exit(void) -{ -	platform_driver_unregister(&efi_rtc_driver); -} - -module_init(efi_rtc_init); -module_exit(efi_rtc_exit); +module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe);  MODULE_AUTHOR("dann frazier <dannf@hp.com>");  MODULE_LICENSE("GPL");  | 
