diff options
Diffstat (limited to 'drivers/media/pci/saa7134/saa7134-video.c')
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-video.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index 135bfd8c28ad..22f8758d047f 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c | |||
@@ -1953,11 +1953,12 @@ static int saa7134_g_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
1953 | return 0; | 1953 | return 0; |
1954 | } | 1954 | } |
1955 | 1955 | ||
1956 | static int saa7134_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | 1956 | static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *crop) |
1957 | { | 1957 | { |
1958 | struct saa7134_fh *fh = f; | 1958 | struct saa7134_fh *fh = f; |
1959 | struct saa7134_dev *dev = fh->dev; | 1959 | struct saa7134_dev *dev = fh->dev; |
1960 | struct v4l2_rect *b = &dev->crop_bounds; | 1960 | struct v4l2_rect *b = &dev->crop_bounds; |
1961 | struct v4l2_rect *c = &dev->crop_current; | ||
1961 | 1962 | ||
1962 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && | 1963 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && |
1963 | crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) | 1964 | crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) |
@@ -1972,21 +1973,20 @@ static int saa7134_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
1972 | if (res_locked(fh->dev, RESOURCE_VIDEO)) | 1973 | if (res_locked(fh->dev, RESOURCE_VIDEO)) |
1973 | return -EBUSY; | 1974 | return -EBUSY; |
1974 | 1975 | ||
1975 | if (crop->c.top < b->top) | 1976 | *c = crop->c; |
1976 | crop->c.top = b->top; | 1977 | if (c->top < b->top) |
1977 | if (crop->c.top > b->top + b->height) | 1978 | c->top = b->top; |
1978 | crop->c.top = b->top + b->height; | 1979 | if (c->top > b->top + b->height) |
1979 | if (crop->c.height > b->top - crop->c.top + b->height) | 1980 | c->top = b->top + b->height; |
1980 | crop->c.height = b->top - crop->c.top + b->height; | 1981 | if (c->height > b->top - c->top + b->height) |
1981 | 1982 | c->height = b->top - c->top + b->height; | |
1982 | if (crop->c.left < b->left) | 1983 | |
1983 | crop->c.left = b->left; | 1984 | if (c->left < b->left) |
1984 | if (crop->c.left > b->left + b->width) | 1985 | c->left = b->left; |
1985 | crop->c.left = b->left + b->width; | 1986 | if (c->left > b->left + b->width) |
1986 | if (crop->c.width > b->left - crop->c.left + b->width) | 1987 | c->left = b->left + b->width; |
1987 | crop->c.width = b->left - crop->c.left + b->width; | 1988 | if (c->width > b->left - c->left + b->width) |
1988 | 1989 | c->width = b->left - c->left + b->width; | |
1989 | dev->crop_current = crop->c; | ||
1990 | return 0; | 1990 | return 0; |
1991 | } | 1991 | } |
1992 | 1992 | ||