From 4a7b9aa4b08d57c4b2cbaf667c1f46c90fe6f919 Mon Sep 17 00:00:00 2001 From: Maximilian Attems Date: Mon, 18 Oct 2004 18:22:16 -0700 Subject: [PATCH] [PATCH] janitor: drivers/media: replace schedule_timeout() with msleep() Signed-off-by: Nishanth Aravamudan Signed-off-by: Maximilian Attems Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bw-qcam.c | 12 ++++-------- drivers/media/video/c-qcam.c | 6 ++---- drivers/media/video/cpia.c | 17 ++++++----------- drivers/media/video/ovcamchip/ovcamchip_core.c | 7 +++---- drivers/media/video/planb.c | 3 +-- drivers/media/video/saa5249.c | 3 +-- drivers/media/video/tda9887.c | 4 ++-- drivers/media/video/zoran_driver.c | 6 ++---- drivers/media/video/zr36120.c | 6 ++---- 9 files changed, 23 insertions(+), 41 deletions(-) diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index 31412e8d32dbc..293173885bd94 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c @@ -249,8 +249,7 @@ static int qc_waithand(struct qcam_device *q, int val) if(runs++>maxpoll) { - current->state=TASK_INTERRUPTIBLE; - schedule_timeout(HZ/200); + msleep_interruptible(5); } if(runs>(maxpoll+1000)) /* 5 seconds */ return -1; @@ -269,8 +268,7 @@ static int qc_waithand(struct qcam_device *q, int val) if(runs++>maxpoll) { - current->state=TASK_INTERRUPTIBLE; - schedule_timeout(HZ/200); + msleep_interruptible(5); } if(runs++>(maxpoll+1000)) /* 5 seconds */ return -1; @@ -302,8 +300,7 @@ static unsigned int qc_waithand2(struct qcam_device *q, int val) if(runs++>maxpoll) { - current->state=TASK_INTERRUPTIBLE; - schedule_timeout(HZ/200); + msleep_interruptible(5); } if(runs++>(maxpoll+1000)) /* 5 seconds */ return 0; @@ -669,8 +666,7 @@ long qc_capture(struct qcam_device * q, char __user *buf, unsigned long len) time will be 240 / 200 = 1.2 seconds. The compile-time default is to yield every 4 lines. */ if (i >= yield) { - current->state=TASK_INTERRUPTIBLE; - schedule_timeout(HZ/200); + msleep_interruptible(5); yield = i + yieldlines; } } diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index bd9fef419a88a..703c4cba97b63 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c @@ -103,8 +103,7 @@ static unsigned int qcam_await_ready1(struct qcam_device *qcam, { if (qcam_ready1(qcam) == value) return 0; - current->state=TASK_INTERRUPTIBLE; - schedule_timeout(HZ/10); + msleep_interruptible(100); } /* Probably somebody pulled the plug out. Not much we can do. */ @@ -129,8 +128,7 @@ static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value) { if (qcam_ready2(qcam) == value) return 0; - current->state=TASK_INTERRUPTIBLE; - schedule_timeout(HZ/10); + msleep_interruptible(100); } /* Probably somebody pulled the plug out. Not much we can do. */ diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index 21db4b3902770..388bc09366bdb 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -2886,9 +2887,7 @@ static int fetch_frame(void *data) cond_resched(); /* sleep for 10 ms, hopefully ;) */ - current->state = TASK_INTERRUPTIBLE; - - schedule_timeout(10*HZ/1000); + msleep_interruptible(10); if (signal_pending(current)) return -EINTR; @@ -2951,8 +2950,7 @@ static int fetch_frame(void *data) CPIA_GRAB_SINGLE, 0, 0, 0); /* FIXME: Trial & error - need up to 70ms for the grab mode change to complete ? */ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(70*HZ / 1000); + msleep_interruptible(70); if (signal_pending(current)) return -EINTR; } @@ -3003,8 +3001,7 @@ static int goto_high_power(struct cam_data *cam) { if (do_command(cam, CPIA_COMMAND_GotoHiPower, 0, 0, 0, 0)) return -EIO; - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(40*HZ/1000); /* windows driver does it too */ + msleep_interruptible(40); /* windows driver does it too */ if(signal_pending(current)) return -EINTR; if (do_command(cam, CPIA_COMMAND_GetCameraStatus, 0, 0, 0, 0)) @@ -3074,10 +3071,8 @@ static int set_camera_state(struct cam_data *cam) /* Wait 6 frames for the sensor to get all settings and AEC/ACB to settle */ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout((6*(cam->params.sensorFps.baserate ? 33 : 40) * - (1 << cam->params.sensorFps.divisor) + 10) * - HZ / 1000); + msleep_interruptible(6*(cam->params.sensorFps.baserate ? 33 : 40) * + (1 << cam->params.sensorFps.divisor) + 10); if(signal_pending(current)) return -EINTR; diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index d88956a26aeef..67f2fc4a4f9f2 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "ovcamchip_priv.h" #define DRIVER_VERSION "v2.27 for Linux 2.6" @@ -128,8 +129,7 @@ static int init_camchip(struct i2c_client *c) ov_write(c, 0x12, 0x80); /* Wait for it to initialize */ - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(1 + 150 * HZ / 1000); + msleep(150); for (i = 0, success = 0; i < I2C_DETECT_RETRIES && !success; i++) { if (ov_read(c, GENERIC_REG_ID_HIGH, &high) >= 0) { @@ -145,8 +145,7 @@ static int init_camchip(struct i2c_client *c) ov_write(c, 0x12, 0x80); /* Wait for it to initialize */ - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(1 + 150 * HZ / 1000); + msleep(150); /* Dummy read to sync I2C */ ov_read(c, 0x00, &low); diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c index ebf130f167e35..3a828546952a7 100644 --- a/drivers/media/video/planb.c +++ b/drivers/media/video/planb.c @@ -178,8 +178,7 @@ static unsigned char saa_status(int byte, struct planb *pb) saa_write_reg (SAA7196_STDC, saa_regs[pb->win.norm][SAA7196_STDC]); /* Let's wait 30msec for this one */ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(30 * HZ / 1000); + msleep_interruptible(30); return (unsigned char)in_8 (&planb_regs->saa_status); } diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index d486fb7faf67f..7d5ca87c16190 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c @@ -273,8 +273,7 @@ static void jdelay(unsigned long delay) sigfillset(¤t->blocked); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(delay); + msleep_interruptible(jiffies_to_msecs(delay)); spin_lock_irq(¤t->sighand->siglock); current->blocked = oldblocked; diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index e46fbdbc46e65..31977e770b235 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -543,8 +544,7 @@ static int tda9887_configure(struct tda9887 *t) printk(PREFIX "i2c i/o error: rc == %d (should be 4)\n",rc); if (debug > 2) { - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(HZ); + msleep_interruptible(1000); tda9887_status(t); } return 0; diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index d6294bd7909fc..bb2b4201a24d1 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c @@ -1917,8 +1917,7 @@ zoran_set_norm (struct zoran *zr, decoder_command(zr, DECODER_SET_NORM, &norm); /* let changes come into effect */ - current->state = TASK_UNINTERRUPTIBLE; - schedule_timeout(2 * HZ); + ssleep(2); decoder_command(zr, DECODER_GET_STATUS, &status); if (!(status & DECODER_STATUS_GOOD)) { @@ -2639,8 +2638,7 @@ zoran_do_ioctl (struct inode *inode, decoder_command(zr, DECODER_SET_NORM, &norm); /* sleep 1 second */ - current->state = TASK_UNINTERRUPTIBLE; - schedule_timeout(1 * HZ); + ssleep(1); /* Get status of video decoder */ decoder_command(zr, DECODER_GET_STATUS, &status); diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c index 9b55341baf409..e99226434e739 100644 --- a/drivers/media/video/zr36120.c +++ b/drivers/media/video/zr36120.c @@ -819,8 +819,7 @@ void zoran_close(struct video_device* dev) * be sure its safe to free the buffer. We wait 5-6 fields * which is more than sufficient to be sure. */ - current->state = TASK_UNINTERRUPTIBLE; - schedule_timeout(HZ/10); /* Wait 1/10th of a second */ + msleep(100); /* Wait 1/10th of a second */ /* free the allocated framebuffer */ if (ztv->fbuffer) @@ -1568,8 +1567,7 @@ void vbi_close(struct video_device *dev) * be sure its safe to free the buffer. We wait 5-6 fields * which is more than sufficient to be sure. */ - current->state = TASK_UNINTERRUPTIBLE; - schedule_timeout(HZ/10); /* Wait 1/10th of a second */ + msleep(100); /* Wait 1/10th of a second */ for (item=ztv->readinfo; item!=ztv->readinfo+ZORAN_VBI_BUFFERS; item++) { -- 2.53.0