* [PATCH 02/13] hrtimer: remove useless const
@ 2006-02-13 1:09 Roman Zippel
2006-02-13 11:28 ` Thomas Gleixner
0 siblings, 1 reply; 18+ messages in thread
From: Roman Zippel @ 2006-02-13 1:09 UTC (permalink / raw)
To: Andrew Morton, tglx, linux-kernel
A const for arguments which are passed by value is completely ignored by
gcc. It has only an effect on local variables and even here gcc doesn't
need it either to produce better code.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
---
include/linux/hrtimer.h | 8 +++----
include/linux/jiffies.h | 12 +++++-----
include/linux/ktime.h | 22 +++++++++----------
include/linux/posix-timers.h | 22 +++++++++----------
include/linux/time.h | 10 ++++----
kernel/hrtimer.c | 14 ++++++------
kernel/posix-cpu-timers.c | 48 +++++++++++++++++++++----------------------
kernel/posix-timers.c | 26 +++++++++++------------
kernel/time.c | 10 ++++----
9 files changed, 86 insertions(+), 86 deletions(-)
Index: linux-2.6-git/include/linux/hrtimer.h
===================================================================
--- linux-2.6-git.orig/include/linux/hrtimer.h 2006-02-12 18:32:48.000000000 +0100
+++ linux-2.6-git/include/linux/hrtimer.h 2006-02-12 18:33:07.000000000 +0100
@@ -106,7 +106,7 @@ extern void hrtimer_init(struct hrtimer
/* Basic timer operations: */
extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
- const enum hrtimer_mode mode);
+ enum hrtimer_mode mode);
extern int hrtimer_cancel(struct hrtimer *timer);
extern int hrtimer_try_to_cancel(struct hrtimer *timer);
@@ -114,7 +114,7 @@ extern int hrtimer_try_to_cancel(struct
/* Query timers: */
extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer);
-extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp);
+extern int hrtimer_get_res(clockid_t which_clock, struct timespec *tp);
static inline int hrtimer_active(const struct hrtimer *timer)
{
@@ -127,8 +127,8 @@ extern unsigned long hrtimer_forward(str
/* Precise sleep: */
extern long hrtimer_nanosleep(struct timespec *rqtp,
struct timespec __user *rmtp,
- const enum hrtimer_mode mode,
- const clockid_t clockid);
+ enum hrtimer_mode mode,
+ clockid_t clockid);
/* Soft interrupt function to run the hrtimer queues: */
extern void hrtimer_run_queues(void);
Index: linux-2.6-git/include/linux/jiffies.h
===================================================================
--- linux-2.6-git.orig/include/linux/jiffies.h 2006-02-12 18:32:48.000000000 +0100
+++ linux-2.6-git/include/linux/jiffies.h 2006-02-12 18:33:07.000000000 +0100
@@ -243,7 +243,7 @@ static inline u64 get_jiffies_64(void)
* Avoid unnecessary multiplications/divisions in the
* two most common HZ cases:
*/
-static inline unsigned int jiffies_to_msecs(const unsigned long j)
+static inline unsigned int jiffies_to_msecs(unsigned long j)
{
#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
return (MSEC_PER_SEC / HZ) * j;
@@ -254,7 +254,7 @@ static inline unsigned int jiffies_to_ms
#endif
}
-static inline unsigned int jiffies_to_usecs(const unsigned long j)
+static inline unsigned int jiffies_to_usecs(unsigned long j)
{
#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)
return (USEC_PER_SEC / HZ) * j;
@@ -265,7 +265,7 @@ static inline unsigned int jiffies_to_us
#endif
}
-static inline unsigned long msecs_to_jiffies(const unsigned int m)
+static inline unsigned long msecs_to_jiffies(unsigned int m)
{
if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
return MAX_JIFFY_OFFSET;
@@ -278,7 +278,7 @@ static inline unsigned long msecs_to_jif
#endif
}
-static inline unsigned long usecs_to_jiffies(const unsigned int u)
+static inline unsigned long usecs_to_jiffies(unsigned int u)
{
if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET))
return MAX_JIFFY_OFFSET;
@@ -319,7 +319,7 @@ timespec_to_jiffies(const struct timespe
}
static __inline__ void
-jiffies_to_timespec(const unsigned long jiffies, struct timespec *value)
+jiffies_to_timespec(unsigned long jiffies, struct timespec *value)
{
/*
* Convert jiffies to nanoseconds and separate with
@@ -357,7 +357,7 @@ timeval_to_jiffies(const struct timeval
}
static __inline__ void
-jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
+jiffies_to_timeval(unsigned long jiffies, struct timeval *value)
{
/*
* Convert jiffies to nanoseconds and separate with
Index: linux-2.6-git/include/linux/ktime.h
===================================================================
--- linux-2.6-git.orig/include/linux/ktime.h 2006-02-12 18:32:48.000000000 +0100
+++ linux-2.6-git/include/linux/ktime.h 2006-02-12 18:33:07.000000000 +0100
@@ -75,7 +75,7 @@ typedef union {
*
* Return the ktime_t representation of the value
*/
-static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
+static inline ktime_t ktime_set(long secs, unsigned long nsecs)
{
return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs };
}
@@ -134,7 +134,7 @@ static inline ktime_t ktime_set(const lo
#define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 }
/* Set a ktime_t variable to a value in sec/nsec representation: */
-static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
+static inline ktime_t ktime_set(long secs, unsigned long nsecs)
{
return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
}
@@ -147,7 +147,7 @@ static inline ktime_t ktime_set(const lo
*
* Returns the remainder of the substraction
*/
-static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
+static inline ktime_t ktime_sub(ktime_t lhs, ktime_t rhs)
{
ktime_t res;
@@ -166,7 +166,7 @@ static inline ktime_t ktime_sub(const kt
*
* Returns the sum of addend1 and addend2
*/
-static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
+static inline ktime_t ktime_add(ktime_t add1, ktime_t add2)
{
ktime_t res;
@@ -193,7 +193,7 @@ static inline ktime_t ktime_add(const kt
*
* Returns the sum of kt and nsec in ktime_t format
*/
-extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
+extern ktime_t ktime_add_ns(ktime_t kt, u64 nsec);
/**
* timespec_to_ktime - convert a timespec to ktime_t format
@@ -202,7 +202,7 @@ extern ktime_t ktime_add_ns(const ktime_
*
* Returns a ktime_t variable with the converted timespec value
*/
-static inline ktime_t timespec_to_ktime(const struct timespec ts)
+static inline ktime_t timespec_to_ktime(struct timespec ts)
{
return (ktime_t) { .tv = { .sec = (s32)ts.tv_sec,
.nsec = (s32)ts.tv_nsec } };
@@ -215,7 +215,7 @@ static inline ktime_t timespec_to_ktime(
*
* Returns a ktime_t variable with the converted timeval value
*/
-static inline ktime_t timeval_to_ktime(const struct timeval tv)
+static inline ktime_t timeval_to_ktime(struct timeval tv)
{
return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec,
.nsec = (s32)tv.tv_usec * 1000 } };
@@ -228,7 +228,7 @@ static inline ktime_t timeval_to_ktime(c
*
* Returns the timespec representation of the ktime value
*/
-static inline struct timespec ktime_to_timespec(const ktime_t kt)
+static inline struct timespec ktime_to_timespec(ktime_t kt)
{
return (struct timespec) { .tv_sec = (time_t) kt.tv.sec,
.tv_nsec = (long) kt.tv.nsec };
@@ -241,7 +241,7 @@ static inline struct timespec ktime_to_t
*
* Returns the timeval representation of the ktime value
*/
-static inline struct timeval ktime_to_timeval(const ktime_t kt)
+static inline struct timeval ktime_to_timeval(ktime_t kt)
{
return (struct timeval) {
.tv_sec = (time_t) kt.tv.sec,
@@ -254,7 +254,7 @@ static inline struct timeval ktime_to_ti
*
* Returns a clock_t variable with the converted value
*/
-static inline clock_t ktime_to_clock_t(const ktime_t kt)
+static inline clock_t ktime_to_clock_t(ktime_t kt)
{
return nsec_to_clock_t( (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec);
}
@@ -265,7 +265,7 @@ static inline clock_t ktime_to_clock_t(c
*
* Returns the scalar nanoseconds representation of kt
*/
-static inline u64 ktime_to_ns(const ktime_t kt)
+static inline u64 ktime_to_ns(ktime_t kt)
{
return (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
}
Index: linux-2.6-git/include/linux/posix-timers.h
===================================================================
--- linux-2.6-git.orig/include/linux/posix-timers.h 2006-02-12 18:32:48.000000000 +0100
+++ linux-2.6-git/include/linux/posix-timers.h 2006-02-12 18:33:07.000000000 +0100
@@ -66,11 +66,11 @@ struct k_itimer {
struct k_clock {
int res; /* in nanoseconds */
- int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
- int (*clock_set) (const clockid_t which_clock, struct timespec * tp);
- int (*clock_get) (const clockid_t which_clock, struct timespec * tp);
+ int (*clock_getres) (clockid_t which_clock, struct timespec *tp);
+ int (*clock_set) (clockid_t which_clock, struct timespec * tp);
+ int (*clock_get) (clockid_t which_clock, struct timespec * tp);
int (*timer_create) (struct k_itimer *timer);
- int (*nsleep) (const clockid_t which_clock, int flags,
+ int (*nsleep) (clockid_t which_clock, int flags,
struct timespec *, struct timespec __user *);
int (*timer_set) (struct k_itimer * timr, int flags,
struct itimerspec * new_setting,
@@ -81,21 +81,21 @@ struct k_clock {
struct itimerspec * cur_setting);
};
-void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock);
+void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock);
/* error handlers for timer_create, nanosleep and settime */
-int do_posix_clock_nonanosleep(const clockid_t, int flags, struct timespec *,
+int do_posix_clock_nonanosleep(clockid_t, int flags, struct timespec *,
struct timespec __user *);
-int do_posix_clock_nosettime(const clockid_t, struct timespec *tp);
+int do_posix_clock_nosettime(clockid_t, struct timespec *tp);
/* function to call to trigger timer event */
int posix_timer_event(struct k_itimer *timr, int si_private);
-int posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *ts);
-int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *ts);
-int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts);
+int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *ts);
+int posix_cpu_clock_get(clockid_t which_clock, struct timespec *ts);
+int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *ts);
int posix_cpu_timer_create(struct k_itimer *timer);
-int posix_cpu_nsleep(const clockid_t which_clock, int flags,
+int posix_cpu_nsleep(clockid_t which_clock, int flags,
struct timespec *rqtp, struct timespec __user *rmtp);
int posix_cpu_timer_set(struct k_itimer *timer, int flags,
struct itimerspec *new, struct itimerspec *old);
Index: linux-2.6-git/include/linux/time.h
===================================================================
--- linux-2.6-git.orig/include/linux/time.h 2006-02-12 18:32:48.000000000 +0100
+++ linux-2.6-git/include/linux/time.h 2006-02-12 18:33:07.000000000 +0100
@@ -61,9 +61,9 @@ static inline int timeval_compare(struct
return lhs->tv_usec - rhs->tv_usec;
}
-extern unsigned long mktime(const unsigned int year, const unsigned int mon,
- const unsigned int day, const unsigned int hour,
- const unsigned int min, const unsigned int sec);
+extern unsigned long mktime(unsigned int year, unsigned int mon,
+ unsigned int day, unsigned int hour,
+ unsigned int min, unsigned int sec);
extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
@@ -137,7 +137,7 @@ static inline nsec_t timeval_to_ns(const
*
* Returns the timespec representation of the nsec parameter.
*/
-extern struct timespec ns_to_timespec(const nsec_t nsec);
+extern struct timespec ns_to_timespec(nsec_t nsec);
/**
* ns_to_timeval - Convert nanoseconds to timeval
@@ -145,7 +145,7 @@ extern struct timespec ns_to_timespec(co
*
* Returns the timeval representation of the nsec parameter.
*/
-extern struct timeval ns_to_timeval(const nsec_t nsec);
+extern struct timeval ns_to_timeval(nsec_t nsec);
#endif /* __KERNEL__ */
Index: linux-2.6-git/kernel/hrtimer.c
===================================================================
--- linux-2.6-git.orig/kernel/hrtimer.c 2006-02-12 18:32:57.000000000 +0100
+++ linux-2.6-git/kernel/hrtimer.c 2006-02-12 18:33:07.000000000 +0100
@@ -224,7 +224,7 @@ lock_hrtimer_base(const struct hrtimer *
*
* Returns the sum of kt and nsec in ktime_t format
*/
-ktime_t ktime_add_ns(const ktime_t kt, u64 nsec)
+ktime_t ktime_add_ns(ktime_t kt, u64 nsec)
{
ktime_t tmp;
@@ -246,7 +246,7 @@ ktime_t ktime_add_ns(const ktime_t kt, u
/*
* Divide a ktime value by a nanosecond value
*/
-static unsigned long ktime_divns(const ktime_t kt, nsec_t div)
+static unsigned long ktime_divns(ktime_t kt, nsec_t div)
{
u64 dclc, inc, dns;
int sft = 0;
@@ -404,7 +404,7 @@ remove_hrtimer(struct hrtimer *timer, st
* 1 when the timer was active
*/
int
-hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
+hrtimer_start(struct hrtimer *timer, ktime_t tim, enum hrtimer_mode mode)
{
struct hrtimer_base *base, *new_base;
unsigned long flags;
@@ -526,7 +526,7 @@ void hrtimer_init(struct hrtimer *timer,
* Store the resolution of the clock selected by which_clock in the
* variable pointed to by tp.
*/
-int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp)
+int hrtimer_get_res(clockid_t which_clock, struct timespec *tp)
{
struct hrtimer_base *bases;
@@ -626,7 +626,7 @@ void hrtimer_run_queues(void)
* routine returns.
*/
static ktime_t __sched
-schedule_hrtimer(struct hrtimer *timer, const enum hrtimer_mode mode)
+schedule_hrtimer(struct hrtimer *timer, enum hrtimer_mode mode)
{
/* fn stays NULL, meaning single-shot wakeup: */
timer->data = current;
@@ -645,7 +645,7 @@ schedule_hrtimer(struct hrtimer *timer,
static inline ktime_t __sched
schedule_hrtimer_interruptible(struct hrtimer *timer,
- const enum hrtimer_mode mode)
+ enum hrtimer_mode mode)
{
set_current_state(TASK_INTERRUPTIBLE);
@@ -683,7 +683,7 @@ static long __sched nanosleep_restart(st
}
long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
- const enum hrtimer_mode mode, const clockid_t clockid)
+ enum hrtimer_mode mode, clockid_t clockid)
{
struct restart_block *restart;
struct hrtimer timer;
Index: linux-2.6-git/kernel/posix-cpu-timers.c
===================================================================
--- linux-2.6-git.orig/kernel/posix-cpu-timers.c 2006-02-12 18:32:48.000000000 +0100
+++ linux-2.6-git/kernel/posix-cpu-timers.c 2006-02-12 18:33:07.000000000 +0100
@@ -7,11 +7,11 @@
#include <asm/uaccess.h>
#include <linux/errno.h>
-static int check_clock(const clockid_t which_clock)
+static int check_clock(clockid_t which_clock)
{
int error = 0;
struct task_struct *p;
- const pid_t pid = CPUCLOCK_PID(which_clock);
+ pid_t pid = CPUCLOCK_PID(which_clock);
if (CPUCLOCK_WHICH(which_clock) >= CPUCLOCK_MAX)
return -EINVAL;
@@ -31,7 +31,7 @@ static int check_clock(const clockid_t w
}
static inline union cpu_time_count
-timespec_to_sample(const clockid_t which_clock, const struct timespec *tp)
+timespec_to_sample(clockid_t which_clock, const struct timespec *tp)
{
union cpu_time_count ret;
ret.sched = 0; /* high half always zero when .cpu used */
@@ -43,7 +43,7 @@ timespec_to_sample(const clockid_t which
return ret;
}
-static void sample_to_timespec(const clockid_t which_clock,
+static void sample_to_timespec(clockid_t which_clock,
union cpu_time_count cpu,
struct timespec *tp)
{
@@ -55,7 +55,7 @@ static void sample_to_timespec(const clo
}
}
-static inline int cpu_time_before(const clockid_t which_clock,
+static inline int cpu_time_before(clockid_t which_clock,
union cpu_time_count now,
union cpu_time_count then)
{
@@ -65,7 +65,7 @@ static inline int cpu_time_before(const
return cputime_lt(now.cpu, then.cpu);
}
}
-static inline void cpu_time_add(const clockid_t which_clock,
+static inline void cpu_time_add(clockid_t which_clock,
union cpu_time_count *acc,
union cpu_time_count val)
{
@@ -75,7 +75,7 @@ static inline void cpu_time_add(const cl
acc->cpu = cputime_add(acc->cpu, val.cpu);
}
}
-static inline union cpu_time_count cpu_time_sub(const clockid_t which_clock,
+static inline union cpu_time_count cpu_time_sub(clockid_t which_clock,
union cpu_time_count a,
union cpu_time_count b)
{
@@ -151,7 +151,7 @@ static inline unsigned long long sched_n
return (p == current) ? current_sched_time(p) : p->sched_time;
}
-int posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *tp)
+int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *tp)
{
int error = check_clock(which_clock);
if (!error) {
@@ -169,7 +169,7 @@ int posix_cpu_clock_getres(const clockid
return error;
}
-int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *tp)
+int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *tp)
{
/*
* You can never reset a CPU clock, but we check for other errors
@@ -186,7 +186,7 @@ int posix_cpu_clock_set(const clockid_t
/*
* Sample a per-thread clock for the given task.
*/
-static int cpu_clock_sample(const clockid_t which_clock, struct task_struct *p,
+static int cpu_clock_sample(clockid_t which_clock, struct task_struct *p,
union cpu_time_count *cpu)
{
switch (CPUCLOCK_WHICH(which_clock)) {
@@ -248,7 +248,7 @@ static int cpu_clock_sample_group_locked
* Sample a process (thread group) clock for the given group_leader task.
* Must be called with tasklist_lock held for reading.
*/
-static int cpu_clock_sample_group(const clockid_t which_clock,
+static int cpu_clock_sample_group(clockid_t which_clock,
struct task_struct *p,
union cpu_time_count *cpu)
{
@@ -262,9 +262,9 @@ static int cpu_clock_sample_group(const
}
-int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *tp)
+int posix_cpu_clock_get(clockid_t which_clock, struct timespec *tp)
{
- const pid_t pid = CPUCLOCK_PID(which_clock);
+ pid_t pid = CPUCLOCK_PID(which_clock);
int error = -EINVAL;
union cpu_time_count rtn;
@@ -321,7 +321,7 @@ int posix_cpu_clock_get(const clockid_t
int posix_cpu_timer_create(struct k_itimer *new_timer)
{
int ret = 0;
- const pid_t pid = CPUCLOCK_PID(new_timer->it_clock);
+ pid_t pid = CPUCLOCK_PID(new_timer->it_clock);
struct task_struct *p;
if (CPUCLOCK_WHICH(new_timer->it_clock) >= CPUCLOCK_MAX)
@@ -551,7 +551,7 @@ static void arm_timer(struct k_itimer *t
{
struct task_struct *p = timer->it.cpu.task;
struct list_head *head, *listpos;
- struct cpu_timer_list *const nt = &timer->it.cpu;
+ struct cpu_timer_list *nt = &timer->it.cpu;
struct cpu_timer_list *next;
unsigned long i;
@@ -1006,7 +1006,7 @@ static void check_process_timers(struct
struct list_head *firing)
{
int maxfire;
- struct signal_struct *const sig = tsk->signal;
+ struct signal_struct *sig = tsk->signal;
cputime_t utime, stime, ptime, virt_expires, prof_expires;
unsigned long long sched_time, sched_expires;
struct task_struct *t;
@@ -1155,7 +1155,7 @@ static void check_process_timers(struct
cputime_t prof_left, virt_left, ticks;
unsigned long long sched_left, sched;
- const unsigned int nthreads = atomic_read(&sig->live);
+ unsigned int nthreads = atomic_read(&sig->live);
if (!nthreads)
return;
@@ -1399,7 +1399,7 @@ void set_process_cpu_timer(struct task_s
static long posix_cpu_clock_nanosleep_restart(struct restart_block *);
-int posix_cpu_nsleep(const clockid_t which_clock, int flags,
+int posix_cpu_nsleep(clockid_t which_clock, int flags,
struct timespec *rqtp, struct timespec __user *rmtp)
{
struct restart_block *restart_block =
@@ -1507,12 +1507,12 @@ posix_cpu_clock_nanosleep_restart(struct
#define PROCESS_CLOCK MAKE_PROCESS_CPUCLOCK(0, CPUCLOCK_SCHED)
#define THREAD_CLOCK MAKE_THREAD_CPUCLOCK(0, CPUCLOCK_SCHED)
-static int process_cpu_clock_getres(const clockid_t which_clock,
+static int process_cpu_clock_getres(clockid_t which_clock,
struct timespec *tp)
{
return posix_cpu_clock_getres(PROCESS_CLOCK, tp);
}
-static int process_cpu_clock_get(const clockid_t which_clock,
+static int process_cpu_clock_get(clockid_t which_clock,
struct timespec *tp)
{
return posix_cpu_clock_get(PROCESS_CLOCK, tp);
@@ -1522,18 +1522,18 @@ static int process_cpu_timer_create(stru
timer->it_clock = PROCESS_CLOCK;
return posix_cpu_timer_create(timer);
}
-static int process_cpu_nsleep(const clockid_t which_clock, int flags,
+static int process_cpu_nsleep(clockid_t which_clock, int flags,
struct timespec *rqtp,
struct timespec __user *rmtp)
{
return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp, rmtp);
}
-static int thread_cpu_clock_getres(const clockid_t which_clock,
+static int thread_cpu_clock_getres(clockid_t which_clock,
struct timespec *tp)
{
return posix_cpu_clock_getres(THREAD_CLOCK, tp);
}
-static int thread_cpu_clock_get(const clockid_t which_clock,
+static int thread_cpu_clock_get(clockid_t which_clock,
struct timespec *tp)
{
return posix_cpu_clock_get(THREAD_CLOCK, tp);
@@ -1543,7 +1543,7 @@ static int thread_cpu_timer_create(struc
timer->it_clock = THREAD_CLOCK;
return posix_cpu_timer_create(timer);
}
-static int thread_cpu_nsleep(const clockid_t which_clock, int flags,
+static int thread_cpu_nsleep(clockid_t which_clock, int flags,
struct timespec *rqtp, struct timespec __user *rmtp)
{
return -EINVAL;
Index: linux-2.6-git/kernel/posix-timers.c
===================================================================
--- linux-2.6-git.orig/kernel/posix-timers.c 2006-02-12 18:32:48.000000000 +0100
+++ linux-2.6-git/kernel/posix-timers.c 2006-02-12 18:33:07.000000000 +0100
@@ -137,7 +137,7 @@ static struct k_clock posix_clocks[MAX_C
/*
* These ones are defined below.
*/
-static int common_nsleep(const clockid_t, int flags, struct timespec *t,
+static int common_nsleep(clockid_t, int flags, struct timespec *t,
struct timespec __user *rmtp);
static void common_timer_get(struct k_itimer *, struct itimerspec *);
static int common_timer_set(struct k_itimer *, int,
@@ -169,7 +169,7 @@ static inline void unlock_timer(struct k
* the function pointer CALL in struct k_clock.
*/
-static inline int common_clock_getres(const clockid_t which_clock,
+static inline int common_clock_getres(clockid_t which_clock,
struct timespec *tp)
{
tp->tv_sec = 0;
@@ -186,7 +186,7 @@ static int common_clock_get(clockid_t wh
return 0;
}
-static inline int common_clock_set(const clockid_t which_clock,
+static inline int common_clock_set(clockid_t which_clock,
struct timespec *tp)
{
return do_sys_settimeofday(tp, NULL);
@@ -201,7 +201,7 @@ static int common_timer_create(struct k_
/*
* Return nonzero if we know a priori this clockid_t value is bogus.
*/
-static inline int invalid_clockid(const clockid_t which_clock)
+static inline int invalid_clockid(clockid_t which_clock)
{
if (which_clock < 0) /* CPU clock, posix_cpu_* will check it */
return 0;
@@ -377,7 +377,7 @@ static struct task_struct * good_sigeven
return rtn;
}
-void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock)
+void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock)
{
if ((unsigned) clock_id >= MAX_CLOCKS) {
printk("POSIX clock register failed for clock_id %d\n",
@@ -423,7 +423,7 @@ static void release_posix_timer(struct k
/* Create a POSIX.1b interval timer. */
asmlinkage long
-sys_timer_create(const clockid_t which_clock,
+sys_timer_create(clockid_t which_clock,
struct sigevent __user *timer_event_spec,
timer_t __user * created_timer_id)
{
@@ -869,13 +869,13 @@ void exit_itimers(struct signal_struct *
}
/* Not available / possible... functions */
-int do_posix_clock_nosettime(const clockid_t clockid, struct timespec *tp)
+int do_posix_clock_nosettime(clockid_t clockid, struct timespec *tp)
{
return -EINVAL;
}
EXPORT_SYMBOL_GPL(do_posix_clock_nosettime);
-int do_posix_clock_nonanosleep(const clockid_t clock, int flags,
+int do_posix_clock_nonanosleep(clockid_t clock, int flags,
struct timespec *t, struct timespec __user *r)
{
#ifndef ENOTSUP
@@ -886,7 +886,7 @@ int do_posix_clock_nonanosleep(const clo
}
EXPORT_SYMBOL_GPL(do_posix_clock_nonanosleep);
-asmlinkage long sys_clock_settime(const clockid_t which_clock,
+asmlinkage long sys_clock_settime(clockid_t which_clock,
const struct timespec __user *tp)
{
struct timespec new_tp;
@@ -900,7 +900,7 @@ asmlinkage long sys_clock_settime(const
}
asmlinkage long
-sys_clock_gettime(const clockid_t which_clock, struct timespec __user *tp)
+sys_clock_gettime(clockid_t which_clock, struct timespec __user *tp)
{
struct timespec kernel_tp;
int error;
@@ -917,7 +917,7 @@ sys_clock_gettime(const clockid_t which_
}
asmlinkage long
-sys_clock_getres(const clockid_t which_clock, struct timespec __user *tp)
+sys_clock_getres(clockid_t which_clock, struct timespec __user *tp)
{
struct timespec rtn_tp;
int error;
@@ -938,7 +938,7 @@ sys_clock_getres(const clockid_t which_c
/*
* nanosleep for monotonic and realtime clocks
*/
-static int common_nsleep(const clockid_t which_clock, int flags,
+static int common_nsleep(clockid_t which_clock, int flags,
struct timespec *tsave, struct timespec __user *rmtp)
{
return hrtimer_nanosleep(tsave, rmtp, flags & TIMER_ABSTIME ?
@@ -946,7 +946,7 @@ static int common_nsleep(const clockid_t
}
asmlinkage long
-sys_clock_nanosleep(const clockid_t which_clock, int flags,
+sys_clock_nanosleep(clockid_t which_clock, int flags,
const struct timespec __user *rqtp,
struct timespec __user *rmtp)
{
Index: linux-2.6-git/kernel/time.c
===================================================================
--- linux-2.6-git.orig/kernel/time.c 2006-02-12 18:32:48.000000000 +0100
+++ linux-2.6-git/kernel/time.c 2006-02-12 18:33:07.000000000 +0100
@@ -581,9 +581,9 @@ EXPORT_SYMBOL_GPL(getnstimeofday);
* will already get problems at other places on 2038-01-19 03:14:08)
*/
unsigned long
-mktime(const unsigned int year0, const unsigned int mon0,
- const unsigned int day, const unsigned int hour,
- const unsigned int min, const unsigned int sec)
+mktime(unsigned int year0, unsigned int mon0,
+ unsigned int day, unsigned int hour,
+ unsigned int min, unsigned int sec)
{
unsigned int mon = mon0, year = year0;
@@ -637,7 +637,7 @@ void set_normalized_timespec(struct time
*
* Returns the timespec representation of the nsec parameter.
*/
-struct timespec ns_to_timespec(const nsec_t nsec)
+struct timespec ns_to_timespec(nsec_t nsec)
{
struct timespec ts;
@@ -657,7 +657,7 @@ struct timespec ns_to_timespec(const nse
*
* Returns the timeval representation of the nsec parameter.
*/
-struct timeval ns_to_timeval(const nsec_t nsec)
+struct timeval ns_to_timeval(nsec_t nsec)
{
struct timespec ts = ns_to_timespec(nsec);
struct timeval tv;
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 1:09 [PATCH 02/13] hrtimer: remove useless const Roman Zippel
@ 2006-02-13 11:28 ` Thomas Gleixner
2006-02-13 11:38 ` Roman Zippel
0 siblings, 1 reply; 18+ messages in thread
From: Thomas Gleixner @ 2006-02-13 11:28 UTC (permalink / raw)
To: Roman Zippel; +Cc: Andrew Morton, linux-kernel, Ingo Molnar
On Mon, 2006-02-13 at 02:09 +0100, Roman Zippel wrote:
> A const for arguments which are passed by value is completely ignored by
> gcc. It has only an effect on local variables and even here gcc doesn't
> need it either to produce better code.
>
> Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
NACK - gcc3 produces smaller code with the const - only gcc4 fixed that,
so we want to keep these consts until gcc4 is the only compiler
supported.
Also this is neither a regression nor a bug and therefor not required
for 2.6.16.
tglx
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 11:28 ` Thomas Gleixner
@ 2006-02-13 11:38 ` Roman Zippel
2006-02-13 11:46 ` Ingo Molnar
0 siblings, 1 reply; 18+ messages in thread
From: Roman Zippel @ 2006-02-13 11:38 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: Andrew Morton, linux-kernel, Ingo Molnar
Hi,
On Mon, 13 Feb 2006, Thomas Gleixner wrote:
> > A const for arguments which are passed by value is completely ignored by
> > gcc. It has only an effect on local variables and even here gcc doesn't
> > need it either to produce better code.
>
> NACK - gcc3 produces smaller code with the const - only gcc4 fixed that
That would would be a compiler problem, these const _are_ bogus.
> Also this is neither a regression nor a bug and therefor not required
> for 2.6.16.
Well, hrtimer was merged a bit suddenly for me, so I never had a chance
for a detailed review and this patch doesn't break anything either.
bye, Roman
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 11:38 ` Roman Zippel
@ 2006-02-13 11:46 ` Ingo Molnar
2006-02-13 11:53 ` Andrew Morton
` (3 more replies)
0 siblings, 4 replies; 18+ messages in thread
From: Ingo Molnar @ 2006-02-13 11:46 UTC (permalink / raw)
To: Roman Zippel; +Cc: Thomas Gleixner, Andrew Morton, linux-kernel
* Roman Zippel <zippel@linux-m68k.org> wrote:
> On Mon, 13 Feb 2006, Thomas Gleixner wrote:
>
> > > A const for arguments which are passed by value is completely ignored by
> > > gcc. It has only an effect on local variables and even here gcc doesn't
> > > need it either to produce better code.
> >
> > NACK - gcc3 produces smaller code with the const - only gcc4 fixed that
>
> That would would be a compiler problem, these const _are_ bogus.
code size is really important for the ktime ops, so i'd keep the consts
for the time being. In any case, it's definitely not a 2.6.16 change.
> [...] and this patch doesn't break anything either.
your patch makes code larger on gcc3. Please investigate why.
Ingo
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 11:46 ` Ingo Molnar
@ 2006-02-13 11:53 ` Andrew Morton
2006-02-13 12:18 ` Roman Zippel
2006-02-13 12:09 ` Roman Zippel
` (2 subsequent siblings)
3 siblings, 1 reply; 18+ messages in thread
From: Andrew Morton @ 2006-02-13 11:53 UTC (permalink / raw)
To: Ingo Molnar; +Cc: zippel, tglx, linux-kernel
Ingo Molnar <mingo@elte.hu> wrote:
>
> your patch makes code larger on gcc3.
By 120 bytes here. I dropped the patch.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 11:46 ` Ingo Molnar
2006-02-13 11:53 ` Andrew Morton
@ 2006-02-13 12:09 ` Roman Zippel
2006-02-13 12:26 ` Roman Zippel
2006-02-13 15:54 ` Roman Zippel
3 siblings, 0 replies; 18+ messages in thread
From: Roman Zippel @ 2006-02-13 12:09 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Thomas Gleixner, Andrew Morton, linux-kernel
Hi,
On Mon, 13 Feb 2006, Ingo Molnar wrote:
> > That would would be a compiler problem, these const _are_ bogus.
>
> code size is really important for the ktime ops, so i'd keep the consts
> for the time being. In any case, it's definitely not a 2.6.16 change.
I checked with gcc-3.3 and before the patch:
$ size kernel/built-in.o
text data bss dec hex filename
197342 48061 44896 290299 46dfb kernel/built-in.o
After the patch:
$ size kernel/built-in.o
text data bss dec hex filename
197346 48061 44896 290303 46dff kernel/built-in.o
Impressive savings...
bye, Roman
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 11:53 ` Andrew Morton
@ 2006-02-13 12:18 ` Roman Zippel
2006-02-13 12:30 ` Andrew Morton
0 siblings, 1 reply; 18+ messages in thread
From: Roman Zippel @ 2006-02-13 12:18 UTC (permalink / raw)
To: Andrew Morton; +Cc: Ingo Molnar, tglx, linux-kernel
Hi,
On Mon, 13 Feb 2006, Andrew Morton wrote:
> Ingo Molnar <mingo@elte.hu> wrote:
> >
> > your patch makes code larger on gcc3.
>
> By 120 bytes here. I dropped the patch.
Is this really worth it? This _is_ a compiler problem, are we going to add
now const everywhere to work around a (small) compiler problem, which is
already fixed in newer versions?
bye, Roman
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 11:46 ` Ingo Molnar
2006-02-13 11:53 ` Andrew Morton
2006-02-13 12:09 ` Roman Zippel
@ 2006-02-13 12:26 ` Roman Zippel
2006-02-13 15:54 ` Roman Zippel
3 siblings, 0 replies; 18+ messages in thread
From: Roman Zippel @ 2006-02-13 12:26 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Thomas Gleixner, Andrew Morton, linux-kernel
Hi,
On Mon, 13 Feb 2006, Ingo Molnar wrote:
> > [...] and this patch doesn't break anything either.
>
> your patch makes code larger on gcc3. Please investigate why.
The size change can actually go either way:
@@ -1826,7 +1826,7 @@
00000000 w F .text 00000006 sys_mq_timedsend
00000000 *UND* 00000000 __per_cpu_offset
00000000 *UND* 00000000 cpu_gdt_descr
-00000000 g F .text 0000004f posix_cpu_clock_getres
+00000000 g F .text 00000049 posix_cpu_clock_getres
00000000 g F .text 00000006 do_posix_clock_nonanosleep
00000000 g F .text 00000020 idle_cpu
00000000 g F .text 00000030 sys_chown16
@@ -2081,7 +2081,7 @@
00000000 w F .text 00000006 sys_epoll_ctl
00000000 g F .text 00000005 sys_syslog
00000000 *UND* 00000000 cap_capset_check
-00000000 g F .text 00000246 posix_cpu_nsleep
+00000000 g F .text 00000251 posix_cpu_nsleep
00000000 g F .text 000000c6 sysctl_jiffies
00000000 g F .text 0000002e __wake_up_locked
00000000 *UND* 00000000 module_arch_cleanup
The const _is_ bogus.
bye, Roman
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 12:18 ` Roman Zippel
@ 2006-02-13 12:30 ` Andrew Morton
2006-02-13 12:50 ` Roman Zippel
0 siblings, 1 reply; 18+ messages in thread
From: Andrew Morton @ 2006-02-13 12:30 UTC (permalink / raw)
To: Roman Zippel; +Cc: mingo, tglx, linux-kernel
Roman Zippel <zippel@linux-m68k.org> wrote:
>
> Hi,
>
> On Mon, 13 Feb 2006, Andrew Morton wrote:
>
> > Ingo Molnar <mingo@elte.hu> wrote:
> > >
> > > your patch makes code larger on gcc3.
> >
> > By 120 bytes here. I dropped the patch.
>
> Is this really worth it? This _is_ a compiler problem, are we going to add
> now const everywhere to work around a (small) compiler problem, which is
> already fixed in newer versions?
>
Can't say I care a lot, but there doesn't seem much point in giving away
the consts now we have them, if it just produces worse code.
const arguments to functions are pretty useful for code readability and
maintainability too, if you use them consistently.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 12:30 ` Andrew Morton
@ 2006-02-13 12:50 ` Roman Zippel
2006-02-13 19:52 ` Andrew Morton
0 siblings, 1 reply; 18+ messages in thread
From: Roman Zippel @ 2006-02-13 12:50 UTC (permalink / raw)
To: Andrew Morton; +Cc: mingo, tglx, linux-kernel
Hi,
On Mon, 13 Feb 2006, Andrew Morton wrote:
> const arguments to functions are pretty useful for code readability and
> maintainability too, if you use them consistently.
I could understand that argument, if gcc would warn about it in any way.
The const in function prototypes are completely useless and have no effect
on the compiler output. Only for the local variables it seems to make a
small difference with gcc3, but even here AFAICT only for already complex
functions.
bye, Roman
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 11:46 ` Ingo Molnar
` (2 preceding siblings ...)
2006-02-13 12:26 ` Roman Zippel
@ 2006-02-13 15:54 ` Roman Zippel
2006-02-13 20:35 ` Andrew Morton
3 siblings, 1 reply; 18+ messages in thread
From: Roman Zippel @ 2006-02-13 15:54 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Thomas Gleixner, Andrew Morton, linux-kernel
Hi,
On Mon, 13 Feb 2006, Ingo Molnar wrote:
> your patch makes code larger on gcc3. Please investigate why.
Ok, I checked with 3.3.6 and 3.4.5 and adding const to ktime_divns/
posix_cpu_nsleep fixes the problem (actually the kernel becomes even
smaller because posix_cpu_clock_getres is better off without const), both
are complex and noncritical functions.
Andrew, I'd really prefer to keep the patch and I'll send a patch to add
the const where it's actually an improvement.
bye, Roman
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 12:50 ` Roman Zippel
@ 2006-02-13 19:52 ` Andrew Morton
2006-02-13 19:59 ` Ingo Molnar
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: Andrew Morton @ 2006-02-13 19:52 UTC (permalink / raw)
To: Roman Zippel; +Cc: mingo, tglx, linux-kernel
Roman Zippel <zippel@linux-m68k.org> wrote:
>
> On Mon, 13 Feb 2006, Andrew Morton wrote:
>
> > const arguments to functions are pretty useful for code readability and
> > maintainability too, if you use them consistently.
>
> I could understand that argument, if gcc would warn about it in any way.
It does. If a function tries to modify a formal argument which was marked
const you'll get a warning.
We're talking about different things here. My point is that it is
perverted and evil for a function to modify its own args (unless it's very
small and simple), and a const declaration is a useful way for a
maintenance programmer to be assured that nobody has done perverted and
evil things to a function.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 19:52 ` Andrew Morton
@ 2006-02-13 19:59 ` Ingo Molnar
2006-02-13 20:03 ` linux-os (Dick Johnson)
2006-02-13 21:57 ` Roman Zippel
2 siblings, 0 replies; 18+ messages in thread
From: Ingo Molnar @ 2006-02-13 19:59 UTC (permalink / raw)
To: Andrew Morton; +Cc: Roman Zippel, tglx, linux-kernel
* Andrew Morton <akpm@osdl.org> wrote:
> Roman Zippel <zippel@linux-m68k.org> wrote:
> >
> > On Mon, 13 Feb 2006, Andrew Morton wrote:
> >
> > > const arguments to functions are pretty useful for code readability and
> > > maintainability too, if you use them consistently.
> >
> > I could understand that argument, if gcc would warn about it in any way.
>
> It does. If a function tries to modify a formal argument which was
> marked const you'll get a warning.
>
> We're talking about different things here. My point is that it is
> perverted and evil for a function to modify its own args (unless it's
> very small and simple), and a const declaration is a useful way for a
> maintenance programmer to be assured that nobody has done perverted
> and evil things to a function.
good point. I dont think it's "evil" (or as Roman has put it, "bogus")
in any way, and it should be up to the authors of the code to decide one
way or another. [An added bonus for me is that in my editor the 'const'
keyword is color highlighted, so const args are visually separate from
non-const arguments]
Ingo
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 19:52 ` Andrew Morton
2006-02-13 19:59 ` Ingo Molnar
@ 2006-02-13 20:03 ` linux-os (Dick Johnson)
2006-02-13 21:21 ` Andrew Morton
2006-02-13 21:57 ` Roman Zippel
2 siblings, 1 reply; 18+ messages in thread
From: linux-os (Dick Johnson) @ 2006-02-13 20:03 UTC (permalink / raw)
To: Andrew Morton; +Cc: Roman Zippel, mingo, tglx, linux-kernel
On Mon, 13 Feb 2006, Andrew Morton wrote:
> Roman Zippel <zippel@linux-m68k.org> wrote:
>>
>> On Mon, 13 Feb 2006, Andrew Morton wrote:
>>
>> > const arguments to functions are pretty useful for code readability and
>> > maintainability too, if you use them consistently.
>>
>> I could understand that argument, if gcc would warn about it in any way.
>
> It does. If a function tries to modify a formal argument which was marked
> const you'll get a warning.
>
> We're talking about different things here. My point is that it is
> perverted and evil for a function to modify its own args (unless it's very
> small and simple), and a const declaration is a useful way for a
> maintenance programmer to be assured that nobody has done perverted and
> evil things to a function.
> -
This is evil????
void foo(int len)
{
while(len--)
do_something();
}
I don't think so. The function already owns "len". Why should it
create another copy?
Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.66 BogoMips).
Warning : 98.36% of all statistics are fiction.
_
\x1a\x04
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 15:54 ` Roman Zippel
@ 2006-02-13 20:35 ` Andrew Morton
2006-02-13 22:01 ` Roman Zippel
0 siblings, 1 reply; 18+ messages in thread
From: Andrew Morton @ 2006-02-13 20:35 UTC (permalink / raw)
To: Roman Zippel; +Cc: mingo, tglx, linux-kernel
Roman Zippel <zippel@linux-m68k.org> wrote:
>
> Hi,
>
> On Mon, 13 Feb 2006, Ingo Molnar wrote:
>
> > your patch makes code larger on gcc3. Please investigate why.
>
> Ok, I checked with 3.3.6 and 3.4.5 and adding const to ktime_divns/
> posix_cpu_nsleep fixes the problem (actually the kernel becomes even
> smaller because posix_cpu_clock_getres is better off without const), both
> are complex and noncritical functions.
> Andrew, I'd really prefer to keep the patch and I'll send a patch to add
> the const where it's actually an improvement.
>
There's been enough churn here that it'll be counterproductive for me to
continue to munge on your patches. I'll drop the lot and will await rev
#2.
I don't think any of this was critical for 2.6.16. If there's something
which you really do think needs to be in 2.6.16 then please carefully
describe the reasons for that, and make sure that the most critical
patches are staged at the head of the series.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 20:03 ` linux-os (Dick Johnson)
@ 2006-02-13 21:21 ` Andrew Morton
0 siblings, 0 replies; 18+ messages in thread
From: Andrew Morton @ 2006-02-13 21:21 UTC (permalink / raw)
To: linux-os (Dick Johnson); +Cc: zippel, mingo, tglx, linux-kernel
"linux-os \(Dick Johnson\)" <linux-os@analogic.com> wrote:
>
>
> On Mon, 13 Feb 2006, Andrew Morton wrote:
>
> > Roman Zippel <zippel@linux-m68k.org> wrote:
> >>
> >> On Mon, 13 Feb 2006, Andrew Morton wrote:
> >>
> >> > const arguments to functions are pretty useful for code readability and
> >> > maintainability too, if you use them consistently.
> >>
> >> I could understand that argument, if gcc would warn about it in any way.
> >
> > It does. If a function tries to modify a formal argument which was marked
> > const you'll get a warning.
> >
> > We're talking about different things here. My point is that it is
> > perverted and evil for a function to modify its own args (unless it's very
^^^^^^^^^^^^^^^^
> > small and simple), and a const declaration is a useful way for a
^^^^^^^^^^^^^^^^^
> > maintenance programmer to be assured that nobody has done perverted and
> > evil things to a function.
> > -
>
> This is evil????
>
> void foo(int len)
> {
> while(len--)
> do_something();
> }
>
> I don't think so. The function already owns "len". Why should it
> create another copy?
y
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 19:52 ` Andrew Morton
2006-02-13 19:59 ` Ingo Molnar
2006-02-13 20:03 ` linux-os (Dick Johnson)
@ 2006-02-13 21:57 ` Roman Zippel
2 siblings, 0 replies; 18+ messages in thread
From: Roman Zippel @ 2006-02-13 21:57 UTC (permalink / raw)
To: Andrew Morton; +Cc: mingo, tglx, linux-kernel
Hi,
On Mon, 13 Feb 2006, Andrew Morton wrote:
> We're talking about different things here. My point is that it is
> perverted and evil for a function to modify its own args (unless it's very
> small and simple), and a const declaration is a useful way for a
> maintenance programmer to be assured that nobody has done perverted and
> evil things to a function.
Most of the const I removed are from simple functions!
I don't mind to leave a few const where it actually makes a differences,
but the current amount is equally "perverted and evil".
bye, Roman
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/13] hrtimer: remove useless const
2006-02-13 20:35 ` Andrew Morton
@ 2006-02-13 22:01 ` Roman Zippel
0 siblings, 0 replies; 18+ messages in thread
From: Roman Zippel @ 2006-02-13 22:01 UTC (permalink / raw)
To: Andrew Morton; +Cc: mingo, tglx, linux-kernel
Hi,
On Mon, 13 Feb 2006, Andrew Morton wrote:
> There's been enough churn here that it'll be counterproductive for me to
> continue to munge on your patches. I'll drop the lot and will await rev
> #2.
It's coming shortly, but please give it at least a test run...
> I don't think any of this was critical for 2.6.16.
Well, IMO it's as critical as the complete hrtimer patch.
bye, Roman
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2006-02-13 22:01 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-13 1:09 [PATCH 02/13] hrtimer: remove useless const Roman Zippel
2006-02-13 11:28 ` Thomas Gleixner
2006-02-13 11:38 ` Roman Zippel
2006-02-13 11:46 ` Ingo Molnar
2006-02-13 11:53 ` Andrew Morton
2006-02-13 12:18 ` Roman Zippel
2006-02-13 12:30 ` Andrew Morton
2006-02-13 12:50 ` Roman Zippel
2006-02-13 19:52 ` Andrew Morton
2006-02-13 19:59 ` Ingo Molnar
2006-02-13 20:03 ` linux-os (Dick Johnson)
2006-02-13 21:21 ` Andrew Morton
2006-02-13 21:57 ` Roman Zippel
2006-02-13 12:09 ` Roman Zippel
2006-02-13 12:26 ` Roman Zippel
2006-02-13 15:54 ` Roman Zippel
2006-02-13 20:35 ` Andrew Morton
2006-02-13 22:01 ` Roman Zippel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox