Commit 1db608d1 authored by Ronald Bultje's avatar Ronald Bultje Committed by Linus Torvalds

[PATCH] zr36067 driver - reduce stack size usage

Reduce local variable (large struct) stack usage in zoran_do_ioctl() from 1028
bytes to 324 bytes (on x86-32) by declaring & using only 1 "struct
zoran_jpg_settings" instead of 5 instances of it.  Reduced from 5 * 180 bytes
to 1 * 180 bytes, plus other locals in each case.
Signed-off-by: default avatarRandy Dunlap <rddunlap@osdl.org>
Signed-off-by: default avatarRonald S. Bultje <rbultje@ronald.bitfreak.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f70bb809
...@@ -2014,6 +2014,8 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2014,6 +2014,8 @@ zoran_do_ioctl (struct inode *inode,
{ {
struct zoran_fh *fh = file->private_data; struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
/* CAREFUL: used in multiple places here */
struct zoran_jpg_settings settings;
/* we might have older buffers lying around... We don't want /* we might have older buffers lying around... We don't want
* to wait, but we do want to try cleaning them up ASAP. So * to wait, but we do want to try cleaning them up ASAP. So
...@@ -2462,7 +2464,6 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2462,7 +2464,6 @@ zoran_do_ioctl (struct inode *inode,
case BUZIOC_S_PARAMS: case BUZIOC_S_PARAMS:
{ {
struct zoran_params *bparams = arg; struct zoran_params *bparams = arg;
struct zoran_jpg_settings settings;
int res = 0; int res = 0;
dprintk(3, KERN_DEBUG "%s: BUZIOC_S_PARAMS\n", ZR_DEVNAME(zr)); dprintk(3, KERN_DEBUG "%s: BUZIOC_S_PARAMS\n", ZR_DEVNAME(zr));
...@@ -2919,8 +2920,6 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2919,8 +2920,6 @@ zoran_do_ioctl (struct inode *inode,
} }
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) { if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) {
struct zoran_jpg_settings settings;
down(&zr->resource_lock); down(&zr->resource_lock);
settings = fh->jpg_settings; settings = fh->jpg_settings;
...@@ -3983,7 +3982,8 @@ zoran_do_ioctl (struct inode *inode, ...@@ -3983,7 +3982,8 @@ zoran_do_ioctl (struct inode *inode,
{ {
struct v4l2_crop *crop = arg; struct v4l2_crop *crop = arg;
int res = 0; int res = 0;
struct zoran_jpg_settings settings = fh->jpg_settings;
settings = fh->jpg_settings;
dprintk(3, dprintk(3,
KERN_ERR KERN_ERR
...@@ -4065,9 +4065,10 @@ zoran_do_ioctl (struct inode *inode, ...@@ -4065,9 +4065,10 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOC_S_JPEGCOMP: case VIDIOC_S_JPEGCOMP:
{ {
struct v4l2_jpegcompression *params = arg; struct v4l2_jpegcompression *params = arg;
struct zoran_jpg_settings settings = fh->jpg_settings;
int res = 0; int res = 0;
settings = fh->jpg_settings;
dprintk(3, dprintk(3,
KERN_DEBUG KERN_DEBUG
"%s: VIDIOC_S_JPEGCOMP - quality=%d, APPN=%d, APP_len=%d, COM_len=%d\n", "%s: VIDIOC_S_JPEGCOMP - quality=%d, APPN=%d, APP_len=%d, COM_len=%d\n",
...@@ -4151,8 +4152,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -4151,8 +4152,7 @@ zoran_do_ioctl (struct inode *inode,
down(&zr->resource_lock); down(&zr->resource_lock);
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) { if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) {
struct zoran_jpg_settings settings = settings = fh->jpg_settings;
fh->jpg_settings;
/* we actually need to set 'real' parameters now */ /* we actually need to set 'real' parameters now */
if ((fmt->fmt.pix.height * 2) > if ((fmt->fmt.pix.height * 2) >
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment