Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dfc4f94d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds
Browse files

[PATCH] remove timer debug field



Remove timer_list.magic and associated debugging code.

I originally added this when a spinlock was added to timer_list - this meant
that an all-zeroes timer became illegal and init_timer() was required.

That spinlock isn't even there any more, although timer.base must now be
initialised.

I'll keep this debugging code in -mm.

Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 89ada679
Loading
Loading
Loading
Loading
+2 −16
Original line number Original line Diff line number Diff line
@@ -24,7 +24,6 @@
#include <asm/s390_ext.h>
#include <asm/s390_ext.h>
#include <asm/timer.h>
#include <asm/timer.h>


#define VTIMER_MAGIC (TIMER_MAGIC + 1)
static ext_int_info_t ext_int_info_timer;
static ext_int_info_t ext_int_info_timer;
DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);


@@ -277,20 +276,12 @@ static void do_cpu_timer_interrupt(struct pt_regs *regs, __u16 error_code)


void init_virt_timer(struct vtimer_list *timer)
void init_virt_timer(struct vtimer_list *timer)
{
{
	timer->magic = VTIMER_MAGIC;
	timer->function = NULL;
	timer->function = NULL;
	INIT_LIST_HEAD(&timer->entry);
	INIT_LIST_HEAD(&timer->entry);
	spin_lock_init(&timer->lock);
	spin_lock_init(&timer->lock);
}
}
EXPORT_SYMBOL(init_virt_timer);
EXPORT_SYMBOL(init_virt_timer);


static inline int check_vtimer(struct vtimer_list *timer)
{
	if (timer->magic != VTIMER_MAGIC)
		return -EINVAL;
	return 0;
}

static inline int vtimer_pending(struct vtimer_list *timer)
static inline int vtimer_pending(struct vtimer_list *timer)
{
{
	return (!list_empty(&timer->entry));
	return (!list_empty(&timer->entry));
@@ -346,7 +337,7 @@ static void internal_add_vtimer(struct vtimer_list *timer)


static inline int prepare_vtimer(struct vtimer_list *timer)
static inline int prepare_vtimer(struct vtimer_list *timer)
{
{
	if (check_vtimer(timer) || !timer->function) {
	if (!timer->function) {
		printk("add_virt_timer: uninitialized timer\n");
		printk("add_virt_timer: uninitialized timer\n");
		return -EINVAL;
		return -EINVAL;
	}
	}
@@ -414,7 +405,7 @@ int mod_virt_timer(struct vtimer_list *timer, __u64 expires)
	unsigned long flags;
	unsigned long flags;
	int cpu;
	int cpu;


	if (check_vtimer(timer) || !timer->function) {
	if (!timer->function) {
		printk("mod_virt_timer: uninitialized timer\n");
		printk("mod_virt_timer: uninitialized timer\n");
		return	-EINVAL;
		return	-EINVAL;
	}
	}
@@ -481,11 +472,6 @@ int del_virt_timer(struct vtimer_list *timer)
	unsigned long flags;
	unsigned long flags;
	struct vtimer_queue *vt_list;
	struct vtimer_queue *vt_list;


	if (check_vtimer(timer)) {
		printk("del_virt_timer: timer not initialized\n");
		return -EINVAL;
	}

	/* check if timer is pending */
	/* check if timer is pending */
	if (!vtimer_pending(timer))
	if (!vtimer_pending(timer))
		return 0;
		return 0;
+0 −5
Original line number Original line Diff line number Diff line
@@ -12,16 +12,12 @@ struct timer_list {
	struct list_head entry;
	struct list_head entry;
	unsigned long expires;
	unsigned long expires;


	unsigned long magic;

	void (*function)(unsigned long);
	void (*function)(unsigned long);
	unsigned long data;
	unsigned long data;


	struct timer_base_s *base;
	struct timer_base_s *base;
};
};


#define TIMER_MAGIC	0x4b87ad6e

extern struct timer_base_s __init_timer_base;
extern struct timer_base_s __init_timer_base;


#define TIMER_INITIALIZER(_function, _expires, _data) {		\
#define TIMER_INITIALIZER(_function, _expires, _data) {		\
@@ -29,7 +25,6 @@ extern struct timer_base_s __init_timer_base;
		.expires = (_expires),				\
		.expires = (_expires),				\
		.data = (_data),				\
		.data = (_data),				\
		.base = &__init_timer_base,			\
		.base = &__init_timer_base,			\
		.magic = TIMER_MAGIC,				\
	}
	}


#define DEFINE_TIMER(_name, _function, _expires, _data)		\
#define DEFINE_TIMER(_name, _function, _expires, _data)		\
+0 −35
Original line number Original line Diff line number Diff line
@@ -91,30 +91,6 @@ static inline void set_running_timer(tvec_base_t *base,
#endif
#endif
}
}


