Skip to content

Commit 7f79d4e

Browse files
Fabian Fredericksfrothwell
authored andcommitted
kernel/posix-timers.c: code clean-up
Fixing some checkpatch warnings: -Convert printk to pr_foo() -Remove spaces between function and ( -Split lines > 80 characters Signed-off-by: Fabian Frederick <[email protected]> Cc: Thomas Gleixner <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 766daa2 commit 7f79d4e

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

kernel/posix-timers.c

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static DEFINE_SPINLOCK(hash_lock);
7171
* SIGEV values. Here we put out an error if this assumption fails.
7272
*/
7373
#if SIGEV_THREAD_ID != (SIGEV_THREAD_ID & \
74-
~(SIGEV_SIGNAL | SIGEV_NONE | SIGEV_THREAD))
74+
~(SIGEV_SIGNAL | SIGEV_NONE | SIGEV_THREAD))
7575
#error "SIGEV_THREAD_ID must not share bit with other SIGEV values!"
7676
#endif
7777

@@ -252,7 +252,8 @@ static int posix_get_monotonic_coarse(clockid_t which_clock,
252252
return 0;
253253
}
254254

255-
static int posix_get_coarse_res(const clockid_t which_clock, struct timespec *tp)
255+
static int posix_get_coarse_res(const clockid_t which_clock,
256+
struct timespec *tp)
256257
{
257258
*tp = ktime_to_timespec(KTIME_LOW_RES);
258259
return 0;
@@ -333,14 +334,16 @@ static __init int init_posix_timers(void)
333334
posix_timers_register_clock(CLOCK_REALTIME, &clock_realtime);
334335
posix_timers_register_clock(CLOCK_MONOTONIC, &clock_monotonic);
335336
posix_timers_register_clock(CLOCK_MONOTONIC_RAW, &clock_monotonic_raw);
336-
posix_timers_register_clock(CLOCK_REALTIME_COARSE, &clock_realtime_coarse);
337-
posix_timers_register_clock(CLOCK_MONOTONIC_COARSE, &clock_monotonic_coarse);
337+
posix_timers_register_clock(CLOCK_REALTIME_COARSE,
338+
&clock_realtime_coarse);
339+
posix_timers_register_clock(CLOCK_MONOTONIC_COARSE,
340+
&clock_monotonic_coarse);
338341
posix_timers_register_clock(CLOCK_BOOTTIME, &clock_boottime);
339342
posix_timers_register_clock(CLOCK_TAI, &clock_tai);
340343

341344
posix_timers_cache = kmem_cache_create("posix_timers_cache",
342-
sizeof (struct k_itimer), 0, SLAB_PANIC,
343-
NULL);
345+
sizeof (struct k_itimer), 0,
346+
SLAB_PANIC, NULL);
344347
return 0;
345348
}
346349

@@ -494,11 +497,11 @@ static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer)
494497
return ret;
495498
}
496499

