[PATCH RFT/RFC v2 40/47] staging: media: zoran: remove framebuffer support

From: Corentin Labbe
Date: Fri Sep 25 2020 - 14:35:16 EST


The framebuffer support is obsolete, so let's reduce code size.

Signed-off-by: Corentin Labbe <clabbe@xxxxxxxxxxxx>
---
drivers/staging/media/zoran/zoran.h | 4 -
drivers/staging/media/zoran/zoran_card.c | 6 --
drivers/staging/media/zoran/zoran_driver.c | 85 ----------------------
3 files changed, 95 deletions(-)

diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h
index 294e52d78e1b..0246635e0eac 100644
--- a/drivers/staging/media/zoran/zoran.h
+++ b/drivers/staging/media/zoran/zoran.h
@@ -299,10 +299,6 @@ struct zoran {

/* Current buffer params */
unsigned int buffer_size;
- void *vbuf_base;
- int vbuf_height, vbuf_width;
- int vbuf_depth;
- int vbuf_bytesperline;

wait_queue_head_t v4l_capq;

diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c
index 0a193283eefc..28a403257bb9 100644
--- a/drivers/staging/media/zoran/zoran_card.c
+++ b/drivers/staging/media/zoran/zoran_card.c
@@ -900,12 +900,6 @@ static int zr36057_init(struct zoran *zr)
zr->jpg_buffers.allocated = 0;
zr->v4l_buffers.allocated = 0;

- zr->vbuf_base = (void *)vidmem;
- zr->vbuf_width = 0;
- zr->vbuf_height = 0;
- zr->vbuf_depth = 0;
- zr->vbuf_bytesperline = 0;
-
/* Avoid nonsense settings from user for default input/norm */
if (default_norm < 0 || default_norm > 2)
default_norm = 0;
diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c
index 43f7c0c02876..bcbe2c78ea16 100644
--- a/drivers/staging/media/zoran/zoran_driver.c
+++ b/drivers/staging/media/zoran/zoran_driver.c
@@ -881,48 +881,6 @@ static int zoran_close(struct file *file)
return 0;
}

-static int setup_fbuffer(struct zoran_fh *fh, void *base, const struct zoran_format *fmt,
- int width, int height, int bytesperline)
-{
- struct zoran *zr = fh->zr;
-
- /* (Ronald) v4l/v4l2 guidelines */
- if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RAWIO))
- return -EPERM;
-
- /*
- * Don't allow frame buffer overlay if PCI or AGP is buggy, or on
- ALi Magik (that needs very low latency while the card needs a
- higher value always)
- */
-
- if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK))
- return -ENXIO;
-
- /* we need a bytesperline value, even if not given */
- if (!bytesperline)
- bytesperline = width * ((fmt->depth + 7) & ~7) / 8;
-
- if (height <= 0 || width <= 0 || bytesperline <= 0) {
- pci_err(zr->pci_dev, "%s - invalid height/width/bpl value (%d|%d|%d)\n",
- __func__, width, height, bytesperline);
- return -EINVAL;
- }
- if (bytesperline & 3) {
- pci_err(zr->pci_dev, "%s - bytesperline (%d) must be 4-byte aligned\n",
- __func__, bytesperline);
- return -EINVAL;
- }
-
- zr->vbuf_base = (void *)((unsigned long)base & ~3);
- zr->vbuf_height = height;
- zr->vbuf_width = width;
- zr->vbuf_depth = fmt->depth;
- zr->vbuf_bytesperline = bytesperline;
-
- return 0;
-}
-
/* get the status of a buffer in the clients buffer queue */
static int zoran_v4l2_buffer_status(struct zoran_fh *fh,
struct v4l2_buffer *buf, int num)
@@ -1403,47 +1361,6 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
return res;
}

-static int zoran_g_fbuf(struct file *file, void *__fh,
- struct v4l2_framebuffer *fb)
-{
- struct zoran *zr = video_drvdata(file);
-
- memset(fb, 0, sizeof(*fb));
- fb->base = zr->vbuf_base;
- fb->fmt.width = zr->vbuf_width;
- fb->fmt.height = zr->vbuf_height;
- fb->fmt.bytesperline = zr->vbuf_bytesperline;
- fb->fmt.colorspace = V4L2_COLORSPACE_SRGB;
- fb->fmt.field = V4L2_FIELD_INTERLACED;
- fb->capability = V4L2_FBUF_CAP_LIST_CLIPPING;
-
- return 0;
-}
-
-static int zoran_s_fbuf(struct file *file, void *__fh,
- const struct v4l2_framebuffer *fb)
-{
- struct zoran *zr = video_drvdata(file);
- struct zoran_fh *fh = __fh;
- int i, res = 0;
- __le32 printformat = __cpu_to_le32(fb->fmt.pixelformat);
-
- for (i = 0; i < NUM_FORMATS; i++)
- if (zoran_formats[i].fourcc == fb->fmt.pixelformat)
- break;
- if (i == NUM_FORMATS) {
- pci_err(zr->pci_dev, "VIDIOC_S_FBUF - format=0x%x (%4.4s) not allowed\n",
- fb->fmt.pixelformat,
- (char *)&printformat);
- return -EINVAL;
- }
-
- res = setup_fbuffer(fh, fb->base, &zoran_formats[i], fb->fmt.width,
- fb->fmt.height, fb->fmt.bytesperline);
-
- return res;
-}
-
static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type type);

static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffers *req)
@@ -2235,8 +2152,6 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = {
/* .vidioc_enum_output = zoran_enum_output,
.vidioc_g_output = zoran_g_output,
.vidioc_s_output = zoran_s_output,*/
- .vidioc_g_fbuf = zoran_g_fbuf,
- .vidioc_s_fbuf = zoran_s_fbuf,
.vidioc_g_std = zoran_g_std,
.vidioc_s_std = zoran_s_std,
.vidioc_g_jpegcomp = zoran_g_jpegcomp,
--
2.26.2