static void check_timer_failed(struct timer_list *timer)
{
	static int whine_count;
	if (whine_count < 16) {
		whine_count++;
		printk("Uninitialised timer!\n");
		printk("This is just a warning.  Your computer is OK\n");
		printk("function=0x%p, data=0x%lx\n",
			timer->function, timer->data);
		dump_stack();
	}
	/*
	 * Now fix it up
	 */
	timer->magic = TIMER_MAGIC;
}

static inline void check_timer(struct timer_list *timer)
{
	if (timer->magic != TIMER_MAGIC)
		check_timer_failed(timer);
}


static void internal_add_timer(tvec_base_t *base, struct timer_list *timer)
static void internal_add_timer(tvec_base_t *base, struct timer_list *timer)
{
{
	unsigned long expires = timer->expires;
	unsigned long expires = timer->expires;
@@ -177,7 +153,6 @@ void fastcall init_timer(struct timer_list *timer)
{
{
	timer->entry.next = NULL;
	timer->entry.next = NULL;
	timer->base = &per_cpu(tvec_bases, raw_smp_processor_id()).t_base;
	timer->base = &per_cpu(tvec_bases, raw_smp_processor_id()).t_base;
	timer->magic = TIMER_MAGIC;
}
}
EXPORT_SYMBOL(init_timer);
EXPORT_SYMBOL(init_timer);


@@ -230,7 +205,6 @@ int __mod_timer(struct timer_list *timer, unsigned long expires)
	int ret = 0;
	int ret = 0;


	BUG_ON(!timer->function);
	BUG_ON(!timer->function);
	check_timer(timer);


	base = lock_timer_base(timer, &flags);
	base = lock_timer_base(timer, &flags);


@@ -283,9 +257,6 @@ void add_timer_on(struct timer_list *timer, int cpu)
  	unsigned long flags;
  	unsigned long flags;


  	BUG_ON(timer_pending(timer) || !timer->function);
  	BUG_ON(timer_pending(timer) || !timer->function);

	check_timer(timer);

	spin_lock_irqsave(&base->t_base.lock, flags);
	spin_lock_irqsave(&base->t_base.lock, flags);
	timer->base = &base->t_base;
	timer->base = &base->t_base;
	internal_add_timer(base, timer);
	internal_add_timer(base, timer);
@@ -316,8 +287,6 @@ int mod_timer(struct timer_list *timer, unsigned long expires)
{
{
	BUG_ON(!timer->function);
	BUG_ON(!timer->function);


	check_timer(timer);

	/*
	/*
	 * This is a common optimization triggered by the
	 * This is a common optimization triggered by the
	 * networking code - if the timer is re-modified
	 * networking code - if the timer is re-modified
@@ -348,8 +317,6 @@ int del_timer(struct timer_list *timer)
	unsigned long flags;
	unsigned long flags;
	int ret = 0;
	int ret = 0;


	check_timer(timer);

	if (timer_pending(timer)) {
	if (timer_pending(timer)) {
		base = lock_timer_base(timer, &flags);
		base = lock_timer_base(timer, &flags);
		if (timer_pending(timer)) {
		if (timer_pending(timer)) {
@@ -412,8 +379,6 @@ int try_to_del_timer_sync(struct timer_list *timer)
 */
 */
int del_timer_sync(struct timer_list *timer)
int del_timer_sync(struct timer_list *timer)
{
{
	check_timer(timer);

	for (;;) {
	for (;;) {
		int ret = try_to_del_timer_sync(timer);
		int ret = try_to_del_timer_sync(timer);
		if (ret >= 0)
		if (ret >= 0)