497-
static struct pid *good_sigevent(sigevent_t * event)
500+
static struct pid *good_sigevent(sigevent_t *event)
498501
{
499502
struct task_struct *rtn = current->group_leader;
500503

501-
if ((event->sigev_notify & SIGEV_THREAD_ID ) &&
504+
if ((event->sigev_notify & SIGEV_THREAD_ID) &&
502505
(!(rtn = find_task_by_vpid(event->sigev_notify_thread_id)) ||
503506
!same_thread_group(rtn, current) ||
504507
(event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL))
@@ -515,18 +518,18 @@ void posix_timers_register_clock(const clockid_t clock_id,
515518
struct k_clock *new_clock)
516519
{
517520
if ((unsigned) clock_id >= MAX_CLOCKS) {
518-
printk(KERN_WARNING "POSIX clock register failed for clock_id %d\n",
521+
pr_warn("POSIX clock register failed for clock_id %d\n",
519522
clock_id);
520523
return;
521524
}
522525

523526
if (!new_clock->clock_get) {
524-
printk(KERN_WARNING "POSIX clock id %d lacks clock_get()\n",
527+
pr_warn("POSIX clock id %d lacks clock_get()\n",
525528
clock_id);
526529
return;
527530
}
528531
if (!new_clock->clock_getres) {
529-
printk(KERN_WARNING "POSIX clock id %d lacks clock_getres()\n",
532+
pr_warn("POSIX clock id %d lacks clock_getres()\n",
530533
clock_id);
531534
return;
532535
}
@@ -535,7 +538,7 @@ void posix_timers_register_clock(const clockid_t clock_id,
535538
}
536539
EXPORT_SYMBOL_GPL(posix_timers_register_clock);
537540

538-
static struct k_itimer * alloc_posix_timer(void)
541+
static struct k_itimer *alloc_posix_timer(void)
539542
{
540543
struct k_itimer *tmr;
541544
tmr = kmem_cache_zalloc(posix_timers_cache, GFP_KERNEL);
@@ -622,7 +625,7 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
622625
new_timer->it_overrun = -1;
623626

624627
if (timer_event_spec) {
625-
if (copy_from_user(&event, timer_event_spec, sizeof (event))) {
628+
if (copy_from_user(&event, timer_event_spec, sizeof(event))) {
626629
error = -EFAULT;
627630
goto out;
628631
}
@@ -647,7 +650,7 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
647650
new_timer->sigq->info.si_code = SI_TIMER;
648651

649652
if (copy_to_user(created_timer_id,
650-
&new_timer_id, sizeof (new_timer_id))) {
653+
&new_timer_id, sizeof(new_timer_id))) {
651654
error = -EFAULT;
652655
goto out;
653656
}
@@ -748,7 +751,8 @@ common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
748751
*/
749752
if (iv.tv64 && (timr->it_requeue_pending & REQUEUE_PENDING ||
750753
(timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE))
751-
timr->it_overrun += (unsigned int) hrtimer_forward(timer, now, iv);
754+
timr->it_overrun += (unsigned int) hrtimer_forward(timer, now,
755+
iv);
752756

753757
remaining = ktime_sub(hrtimer_get_expires(timer), now);
754758
/* Return 0 only, when the timer is expired and not pending */
@@ -785,7 +789,7 @@ SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
785789

786790
unlock_timer(timr, flags);
787791

788-
if (!ret && copy_to_user(setting, &cur_setting, sizeof (cur_setting)))
792+
if (!ret && copy_to_user(setting, &cur_setting, sizeof(cur_setting)))
789793
return -EFAULT;
790794

791795
return ret;
@@ -837,7 +841,7 @@ common_timer_set(struct k_itimer *timr, int flags,
837841
if (hrtimer_try_to_cancel(timer) < 0)
838842
return TIMER_RETRY;
839843

840-
timr->it_requeue_pending = (timr->it_requeue_pending + 2) &
844+
timr->it_requeue_pending = (timr->it_requeue_pending + 2) &
841845
~REQUEUE_PENDING;
842846
timr->it_overrun_last = 0;
843847

@@ -857,9 +861,8 @@ common_timer_set(struct k_itimer *timr, int flags,
857861
/* SIGEV_NONE timers are not queued ! See common_timer_get */
858862
if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) {
859863
/* Setup correct expiry time for relative timers */
860-
if (mode == HRTIMER_MODE_REL) {
864+
if (mode == HRTIMER_MODE_REL)
861865
hrtimer_add_expires(timer, timer->base->get_time());
862-
}
863866
return 0;
864867
}
865868

@@ -882,7 +885,7 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
882885
if (!new_setting)
883886
return -EINVAL;
884887

885-
if (copy_from_user(&new_spec, new_setting, sizeof (new_spec)))
888+
if (copy_from_user(&new_spec, new_setting, sizeof(new_spec)))
886889
return -EFAULT;
887890

888891
if (!timespec_valid(&new_spec.it_interval) ||
@@ -901,12 +904,12 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
901904

902905
unlock_timer(timr, flag);
903906
if (error == TIMER_RETRY) {
904-
rtn = NULL; // We already got the old time...
907+
rtn = NULL; /* We already got the old time... */
905908
goto retry;
906909
}
907910

908911
if (old_setting && !error &&
909-
copy_to_user(old_setting, &old_spec, sizeof (old_spec)))
912+
copy_to_user(old_setting, &old_spec, sizeof(old_spec)))
910913
error = -EFAULT;
911914

912915
return error;
@@ -1008,14 +1011,14 @@ SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
10081011
if (!kc || !kc->clock_set)
10091012
return -EINVAL;
10101013

1011-
if (copy_from_user(&new_tp, tp, sizeof (*tp)))
1014+
if (copy_from_user(&new_tp, tp, sizeof(*tp)))
10121015
return -EFAULT;
10131016

10141017
return kc->clock_set(which_clock, &new_tp);
10151018
}
10161019

10171020
SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
1018-
struct timespec __user *,tp)
1021+
struct timespec __user *, tp)
10191022
{
10201023
struct k_clock *kc = clockid_to_kclock(which_clock);
10211024
struct timespec kernel_tp;
@@ -1026,7 +1029,7 @@ SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
10261029

10271030
error = kc->clock_get(which_clock, &kernel_tp);
10281031

1029-
if (!error && copy_to_user(tp, &kernel_tp, sizeof (kernel_tp)))
1032+
if (!error && copy_to_user(tp, &kernel_tp, sizeof(kernel_tp)))
10301033
error = -EFAULT;
10311034

10321035
return error;
@@ -1067,7 +1070,7 @@ SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock,
10671070

10681071
error = kc->clock_getres(which_clock, &rtn_tp);
10691072

1070-
if (!error && tp && copy_to_user(tp, &rtn_tp, sizeof (rtn_tp)))
1073+
if (!error && tp && copy_to_user(tp, &rtn_tp, sizeof(rtn_tp)))
10711074
error = -EFAULT;
10721075

10731076
return error;
@@ -1096,7 +1099,7 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
10961099
if (!kc->nsleep)
10971100
return -ENANOSLEEP_NOTSUP;
10981101

1099-
if (copy_from_user(&t, rqtp, sizeof (struct timespec)))
1102+
if (copy_from_user(&t, rqtp, sizeof(struct timespec)))
11001103
return -EFAULT;
11011104

11021105
if (!timespec_valid(&t))

0 commit comments

Comments
 (0)