Re: [PATCH] advansys.c: include missing restore_flags, etc

Russell King (rmk@arm.linux.org.uk)
Tue, 9 Jan 2001 10:02:14 +0000 (GMT)


Arnaldo Carvalho de Melo writes:
> Please consider applying, comments in the patch.

Can't the following be fixed properly?

> -STATIC int
> +STATIC unsigned long
> DvcEnterCritical(void)
> {
> - int flags;
> + unsigned long flags;
>
> save_flags(flags);
> cli();

Guess what happens here?

return flags;

> @@ -9965,7 +9972,7 @@
> }
>
> STATIC void
> -DvcLeaveCritical(int flags)
> +DvcLeaveCritical(unsigned long flags)
> {
> restore_flags(flags);
> }

The above doesn't work on some architectures. Its better to use a macro
if you want to separate this out. ie, something like (davem will have to
okay it tho):

#define DvcEnterCritical() \
({ unsigned long __flags; save_flags(__flags); cli(); __flags; })

#define DvcLeaveCritical(flags) \
do { restore_flags(flags); } while (0)

This should then ensure that you don't end up with problems associated
with register windows on the sparc or whatever. Even better would be
to use a spinlock instead of Dvc?????Critical.
_____
|_____| ------------------------------------------------- ---+---+-
| | Russell King rmk@arm.linux.org.uk --- ---
| | | | http://www.arm.linux.org.uk/personal/aboutme.html / / |
| +-+-+ --- -+-
/ | THE developer of ARM Linux |+| /|\
/ | | | --- |
+-+-+ ------------------------------------------------- /\\\ |
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/