[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.1102012232511.31804@localhost6.localdomain6>
Date: Tue, 1 Feb 2011 22:33:58 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: John Stultz <john.stultz@...aro.org>
cc: LKML <linux-kernel@...r.kernel.org>,
Richard Cochran <richard.cochran@...cron.at>,
Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [patch 20/28] posix-timers: Make posix-cpu-timers functions
static
On Tue, 1 Feb 2011, John Stultz wrote:
> On Tue, 2011-02-01 at 13:52 +0000, Thomas Gleixner wrote:
> > plain text document attachment
> > (posix-timer-make-posix-cpu-timer-functions-static.patch)
> > All functions are accessed via clock_posix_cpu now. So make them static.
> >
> > Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> > Cc: John Stultz <john.stultz@...aro.org>
> > Cc: Richard Cochran <richard.cochran@...cron.at>
>
> This patch seems to have more then just making functions static in it.
>
> > @@ -1481,68 +1483,67 @@ static int do_cpu_nanosleep(const clocki
> > return error;
> > }
> >
> > -int posix_cpu_nsleep(const clockid_t which_clock, int flags,
> > - struct timespec *rqtp, struct timespec __user *rmtp)
> > +static long posix_cpu_nsleep_restart(struct restart_block *restart_block)
> > {
> > - struct restart_block *restart_block =
> > - ¤t_thread_info()->restart_block;
> > + clockid_t which_clock = restart_block->nanosleep.index;
> > + struct timespec t;
> > struct itimerspec it;
> > int error;
> >
> > - /*
> > - * Diagnose required errors first.
> > - */
> > - if (CPUCLOCK_PERTHREAD(which_clock) &&
> > - (CPUCLOCK_PID(which_clock) == 0 ||
> > - CPUCLOCK_PID(which_clock) == current->pid))
> > - return -EINVAL;
> > + t = ns_to_timespec(restart_block->nanosleep.expires);
> >
> > - error = do_cpu_nanosleep(which_clock, flags, rqtp, &it);
> > + error = do_cpu_nanosleep(which_clock, TIMER_ABSTIME, &t, &it);
> >
> > if (error == -ERESTART_RESTARTBLOCK) {
> > -
> > - if (flags & TIMER_ABSTIME)
> > - return -ERESTARTNOHAND;
> > + struct timespec __user *rmtp = restart_block->nanosleep.rmtp;
> > /*
> > * Report back to the user the time still remaining.
> > */
> > if (rmtp && copy_to_user(rmtp, &it.it_value, sizeof *rmtp))
> > return -EFAULT;
> >
> > - restart_block->fn = posix_cpu_nsleep_restart;
> > - restart_block->nanosleep.index = which_clock;
> > - restart_block->nanosleep.rmtp = rmtp;
> > - restart_block->nanosleep.expires = timespec_to_ns(rqtp);
> > + restart_block->nanosleep.expires = timespec_to_ns(&t);
> > }
> > return error;
> > +
> > }
> >
> > -long posix_cpu_nsleep_restart(struct restart_block *restart_block)
> > +static int posix_cpu_nsleep(const clockid_t which_clock, int flags,
> > + struct timespec *rqtp, struct timespec __user *rmtp)
> > {
> > - clockid_t which_clock = restart_block->nanosleep.index;
> > - struct timespec t;
> > + struct restart_block *restart_block =
> > + ¤t_thread_info()->restart_block;
> > struct itimerspec it;
> > int error;
> >
> > - t = ns_to_timespec(restart_block->nanosleep.expires);
> > + /*
> > + * Diagnose required errors first.
> > + */
> > + if (CPUCLOCK_PERTHREAD(which_clock) &&
> > + (CPUCLOCK_PID(which_clock) == 0 ||
> > + CPUCLOCK_PID(which_clock) == current->pid))
> > + return -EINVAL;
> >
> > - error = do_cpu_nanosleep(which_clock, TIMER_ABSTIME, &t, &it);
> > + error = do_cpu_nanosleep(which_clock, flags, rqtp, &it);
> >
> > if (error == -ERESTART_RESTARTBLOCK) {
> > - struct timespec __user *rmtp = restart_block->nanosleep.rmtp;
> > +
> > + if (flags & TIMER_ABSTIME)
> > + return -ERESTARTNOHAND;
> > /*
> > * Report back to the user the time still remaining.
> > */
> > if (rmtp && copy_to_user(rmtp, &it.it_value, sizeof *rmtp))
> > return -EFAULT;
> >
> > - restart_block->nanosleep.expires = timespec_to_ns(&t);
> > + restart_block->fn = posix_cpu_nsleep_restart;
> > + restart_block->nanosleep.index = which_clock;
> > + restart_block->nanosleep.rmtp = rmtp;
> > + restart_block->nanosleep.expires = timespec_to_ns(rqtp);
> > }
> > return error;
> > -
> > }
>
> Maybe split that out?
I just moved the restart function above nanosleep to avoid the forward
declaration, but patch deciced to make it more complex. I'll stick
with the forward declaration.
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists