diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-07-17 16:48:38 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:28:44 -0400 |
commit | c3fb62bf927cee771c3bcd5053e393e7df518f28 (patch) | |
tree | 57819aaabfccac45fc135579aa5f266f01ca5cba /drivers | |
parent | 8373a3e512c8ea8e93981d42b0d1efb252be17fa (diff) |
V4L/DVB (8390): videodev: add comment and remove magic number.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/videodev.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index bf12b5f850e2..aca36dec6746 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c | |||
@@ -2023,9 +2023,13 @@ EXPORT_SYMBOL(video_ioctl2); | |||
2023 | static int get_index(struct video_device *vdev, int num) | 2023 | static int get_index(struct video_device *vdev, int num) |
2024 | { | 2024 | { |
2025 | u32 used = 0; | 2025 | u32 used = 0; |
2026 | const unsigned max_index = sizeof(used) * 8 - 1; | ||
2026 | int i; | 2027 | int i; |
2027 | 2028 | ||
2028 | if (num >= 32) { | 2029 | /* Currently a single v4l driver instance cannot create more than |
2030 | 32 devices. | ||
2031 | Increase to u64 or an array of u32 if more are needed. */ | ||
2032 | if (num > max_index) { | ||
2029 | printk(KERN_ERR "videodev: %s num is too large\n", __func__); | 2033 | printk(KERN_ERR "videodev: %s num is too large\n", __func__); |
2030 | return -EINVAL; | 2034 | return -EINVAL; |
2031 | } | 2035 | } |
@@ -2045,7 +2049,7 @@ static int get_index(struct video_device *vdev, int num) | |||
2045 | } | 2049 | } |
2046 | 2050 | ||
2047 | i = ffz(used); | 2051 | i = ffz(used); |
2048 | return i >= 32 ? -ENFILE : i; | 2052 | return i > max_index ? -ENFILE : i; |
2049 | } | 2053 | } |
2050 | 2054 | ||
2051 | static const struct file_operations video_fops; | 2055 | static const struct file_operations video_fops; |