rtc: core: correct trivial checkpatch warnings
Alexandre Belloni
maintainerPATCH 1/1 rtc: core: correct trivial checkpatch warnings
Correct trivial checkpatch warnings, mostly whitespace issues and unbalanced braces.
Signed-off-by Alexandre Belloni <[email protected]>
--- drivers/rtc/class.c | 14 +++--- drivers/rtc/dev.c | 13 +++--- drivers/rtc/hctosys.c | 3 +- drivers/rtc/interface.c | 99 ++++++++++++++++++++++------------------- drivers/rtc/lib.c | 22 ++++----- drivers/rtc/nvmem.c | 2 +- drivers/rtc/proc.c | 14 +++--- drivers/rtc/sysfs.c | 16 +++---- 8 files changed, 93 insertions(+), 90 deletions(-)
drivers/rtc/class.c +6 -8
@@ -20,13 +20,13 @@#include "rtc-core.h" -static DEFINE_IDA (rtc_ida);struct class *rtc_class;static void rtc_device_release (struct device *dev) {struct rtc_device *rtc =to_rtc_device (dev); +ida_simple_remove (&rtc_ida, rtc->id);kfree (rtc); }
@@ -44,7 +44,6 @@ int rtc_hctosys_ret = -ENODEV;static struct timespec64 old_rtc, old_system, old_delta; -static int rtc_suspend (struct device *dev) {struct rtc_device *rtc =to_rtc_device (dev);
@@ -68,7 +67,6 @@ static int rtc_suspend(struct device *dev)ktime_get_real_ts64 (&old_system); old_rtc.tv_sec =rtc_tm_to_time64 (&tm); -/* * To avoid drift caused by repeated suspend/resumes, * which each can add ~1 second drift error,
@@ -80,7 +78,7 @@ static int rtc_suspend(struct device *dev)if (delta_delta.tv_sec <-2 || delta_delta.tv_sec >=2 ) {/* * if delta_delta is too large, assume time correction -* has occured and set old_delta to the current delta. +* has occurred and set old_delta to the current delta. */ old_delta = delta; }else {
@@ -133,7 +131,7 @@ static int rtc_resume(struct device *dev)* to keep things accurate. */ sleep_time =timespec64_sub (sleep_time, -timespec64_sub (new_system, old_system)); +timespec64_sub (new_system, old_system));if (sleep_time.tv_sec >=0 )timekeeping_inject_sleeptime64 (&sleep_time);
@@ -394,9 +392,9 @@ EXPORT_SYMBOL_GPL(__rtc_register_device);* rtc_register_device instead */ struct rtc_device *devm_rtc_device_register (struct device *dev, -const char *name, -const struct rtc_class_ops *ops, -struct module *owner) +const char *name, +const struct rtc_class_ops *ops, +struct module *owner) {struct rtc_device *rtc;int err;
drivers/rtc/dev.c +8 -5
@@ -57,7 +57,7 @@ static void rtc_uie_task(struct work_struct *work) }else if (rtc->oldsecs != tm.tm_sec) { num = (tm.tm_sec +60 - rtc->oldsecs) %60 ; rtc->oldsecs = tm.tm_sec; - rtc->uie_timer.expires = jiffies +HZ - (HZ /10 ); + rtc->uie_timer.expires = jiffies +HZ - (HZ /10 ); rtc->uie_timer_active =1 ; rtc->uie_task_active =0 ;add_timer (&rtc->uie_timer);
@@ -68,6 +68,7 @@ static void rtc_uie_task(struct work_struct *work)if (num)rtc_handle_legacy_irq (rtc, num,RTC_UF ); } +static void rtc_uie_timer (struct timer_list *t) {struct rtc_device *rtc =from_timer (rtc, t, uie_timer);
@@ -199,14 +200,14 @@ static __poll_t rtc_dev_poll(struct file *file, poll_table *wait) }static long rtc_dev_ioctl (struct file *file, -unsigned int cmd,unsigned long arg) +unsigned int cmd,unsigned long arg) {int err =0 ;struct rtc_device *rtc = file->private_data;const struct rtc_class_ops *ops = rtc->ops;struct rtc_time tm;struct rtc_wkalrm alarm; -void __user *uarg = (void __user *) arg; +void __user *uarg = (void __user *)arg; err =mutex_lock_interruptible (&rtc->ops_lock);if (err)
@@ -230,7 +231,7 @@ static long rtc_dev_ioctl(struct file *file,case RTC_PIE_ON :if (rtc->irq_freq > rtc->max_user_freq && - !capable (CAP_SYS_RESOURCE )) + !capable (CAP_SYS_RESOURCE )) err = -EACCES ;break ; }
@@ -387,8 +388,9 @@ static long rtc_dev_ioctl(struct file *file, err = ops->ioctl (rtc->dev.parent, cmd, arg);if (err == -ENOIOCTLCMD ) err = -ENOTTY ; - }else + }else { err = -ENOTTY ; + }break ; }
@@ -400,6 +402,7 @@ static long rtc_dev_ioctl(struct file *file,static int rtc_dev_fasync (int fd,struct file *file,int on) {struct rtc_device *rtc = file->private_data; +return fasync_helper (fd, file, on, &rtc->async_queue); }
drivers/rtc/hctosys.c +1 -2
@@ -30,7 +30,7 @@ static int __init rtc_hctosys(void) };struct rtc_device *rtc =rtc_class_open (CONFIG_RTC_HCTOSYS_DEVICE ); -if (rtc ==NULL ) { +if (!rtc) {pr_info ("unable to open rtc device (%s)\n" ,CONFIG_RTC_HCTOSYS_DEVICE ); goto err_open;
@@ -41,7 +41,6 @@ static int __init rtc_hctosys(void)dev_err (rtc->dev.parent,"hctosys: unable to read the hardware clock\n" ); goto err_read; - } tv64.tv_sec =rtc_tm_to_time64 (&tm);
drivers/rtc/interface.c +52 -47
297 lines not on this page · raw message
drivers/rtc/lib.c +11 -11
@@ -22,7 +22,7 @@ static const unsigned short rtc_ydays[2][13] = { { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } }; -#define LEAPS_THRU_END_OF (y) ((y)/4 - (y)/100 + (y)/400) +#define LEAPS_THRU_END_OF (y) ((y) / 4 - (y) / 100 + (y) / 400)/* * The number of days in the month.
@@ -38,11 +38,10 @@ EXPORT_SYMBOL(rtc_month_days);*/ int rtc_year_days (unsigned int day,unsigned int month,unsigned int year) { -return rtc_ydays[is_leap_year (year)][month] + day-1 ; +return rtc_ydays[is_leap_year (year)][month] + day -1 ; }EXPORT_SYMBOL (rtc_year_days); -/* * rtc_time64_to_tm - Converts time64_t to rtc_time. * Convert seconds since 01-01-1970 00:00:00 to Gregorian date.
@@ -94,13 +93,14 @@ EXPORT_SYMBOL(rtc_time64_to_tm);*/ int rtc_valid_tm (struct rtc_time *tm) { -if (tm->tm_year <70 - || ((unsigned )tm->tm_mon) >=12 - || tm->tm_mday <1 - || tm->tm_mday >rtc_month_days (tm->tm_mon, ((unsigned )tm->tm_year +1900 )) - || ((unsigned )tm->tm_hour) >=24 - || ((unsigned )tm->tm_min) >=60 - || ((unsigned )tm->tm_sec) >=60 ) +if (tm->tm_year <70 || + ((unsigned int )tm->tm_mon) >=12 || + tm->tm_mday <1 || + tm->tm_mday >rtc_month_days (tm->tm_mon, + ((unsigned int )tm->tm_year +1900 )) || + ((unsigned int )tm->tm_hour) >=24 || + ((unsigned int )tm->tm_min) >=60 || + ((unsigned int )tm->tm_sec) >=60 )return -EINVAL ;return 0 ;
@@ -113,7 +113,7 @@ EXPORT_SYMBOL(rtc_valid_tm);*/ time64_t rtc_tm_to_time64 (struct rtc_time *tm) { -return mktime64 (((unsigned )tm->tm_year +1900 ), tm->tm_mon +1 , +return mktime64 (((unsigned int )tm->tm_year +1900 ), tm->tm_mon +1 , tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); }EXPORT_SYMBOL (rtc_tm_to_time64);
drivers/rtc/nvmem.c +1 -1
@@ -43,7 +43,7 @@ static int rtc_nvram_register(struct rtc_device *rtc, {int err; - rtc->nvram =kzalloc (sizeof (struct bin_attribute ),GFP_KERNEL ); + rtc->nvram =kzalloc (sizeof (*rtc->nvram),GFP_KERNEL );if (!rtc->nvram)return -ENOMEM ;
drivers/rtc/proc.c +7 -7
@@ -57,17 +57,17 @@ static int rtc_proc_show(struct seq_file *seq, void *offset)seq_printf (seq,"alrm_time\t: %ptRt\n" , &alrm.time);seq_printf (seq,"alrm_date\t: %ptRd\n" , &alrm.time);seq_printf (seq,"alarm_IRQ\t: %s\n" , - alrm.enabled ?"yes" :"no" ); + alrm.enabled ?"yes" :"no" );seq_printf (seq,"alrm_pending\t: %s\n" , - alrm.pending ?"yes" :"no" ); + alrm.pending ?"yes" :"no" );seq_printf (seq,"update IRQ enabled\t: %s\n" , - (rtc->uie_rtctimer.enabled) ?"yes" :"no" ); + (rtc->uie_rtctimer.enabled) ?"yes" :"no" );seq_printf (seq,"periodic IRQ enabled\t: %s\n" , - (rtc->pie_enabled) ?"yes" :"no" ); + (rtc->pie_enabled) ?"yes" :"no" );seq_printf (seq,"periodic IRQ frequency\t: %d\n" , - rtc->irq_freq); + rtc->irq_freq);seq_printf (seq,"max user IRQ frequency\t: %d\n" , - rtc->max_user_freq); + rtc->max_user_freq); }seq_printf (seq,"24hr\t\t: yes\n" );
@@ -82,7 +82,7 @@ void rtc_proc_add_device(struct rtc_device *rtc) {if (is_rtc_hctosys (rtc))proc_create_single_data ("driver/rtc" ,0 ,NULL , rtc_proc_show, - rtc); + rtc); }void rtc_proc_del_device (struct rtc_device *rtc)
drivers/rtc/sysfs.c +7 -9
@@ -11,7 +11,6 @@#include "rtc-core.h" -/* device attributes */ /*
@@ -83,7 +82,7 @@ max_user_freq_show(struct device *dev, struct device_attribute *attr, char *buf)static ssize_t max_user_freq_store (struct device *dev,struct device_attribute *attr, -const char *buf,size_t n) +const char *buf,size_t n) {struct rtc_device *rtc =to_rtc_device (dev);unsigned long val;
@@ -113,12 +112,11 @@ hctosys_show(struct device *dev, struct device_attribute *attr, char *buf) {#ifdef CONFIG_RTC_HCTOSYS_DEVICE if (rtc_hctosys_ret ==0 && -strcmp (dev_name (&to_rtc_device (dev)->dev), -CONFIG_RTC_HCTOSYS_DEVICE ) ==0 ) +strcmp (dev_name (&to_rtc_device (dev)->dev), +CONFIG_RTC_HCTOSYS_DEVICE ) ==0 )return sprintf (buf,"1\n" ); - else#endif -return sprintf (buf,"0\n" ); +return sprintf (buf,"0\n" ); }static DEVICE_ATTR_RO (hctosys);
@@ -172,15 +170,15 @@ wakealarm_store(struct device *dev, struct device_attribute *attr,if (*buf_ptr =='=' ) { buf_ptr++; push =1 ; - }else + }else { adjust =1 ; + } } retval =kstrtos64 (buf_ptr,0 , &alarm);if (retval)return retval; -if (adjust) { +if (adjust) alarm += now; - }if (alarm > now || push) {/* Avoid accidentally clobbering active alarms; we can't * entirely prevent that here, without even the minimal
Signature · 1 line
2.20.1