* [PATCH] Use msleep in meye driver
@ 2004-06-02 15:57 Daniel Drake
2004-06-03 8:38 ` Stelian Pop
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Drake @ 2004-06-02 15:57 UTC (permalink / raw)
To: stelian; +Cc: video4linux-list, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 158 bytes --]
Remove meye's definition of wait_ms() and switch to using the new global
msleep() function.
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Against 2.6.7-rc2
[-- Attachment #2: meye-msleep.patch --]
[-- Type: text/plain, Size: 2384 bytes --]
--- linux-dsd/drivers/media/video/meye.c.orig 2004-05-10 03:32:39.000000000 +0100
+++ linux-dsd/drivers/media/video/meye.c 2004-06-02 15:20:24.677887544 +0100
@@ -473,16 +473,6 @@
/* MCHIP low-level functions */
/****************************************************************************/
-/* waits for the specified miliseconds */
-static inline void wait_ms(unsigned int ms) {
- if (!in_interrupt()) {
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1 + ms * HZ / 1000);
- }
- else
- mdelay(ms);
-}
-
/* returns the horizontal capture size */
static inline int mchip_hsize(void) {
return meye.params.subsample ? 320 : 640;
@@ -640,12 +630,12 @@
for (j = 0; j < 100; ++j) {
if (mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE))
return;
- wait_ms(1);
+ msleep(1);
}
printk(KERN_ERR "meye: need to reset HIC!\n");
mchip_set(MCHIP_HIC_CTL, MCHIP_HIC_CTL_SOFT_RESET);
- wait_ms(250);
+ msleep(250);
}
printk(KERN_ERR "meye: resetting HIC hanged!\n");
}
@@ -741,7 +731,7 @@
for (i = 0; i < 100; ++i) {
if (mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE))
break;
- wait_ms(1);
+ msleep(1);
}
}
@@ -757,7 +747,7 @@
for (i = 0; i < 100; ++i) {
if (mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE))
break;
- wait_ms(1);
+ msleep(1);
}
for (i = 0; i < 4 ; ++i) {
v = mchip_get_frame();
@@ -799,7 +789,7 @@
for (i = 0; i < 100; ++i) {
if (mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE))
break;
- wait_ms(1);
+ msleep(1);
}
for (i = 0; i < 4 ; ++i) {
@@ -1260,11 +1250,11 @@
mchip_delay(MCHIP_HIC_CMD, 0);
mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE);
- wait_ms(1);
+ msleep(1);
mchip_set(MCHIP_VRJ_SOFT_RESET, 1);
- wait_ms(1);
+ msleep(1);
mchip_set(MCHIP_MM_PCI_MODE, 5);
- wait_ms(1);
+ msleep(1);
mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK);
switch (meye.pm_mchip_mode) {
@@ -1349,13 +1339,13 @@
mchip_delay(MCHIP_HIC_CMD, 0);
mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE);
- wait_ms(1);
+ msleep(1);
mchip_set(MCHIP_VRJ_SOFT_RESET, 1);
- wait_ms(1);
+ msleep(1);
mchip_set(MCHIP_MM_PCI_MODE, 5);
- wait_ms(1);
+ msleep(1);
mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK);
if (video_register_device(meye.video_dev, VFL_TYPE_GRABBER, video_nr) < 0) {
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Use msleep in meye driver
2004-06-02 15:57 [PATCH] Use msleep in meye driver Daniel Drake
@ 2004-06-03 8:38 ` Stelian Pop
2004-06-03 8:47 ` Arjan van de Ven
0 siblings, 1 reply; 4+ messages in thread
From: Stelian Pop @ 2004-06-03 8:38 UTC (permalink / raw)
To: Daniel Drake; +Cc: video4linux-list, linux-kernel
On Wed, Jun 02, 2004 at 04:57:26PM +0100, Daniel Drake wrote:
> Remove meye's definition of wait_ms() and switch to using the new global
> msleep() function.
[...]
> -static inline void wait_ms(unsigned int ms) {
> - if (!in_interrupt()) {
> - set_current_state(TASK_UNINTERRUPTIBLE);
> - schedule_timeout(1 + ms * HZ / 1000);
> - }
> - else
> - mdelay(ms);
> -}
>From what I see in kernel/timer.c, msleep() cannot be called in
interrupt context, so the in_interrupt() test must stay.
Stelian.
--
Stelian Pop <stelian@popies.net>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Use msleep in meye driver
2004-06-03 8:38 ` Stelian Pop
@ 2004-06-03 8:47 ` Arjan van de Ven
2004-06-03 9:00 ` Stelian Pop
0 siblings, 1 reply; 4+ messages in thread
From: Arjan van de Ven @ 2004-06-03 8:47 UTC (permalink / raw)
To: Stelian Pop; +Cc: Daniel Drake, video4linux-list, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 239 bytes --]
> >From what I see in kernel/timer.c, msleep() cannot be called in
> interrupt context, so the in_interrupt() test must stay.
mdelay in irq context is *EVIL* though, and will get all the low latency
and audio folks very upset...
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use msleep in meye driver
2004-06-03 8:47 ` Arjan van de Ven
@ 2004-06-03 9:00 ` Stelian Pop
0 siblings, 0 replies; 4+ messages in thread
From: Stelian Pop @ 2004-06-03 9:00 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: Daniel Drake, video4linux-list, linux-kernel
On Thu, Jun 03, 2004 at 10:47:18AM +0200, Arjan van de Ven wrote:
>
> > >From what I see in kernel/timer.c, msleep() cannot be called in
> > interrupt context, so the in_interrupt() test must stay.
>
> mdelay in irq context is *EVIL* though, and will get all the low latency
> and audio folks very upset...
Indeed :)
In fact, reading the code again shows that wait_ms() is never called
in interrupt context, so the in_interrupt() test was useless.
Daniel's patch is then correct, please apply it.
Or should I add a "Signed-off" line too and resend the patch ?
Stelian.
--
Stelian Pop <stelian@popies.net>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-06-03 9:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-02 15:57 [PATCH] Use msleep in meye driver Daniel Drake
2004-06-03 8:38 ` Stelian Pop
2004-06-03 8:47 ` Arjan van de Ven
2004-06-03 9:00 ` Stelian Pop
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox