public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Thierry Merle <thierry.merle@free.fr>
To: Linux DVB Mailing List <linux-dvb@linuxtv.org>,
	Martin Michlmayr <tbm@cyrius.com>
Subject: [linux-dvb] [PATCH] transform udelay to mdelay
Date: Tue, 26 Aug 2008 21:18:52 +0200	[thread overview]
Message-ID: <48B4571C.1040207@free.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 2224 bytes --]

Hello,
following the conversation on the v4l-dvb-maitainer ML:
http://www.linuxtv.org/pipermail/v4l-dvb-maintainer/2008-August/007753.html
Contents:
Thierry Merle a écrit :
> Hi Martin
>
> Martin Michlmayr a écrit :
>   
>> budget.ko fails to build on ARM with:
>>
>> ERROR: "__bad_udelay" [drivers/media/dvb/ttpci/budget.ko] undefined!
>> make[1]: *** [__modpost] Error 1
>>
>> __bad_udelay is specifically designed on ARM to fail when udelay is
>> called in a bad way.  arch/arm/include/asm/delay.h has this to say
>> about __bad_udelay:
>>
>> /*
>>  * This function intentionally does not exist; if you see references to
>>  * it, it means that you're calling udelay() with an out of range value.
>>  *
>>  * With currently imposed limits, this means that we support a max delay
>>  * of 2000us. Further limits: HZ<=1000 and bogomips<=3355
>>  */
>> extern void __bad_udelay(void);
>>
>> Can you check why your driver is calling udelay() with a value > 2000?
>>
>>   
>>     
> Right, I experienced the same problem with the em28xx (from mcentral.de)
> driver compilation on my NSLU2 target.
> I guess you are doing the same thing for this driver.
> The solution was to use mdelay when possible.
> It solves the compilation on these low-power-consuming-but-high-capacities targets.
> Here are all the udelay with value greater than 2000 in v4l-dvb/:
> linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c:                       
> udelay(12500);
> linux/drivers/media/dvb/bt8xx/dst.c:            udelay(3000);
> linux/drivers/media/dvb/bt8xx/dst.c:            udelay(3000);
> linux/drivers/media/dvb/ttpci/budget-patch.c:                  
> udelay(12500);
> linux/drivers/media/dvb/ttpci/budget.c:                 udelay(12500);
> linux/drivers/media/video/bt8xx/bttv-cards.c:   udelay(2500);
> I attached a patch that replaces all these calls to mdelay, and additional udelay if
> necessary.
> I cannot test it since I do not own any of these devices so this is just a proposal.
> Cheers,
> Thierry
>   
Here is the patch I proposed, this should be harmless but I have no
device to test them.

Cheers,
Thierry

Signed-off-by: Thierry Merle <thierry.merle@free.fr>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: udelay_to_mdelay.patch --]
[-- Type: text/x-patch; name="udelay_to_mdelay.patch", Size: 2712 bytes --]

diff -r a4843e1304e6 linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
--- a/linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c	Sun Aug 24 12:28:11 2008 -0300
+++ b/linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c	Tue Aug 26 14:15:36 2008 +0200
@@ -137,7 +137,8 @@ static int flexcop_send_diseqc_msg(struc
 			flexcop_diseqc_send_byte(fe, 0xff);
 		else {
 			flexcop_set_tone(fe, SEC_TONE_ON);
-			udelay(12500);
+			mdelay(12);
+			udelay(500);
 			flexcop_set_tone(fe, SEC_TONE_OFF);
 		}
 		msleep(20);
diff -r a4843e1304e6 linux/drivers/media/dvb/bt8xx/dst.c
--- a/linux/drivers/media/dvb/bt8xx/dst.c	Sun Aug 24 12:28:11 2008 -0300
+++ b/linux/drivers/media/dvb/bt8xx/dst.c	Tue Aug 26 14:16:16 2008 +0200
@@ -1244,7 +1244,7 @@ static int dst_command(struct dst_state 
 		goto error;
 	}
 	if (state->type_flags & DST_TYPE_HAS_FW_1)
-		udelay(3000);
+		mdelay(3);
 	if (read_dst(state, &reply, GET_ACK)) {
 		dprintk(verbose, DST_DEBUG, 1, "Trying to recover.. ");
 		if ((dst_error_recovery(state)) < 0) {
@@ -1260,7 +1260,7 @@ static int dst_command(struct dst_state 
 	if (len >= 2 && data[0] == 0 && (data[1] == 1 || data[1] == 3))
 		goto error;
 	if (state->type_flags & DST_TYPE_HAS_FW_1)
-		udelay(3000);
+		mdelay(3);
 	else
 		udelay(2000);
 	if (!dst_wait_dst_ready(state, NO_DELAY))
diff -r a4843e1304e6 linux/drivers/media/dvb/ttpci/budget-patch.c
--- a/linux/drivers/media/dvb/ttpci/budget-patch.c	Sun Aug 24 12:28:11 2008 -0300
+++ b/linux/drivers/media/dvb/ttpci/budget-patch.c	Tue Aug 26 14:16:54 2008 +0200
@@ -116,7 +116,8 @@ static int SendDiSEqCMsg (struct budget 
 			DiseqcSendByte(budget, 0xff);
 		else {
 			saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI);
-			udelay(12500);
+			mdelay(12);
+			udelay(500);
 			saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO);
 		}
 		msleep(20);
diff -r a4843e1304e6 linux/drivers/media/dvb/ttpci/budget.c
--- a/linux/drivers/media/dvb/ttpci/budget.c	Sun Aug 24 12:28:11 2008 -0300
+++ b/linux/drivers/media/dvb/ttpci/budget.c	Tue Aug 26 14:18:56 2008 +0200
@@ -108,7 +108,8 @@ static int SendDiSEqCMsg (struct budget 
 			DiseqcSendByte(budget, 0xff);
 		else {
 			saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI);
-			udelay(12500);
+			mdelay(12);
+			udelay(500);
 			saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO);
 		}
 		msleep(20);
diff -r a4843e1304e6 linux/drivers/media/video/bt8xx/bttv-cards.c
--- a/linux/drivers/media/video/bt8xx/bttv-cards.c	Sun Aug 24 12:28:11 2008 -0300
+++ b/linux/drivers/media/video/bt8xx/bttv-cards.c	Tue Aug 26 14:17:45 2008 +0200
@@ -4103,7 +4103,8 @@ static void __devinit boot_msp34xx(struc
 
 	gpio_inout(mask,mask);
 	gpio_bits(mask,0);
-	udelay(2500);
+	mdelay(2);
+	udelay(500);
 	gpio_bits(mask,mask);
 
 	if (bttv_gpio)

[-- Attachment #3: Type: text/plain, Size: 150 bytes --]

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

             reply	other threads:[~2008-08-26 19:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-26 19:18 Thierry Merle [this message]
2008-08-27  1:43 ` [linux-dvb] [PATCH] transform udelay to mdelay Trent Piepho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48B4571C.1040207@free.fr \
    --to=thierry.merle@free.fr \
    --cc=linux-dvb@linuxtv.org \
    --cc=tbm@cyrius.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox