2001-11-29 23:33:58

by Alex Valys

[permalink] [raw]
Subject: PATCH: Spinlock Macro Arguments Correction in pc_keyb.c

I was compiling 2.5.1-pre3 this evening, and recieved errors to the effect of:
Line xxx:spinlock_unlock used with too many arguments
Line xxxx:spinlock_unlock_irqrestore used with too few arguments
Line XXXX:spinlock_unlock_irqrestore used with too few arguments

Not having ever done any serious kernel programming, I have only a dim
understanding of what spinlocks are, but by looking at those macro
definitions in spinlock.h (and their occurences elsewhere in the file) I
think I determined their proper usage. The following patch fixed the compile
errors, and I'm using 2.5.1-pre3 to type this message.

This is my first patch, so if I did anything wrong please correct me.
-Alex Valys




--- drivers/char/pc_keyb.c.orig Thu Nov 29 18:05:00 2001
+++ drivers/char/pc_keyb.c Thu Nov 29 18:07:14 2001
@@ -420,7 +420,7 @@
kbd_write_command(KBD_CCMD_WRITE_MODE);
kb_wait();
kbd_write_output(AUX_INTS_OFF);
- spin_unlock(&kbd_controller_lock, flags);
+ spin_unlock(&kbd_controller_lock);
}
spin_unlock_irqrestore( &aux_count_lock,flags );
}
@@ -1056,7 +1056,7 @@
fasync_aux(-1, file, 0);
spin_lock_irqsave( &aux_count, flags );
if ( --aux_count ) {
- spin_unlock_irqrestore( &aux_count_lock );
+ spin_unlock_irqrestore( &aux_count_lock, flags );
return 0;
}
spin_unlock_irqrestore( &aux_count_lock, flags );
@@ -1076,7 +1076,7 @@
int flags;
spin_lock_irqsave( &aux_count_lock, flags );
if ( aux_count++ ) {
- spin_unlock_irqrestore( &aux_count_lock );
+ spin_unlock_irqrestore( &aux_count_lock, flags );
return 0;
}
queue->head = queue->tail = 0; /* Flush input queue */



















2001-11-30 00:43:25

by Dave Hansen

[permalink] [raw]
Subject: Re: PATCH: Spinlock Macro Arguments Correction in pc_keyb.c

Alex Valys wrote:

>Not having ever done any serious kernel programming, I have only a dim
>understanding of what spinlocks are, but by looking at those macro
>definitions in spinlock.h (and their occurences elsewhere in the file) I
>think I determined their proper usage. The following patch fixed the compile
>errors, and I'm using 2.5.1-pre3 to type this message.
>
>This is my first patch, so if I did anything wrong please correct me.
>-Alex Valys
>
That looks like an error as a result of one of my patches. Your
solution looks correct. Make sure to send it over to Linus. Nice job
with your first patch!

David C. Hansen
[email protected]