Skip to contentSkip to conversation

linux-2.2.18-pre19 asm/delay.h problem?

DISCUSSION [email protected] 10 participants 12 messages Nov 22, 2000 – Nov 24, 2000

lore
Share & tools
lore
#0 lore raw

Hello,

Possibly an issue with an external module that I'm using, but when I compile a module that is pulling the definition of udelay() from asm/delay.h, it's referencing __bad_udelay(). However, I can't seem to find the __bad_udelay() function actually defined anyplace. (Although it could be somewhere in the kernel source that my grep missed.)

Would this be a bug in the module that I'm compiling? Or a real forgotten and unused symbol in the delay.h file? I doubt it would be the latter, but I can't figure out what I should link this module against to make things work.

Thanks so much,

Joe Pranevich
Product Support Analyst
Lycos.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 4 lines

module that is pulling the definition of udelay() from asm/delay.h, it's referencing __bad_udelay(). However, I can't seem to find the __bad_udelay() function actually defined anyplace. (Although it could be somewhere in the kernel source that my grep missed.)

Its intentionally missing

Quoted 1 line

Would this be a bug in the module that I'm compiling? Or a real forgotten and

You got it. The module is doing an overlarge delay

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
Quoted 6 lines · Alan Cox
Quoted 4 lines

module that is pulling the definition of udelay() from asm/delay.h, it's referencing __bad_udelay(). However, I can't seem to find the __bad_udelay() function actually defined anyplace. (Although it could be somewhere in the kernel source that my grep missed.)

Its intentionally missing

Alan, Linus,

Would it be an idea to define __bad_udelay() somewhere? (No don't stop reading!) ....

.... Inside a #if 0. This question keeps on popping up, and people seem to be able to grep for definitions of stuff well enough. Then near the definition you can explain this. It's a form of documenting this "trick"...

#if 0
/* Note: This definition is not for real. The idea about __bad_udelay is that you get a compile-time error if you call udelay with a number of microseconds that is too large for udelay. There is mdelay if you need delays on the order of miliseconds. Please update the places where udelay is called with this large constant!

If you change the #if 0 to #if 1, the stuff you're trying to compile will compile, but you'll crash your system when it's used.
*/

#define __bad_udelay() panic("Udelay called with too large a constant") #endif

Roger.

Signature · 8 lines
** [email protected] ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* There are old pilots, and there are bold pilots. 
* There are also old, bald pilots. 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#3 lore raw
In reply to Alan Cox

On Wed, 22 Nov 2000 around 10:57:53 +0100, Rogier Wolff wrote:
[skip]

Quoted 12 lines

.... Inside a #if 0. This question keeps on popping up, and people seem to be able to grep for definitions of stuff well enough. Then near the definition you can explain this. It's a form of documenting this "trick"...

#if 0
/* Note: This definition is not for real. The idea about __bad_udelay is that you get a compile-time error if you call udelay with a number of microseconds that is too large for udelay. There is mdelay if you need delays on the order of miliseconds. Please update the places where udelay is called with this large constant!

Quoted 6 lines

If you change the #if 0 to #if 1, the stuff you're trying to compile will compile, but you'll crash your system when it's used.
*/

#define __bad_udelay() panic("Udelay called with too large a constant") #endif

I want to bed that somebody will post a "fix" which will patch the #if 0 to 1. :)

Met vriendelijke groet,
Pauline Middelink

Signature · 6 lines
PGP Key fingerprint = DE 6B D0 D9 19 AD A7 A0  58 A3 06 9D B6 34 39 E2
For more details look at my website http://www.polyware.nl/~middelink
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#4 lore raw
Quoted 2 lines
Quoted 2 lines

#define __bad_udelay() panic("Udelay called with too large a constant")

Can't we change that to :
#error "Udelay..."

Igmar

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#5 lore raw

Igmar Palsenberg <[email protected]> writes:

|> > > #define __bad_udelay() panic("Udelay called with too large a constant")
|> 
|> Can't we change that to :
|> #error "Udelay..."

No.

Andreas.

Signature · 8 lines
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
[email protected]
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#6 lore raw
Quoted 7 lines
|> > > #define __bad_udelay() panic("Udelay called with too large a constant")
|> 
|> Can't we change that to :
|> #error "Udelay..."

No.

?? I think I'm missing something here.

Quoted 1 line

Andreas.

Igmar

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw
Quoted 8 lines
Quoted 6 lines
|> > > #define __bad_udelay() panic("Udelay called with too large a constant")
|> 
|> Can't we change that to :
|> #error "Udelay..."

No.

?? I think I'm missing something here.

preprocessor stuff is done too early for this

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#8 lore raw
Quoted 7 lines · [email protected] said:
Quoted 4 lines

|> Can't we change that to :
|> #error "Udelay..."

No.

?? I think I'm missing something here.
preprocessor stuff is done too early for this

We were talking about

#if 0
/* Don't turn this on, fix your code instead */

void __bad_udelay(int c)
{
#error you broke it. read the damn comment
}
#endif

... so that when people search the tree for __bad_udelay they find this, and if they're silly enough to change the 0 to a 1 then it'll still break.

--
dwmw2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#9 lore raw
In reply to Alan Cox
Quoted 10 lines · Alan Cox
Quoted 8 lines
Quoted 6 lines
|> > > #define __bad_udelay() panic("Udelay called with too large a constant")
|> 
|> Can't we change that to :
|> #error "Udelay..."

No.

?? I think I'm missing something here.

preprocessor stuff is done too early for this

You could still change it to __bug__module_is_using_a_delay_thats_too_large__please_report()..

--
"Love the dolphins," she advised him. "Write by W.A.S.T.E.."

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#10 lore raw
In reply to Alan Cox
Quoted 2 lines · Oliver Xymoron

You could still change it to __bug__module_is_using_a_delay_thats_too_large__please_report()..

I thought that's where we started?

Can we somehow use the GNU linker trick which permits a warning about e.g. gets at link time? (Is it even documented somewhere?) Something like:

/* bad_udelay.c */
static char bad_udelay_warning[] __attribute__((__section__(".gnu.warning")))

	= "warning: constant udelay too long";

bad_udelay() { BUG(); }

Jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#11 lore raw
In reply to [email protected]

[Alan Cox]

Quoted 1 line

You got it. The module is doing an overlarge delay

Perhaps people would stop asking this question if the symbol were renamed from __bad_udelay() to, say, __use_mdelay_instead_please().

Sort of like the DNS zone (somewhere at UCLA was it?) where they had something like 'quit 86400 IN CNAME use.exit.to.get.out.of.nslookup.'

Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/