diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 6282387ca05c..d508b5d0538c 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -243,20 +243,31 @@ static int ivtv_validate_speed(int cur_speed, int new_speed) | |||
243 | int fact = new_speed < 0 ? -1 : 1; | 243 | int fact = new_speed < 0 ? -1 : 1; |
244 | int s; | 244 | int s; |
245 | 245 | ||
246 | if (new_speed < 0) new_speed = -new_speed; | 246 | if (cur_speed == 0) |
247 | if (cur_speed < 0) cur_speed = -cur_speed; | 247 | cur_speed = 1000; |
248 | if (new_speed < 0) | ||
249 | new_speed = -new_speed; | ||
250 | if (cur_speed < 0) | ||
251 | cur_speed = -cur_speed; | ||
248 | 252 | ||
249 | if (cur_speed <= new_speed) { | 253 | if (cur_speed <= new_speed) { |
250 | if (new_speed > 1500) return fact * 2000; | 254 | if (new_speed > 1500) |
251 | if (new_speed > 1000) return fact * 1500; | 255 | return fact * 2000; |
256 | if (new_speed > 1000) | ||
257 | return fact * 1500; | ||
252 | } | 258 | } |
253 | else { | 259 | else { |
254 | if (new_speed >= 2000) return fact * 2000; | 260 | if (new_speed >= 2000) |
255 | if (new_speed >= 1500) return fact * 1500; | 261 | return fact * 2000; |
256 | if (new_speed >= 1000) return fact * 1000; | 262 | if (new_speed >= 1500) |
257 | } | 263 | return fact * 1500; |
258 | if (new_speed == 0) return 1000; | 264 | if (new_speed >= 1000) |
259 | if (new_speed == 1 || new_speed == 1000) return fact * new_speed; | 265 | return fact * 1000; |
266 | } | ||
267 | if (new_speed == 0) | ||
268 | return 1000; | ||
269 | if (new_speed == 1 || new_speed == 1000) | ||
270 | return fact * new_speed; | ||
260 | 271 | ||
261 | s = new_speed; | 272 | s = new_speed; |
262 | new_speed = 1000 / new_speed; | 273 | new_speed = 1000 / new_speed; |