From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753138Ab1BAVeO (ORCPT ); Tue, 1 Feb 2011 16:34:14 -0500 Received: from www.tglx.de ([62.245.132.106]:60709 "EHLO www.tglx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752731Ab1BAVeN (ORCPT ); Tue, 1 Feb 2011 16:34:13 -0500 Date: Tue, 1 Feb 2011 22:33:58 +0100 (CET) From: Thomas Gleixner To: John Stultz cc: LKML , Richard Cochran , Ingo Molnar , Peter Zijlstra Subject: Re: [patch 20/28] posix-timers: Make posix-cpu-timers functions static In-Reply-To: <1296595690.3336.66.camel@work-vm> Message-ID: References: <20110201134320.688829863@linutronix.de> <20110201134419.389755466@linutronix.de> <1296595690.3336.66.camel@work-vm> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > Cc: John Stultz > > Cc: Richard Cochran > > 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