aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv/ivtv-mailbox.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-07-19 10:21:04 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-20 16:35:51 -0400
commit201700d3544c653d453716a60976efe1987110af (patch)
tree8052fb09ac170b6de4b28737f89cb2621fac4fe7 /drivers/media/video/ivtv/ivtv-mailbox.c
parentfe06fe0a4d0f781f8ae0570e4d7e517a81878c1d (diff)
V4L/DVB (5865): Remove usage of HZ on ivtv driver, replacing by msecs_to_jiffies
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-mailbox.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-mailbox.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/media/video/ivtv/ivtv-mailbox.c b/drivers/media/video/ivtv/ivtv-mailbox.c
index eaa43e9e9185..814a673712b3 100644
--- a/drivers/media/video/ivtv/ivtv-mailbox.c
+++ b/drivers/media/video/ivtv/ivtv-mailbox.c
@@ -176,9 +176,9 @@ static int get_mailbox(struct ivtv *itv, struct ivtv_mailbox_data *mbdata, int f
176 176
177 /* Sleep before a retry, if not atomic */ 177 /* Sleep before a retry, if not atomic */
178 if (!(flags & API_NO_WAIT_MB)) { 178 if (!(flags & API_NO_WAIT_MB)) {
179 if (jiffies - then > retries * HZ / 100) 179 if (jiffies - then > msecs_to_jiffies(10*retries))
180 break; 180 break;
181 ivtv_sleep_timeout(HZ / 100, 0); 181 ivtv_msleep_timeout(10, 0);
182 } 182 }
183 } 183 }
184 return -ENODEV; 184 return -ENODEV;
@@ -213,7 +213,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
213{ 213{
214 struct ivtv_mailbox_data *mbdata = (cmd >= 128) ? &itv->enc_mbox : &itv->dec_mbox; 214 struct ivtv_mailbox_data *mbdata = (cmd >= 128) ? &itv->enc_mbox : &itv->dec_mbox;
215 volatile struct ivtv_mailbox __iomem *mbox; 215 volatile struct ivtv_mailbox __iomem *mbox;
216 int api_timeout = HZ; 216 int api_timeout = msecs_to_jiffies(1000);
217 int flags, mb, i; 217 int flags, mb, i;
218 unsigned long then; 218 unsigned long then;
219 219
@@ -243,7 +243,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
243 data, then just return 0 as there is no need to issue this command again. 243 data, then just return 0 as there is no need to issue this command again.
244 Just an optimization to prevent unnecessary use of mailboxes. */ 244 Just an optimization to prevent unnecessary use of mailboxes. */
245 if (itv->api_cache[cmd].last_jiffies && 245 if (itv->api_cache[cmd].last_jiffies &&
246 jiffies - itv->api_cache[cmd].last_jiffies < HZ * 1800 && 246 jiffies - itv->api_cache[cmd].last_jiffies < msecs_to_jiffies(1800000) &&
247 !memcmp(data, itv->api_cache[cmd].data, sizeof(itv->api_cache[cmd].data))) { 247 !memcmp(data, itv->api_cache[cmd].data, sizeof(itv->api_cache[cmd].data))) {
248 itv->api_cache[cmd].last_jiffies = jiffies; 248 itv->api_cache[cmd].last_jiffies = jiffies;
249 return 0; 249 return 0;
@@ -268,7 +268,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
268 } 268 }
269 269
270 if ((flags & API_FAST_RESULT) == API_FAST_RESULT) 270 if ((flags & API_FAST_RESULT) == API_FAST_RESULT)
271 api_timeout = HZ / 10; 271 api_timeout = msecs_to_jiffies(100);
272 272
273 mb = get_mailbox(itv, mbdata, flags); 273 mb = get_mailbox(itv, mbdata, flags);
274 if (mb < 0) { 274 if (mb < 0) {
@@ -301,11 +301,12 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
301 if (flags & API_NO_WAIT_RES) 301 if (flags & API_NO_WAIT_RES)
302 mdelay(1); 302 mdelay(1);
303 else 303 else
304 ivtv_sleep_timeout(HZ / 100, 0); 304 ivtv_msleep_timeout(10, 0);
305 } 305 }
306 if (jiffies - then > HZ / 10) 306 if (jiffies - then > msecs_to_jiffies(100))
307 IVTV_DEBUG_WARN("%s took %lu jiffies (%d per HZ)\n", 307 IVTV_DEBUG_WARN("%s took %u jiffies\n",
308 api_info[cmd].name, jiffies - then, HZ); 308 api_info[cmd].name,
309 jiffies_to_msecs(jiffies - then));
309 310
310 for (i = 0; i < CX2341X_MBOX_MAX_DATA; i++) 311 for (i = 0; i < CX2341X_MBOX_MAX_DATA; i++)
311 data[i] = readl(&mbox->data[i]); 312 data[i] = readl(&mbox->data[i]);