2020-09-02 16:15:52

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 00/38] media sparse/smatch warn fixes

While I was lately relying on Jenkins to report smatch/sparse issues,
I discovered this week that the reports were missing such warnings

I got it fixed already at builder.linuxtv.org, but there are several new
warnings that got added over time.

This series is meant to solve the ones that are reported on x86_64
without pre-building the smatch database.

It should allow receiving cleaner error reports.

While most of the patches are meant to shut up the static analizers,
some contain real bug fixes.

Mauro Carvalho Chehab (38):
media: tda10086: cleanup symbol_rate setting logic
media: v4l2-ioctl: avoid memory leaks on some time32 compat functions
media: qt1010: fix usage of unititialized value
media: av7110_v4l: avoid a typecast
media: wl128x: get rid of a potential spectre issue
media: venus: place extern venus_fw_debug on a header file
media: tda10021: avoid casts when using symbol_rate
media: serial_ir: use the right type for a dma address
media: vivid: move the detection part out of vivid_create_instance
media: vivid: place the logic which disables ioctl on a separate
function
media: vivid: move set_capabilities logic to a separate function
media: vivid: place dt timings init code on a separate function
media: vivid: move the create queues to a separate function
media: vivid: move the devnode creation logic to a separate function
media: vivid: fix error path
media: videobuf-dma-sg: number of pages should be unsigned long
media: cx25821-alsa: number of pages should be unsigned long
media: cx23885-alsa: number of pages should be unsigned long
media: cx88-alsa: number of pages should be unsigned long
media: saa7134-alsa.c: number of pages should be unsigned long
media: dvb-ttusb-budget: don't use stack for USB transfers
media: dvb-ttusb-budget: cleanup printk logic
media: saa7134: avoid a shift overflow
media: atomisp: fix casts at atomisp_compat_ioctl32.c
media: atomisp: get rid of some unused code
media: atomisp: cleanup ifdefs from ia_css_debug.c
media: atomisp: get rid of version-dependent globals
media: atomisp: get rid of isys_dma.h and isys_dma_local.h
media: atomisp: get rid of ibuf_ctrl abstraction
media: atomisp: don't check for ISP version for includes
media: atomisp: unify INPUT error return type
media: atomisp: de-duplicate names at *_input_system_global.h
media: atomisp: reorder functions at pixelgen_private.h
media: atomisp: remove compile-time tests from input_system_global.h
media: atomisp: fix some bad indents
media: atomisp: csi_rx.c: add a missing includes
media: atomisp: atomisp_gmin_platform: check before use
media: atomisp: cleanup isys_irq headers

drivers/media/dvb-frontends/tda10021.c | 38 +-
drivers/media/dvb-frontends/tda10086.c | 22 +-
drivers/media/pci/cx23885/cx23885-alsa.c | 7 +-
drivers/media/pci/cx23885/cx23885.h | 4 +-
drivers/media/pci/cx25821/cx25821-alsa.c | 11 +-
drivers/media/pci/cx88/cx88-alsa.c | 13 +-
drivers/media/pci/saa7134/saa7134-alsa.c | 7 +-
drivers/media/pci/saa7134/saa7134-tvaudio.c | 3 +-
drivers/media/pci/saa7134/saa7134.h | 2 +-
drivers/media/pci/ttpci/av7110_v4l.c | 4 +-
drivers/media/platform/qcom/venus/core.h | 2 +
drivers/media/platform/qcom/venus/dbgfs.c | 2 -
drivers/media/radio/wl128x/fmdrv_common.c | 16 +-
drivers/media/rc/serial_ir.c | 2 +-
drivers/media/test-drivers/vivid/vivid-core.c | 645 ++++++------
drivers/media/tuners/qt1010.c | 25 +-
.../media/usb/ttusb-budget/dvb-ttusb-budget.c | 197 ++--
drivers/media/v4l2-core/v4l2-ioctl.c | 48 +-
drivers/media/v4l2-core/videobuf-dma-sg.c | 22 +-
drivers/staging/media/atomisp/Makefile | 12 +-
.../atomisp/pci/atomisp_compat_ioctl32.c | 84 +-
.../media/atomisp/pci/atomisp_gmin_platform.c | 5 +-
.../atomisp/pci/css_2401_system/host/csi_rx.c | 1 +
.../pci/css_2401_system/host/ibuf_ctrl.c | 1 +
.../css_2401_system/host/ibuf_ctrl_local.h | 1 +
.../css_2401_system/host/ibuf_ctrl_private.h | 268 -----
.../pci/css_2401_system/host/isys_dma.c | 10 +-
.../pci/css_2401_system/host/isys_dma_local.h | 21 -
.../css_2401_system/host/isys_dma_private.h | 12 +-
.../pci/css_2401_system/host/isys_irq.c | 3 +-
.../pci/css_2401_system/host/isys_irq_local.h | 4 +-
.../css_2401_system/host/isys_irq_private.h | 12 +-
.../css_2401_system/host/pixelgen_private.h | 73 +-
.../pci/css_2401_system/ibuf_ctrl_global.h | 6 +-
.../pci/css_2401_system/isys_irq_global.h | 4 +-
.../pci/css_2401_system/pixelgen_global.h | 8 +-
.../host/input_formatter.c | 2 +-
.../hive_isp_css_common/host/input_system.c | 70 +-
.../hive_isp_css_include/host/csi_rx_public.h | 4 +-
.../host/ibuf_ctrl_public.h | 94 --
.../host/isys_dma_public.h | 8 +-
.../host/isys_irq_public.h | 29 +-
.../hive_isp_css_include/host/isys_public.h | 4 +-
.../host/pixelgen_public.h | 4 +-
.../pci/hive_isp_css_include/ibuf_ctrl.h | 47 -
.../pci/hive_isp_css_include/isys_dma.h | 47 -
.../pci/hive_isp_css_include/isys_irq.h | 16 +-
drivers/staging/media/atomisp/pci/hmm/hmm.c | 6 +-
.../staging/media/atomisp/pci/ia_css_mipi.h | 2 -
.../staging/media/atomisp/pci/ia_css_stream.h | 4 +-
.../media/atomisp/pci/input_system_global.h | 29 +-
.../kernels/ctc/ctc_1.0/ia_css_ctc_param.h | 7 -
.../ctc/ctc_1.0/ia_css_ctc_table.host.c | 145 ---
.../kernels/gc/gc_1.0/ia_css_gc_table.host.c | 144 ---
.../kernels/gc/gc_2/ia_css_gc2_table.host.c | 53 -
.../isp/kernels/raw/raw_1.0/ia_css_raw.host.c | 4 +-
.../kernels/xnr/xnr_1.0/ia_css_xnr_param.h | 7 -
.../xnr/xnr_1.0/ia_css_xnr_table.host.c | 31 -
.../atomisp/pci/isp2400_input_system_global.h | 21 +-
.../atomisp/pci/isp2400_input_system_local.h | 17 +-
.../atomisp/pci/isp2400_input_system_public.h | 26 +-
.../media/atomisp/pci/isp2400_system_global.h | 16 -
.../atomisp/pci/isp2401_input_system_global.h | 30 +-
.../atomisp/pci/isp2401_input_system_local.h | 3 -
.../pci/isp2401_input_system_private.h | 224 ++++-
.../media/atomisp/pci/isp2401_system_global.h | 19 -
.../atomisp/pci/runtime/binary/src/binary.c | 919 +++++++++---------
.../runtime/bufq/interface/ia_css_bufq_comm.h | 10 -
.../media/atomisp/pci/runtime/bufq/src/bufq.c | 26 +-
.../runtime/debug/interface/ia_css_debug.h | 6 -
.../pci/runtime/debug/src/ia_css_debug.c | 193 +---
.../atomisp/pci/runtime/ifmtr/src/ifmtr.c | 2 +-
.../pci/runtime/inputfifo/src/inputfifo.c | 10 -
.../pci/runtime/isys/interface/ia_css_isys.h | 18 +-
.../runtime/isys/interface/ia_css_isys_comm.h | 4 +-
.../pci/runtime/isys/src/csi_rx_rmgr.c | 2 +-
.../pci/runtime/isys/src/isys_dma_rmgr.c | 2 +-
.../atomisp/pci/runtime/isys/src/isys_init.c | 20 +-
.../runtime/isys/src/isys_stream2mmio_rmgr.c | 2 +-
.../media/atomisp/pci/runtime/isys/src/rx.c | 24 +-
.../pci/runtime/isys/src/virtual_isys.c | 58 +-
.../pipeline/interface/ia_css_pipeline.h | 2 +-
.../pci/runtime/pipeline/src/pipeline.c | 4 +-
drivers/staging/media/atomisp/pci/sh_css.c | 296 ++----
.../staging/media/atomisp/pci/sh_css_defs.h | 4 -
.../staging/media/atomisp/pci/sh_css_hrt.c | 4 -
.../media/atomisp/pci/sh_css_internal.h | 36 +-
.../staging/media/atomisp/pci/sh_css_mipi.c | 34 +-
.../media/atomisp/pci/sh_css_param_shading.c | 2 +-
.../staging/media/atomisp/pci/sh_css_params.c | 538 ----------
.../media/atomisp/pci/sh_css_properties.c | 10 -
drivers/staging/media/atomisp/pci/sh_css_sp.c | 39 +-
drivers/staging/media/atomisp/pci/sh_css_sp.h | 8 +-
.../staging/media/atomisp/pci/sh_css_struct.h | 2 -
.../staging/media/atomisp/pci/system_global.h | 23 -
include/media/videobuf-dma-sg.h | 2 +-
96 files changed, 1708 insertions(+), 3300 deletions(-)
delete mode 100644 drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h
delete mode 100644 drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h
delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h
delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h
delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_dma.h
delete mode 100644 drivers/staging/media/atomisp/pci/isp2400_system_global.h
delete mode 100644 drivers/staging/media/atomisp/pci/isp2401_system_global.h

--
2.26.2



2020-09-02 16:16:03

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 21/38] media: dvb-ttusb-budget: don't use stack for USB transfers

As reported by smatch:

drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:311 ttusb_boot_dsp() error: doing dma on the stack (b)
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:321 ttusb_boot_dsp() error: doing dma on the stack (b)
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:330 ttusb_boot_dsp() error: doing dma on the stack (b)
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:351 ttusb_set_channel() error: doing dma on the stack (b)
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:361 ttusb_del_channel() error: doing dma on the stack (b)
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:412 ttusb_init_controller() error: doing dma on the stack (b0)
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:416 ttusb_init_controller() error: doing dma on the stack (b1)
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:422 ttusb_init_controller() error: doing dma on the stack (b2)
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:425 ttusb_init_controller() error: doing dma on the stack (b3)
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:430 ttusb_init_controller() error: doing dma on the stack (get_version)

This driver still uses the USB stack for DMA transfers,
which is broken for a long time. I almost dropped this driver,
as there's a high chance that nobody is using it with upstream
Kernels, as we didn't receive any bug reports.

As fixing this won't be hard, I ended opting to fix.

While here, I dropped an ugly hack that implemented read via
a separate function that was just doing a memcpy().

It should be noticed that, during the init phase, there's
a "b4" register that were never initialized, as its buffer
were used just to store the results of "b3" initialization.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
.../media/usb/ttusb-budget/dvb-ttusb-budget.c | 83 +++++++------------
1 file changed, 30 insertions(+), 53 deletions(-)

diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
index 4e56ff83566b..2582a62184fd 100644
--- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
@@ -72,6 +72,9 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
#define TTUSB_REV_2_2 0x22
#define TTUSB_BUDGET_NAME "ttusb_stc_fw"

+#define MAX_SEND 0x28
+#define MAX_RCV 0x20
+
/*
* since we're casting (struct ttusb*) <-> (struct dvb_demux*) around
* the dvb_demux field must be the first in struct!!
@@ -119,87 +122,72 @@ struct ttusb {
int cc; /* MuxCounter - will increment on EVERY MUX PACKET */
/* (including stuffing. yes. really.) */

- u8 last_result[32];
+ u8 send_buf[MAX_SEND];
+ u8 last_result[MAX_RCV];

int revision;

struct dvb_frontend* fe;
};

-/* ugly workaround ... don't know why it's necessary to read */
-/* all result codes. */
-
-static int ttusb_cmd(struct ttusb *ttusb,
- const u8 * data, int len, int needresult)
+static int ttusb_cmd(struct ttusb *ttusb, u8 *data, int len, int len_result)
{
int actual_len;
int err;
- int i;
-
- if (debug >= 3) {
- printk(KERN_DEBUG ">");
- for (i = 0; i < len; ++i)
- printk(KERN_CONT " %02x", data[i]);
- printk(KERN_CONT "\n");
- }

if (mutex_lock_interruptible(&ttusb->semusb) < 0)
return -EAGAIN;

+ if (debug >= 3)
+ printk(KERN_DEBUG "> %*ph\n", len, data);
+
+ memcpy(data, ttusb->send_buf, len);
+
err = usb_bulk_msg(ttusb->dev, ttusb->bulk_out_pipe,
- (u8 *) data, len, &actual_len, 1000);
+ ttusb->send_buf, len, &actual_len, 1000);
if (err != 0) {
dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n",
__func__, err);
- mutex_unlock(&ttusb->semusb);
- return err;
+ goto err;
}
if (actual_len != len) {
+ err = -EIO;
dprintk("%s: only wrote %d of %d bytes\n", __func__,
actual_len, len);
- mutex_unlock(&ttusb->semusb);
- return -1;
+ goto err;
}

err = usb_bulk_msg(ttusb->dev, ttusb->bulk_in_pipe,
- ttusb->last_result, 32, &actual_len, 1000);
+ ttusb->last_result, MAX_RCV, &actual_len, 1000);

if (err != 0) {
printk("%s: failed, receive error %d\n", __func__,
err);
- mutex_unlock(&ttusb->semusb);
- return err;
+ goto err;
}

if (debug >= 3) {
actual_len = ttusb->last_result[3] + 4;
- printk(KERN_DEBUG "<");
- for (i = 0; i < actual_len; ++i)
- printk(KERN_CONT " %02x", ttusb->last_result[i]);
- printk(KERN_CONT "\n");
+ printk(KERN_DEBUG "< %*ph\n", actual_len, ttusb->last_result);
}

- if (!needresult)
- mutex_unlock(&ttusb->semusb);
- return 0;
-}
+ if (len_result)
+ memcpy(ttusb->send_buf, ttusb->last_result, len_result);

-static int ttusb_result(struct ttusb *ttusb, u8 * data, int len)
-{
- memcpy(data, ttusb->last_result, len);
+err:
mutex_unlock(&ttusb->semusb);
- return 0;
+ return err;
}

static int ttusb_i2c_msg(struct ttusb *ttusb,
u8 addr, u8 * snd_buf, u8 snd_len, u8 * rcv_buf,
u8 rcv_len)
{
- u8 b[0x28];
+ u8 b[MAX_SEND];
u8 id = ++ttusb->c;
int i, err;

- if (snd_len > 0x28 - 7 || rcv_len > 0x20 - 7)
+ if (snd_len > MAX_SEND - 7 || rcv_len > MAX_RCV - 7)
return -EINVAL;

b[0] = 0xaa;
@@ -213,13 +201,11 @@ static int ttusb_i2c_msg(struct ttusb *ttusb,
for (i = 0; i < snd_len; i++)
b[7 + i] = snd_buf[i];

- err = ttusb_cmd(ttusb, b, snd_len + 7, 1);
+ err = ttusb_cmd(ttusb, b, snd_len + 7, MAX_RCV);

if (err)
return -EREMOTEIO;

- err = ttusb_result(ttusb, b, 0x20);
-
/* check if the i2c transaction was successful */
if ((snd_len != b[5]) || (rcv_len != b[6])) return -EREMOTEIO;

@@ -400,8 +386,6 @@ static int ttusb_init_controller(struct ttusb *ttusb)
/* i2c write read: 5 bytes, addr 0x10, 0x02 bytes write, 1 bytes read. */
u8 b3[] =
{ 0xaa, ++ttusb->c, 0x31, 5, 0x10, 0x02, 0x01, 0x00, 0x1e };
- u8 b4[] =
- { 0x55, ttusb->c, 0x31, 4, 0x10, 0x02, 0x01, 0x00, 0x1e };

u8 get_version[] = { 0xaa, ++ttusb->c, 0x17, 5, 0, 0, 0, 0, 0 };
u8 get_dsp_version[0x20] =
@@ -422,15 +406,11 @@ static int ttusb_init_controller(struct ttusb *ttusb)
if ((err = ttusb_cmd(ttusb, b2, sizeof(b2), 0)))
return err;

- if ((err = ttusb_cmd(ttusb, b3, sizeof(b3), 1)))
+ if ((err = ttusb_cmd(ttusb, b3, sizeof(b3), 0)))
return err;

- err = ttusb_result(ttusb, b4, sizeof(b4));
-
- if ((err = ttusb_cmd(ttusb, get_version, sizeof(get_version), 1)))
- return err;
-
- if ((err = ttusb_result(ttusb, get_version, sizeof(get_version))))
+ if ((err = ttusb_cmd(ttusb, get_version,
+ sizeof(get_version), sizeof(get_version))))
return err;

dprintk("%s: stc-version: %c%c%c%c%c\n", __func__,
@@ -451,14 +431,11 @@ static int ttusb_init_controller(struct ttusb *ttusb)
(get_version[8] - '0');

err =
- ttusb_cmd(ttusb, get_dsp_version, sizeof(get_dsp_version), 1);
+ ttusb_cmd(ttusb, get_dsp_version,
+ sizeof(get_dsp_version), sizeof(get_dsp_version));
if (err)
return err;

- err =
- ttusb_result(ttusb, get_dsp_version, sizeof(get_dsp_version));
- if (err)
- return err;
printk("%s: dsp-version: %c%c%c\n", __func__,
get_dsp_version[4], get_dsp_version[5], get_dsp_version[6]);
return 0;
--
2.26.2

2020-09-02 16:16:08

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 30/38] media: atomisp: don't check for ISP version for includes

As there aren't duplicated names anymore, and the end goal
is to do runtime checks between ISP2400 and ISP2401,
remove the part of the Makefile which changes the include
places based on the compile-time version.

This shouldn't cause any effect, but it will make easier
for further patches meant to remove conditional compiler
decisions between ISP versions to be replaced by
runtime ones.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/staging/media/atomisp/Makefile | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/media/atomisp/Makefile b/drivers/staging/media/atomisp/Makefile
index 205d0f8cc2e1..1dfad0dd02d0 100644
--- a/drivers/staging/media/atomisp/Makefile
+++ b/drivers/staging/media/atomisp/Makefile
@@ -307,18 +307,12 @@ INCLUDES += \
-I$(atomisp)/pci/runtime/queue/src/ \
-I$(atomisp)/pci/runtime/rmgr/interface/ \
-I$(atomisp)/pci/runtime/spctrl/interface/ \
- -I$(atomisp)/pci/runtime/tagger/interface/
-
-INCLUDES_byt += \
+ -I$(atomisp)/pci/runtime/tagger/interface/ \
-I$(atomisp)/pci/css_2400_system/hive/ \
-
-INCLUDES_cht += \
-I$(atomisp)/pci/css_2401_system/ \
-I$(atomisp)/pci/css_2401_system/host/ \
-I$(atomisp)/pci/css_2401_system/hive/ \
- -I$(atomisp)/pci/css_2401_system/hrt/ \
-
-# -I$(atomisp)/pci/css_2401_system/hive_isp_css_2401_system_generated/ \
+ -I$(atomisp)/pci/css_2401_system/hrt/

DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST -DHRT_USE_VIR_ADDRS -D__HOST__
#DEFINES += -DUSE_DYNAMIC_BIN
@@ -330,11 +324,9 @@ DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST -DHRT_USE_VIR_ADDRS -D__HOST__

ifeq ($(CONFIG_VIDEO_ATOMISP_ISP2401),y)
atomisp-objs += $(obj-cht)
-INCLUDES += $(INCLUDES_cht)
DEFINES += -DISP2401 -DISP2401_NEW_INPUT_SYSTEM -DSYSTEM_hive_isp_css_2401_system
else
atomisp-objs += $(obj-byt)
-INCLUDES += $(INCLUDES_byt)
DEFINES += -DISP2400 -DSYSTEM_hive_isp_css_2400_system
endif

--
2.26.2

2020-09-02 16:16:23

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 24/38] media: atomisp: fix casts at atomisp_compat_ioctl32.c

There are several warnings reported by sparse with regards to wrong
typecasts:

drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:73:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:73:13: expected void *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:73:13: got void [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:247:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:247:13: expected unsigned int [usertype] *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:247:13: got void [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:248:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:248:13: expected unsigned int [usertype] *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:248:13: got void [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:249:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:249:13: expected unsigned int [usertype] *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:249:13: got void [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:250:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:250:13: expected unsigned int [usertype] *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:250:13: got void [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:282:30: warning: incorrect type in argument 2 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:282:30: expected void const *from
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:282:30: got struct atomisp_3a_statistics [noderef] __user *kp
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:308:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:308:13: expected unsigned int [usertype] *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:308:13: got void [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:327:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:327:13: expected void [noderef] __user *effective_width
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:327:13: got unsigned int [usertype] *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:348:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:348:13: expected void [noderef] __user *effective_width
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:348:13: got unsigned int [usertype] *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:372:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:372:13: expected unsigned int [usertype] *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:372:13: got void [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:433:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:433:13: expected struct v4l2_framebuffer *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:433:13: got void [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:462:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:462:13: expected void [noderef] __user *frame
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:462:13: got struct v4l2_framebuffer *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:496:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:496:13: expected unsigned short *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:496:13: got void [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:511:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:511:13: expected void [noderef] __user *calb_grp_values
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:511:13: got unsigned short *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:630:21: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:630:21: expected unsigned short [usertype] *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:630:21: got void [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27: warning: cast removes address space '__user' of expression
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27: warning: incorrect type in initializer (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27: expected struct <noident> [noderef] __user *karg
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27: got void *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:721:39: warning: cast removes address space '__user' of expression
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:21: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:21: expected void const volatile [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:21: got unsigned int [usertype] *src
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:43: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:43: expected void *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:43: got void [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:741:21: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:741:21: expected struct atomisp_shading_table *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:741:21: got struct atomisp_shading_table [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:747:21: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:747:21: expected struct atomisp_morph_table *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:747:21: got struct atomisp_morph_table [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:753:21: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:753:21: expected struct atomisp_dis_coefficients *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:753:21: got struct atomisp_dis_coefficients [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:760:14: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:760:14: expected struct atomisp_dvs_6axis_config *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:760:14: got struct atomisp_dvs_6axis_config [noderef] __user *
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:817:13: warning: incorrect type in assignment (different address spaces)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:817:13: expected struct atomisp_sensor_ae_bracketing_lut_entry *__pu_val
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:817:13: got void [noderef] __user *

Use the same strategies used at v4l2-compat32.c, in order to
solve them and avoid warnings.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
.../atomisp/pci/atomisp_compat_ioctl32.c | 84 +++++++++++--------
1 file changed, 48 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c b/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c
index fa5918270614..e5553df5bad4 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c
@@ -25,16 +25,26 @@
#include "atomisp_ioctl.h"
#include "atomisp_compat_ioctl32.h"

-/* Macro borrowed from v4l2-compat-ioctl32.c */
+/* Macros borrowed from v4l2-compat-ioctl32.c */
+
+#define get_user_cast(__x, __ptr) \
+({ \
+ get_user(__x, (typeof(*__ptr) __user *)(__ptr)); \
+})
+
+#define put_user_force(__x, __ptr) \
+({ \
+ put_user((typeof(*__x) __force *)(__x), __ptr); \
+})
+
/* Use the same argument order as copy_in_user */
-#define assign_in_user(to, from) \
-({ \
- typeof(*from) __assign_tmp; \
- \
- get_user(__assign_tmp, from) || put_user(__assign_tmp, to); \
+#define assign_in_user(to, from) \
+({ \
+ typeof(*from) __assign_tmp; \
+ \
+ get_user_cast(__assign_tmp, from) || put_user(__assign_tmp, to);\
})

-
static int get_atomisp_histogram32(struct atomisp_histogram __user *kp,
struct atomisp_histogram32 __user *up)
{
@@ -64,13 +74,13 @@ static int put_atomisp_histogram32(struct atomisp_histogram __user *kp,
}

static int get_v4l2_framebuffer32(struct v4l2_framebuffer __user *kp,
- struct v4l2_framebuffer32 __user *up)
+ struct v4l2_framebuffer32 __user *up)
{
compat_uptr_t tmp;

if (!access_ok(up, sizeof(struct v4l2_framebuffer32)) ||
get_user(tmp, &up->base) ||
- put_user(compat_ptr(tmp), &kp->base) ||
+ put_user_force(compat_ptr(tmp), &kp->base) ||
assign_in_user(&kp->capability, &up->capability) ||
assign_in_user(&kp->flags, &up->flags) ||
copy_in_user(&kp->fmt, &up->fmt, sizeof(kp->fmt)))
@@ -244,10 +254,10 @@ static int get_atomisp_dvs_6axis_config32(struct atomisp_dvs_6axis_config __user
get_user(ycoords_y, &up->ycoords_y) ||
get_user(xcoords_uv, &up->xcoords_uv) ||
get_user(ycoords_uv, &up->ycoords_uv) ||
- put_user(compat_ptr(xcoords_y), &kp->xcoords_y) ||
- put_user(compat_ptr(ycoords_y), &kp->ycoords_y) ||
- put_user(compat_ptr(xcoords_uv), &kp->xcoords_uv) ||
- put_user(compat_ptr(ycoords_uv), &kp->ycoords_uv))
+ put_user_force(compat_ptr(xcoords_y), &kp->xcoords_y) ||
+ put_user_force(compat_ptr(ycoords_y), &kp->ycoords_y) ||
+ put_user_force(compat_ptr(xcoords_uv), &kp->xcoords_uv) ||
+ put_user_force(compat_ptr(ycoords_uv), &kp->ycoords_uv))
return -EFAULT;

return 0;
@@ -279,7 +289,7 @@ static int put_atomisp_3a_statistics32(struct atomisp_3a_statistics __user *kp,
void __user *rgby_data;

if (!access_ok(up, sizeof(struct atomisp_3a_statistics32)) ||
- copy_to_user(up, kp, sizeof(struct atomisp_grid_info)) ||
+ copy_in_user(up, kp, sizeof(struct atomisp_grid_info)) ||
get_user(rgby_data, &kp->rgby_data) ||
put_user(ptr_to_compat(rgby_data), &up->rgby_data) ||
get_user(data, &kp->data) ||
@@ -305,7 +315,7 @@ static int get_atomisp_metadata_stat32(struct atomisp_metadata __user *kp,
assign_in_user(&kp->stride, &up->stride) ||
assign_in_user(&kp->exp_id, &up->exp_id) ||
get_user(effective_width, &up->effective_width) ||
- put_user(compat_ptr(effective_width), &kp->effective_width))
+ put_user_force(compat_ptr(effective_width), &kp->effective_width))
return -EFAULT;

return 0;
@@ -315,7 +325,7 @@ static int put_atomisp_metadata_stat32(struct atomisp_metadata __user *kp,
struct atomisp_metadata32 __user *up)
{
void __user *data;
- void __user *effective_width;
+ void *effective_width;

if (!access_ok(up, sizeof(struct atomisp_metadata32)) ||
get_user(data, &kp->data) ||
@@ -325,7 +335,8 @@ static int put_atomisp_metadata_stat32(struct atomisp_metadata __user *kp,
assign_in_user(&up->stride, &kp->stride) ||
assign_in_user(&up->exp_id, &kp->exp_id) ||
get_user(effective_width, &kp->effective_width) ||
- put_user(ptr_to_compat(effective_width), &up->effective_width))
+ put_user(ptr_to_compat((void __user *)effective_width),
+ &up->effective_width))
return -EFAULT;

return 0;
@@ -336,7 +347,7 @@ put_atomisp_metadata_by_type_stat32(struct atomisp_metadata_with_type __user *kp
struct atomisp_metadata_with_type32 __user *up)
{
void __user *data;
- void __user *effective_width;
+ u32 *effective_width;

if (!access_ok(up, sizeof(struct atomisp_metadata_with_type32)) ||
get_user(data, &kp->data) ||
@@ -346,7 +357,7 @@ put_atomisp_metadata_by_type_stat32(struct atomisp_metadata_with_type __user *kp
assign_in_user(&up->stride, &kp->stride) ||
assign_in_user(&up->exp_id, &kp->exp_id) ||
get_user(effective_width, &kp->effective_width) ||
- put_user(ptr_to_compat(effective_width),
+ put_user(ptr_to_compat((void __user *)effective_width),
&up->effective_width) ||
assign_in_user(&up->type, &kp->type))
return -EFAULT;
@@ -369,7 +380,7 @@ get_atomisp_metadata_by_type_stat32(struct atomisp_metadata_with_type __user *kp
assign_in_user(&kp->stride, &up->stride) ||
assign_in_user(&kp->exp_id, &up->exp_id) ||
get_user(effective_width, &up->effective_width) ||
- put_user(compat_ptr(effective_width), &kp->effective_width) ||
+ put_user_force(compat_ptr(effective_width), &kp->effective_width) ||
assign_in_user(&kp->type, &up->type))
return -EFAULT;

@@ -430,7 +441,7 @@ static int get_atomisp_overlay32(struct atomisp_overlay __user *kp,

if (!access_ok(up, sizeof(struct atomisp_overlay32)) ||
get_user(frame, &up->frame) ||
- put_user(compat_ptr(frame), &kp->frame) ||
+ put_user_force(compat_ptr(frame), &kp->frame) ||
assign_in_user(&kp->bg_y, &up->bg_y) ||
assign_in_user(&kp->bg_u, &up->bg_u) ||
assign_in_user(&kp->bg_v, &up->bg_v) ||
@@ -456,11 +467,11 @@ static int get_atomisp_overlay32(struct atomisp_overlay __user *kp,
static int put_atomisp_overlay32(struct atomisp_overlay __user *kp,
struct atomisp_overlay32 __user *up)
{
- void __user *frame;
+ void *frame;

if (!access_ok(up, sizeof(struct atomisp_overlay32)) ||
get_user(frame, &kp->frame) ||
- put_user(ptr_to_compat(frame), &up->frame) ||
+ put_user(ptr_to_compat((void __user *)frame), &up->frame) ||
assign_in_user(&up->bg_y, &kp->bg_y) ||
assign_in_user(&up->bg_u, &kp->bg_u) ||
assign_in_user(&up->bg_v, &kp->bg_v) ||
@@ -493,7 +504,7 @@ get_atomisp_calibration_group32(struct atomisp_calibration_group __user *kp,
assign_in_user(&kp->size, &up->size) ||
assign_in_user(&kp->type, &up->type) ||
get_user(calb_grp_values, &up->calb_grp_values) ||
- put_user(compat_ptr(calb_grp_values), &kp->calb_grp_values))
+ put_user_force(compat_ptr(calb_grp_values), &kp->calb_grp_values))
return -EFAULT;

return 0;
@@ -503,13 +514,14 @@ static int
put_atomisp_calibration_group32(struct atomisp_calibration_group __user *kp,
struct atomisp_calibration_group32 __user *up)
{
- void __user *calb_grp_values;
+ void *calb_grp_values;

if (!access_ok(up, sizeof(struct atomisp_calibration_group32)) ||
assign_in_user(&up->size, &kp->size) ||
assign_in_user(&up->type, &kp->type) ||
get_user(calb_grp_values, &kp->calb_grp_values) ||
- put_user(ptr_to_compat(calb_grp_values), &up->calb_grp_values))
+ put_user(ptr_to_compat((void __user *)calb_grp_values),
+ &up->calb_grp_values))
return -EFAULT;

return 0;
@@ -523,7 +535,7 @@ static int get_atomisp_acc_fw_load32(struct atomisp_acc_fw_load __user *kp,
if (!access_ok(up, sizeof(struct atomisp_acc_fw_load32)) ||
assign_in_user(&kp->size, &up->size) ||
assign_in_user(&kp->fw_handle, &up->fw_handle) ||
- get_user(data, &up->data) ||
+ get_user_cast(data, &up->data) ||
put_user(compat_ptr(data), &kp->data))
return -EFAULT;

@@ -627,7 +639,7 @@ static int get_atomisp_shading_table32(struct atomisp_shading_table __user *kp,
compat_uptr_t tmp;

if (get_user(tmp, &up->data[n]) ||
- put_user(compat_ptr(tmp), &kp->data[n]))
+ put_user_force(compat_ptr(tmp), &kp->data[n]))
return -EFAULT;
}
return 0;
@@ -712,17 +724,17 @@ static int get_atomisp_parameters32(struct atomisp_parameters __user *kp,
struct atomisp_morph_table morph_table;
struct atomisp_dis_coefficients dvs2_coefs;
struct atomisp_dvs_6axis_config dvs_6axis_config;
- } __user *karg = (void *)(kp + 1);
+ } __user *karg = (void __user *)(kp + 1);

if (!access_ok(up, sizeof(struct atomisp_parameters32)))
return -EFAULT;

while (n >= 0) {
- compat_uptr_t *src = (compat_uptr_t *)up + n;
+ compat_uptr_t __user *src = (compat_uptr_t __user *)up + n;
void * __user *dst = (void * __user *)kp + n;
compat_uptr_t tmp;

- if (get_user(tmp, src) || put_user(compat_ptr(tmp), dst))
+ if (get_user_cast(tmp, src) || put_user_force(compat_ptr(tmp), dst))
return -EFAULT;
n--;
}
@@ -738,26 +750,26 @@ static int get_atomisp_parameters32(struct atomisp_parameters __user *kp,
/* handle shading table */
if (stp && (get_atomisp_shading_table32(&karg->shading_table,
compat_ptr(stp)) ||
- put_user(&karg->shading_table, &kp->shading_table)))
+ put_user_force(&karg->shading_table, &kp->shading_table)))
return -EFAULT;

/* handle morph table */
if (mtp && (get_atomisp_morph_table32(&karg->morph_table,
compat_ptr(mtp)) ||
- put_user(&karg->morph_table, &kp->morph_table)))
+ put_user_force(&karg->morph_table, &kp->morph_table)))
return -EFAULT;

/* handle dvs2 coefficients */
if (dcp && (get_atomisp_dis_coefficients32(&karg->dvs2_coefs,
compat_ptr(dcp)) ||
- put_user(&karg->dvs2_coefs, &kp->dvs2_coefs)))
+ put_user_force(&karg->dvs2_coefs, &kp->dvs2_coefs)))
return -EFAULT;

/* handle dvs 6axis configuration */
if (dscp &&
(get_atomisp_dvs_6axis_config32(&karg->dvs_6axis_config,
compat_ptr(dscp)) ||
- put_user(&karg->dvs_6axis_config, &kp->dvs_6axis_config)))
+ put_user_force(&karg->dvs_6axis_config, &kp->dvs_6axis_config)))
return -EFAULT;

return 0;
@@ -814,7 +826,7 @@ get_atomisp_sensor_ae_bracketing_lut(struct atomisp_sensor_ae_bracketing_lut __u
if (!access_ok(up, sizeof(struct atomisp_sensor_ae_bracketing_lut32)) ||
assign_in_user(&kp->lut_size, &up->lut_size) ||
get_user(lut, &up->lut) ||
- put_user(compat_ptr(lut), &kp->lut))
+ put_user_force(compat_ptr(lut), &kp->lut))
return -EFAULT;

return 0;
--
2.26.2

2020-09-02 16:17:34

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 26/38] media: atomisp: cleanup ifdefs from ia_css_debug.c

There are lots of code dependency there. Get rid of most of
them.

We can't remove everything, as there are some structs that
are conditionally built if ISP2401. So, keep ifdefs only
on such cases.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
.../runtime/debug/interface/ia_css_debug.h | 6 -
.../pci/runtime/debug/src/ia_css_debug.c | 187 ++++--------------
2 files changed, 42 insertions(+), 151 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h b/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h
index e04d2485ea75..0f9b7eb17647 100644
--- a/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h
+++ b/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h
@@ -158,12 +158,6 @@ void ia_css_debug_set_dtrace_level(
*/
unsigned int ia_css_debug_get_dtrace_level(void);

-/*! @brief Dump input formatter state.
- * Dumps the input formatter state to tracing output.
- * @return None
- */
-void ia_css_debug_dump_if_state(void);
-
/*! @brief Dump isp hardware state.
* Dumps the isp hardware state to tracing output.
* @return None
diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
index 56d5d90634fa..ec598a1697b1 100644
--- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
+++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
@@ -52,9 +52,7 @@

#include "fifo_monitor.h"

-#if !defined(HAS_NO_INPUT_FORMATTER)
#include "input_formatter.h"
-#endif
#include "dma.h"
#include "irq.h"
#include "gp_device.h"
@@ -63,9 +61,7 @@
#include "type_support.h"
#include "math_support.h" /* CEIL_DIV */
#include "input_system.h" /* input_formatter_reg_load */
-#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
#include "ia_css_tagger_common.h"
-#endif

#include "sh_css_internal.h"
#include "ia_css_isys.h"
@@ -105,17 +101,6 @@

#define ENABLE_LINE_MAX_LENGTH (25)

-#ifdef ISP2401
-#define DBG_EXT_CMD_TRACE_PNTS_DUMP BIT(8)
-#define DBG_EXT_CMD_PUB_CFG_DUMP BIT(9)
-#define DBG_EXT_CMD_GAC_REG_DUMP BIT(10)
-#define DBG_EXT_CMD_GAC_ACB_REG_DUMP BIT(11)
-#define DBG_EXT_CMD_FIFO_DUMP BIT(12)
-#define DBG_EXT_CMD_QUEUE_DUMP BIT(13)
-#define DBG_EXT_CMD_DMA_DUMP BIT(14)
-#define DBG_EXT_CMD_MASK 0xAB0000CD
-
-#endif
/*
* TODO:SH_CSS_MAX_SP_THREADS is not the max number of sp threads
* future rework should fix this and remove the define MAX_THREAD_NUM
@@ -449,23 +434,21 @@ void ia_css_debug_dump_isp_state(void)
debug_print_isp_state(&state, "ISP");

if (state.is_stalling) {
-#if !defined(HAS_NO_INPUT_FORMATTER)
- ia_css_debug_dtrace(2, "\t%-32s: %d\n",
- "[0] if_prim_a_FIFO stalled", stall.fifo0);
- ia_css_debug_dtrace(2, "\t%-32s: %d\n",
- "[1] if_prim_b_FIFO stalled", stall.fifo1);
-#endif
+ if (!IS_ISP2401) {
+ ia_css_debug_dtrace(2, "\t%-32s: %d\n",
+ "[0] if_prim_a_FIFO stalled", stall.fifo0);
+ ia_css_debug_dtrace(2, "\t%-32s: %d\n",
+ "[1] if_prim_b_FIFO stalled", stall.fifo1);
+ }
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[2] dma_FIFO stalled",
stall.fifo2);

ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[3] gdc0_FIFO stalled",
stall.fifo3);
-#if !defined(IS_ISP_2500_SYSTEM)
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[4] gdc1_FIFO stalled",
stall.fifo4);
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[5] gpio_FIFO stalled",
stall.fifo5);
-#endif
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[6] sp_FIFO stalled",
stall.fifo6);
ia_css_debug_dtrace(2, "\t%-32s: %d\n",
@@ -505,24 +488,21 @@ void ia_css_debug_dump_sp_state(void)
"str_to_mem_FIFO stalled", stall.fifo2);
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "dma_FIFO stalled",
stall.fifo3);
-#if !defined(HAS_NO_INPUT_FORMATTER)
- ia_css_debug_dtrace(2, "\t%-32s: %d\n",
- "if_prim_a_FIFO stalled", stall.fifo4);
-#endif
+ if (!IS_ISP2401)
+ ia_css_debug_dtrace(2, "\t%-32s: %d\n",
+ "if_prim_a_FIFO stalled", stall.fifo4);
+
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "isp_FIFO stalled",
stall.fifo5);
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "gp_FIFO stalled",
stall.fifo6);
-#if !defined(HAS_NO_INPUT_FORMATTER)
- ia_css_debug_dtrace(2, "\t%-32s: %d\n",
- "if_prim_b_FIFO stalled", stall.fifo7);
-#endif
+ if (!IS_ISP2401)
+ ia_css_debug_dtrace(2, "\t%-32s: %d\n",
+ "if_prim_b_FIFO stalled", stall.fifo7);
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "gdc0_FIFO stalled",
stall.fifo8);
-#if !defined(IS_ISP_2500_SYSTEM)
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "gdc1_FIFO stalled",
stall.fifo9);
-#endif
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "irq FIFO stalled",
stall.fifoa);
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "dmem stalled",
@@ -556,7 +536,6 @@ static void debug_print_fifo_channel_state(const fifo_channel_state_t *state,
return;
}

-#if !defined(HAS_NO_INPUT_FORMATTER) && defined(USE_INPUT_SYSTEM_VERSION_2)
void ia_css_debug_dump_pif_a_isp_fifo_state(void)
{
fifo_channel_state_t pif_to_isp, isp_to_pif;
@@ -593,13 +572,11 @@ void ia_css_debug_dump_str2mem_sp_fifo_state(void)
debug_print_fifo_channel_state(&sp_to_s2m, "SP to stream-to-memory");
}

+#ifndef ISP2401
static void debug_print_if_state(input_formatter_state_t *state, const char *id)
{
unsigned int val;

-#if defined(HAS_INPUT_FORMATTER_VERSION_1)
- const char *st_reset = (state->reset ? "Active" : "Not active");
-#endif
const char *st_vsync_active_low =
(state->vsync_active_low ? "low" : "high");
const char *st_hsync_active_low =
@@ -631,9 +608,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id)

ia_css_debug_dtrace(2, "\tConfiguration:\n");

-#if defined(HAS_INPUT_FORMATTER_VERSION_1)
- ia_css_debug_dtrace(2, "\t\t%-32s: %s\n", "Software reset", st_reset);
-#endif
ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Start line", st_stline);
ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Start column", st_stcol);
ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Cropped height", st_crpht);
@@ -860,7 +834,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id)
state->vector_support);
ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Fifo sensor data lost",
state->sensor_data_lost);
- return;
}

static void debug_print_if_bin_state(input_formatter_bin_state_t *state)
@@ -883,7 +856,7 @@ static void debug_print_if_bin_state(input_formatter_bin_state_t *state)
state->en_status_update);
}

-void ia_css_debug_dump_if_state(void)
+static void ia_css_debug_dump_if_state(void)
{
input_formatter_state_t if_state;
input_formatter_bin_state_t if_bin_state;
@@ -1612,19 +1585,11 @@ void ia_css_debug_print_sp_debug_state(const struct sh_css_sp_debug_state
"frame_buffer.sp.c"
};

-#if 1
/* Example SH_CSS_SP_DBG_NR_OF_TRACES==1 */
/* Adjust this to your trace case */
static char const *trace_name[SH_CSS_SP_DBG_NR_OF_TRACES] = {
"default"
};
-#else
- /* Example SH_CSS_SP_DBG_NR_OF_TRACES==4 */
- /* Adjust this to your trace case */
- static char const *trace_name[SH_CSS_SP_DBG_NR_OF_TRACES] = {
- "copy", "preview/video", "capture", "acceleration"
- };
-#endif

/* Remember host_index_last because we only want to print new entries */
static int host_index_last[SH_CSS_SP_DBG_NR_OF_TRACES] = { 0 };
@@ -1696,7 +1661,7 @@ void ia_css_debug_print_sp_debug_state(const struct sh_css_sp_debug_state
}
#endif

-#if !defined(HAS_NO_INPUT_FORMATTER)
+#if !defined(ISP2401)
static void debug_print_rx_mipi_port_state(mipi_port_state_t *state)
{
int i;
@@ -1893,17 +1858,15 @@ static void debug_print_rx_state(receiver_state_t *state)
}
#endif

-#if defined(USE_INPUT_SYSTEM_VERSION_2)
void ia_css_debug_dump_rx_state(void)
{
-#if !defined(HAS_NO_INPUT_FORMATTER)
+#if !defined(ISP2401)
receiver_state_t state;

receiver_get_state(RX0_ID, &state);
debug_print_rx_state(&state);
#endif
}
-#endif

void ia_css_debug_dump_sp_sw_debug_info(void)
{
@@ -1918,7 +1881,7 @@ void ia_css_debug_dump_sp_sw_debug_info(void)
return;
}

-#if defined(USE_INPUT_SYSTEM_VERSION_2)
+#if !defined(ISP2401)
static void debug_print_isys_capture_unit_state(capture_unit_state_t *state)
{
assert(state);
@@ -2155,31 +2118,20 @@ static void debug_print_isys_state(input_system_state_t *state)
}
/* end of control unit state */
}
-
-void ia_css_debug_dump_isys_state(void)
-{
- input_system_state_t state;
-
- input_system_get_state(INPUT_SYSTEM0_ID, &state);
- debug_print_isys_state(&state);
-
- return;
-}
#endif
-#if defined(USE_INPUT_SYSTEM_VERSION_2401)
+
void ia_css_debug_dump_isys_state(void)
{
- /* Android compilation fails if made a local variable
- stack size on android is limited to 2k and this structure
- is around 3.5K, in place of static malloc can be done but
- if this call is made too often it will lead to fragment memory
- versus a fixed allocation */
static input_system_state_t state;

input_system_get_state(INPUT_SYSTEM0_ID, &state);
- input_system_dump_state(INPUT_SYSTEM0_ID, &state);
-}
+
+#ifndef ISP2401
+ debug_print_isys_state(&state);
+#else
+ input_system_dump_state(INPUT_SYSTEM0_ID, &state);
#endif
+}

void ia_css_debug_dump_debug_info(const char *context)
{
@@ -2187,10 +2139,10 @@ void ia_css_debug_dump_debug_info(const char *context)
context = "No Context provided";

ia_css_debug_dtrace(2, "CSS Debug Info dump [Context = %s]\n", context);
-#if defined(USE_INPUT_SYSTEM_VERSION_2)
- ia_css_debug_dump_rx_state();
-#endif
-#if !defined(HAS_NO_INPUT_FORMATTER) && defined(USE_INPUT_SYSTEM_VERSION_2)
+ if (!IS_ISP2401)
+ ia_css_debug_dump_rx_state();
+
+#ifndef ISP2401
ia_css_debug_dump_if_state();
#endif
ia_css_debug_dump_isp_state();
@@ -2207,12 +2159,12 @@ void ia_css_debug_dump_debug_info(const char *context)
ia_css_debug_dump_dma_isp_fifo_state();
ia_css_debug_dump_dma_sp_fifo_state();
ia_css_debug_dump_dma_state();
-#if defined(USE_INPUT_SYSTEM_VERSION_2)
- ia_css_debug_dump_isys_state();

- {
+ if (!IS_ISP2401) {
struct irq_controller_state state;

+ ia_css_debug_dump_isys_state();
+
irq_controller_get_state(IRQ2_ID, &state);

ia_css_debug_dtrace(2, "\t%-32s:\n",
@@ -2233,14 +2185,12 @@ void ia_css_debug_dump_debug_info(const char *context)
ia_css_debug_dtrace(2, "\t\t%-32s: %d\n",
"irq_level_not_pulse",
state.irq_level_not_pulse);
+ } else {
+ ia_css_debug_dump_isys_state();
}
-#endif
-#if defined(USE_INPUT_SYSTEM_VERSION_2401)
- ia_css_debug_dump_isys_state();
-#endif
-#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
+
ia_css_debug_tagger_state();
-#endif
+
return;
}

@@ -2270,7 +2220,6 @@ void ia_css_debug_wake_up_sp(void)
sp_ctrl_setbit(SP0_ID, SP_SC_REG, SP_START_BIT);
}

-#if !defined(IS_ISP_2500_SYSTEM)
#define FIND_DMEM_PARAMS_TYPE(stream, kernel, type) \
(struct HRTCAT(HRTCAT(sh_css_isp_, type), _params) *) \
findf_dmem_params(stream, offsetof(struct ia_css_memory_offsets, dmem.kernel))
@@ -2302,16 +2251,11 @@ findf_dmem_params(struct ia_css_stream *stream, short idx)
}
return NULL;
}
-#endif

void ia_css_debug_dump_isp_params(struct ia_css_stream *stream,
unsigned int enable)
{
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "ISP PARAMETERS:\n");
-#if defined(IS_ISP_2500_SYSTEM)
- (void)enable;
- (void)stream;
-#else

assert(stream);
if ((enable & IA_CSS_DEBUG_DUMP_FPN)
@@ -2375,7 +2319,6 @@ void ia_css_debug_dump_isp_params(struct ia_css_stream *stream,
|| (enable & IA_CSS_DEBUG_DUMP_ALL)) {
ia_css_ce_dump(FIND_DMEM_PARAMS(stream, ce), IA_CSS_DEBUG_VERBOSE);
}
-#endif
}

void sh_css_dump_sp_raw_copy_linecount(bool reduced)
@@ -2441,12 +2384,14 @@ void ia_css_debug_dump_isp_binary(void)

void ia_css_debug_dump_perf_counters(void)
{
-#if defined(USE_INPUT_SYSTEM_VERSION_2)
const struct ia_css_fw_info *fw;
int i;
unsigned int HIVE_ADDR_ia_css_isys_sp_error_cnt;
- s32 ia_css_sp_input_system_error_cnt[N_MIPI_PORT_ID +
- 1]; /* 3 Capture Units and 1 Acquire Unit. */
+ /* N_MIPI_PORT_ID + 1: 3 Capture Units and 1 Acquire Unit. */
+ s32 ia_css_sp_input_system_error_cnt[N_MIPI_PORT_ID + 1];
+
+ if (IS_ISP2401)
+ return;

ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "Input System Error Counters:\n");

@@ -2465,48 +2410,8 @@ void ia_css_debug_dump_perf_counters(void)
ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "\tport[%d] = %d\n",
i, ia_css_sp_input_system_error_cnt[i]);
}
-#endif
}

-/*
-
-void sh_css_init_ddr_debug_queue(void)
-{
- ia_css_ptr ddr_debug_queue_addr =
- hmm_alloc(sizeof(debug_data_ddr_t), HMM_BO_PRIVATE, 0, NULL, 0);
- const struct ia_css_fw_info *fw;
- unsigned int HIVE_ADDR_debug_buffer_ddr_address;
-
- fw = &sh_css_sp_fw;
- HIVE_ADDR_debug_buffer_ddr_address =
- fw->info.sp.debug_buffer_ddr_address;
-
- (void)HIVE_ADDR_debug_buffer_ddr_address;
-
- debug_buffer_ddr_init(ddr_debug_queue_addr);
-
- sp_dmem_store_uint32(SP0_ID,
- (unsigned int)sp_address_of(debug_buffer_ddr_address),
- (uint32_t)(ddr_debug_queue_addr));
-}
-
-void sh_css_load_ddr_debug_queue(void)
-{
- debug_synch_queue_ddr();
-}
-
-void ia_css_debug_dump_ddr_debug_queue(void)
-{
- int i;
- sh_css_load_ddr_debug_queue();
- for (i = 0; i < DEBUG_BUF_SIZE; i++) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE,
- "ddr_debug_queue[%d] = 0x%x\n",
- i, debug_data_ptr->buf[i]);
- }
-}
-*/
-
/*
* @brief Initialize the debug mode.
* Refer to "ia_css_debug.h" for more details.
@@ -3252,22 +3157,16 @@ ia_css_debug_dump_stream_config(
byte 2-3: data
*/
#if TRACE_ENABLE_SP0 || TRACE_ENABLE_SP1 || TRACE_ENABLE_ISP
-#ifndef ISP2401
-static void debug_dump_one_trace(TRACE_CORE_ID proc_id)
-#else
static void debug_dump_one_trace(enum TRACE_CORE_ID proc_id)
-#endif
{
#if defined(HAS_TRACER_V2)
u32 start_addr;
u32 start_addr_data;
u32 item_size;
-#ifndef ISP2401
u32 tmp;
-#else
u8 tid_val;
enum TRACE_DUMP_FORMAT dump_format;
-#endif
+
int i, j, max_trace_points, point_num, limit = -1;
/* using a static buffer here as the driver has issues allocating memory */
static u32 trace_read_buf[TRACE_BUFF_SIZE] = {0};
@@ -3471,7 +3370,6 @@ void ia_css_debug_dump_trace(void)
#endif
}

-#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
/* Tagger state dump function. The tagger is only available when the CSS
* contains an input system (2400 or 2401). */
void ia_css_debug_tagger_state(void)
@@ -3497,7 +3395,6 @@ void ia_css_debug_tagger_state(void)
i, tbuf_frames[i].exp_id, tbuf_frames[i].mark, tbuf_frames[i].lock);
}
}
-#endif /* defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) */

/* ISP2401 */
void ia_css_debug_pc_dump(sp_ID_t id, unsigned int num_of_dumps)
--
2.26.2

2020-09-02 16:17:39

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 25/38] media: atomisp: get rid of some unused code

Now that the defines which are common for both ISP2400 and ISP2401
are at system_global.h, we can get rid of the code not used by
those versions.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
.../staging/media/atomisp/pci/ia_css_mipi.h | 2 -
.../staging/media/atomisp/pci/ia_css_stream.h | 4 +-
.../kernels/ctc/ctc_1.0/ia_css_ctc_param.h | 7 -
.../ctc/ctc_1.0/ia_css_ctc_table.host.c | 145 ------------------
.../kernels/gc/gc_1.0/ia_css_gc_table.host.c | 144 -----------------
.../kernels/gc/gc_2/ia_css_gc2_table.host.c | 53 -------
.../kernels/xnr/xnr_1.0/ia_css_xnr_param.h | 7 -
.../xnr/xnr_1.0/ia_css_xnr_table.host.c | 31 ----
.../runtime/bufq/interface/ia_css_bufq_comm.h | 6 +-
.../media/atomisp/pci/runtime/bufq/src/bufq.c | 23 ---
.../pci/runtime/debug/src/ia_css_debug.c | 22 +--
.../pci/runtime/inputfifo/src/inputfifo.c | 10 --
.../atomisp/pci/runtime/isys/src/isys_init.c | 2 -
.../media/atomisp/pci/runtime/isys/src/rx.c | 10 --
.../pci/runtime/pipeline/src/pipeline.c | 2 -
drivers/staging/media/atomisp/pci/sh_css.c | 93 ++---------
.../staging/media/atomisp/pci/sh_css_hrt.c | 4 -
.../media/atomisp/pci/sh_css_internal.h | 8 +-
.../staging/media/atomisp/pci/sh_css_mipi.c | 2 +-
.../staging/media/atomisp/pci/sh_css_params.c | 5 -
.../media/atomisp/pci/sh_css_properties.c | 10 --
drivers/staging/media/atomisp/pci/sh_css_sp.c | 19 +--
drivers/staging/media/atomisp/pci/sh_css_sp.h | 2 -
23 files changed, 33 insertions(+), 578 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/ia_css_mipi.h b/drivers/staging/media/atomisp/pci/ia_css_mipi.h
index 56a2fca8117f..7b6d796d6ee0 100644
--- a/drivers/staging/media/atomisp/pci/ia_css_mipi.h
+++ b/drivers/staging/media/atomisp/pci/ia_css_mipi.h
@@ -42,7 +42,6 @@ int
ia_css_mipi_frame_specify(const unsigned int size_mem_words,
const bool contiguous);

-#if !defined(HAS_NO_INPUT_SYSTEM)
/* @brief Register size of a CSS MIPI frame for check during capturing.
*
* @param[in] port CSI-2 port this check is registered.
@@ -58,7 +57,6 @@ ia_css_mipi_frame_specify(const unsigned int size_mem_words,
int
ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port,
const unsigned int size_mem_words);
-#endif

/* @brief Calculate the size of a mipi frame.
*
diff --git a/drivers/staging/media/atomisp/pci/ia_css_stream.h b/drivers/staging/media/atomisp/pci/ia_css_stream.h
index e3e7a8a03b04..4dffc6d7c8d8 100644
--- a/drivers/staging/media/atomisp/pci/ia_css_stream.h
+++ b/drivers/staging/media/atomisp/pci/ia_css_stream.h
@@ -18,7 +18,7 @@

#include <type_support.h>
#include <system_local.h>
-#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if !defined(USE_INPUT_SYSTEM_VERSION_2401)
#include <input_system.h>
#endif
#include "ia_css_types.h"
@@ -30,7 +30,7 @@
struct ia_css_stream {
struct ia_css_stream_config config;
struct ia_css_stream_info info;
-#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if !defined(USE_INPUT_SYSTEM_VERSION_2401)
rx_cfg_t csi_rx_config;
#endif
bool reconfigure_css_rx;
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h
index 7e2fa192a0fe..eaad708c611c 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h
@@ -22,15 +22,8 @@
#include "ia_css_ctc_types.h"

#ifndef PIPE_GENERATION
-#if defined(HAS_VAMEM_VERSION_2)
#define SH_CSS_ISP_CTC_TABLE_SIZE_LOG2 IA_CSS_VAMEM_2_CTC_TABLE_SIZE_LOG2
#define SH_CSS_ISP_CTC_TABLE_SIZE IA_CSS_VAMEM_2_CTC_TABLE_SIZE
-#elif defined(HAS_VAMEM_VERSION_1)
-#define SH_CSS_ISP_CTC_TABLE_SIZE_LOG2 IA_CSS_VAMEM_1_CTC_TABLE_SIZE_LOG2
-#define SH_CSS_ISP_CTC_TABLE_SIZE IA_CSS_VAMEM_1_CTC_TABLE_SIZE
-#else
-#error "VAMEM should be {VERSION1, VERSION2}"
-#endif

#else
/* For pipe generation, the size is not relevant */
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c
index f13b79586963..6a7925c8493a 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c
@@ -23,7 +23,6 @@

struct ia_css_ctc_table default_ctc_table;

-#if defined(HAS_VAMEM_VERSION_2)

static const uint16_t
default_ctc_table_data[IA_CSS_VAMEM_2_CTC_TABLE_SIZE] = {
@@ -62,155 +61,11 @@ default_ctc_table_data[IA_CSS_VAMEM_2_CTC_TABLE_SIZE] = {
0
};

-#elif defined(HAS_VAMEM_VERSION_1)
-
-/* Default Parameters */
-static const uint16_t
-default_ctc_table_data[IA_CSS_VAMEM_1_CTC_TABLE_SIZE] = {
- 0, 0, 256, 384, 384, 497, 765, 806,
- 837, 851, 888, 901, 957, 981, 993, 1001,
- 1011, 1029, 1028, 1039, 1062, 1059, 1073, 1080,
- 1083, 1085, 1085, 1098, 1080, 1084, 1085, 1093,
- 1078, 1073, 1070, 1069, 1077, 1066, 1072, 1063,
- 1053, 1044, 1046, 1053, 1039, 1028, 1025, 1024,
- 1012, 1013, 1016, 996, 992, 990, 990, 980,
- 969, 968, 961, 955, 951, 949, 933, 930,
- 929, 925, 921, 916, 906, 901, 895, 893,
- 886, 877, 872, 869, 866, 861, 857, 849,
- 845, 838, 836, 832, 823, 821, 815, 813,
- 809, 805, 796, 793, 790, 785, 784, 778,
- 772, 768, 766, 763, 758, 752, 749, 745,
- 741, 740, 736, 730, 726, 724, 723, 718,
- 711, 709, 706, 704, 701, 698, 691, 689,
- 688, 683, 683, 678, 675, 673, 671, 669,
- 666, 663, 661, 660, 656, 656, 653, 650,
- 648, 647, 646, 643, 639, 638, 637, 635,
- 633, 632, 629, 627, 626, 625, 622, 621,
- 618, 618, 614, 614, 612, 609, 606, 606,
- 603, 600, 600, 597, 594, 591, 590, 586,
- 582, 581, 578, 575, 572, 569, 563, 560,
- 557, 554, 551, 548, 545, 539, 536, 533,
- 529, 527, 524, 519, 516, 513, 510, 507,
- 504, 501, 498, 493, 491, 488, 485, 484,
- 480, 476, 474, 471, 467, 466, 464, 460,
- 459, 455, 453, 449, 447, 446, 443, 441,
- 438, 435, 432, 432, 429, 427, 426, 422,
- 419, 418, 416, 414, 412, 410, 408, 406,
- 404, 402, 401, 398, 397, 395, 393, 390,
- 389, 388, 387, 384, 382, 380, 378, 377,
- 376, 375, 372, 370, 368, 368, 366, 364,
- 363, 361, 360, 358, 357, 355, 354, 352,
- 351, 350, 349, 346, 345, 344, 344, 342,
- 340, 339, 337, 337, 336, 335, 333, 331,
- 330, 329, 328, 326, 326, 324, 324, 322,
- 321, 320, 318, 318, 318, 317, 315, 313,
- 312, 311, 311, 310, 308, 307, 306, 306,
- 304, 304, 302, 301, 300, 300, 299, 297,
- 297, 296, 296, 294, 294, 292, 291, 291,
- 291, 290, 288, 287, 286, 286, 287, 285,
- 284, 283, 282, 282, 281, 281, 279, 278,
- 278, 278, 276, 276, 275, 274, 274, 273,
- 271, 270, 269, 268, 268, 267, 265, 262,
- 261, 260, 260, 259, 257, 254, 252, 252,
- 251, 251, 249, 246, 245, 244, 243, 242,
- 240, 239, 239, 237, 235, 235, 233, 231,
- 232, 230, 229, 226, 225, 224, 225, 224,
- 223, 220, 219, 219, 218, 217, 217, 214,
- 213, 213, 212, 211, 209, 209, 209, 208,
- 206, 205, 204, 203, 204, 203, 201, 200,
- 199, 197, 198, 198, 197, 195, 194, 194,
- 193, 192, 192, 191, 189, 190, 189, 188,
- 186, 187, 186, 185, 185, 184, 183, 181,
- 183, 182, 181, 180, 179, 178, 178, 178,
- 177, 176, 175, 176, 175, 174, 174, 173,
- 172, 173, 172, 171, 170, 170, 169, 169,
- 169, 168, 167, 166, 167, 167, 166, 165,
- 164, 164, 164, 163, 164, 163, 162, 163,
- 162, 161, 160, 161, 160, 160, 160, 159,
- 158, 157, 158, 158, 157, 157, 156, 156,
- 156, 156, 155, 155, 154, 154, 154, 154,
- 154, 153, 152, 153, 152, 152, 151, 152,
- 151, 152, 151, 150, 150, 149, 149, 150,
- 149, 149, 148, 148, 148, 149, 148, 147,
- 146, 146, 147, 146, 147, 146, 145, 146,
- 146, 145, 144, 145, 144, 145, 144, 144,
- 143, 143, 143, 144, 143, 142, 142, 142,
- 142, 142, 142, 141, 141, 141, 141, 140,
- 140, 141, 140, 140, 141, 140, 139, 139,
- 139, 140, 139, 139, 138, 138, 137, 139,
- 138, 138, 138, 137, 138, 137, 137, 137,
- 137, 136, 137, 136, 136, 136, 136, 135,
- 136, 135, 135, 135, 135, 136, 135, 135,
- 134, 134, 133, 135, 134, 134, 134, 133,
- 134, 133, 134, 133, 133, 132, 133, 133,
- 132, 133, 132, 132, 132, 132, 131, 131,
- 131, 132, 131, 131, 130, 131, 130, 132,
- 131, 130, 130, 129, 130, 129, 130, 129,
- 129, 129, 130, 129, 128, 128, 128, 128,
- 129, 128, 128, 127, 127, 128, 128, 127,
- 127, 126, 126, 127, 127, 126, 126, 126,
- 127, 126, 126, 126, 125, 125, 126, 125,
- 125, 124, 124, 124, 125, 125, 124, 124,
- 123, 124, 124, 123, 123, 122, 122, 122,
- 122, 122, 121, 120, 120, 119, 118, 118,
- 118, 117, 117, 116, 115, 115, 115, 114,
- 114, 113, 113, 112, 111, 111, 111, 110,
- 110, 109, 109, 108, 108, 108, 107, 107,
- 106, 106, 105, 105, 105, 104, 104, 103,
- 103, 102, 102, 102, 102, 101, 101, 100,
- 100, 99, 99, 99, 99, 99, 99, 98,
- 97, 98, 97, 97, 97, 96, 96, 95,
- 96, 95, 96, 95, 95, 94, 94, 95,
- 94, 94, 94, 93, 93, 92, 93, 93,
- 93, 93, 92, 92, 91, 92, 92, 92,
- 91, 91, 90, 90, 91, 91, 91, 90,
- 90, 90, 90, 91, 90, 90, 90, 89,
- 89, 89, 90, 89, 89, 89, 89, 89,
- 88, 89, 89, 88, 88, 88, 88, 87,
- 89, 88, 88, 88, 88, 88, 87, 88,
- 88, 88, 87, 87, 87, 87, 87, 88,
- 87, 87, 87, 87, 87, 87, 88, 87,
- 87, 87, 87, 86, 86, 87, 87, 87,
- 87, 86, 86, 86, 87, 87, 86, 87,
- 86, 86, 86, 87, 87, 86, 86, 86,
- 86, 86, 87, 87, 86, 85, 85, 85,
- 84, 85, 85, 84, 84, 83, 83, 82,
- 82, 82, 81, 81, 80, 79, 79, 79,
- 78, 77, 77, 76, 76, 76, 75, 74,
- 74, 74, 73, 73, 72, 71, 71, 71,
- 70, 70, 69, 69, 68, 68, 67, 67,
- 67, 66, 66, 65, 65, 64, 64, 63,
- 62, 62, 62, 61, 60, 60, 59, 59,
- 58, 58, 57, 57, 56, 56, 56, 55,
- 55, 54, 55, 55, 54, 53, 53, 52,
- 53, 53, 52, 51, 51, 50, 51, 50,
- 49, 49, 50, 49, 49, 48, 48, 47,
- 47, 48, 46, 45, 45, 45, 46, 45,
- 45, 44, 45, 45, 45, 43, 42, 42,
- 41, 43, 41, 40, 40, 39, 40, 41,
- 39, 39, 39, 39, 39, 38, 35, 35,
- 34, 37, 36, 34, 33, 33, 33, 35,
- 34, 32, 32, 31, 32, 30, 29, 26,
- 25, 25, 27, 26, 23, 23, 23, 25,
- 24, 24, 22, 21, 20, 19, 16, 14,
- 13, 13, 13, 10, 9, 7, 7, 7,
- 12, 12, 12, 7, 0, 0, 0, 0
-};
-
-#else
-#error "VAMEM version must be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}"
-#endif

void
ia_css_config_ctc_table(void)
{
-#if defined(HAS_VAMEM_VERSION_2)
memcpy(default_ctc_table.data.vamem_2, default_ctc_table_data,
sizeof(default_ctc_table_data));
default_ctc_table.vamem_type = IA_CSS_VAMEM_TYPE_2;
-#else
- memcpy(default_ctc_table.data.vamem_1, default_ctc_table_data,
- sizeof(default_ctc_table_data));
- default_ctc_table.vamem_type = 1IA_CSS_VAMEM_TYPE_1;
-#endif
}
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c
index f48f876777dc..7dbe2dc0591d 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c
@@ -21,7 +21,6 @@
#include "ia_css_types.h"
#include "ia_css_gc_table.host.h"

-#if defined(HAS_VAMEM_VERSION_2)

struct ia_css_gamma_table default_gamma_table;

@@ -62,154 +61,11 @@ default_gamma_table_data[IA_CSS_VAMEM_2_GAMMA_TABLE_SIZE] = {
255
};

-#elif defined(HAS_VAMEM_VERSION_1)
-
-static const uint16_t
-default_gamma_table_data[IA_CSS_VAMEM_1_GAMMA_TABLE_SIZE] = {
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 16,
- 17, 18, 19, 20, 21, 23, 24, 25,
- 27, 28, 29, 31, 32, 33, 35, 36,
- 38, 39, 41, 42, 44, 45, 47, 48,
- 49, 51, 52, 54, 55, 57, 58, 60,
- 61, 62, 64, 65, 66, 68, 69, 70,
- 71, 72, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 89, 90, 91, 92, 93, 93, 94,
- 95, 96, 97, 98, 98, 99, 100, 101,
- 102, 102, 103, 104, 105, 105, 106, 107,
- 108, 108, 109, 110, 110, 111, 112, 112,
- 113, 114, 114, 115, 116, 116, 117, 118,
- 118, 119, 120, 120, 121, 121, 122, 123,
- 123, 124, 125, 125, 126, 126, 127, 127, /* 128 */
- 128, 129, 129, 130, 130, 131, 131, 132,
- 132, 133, 134, 134, 135, 135, 136, 136,
- 137, 137, 138, 138, 139, 139, 140, 140,
- 141, 141, 142, 142, 143, 143, 144, 144,
- 145, 145, 145, 146, 146, 147, 147, 148,
- 148, 149, 149, 150, 150, 150, 151, 151,
- 152, 152, 152, 153, 153, 154, 154, 155,
- 155, 155, 156, 156, 156, 157, 157, 158,
- 158, 158, 159, 159, 160, 160, 160, 161,
- 161, 161, 162, 162, 162, 163, 163, 163,
- 164, 164, 164, 165, 165, 165, 166, 166,
- 166, 167, 167, 167, 168, 168, 168, 169,
- 169, 169, 170, 170, 170, 170, 171, 171,
- 171, 172, 172, 172, 172, 173, 173, 173,
- 174, 174, 174, 174, 175, 175, 175, 176,
- 176, 176, 176, 177, 177, 177, 177, 178, /* 256 */
- 178, 178, 178, 179, 179, 179, 179, 180,
- 180, 180, 180, 181, 181, 181, 181, 182,
- 182, 182, 182, 182, 183, 183, 183, 183,
- 184, 184, 184, 184, 184, 185, 185, 185,
- 185, 186, 186, 186, 186, 186, 187, 187,
- 187, 187, 187, 188, 188, 188, 188, 188,
- 189, 189, 189, 189, 189, 190, 190, 190,
- 190, 190, 191, 191, 191, 191, 191, 192,
- 192, 192, 192, 192, 192, 193, 193, 193,
- 193, 193, 194, 194, 194, 194, 194, 194,
- 195, 195, 195, 195, 195, 195, 196, 196,
- 196, 196, 196, 196, 197, 197, 197, 197,
- 197, 197, 198, 198, 198, 198, 198, 198,
- 198, 199, 199, 199, 199, 199, 199, 200,
- 200, 200, 200, 200, 200, 200, 201, 201,
- 201, 201, 201, 201, 201, 202, 202, 202, /* 384 */
- 202, 202, 202, 202, 203, 203, 203, 203,
- 203, 203, 203, 204, 204, 204, 204, 204,
- 204, 204, 204, 205, 205, 205, 205, 205,
- 205, 205, 205, 206, 206, 206, 206, 206,
- 206, 206, 206, 207, 207, 207, 207, 207,
- 207, 207, 207, 208, 208, 208, 208, 208,
- 208, 208, 208, 209, 209, 209, 209, 209,
- 209, 209, 209, 209, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 211, 211, 211,
- 211, 211, 211, 211, 211, 211, 212, 212,
- 212, 212, 212, 212, 212, 212, 212, 213,
- 213, 213, 213, 213, 213, 213, 213, 213,
- 214, 214, 214, 214, 214, 214, 214, 214,
- 214, 214, 215, 215, 215, 215, 215, 215,
- 215, 215, 215, 216, 216, 216, 216, 216,
- 216, 216, 216, 216, 216, 217, 217, 217, /* 512 */
- 217, 217, 217, 217, 217, 217, 217, 218,
- 218, 218, 218, 218, 218, 218, 218, 218,
- 218, 219, 219, 219, 219, 219, 219, 219,
- 219, 219, 219, 220, 220, 220, 220, 220,
- 220, 220, 220, 220, 220, 221, 221, 221,
- 221, 221, 221, 221, 221, 221, 221, 221,
- 222, 222, 222, 222, 222, 222, 222, 222,
- 222, 222, 223, 223, 223, 223, 223, 223,
- 223, 223, 223, 223, 223, 224, 224, 224,
- 224, 224, 224, 224, 224, 224, 224, 224,
- 225, 225, 225, 225, 225, 225, 225, 225,
- 225, 225, 225, 226, 226, 226, 226, 226,
- 226, 226, 226, 226, 226, 226, 226, 227,
- 227, 227, 227, 227, 227, 227, 227, 227,
- 227, 227, 228, 228, 228, 228, 228, 228,
- 228, 228, 228, 228, 228, 228, 229, 229,
- 229, 229, 229, 229, 229, 229, 229, 229,
- 229, 229, 230, 230, 230, 230, 230, 230,
- 230, 230, 230, 230, 230, 230, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 232, 232, 232, 232, 232,
- 232, 232, 232, 232, 232, 232, 232, 233,
- 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 234, 234, 234, 234,
- 234, 234, 234, 234, 234, 234, 234, 234,
- 234, 235, 235, 235, 235, 235, 235, 235,
- 235, 235, 235, 235, 235, 235, 236, 236,
- 236, 236, 236, 236, 236, 236, 236, 236,
- 236, 236, 236, 236, 237, 237, 237, 237,
- 237, 237, 237, 237, 237, 237, 237, 237,
- 237, 237, 238, 238, 238, 238, 238, 238,
- 238, 238, 238, 238, 238, 238, 238, 238,
- 239, 239, 239, 239, 239, 239, 239, 239,
- 239, 239, 239, 239, 239, 239, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 241, 241, 241, 241,
- 241, 241, 241, 241, 241, 241, 241, 241,
- 241, 241, 241, 242, 242, 242, 242, 242,
- 242, 242, 242, 242, 242, 242, 242, 242,
- 242, 242, 243, 243, 243, 243, 243, 243,
- 243, 243, 243, 243, 243, 243, 243, 243,
- 243, 244, 244, 244, 244, 244, 244, 244,
- 244, 244, 244, 244, 244, 244, 244, 244,
- 245, 245, 245, 245, 245, 245, 245, 245,
- 245, 245, 245, 245, 245, 245, 245, 246,
- 246, 246, 246, 246, 246, 246, 246, 246,
- 246, 246, 246, 246, 246, 246, 246, 247,
- 247, 247, 247, 247, 247, 247, 247, 247,
- 247, 247, 247, 247, 247, 247, 247, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 249,
- 249, 249, 249, 249, 249, 249, 249, 249,
- 249, 249, 249, 249, 249, 249, 249, 250,
- 250, 250, 250, 250, 250, 250, 250, 250,
- 250, 250, 250, 250, 250, 250, 250, 251,
- 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 252,
- 252, 252, 252, 252, 252, 252, 252, 252,
- 252, 252, 252, 252, 252, 252, 252, 253,
- 253, 253, 253, 253, 253, 253, 253, 253,
- 253, 253, 253, 253, 253, 253, 253, 253,
- 254, 254, 254, 254, 254, 254, 254, 254,
- 254, 254, 254, 254, 254, 254, 254, 254,
- 255, 255, 255, 255, 255, 255, 255, 255
-};
-
-#else
-#error "VAMEM version must be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}"
-#endif

void
ia_css_config_gamma_table(void)
{
-#if defined(HAS_VAMEM_VERSION_2)
memcpy(default_gamma_table.data.vamem_2, default_gamma_table_data,
sizeof(default_gamma_table_data));
default_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2;
-#else
- memcpy(default_gamma_table.data.vamem_1, default_gamma_table_data,
- sizeof(default_gamma_table_data));
- default_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1;
-#endif
}
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c
index 7eadb31268eb..34795011907a 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c
@@ -27,7 +27,6 @@ struct ia_css_rgb_gamma_table default_b_gamma_table;

/* Identical default gamma table for R, G, and B. */

-#if defined(HAS_VAMEM_VERSION_2)

static const uint16_t
default_gamma_table_data[IA_CSS_VAMEM_2_RGB_GAMMA_TABLE_SIZE] = {
@@ -65,51 +64,10 @@ default_gamma_table_data[IA_CSS_VAMEM_2_RGB_GAMMA_TABLE_SIZE] = {
4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088,
4095
};
-#elif defined(HAS_VAMEM_VERSION_1)
-
-static const uint16_t
-default_gamma_table_data[IA_CSS_VAMEM_1_RGB_GAMMA_TABLE_SIZE] = {
- 0, 72, 144, 216, 288, 360, 426, 486,
- 541, 592, 641, 687, 730, 772, 812, 850,
- 887, 923, 958, 991, 1024, 1055, 1086, 1117,
- 1146, 1175, 1203, 1230, 1257, 1284, 1310, 1335,
- 1360, 1385, 1409, 1433, 1457, 1480, 1502, 1525,
- 1547, 1569, 1590, 1612, 1632, 1653, 1674, 1694,
- 1714, 1734, 1753, 1772, 1792, 1811, 1829, 1848,
- 1866, 1884, 1902, 1920, 1938, 1955, 1973, 1990,
- 2007, 2024, 2040, 2057, 2074, 2090, 2106, 2122,
- 2138, 2154, 2170, 2185, 2201, 2216, 2231, 2247,
- 2262, 2277, 2291, 2306, 2321, 2335, 2350, 2364,
- 2378, 2393, 2407, 2421, 2435, 2449, 2462, 2476,
- 2490, 2503, 2517, 2530, 2543, 2557, 2570, 2583,
- 2596, 2609, 2622, 2634, 2647, 2660, 2673, 2685,
- 2698, 2710, 2722, 2735, 2747, 2759, 2771, 2783,
- 2795, 2807, 2819, 2831, 2843, 2855, 2867, 2878,
- 2890, 2901, 2913, 2924, 2936, 2947, 2958, 2970,
- 2981, 2992, 3003, 3014, 3025, 3036, 3047, 3058,
- 3069, 3080, 3091, 3102, 3112, 3123, 3134, 3144,
- 3155, 3165, 3176, 3186, 3197, 3207, 3217, 3228,
- 3238, 3248, 3258, 3268, 3279, 3289, 3299, 3309,
- 3319, 3329, 3339, 3349, 3358, 3368, 3378, 3388,
- 3398, 3407, 3417, 3427, 3436, 3446, 3455, 3465,
- 3474, 3484, 3493, 3503, 3512, 3521, 3531, 3540,
- 3549, 3559, 3568, 3577, 3586, 3595, 3605, 3614,
- 3623, 3632, 3641, 3650, 3659, 3668, 3677, 3686,
- 3694, 3703, 3712, 3721, 3730, 3739, 3747, 3756,
- 3765, 3773, 3782, 3791, 3799, 3808, 3816, 3825,
- 3833, 3842, 3850, 3859, 3867, 3876, 3884, 3893,
- 3901, 3909, 3918, 3926, 3934, 3942, 3951, 3959,
- 3967, 3975, 3984, 3992, 4000, 4008, 4016, 4024,
- 4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088
-};
-#else
-#error "VAMEM version must be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}"
-#endif

void
ia_css_config_rgb_gamma_tables(void)
{
-#if defined(HAS_VAMEM_VERSION_2)
default_r_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2;
default_g_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2;
default_b_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2;
@@ -119,15 +77,4 @@ ia_css_config_rgb_gamma_tables(void)
sizeof(default_gamma_table_data));
memcpy(default_b_gamma_table.data.vamem_2, default_gamma_table_data,
sizeof(default_gamma_table_data));
-#else
- memcpy(default_r_gamma_table.data.vamem_1, default_gamma_table_data,
- sizeof(default_gamma_table_data));
- memcpy(default_g_gamma_table.data.vamem_1, default_gamma_table_data,
- sizeof(default_gamma_table_data));
- memcpy(default_b_gamma_table.data.vamem_1, default_gamma_table_data,
- sizeof(default_gamma_table_data));
- default_r_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1;
- default_g_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1;
- default_b_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1;
-#endif
}
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h
index 7ebf139f3618..93754f7c797d 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h
@@ -20,15 +20,8 @@
#include <system_global.h>

#ifndef PIPE_GENERATION
-#if defined(HAS_VAMEM_VERSION_2)
#define SH_CSS_ISP_XNR_TABLE_SIZE_LOG2 IA_CSS_VAMEM_2_XNR_TABLE_SIZE_LOG2
#define SH_CSS_ISP_XNR_TABLE_SIZE IA_CSS_VAMEM_2_XNR_TABLE_SIZE
-#elif defined(HAS_VAMEM_VERSION_1)
-#define SH_CSS_ISP_XNR_TABLE_SIZE_LOG2 IA_CSS_VAMEM_1_XNR_TABLE_SIZE_LOG2
-#define SH_CSS_ISP_XNR_TABLE_SIZE IA_CSS_VAMEM_1_XNR_TABLE_SIZE
-#else
-#error "Unknown vamem type"
-#endif

#else
/* For pipe generation, the size is not relevant */
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c
index 5566f3c16aac..e5c15308693d 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c
@@ -23,7 +23,6 @@

struct ia_css_xnr_table default_xnr_table;

-#if defined(HAS_VAMEM_VERSION_2)

static const uint16_t
default_xnr_table_data[IA_CSS_VAMEM_2_XNR_TABLE_SIZE] = {
@@ -43,41 +42,11 @@ default_xnr_table_data[IA_CSS_VAMEM_2_XNR_TABLE_SIZE] = {
167 >> 1, 163 >> 1, 160 >> 1, 157 >> 1, 154 >> 1, 151 >> 1, 148 >> 1, 146 >> 1, 143 >> 1, 141 >> 1, 138 >> 1, 136 >> 1, 134 >> 1, 132 >> 1, 130 >> 1, 128 >> 1
};

-#elif defined(HAS_VAMEM_VERSION_1)
-
-static const uint16_t
-default_xnr_table_data[IA_CSS_VAMEM_1_XNR_TABLE_SIZE] = {
- /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */
- 8191 >> 1, 4096 >> 1, 2730 >> 1, 2048 >> 1, 1638 >> 1, 1365 >> 1, 1170 >> 1, 1024 >> 1, 910 >> 1, 819 >> 1, 744 >> 1, 682 >> 1, 630 >> 1, 585 >> 1,
- 546 >> 1, 512 >> 1,
-
- /* 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 */
- 481 >> 1, 455 >> 1, 431 >> 1, 409 >> 1, 390 >> 1, 372 >> 1, 356 >> 1, 341 >> 1, 327 >> 1, 315 >> 1, 303 >> 1, 292 >> 1, 282 >> 1, 273 >> 1, 264 >> 1,
- 256 >> 1,
-
- /* 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 */
- 248 >> 1, 240 >> 1, 234 >> 1, 227 >> 1, 221 >> 1, 215 >> 1, 210 >> 1, 204 >> 1, 199 >> 1, 195 >> 1, 190 >> 1, 186 >> 1, 182 >> 1, 178 >> 1, 174 >> 1,
- 170 >> 1,
-
- /* 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 */
- 167 >> 1, 163 >> 1, 160 >> 1, 157 >> 1, 154 >> 1, 151 >> 1, 148 >> 1, 146 >> 1, 143 >> 1, 141 >> 1, 138 >> 1, 136 >> 1, 134 >> 1, 132 >> 1, 130 >> 1, 128 >> 1
-};
-
-#else
-#error "sh_css_params.c: VAMEM version must \
-be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}"
-#endif

void
ia_css_config_xnr_table(void)
{
-#if defined(HAS_VAMEM_VERSION_2)
memcpy(default_xnr_table.data.vamem_2, default_xnr_table_data,
sizeof(default_xnr_table_data));
default_xnr_table.vamem_type = IA_CSS_VAMEM_TYPE_2;
-#else
- memcpy(default_xnr_table.data.vamem_1, default_xnr_table_data,
- sizeof(default_xnr_table_data));
- default_xnr_table.vamem_type = IA_CSS_VAMEM_TYPE_1;
-#endif
}
diff --git a/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h b/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h
index cddf5882b76a..35f4528b724f 100644
--- a/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h
+++ b/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h
@@ -27,15 +27,11 @@ enum sh_css_queue_id {
SH_CSS_QUEUE_E_ID,
SH_CSS_QUEUE_F_ID,
SH_CSS_QUEUE_G_ID,
-#if defined(HAS_NO_INPUT_SYSTEM)
- /* input frame queue for skycam */
- SH_CSS_QUEUE_H_ID,
-#endif
#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
SH_CSS_QUEUE_H_ID, /* for metadata */
#endif

-#if defined(HAS_NO_INPUT_SYSTEM) || defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
#define SH_CSS_MAX_NUM_QUEUES (SH_CSS_QUEUE_H_ID + 1)
#else
#define SH_CSS_MAX_NUM_QUEUES (SH_CSS_QUEUE_G_ID + 1)
diff --git a/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c b/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c
index 38e85735293b..0901c932bf28 100644
--- a/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c
+++ b/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c
@@ -47,13 +47,11 @@ struct sh_css_queues {
/* SP2Host event queue */
ia_css_queue_t sp2host_psys_event_queue_handle;

-#if !defined(HAS_NO_INPUT_SYSTEM)
/* Host2SP ISYS event queue */
ia_css_queue_t host2sp_isys_event_queue_handle;

/* SP2Host ISYS event queue */
ia_css_queue_t sp2host_isys_event_queue_handle;
-#endif
/* Tagger command queue */
ia_css_queue_t host2sp_tag_cmd_queue_handle;
};
@@ -231,14 +229,12 @@ static ia_css_queue_t *bufq_get_qhandle(
case sh_css_sp2host_psys_event_queue:
q = &css_queues.sp2host_psys_event_queue_handle;
break;
-#if !defined(HAS_NO_INPUT_SYSTEM)
case sh_css_host2sp_isys_event_queue:
q = &css_queues.host2sp_isys_event_queue_handle;
break;
case sh_css_sp2host_isys_event_queue:
q = &css_queues.sp2host_isys_event_queue_handle;
break;
-#endif
case sh_css_host2sp_tag_cmd_queue:
q = &css_queues.host2sp_tag_cmd_queue_handle;
break;
@@ -307,7 +303,6 @@ void ia_css_bufq_init(void)
(uint32_t)offsetof(struct host_sp_queues, sp2host_psys_event_queue_elems),
&css_queues.sp2host_psys_event_queue_handle);

-#if !defined(HAS_NO_INPUT_SYSTEM)
/* Host2SP ISYS event queue */
init_bufq((uint32_t)offsetof(struct host_sp_queues,
host2sp_isys_event_queue_desc),
@@ -324,7 +319,6 @@ void ia_css_bufq_init(void)
init_bufq((uint32_t)offsetof(struct host_sp_queues, host2sp_tag_cmd_queue_desc),
(uint32_t)offsetof(struct host_sp_queues, host2sp_tag_cmd_queue_elems),
&css_queues.host2sp_tag_cmd_queue_handle);
-#endif

IA_CSS_LEAVE_PRIVATE("");
}
@@ -434,7 +428,6 @@ int ia_css_bufq_dequeue_psys_event(
int ia_css_bufq_dequeue_isys_event(
u8 item[BUFQ_EVENT_SIZE])
{
-#if !defined(HAS_NO_INPUT_SYSTEM)
int error = 0;
ia_css_queue_t *q;

@@ -451,15 +444,10 @@ int ia_css_bufq_dequeue_isys_event(
}
error = ia_css_eventq_recv(q, item);
return error;
-#else
- (void)item;
- return -EBUSY;
-#endif
}

int ia_css_bufq_enqueue_isys_event(uint8_t evt_id)
{
-#if !defined(HAS_NO_INPUT_SYSTEM)
int error = 0;
ia_css_queue_t *q;

@@ -474,16 +462,11 @@ int ia_css_bufq_enqueue_isys_event(uint8_t evt_id)

IA_CSS_LEAVE_ERR_PRIVATE(error);
return error;
-#else
- (void)evt_id;
- return -EBUSY;
-#endif
}

int ia_css_bufq_enqueue_tag_cmd(
uint32_t item)
{
-#if !defined(HAS_NO_INPUT_SYSTEM)
int error;
ia_css_queue_t *q;

@@ -497,10 +480,6 @@ int ia_css_bufq_enqueue_tag_cmd(

IA_CSS_LEAVE_ERR_PRIVATE(error);
return error;
-#else
- (void)item;
- return -EBUSY;
-#endif
}

int ia_css_bufq_deinit(void)
@@ -545,12 +524,10 @@ void ia_css_bufq_dump_queue_info(void)
bufq_dump_queue_info("sp2host_psys_event",
&css_queues.sp2host_psys_event_queue_handle);

-#if !defined(HAS_NO_INPUT_SYSTEM)
bufq_dump_queue_info("host2sp_isys_event",
&css_queues.host2sp_isys_event_queue_handle);
bufq_dump_queue_info("sp2host_isys_event",
&css_queues.sp2host_isys_event_queue_handle);
bufq_dump_queue_info("host2sp_tag_cmd",
&css_queues.host2sp_tag_cmd_queue_handle);
-#endif
}
diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
index 2bca27a04b02..56d5d90634fa 100644
--- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
+++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
@@ -62,17 +62,13 @@
#include "isp.h"
#include "type_support.h"
#include "math_support.h" /* CEIL_DIV */
-#if defined(HAS_INPUT_FORMATTER_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
#include "input_system.h" /* input_formatter_reg_load */
-#endif
#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
#include "ia_css_tagger_common.h"
#endif

#include "sh_css_internal.h"
-#if !defined(HAS_NO_INPUT_SYSTEM)
#include "ia_css_isys.h"
-#endif
#include "sh_css_sp.h" /* sh_css_sp_get_debug_state() */

#include "css_trace.h" /* tracer */
@@ -501,12 +497,10 @@ void ia_css_debug_dump_sp_state(void)
sp_get_state(SP0_ID, &state, &stall);
debug_print_sp_state(&state, "SP");
if (state.is_stalling) {
-#if !defined(HAS_NO_INPUT_SYSTEM)
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "isys_FIFO stalled",
stall.fifo0);
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "if_sec_FIFO stalled",
stall.fifo1);
-#endif
ia_css_debug_dtrace(2, "\t%-32s: %d\n",
"str_to_mem_FIFO stalled", stall.fifo2);
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "dma_FIFO stalled",
@@ -674,7 +668,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id)
ia_css_debug_dtrace(2, "\t\t%-32s: %d\n",
"Block when no request", st_block_fifo_when_no_req);

-#if defined(HAS_INPUT_FORMATTER_VERSION_2)
ia_css_debug_dtrace(2, "\t\t%-32s: %d\n",
"IF_BLOCKED_FIFO_NO_REQ_ADDRESS",
input_formatter_reg_load(INPUT_FORMATTER0_ID,
@@ -737,7 +730,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id)
"_REG_GP_IFMT_slv_reg_srst",
gp_device_reg_load(GP_DEVICE0_ID,
_REG_GP_IFMT_slv_reg_srst));
-#endif

ia_css_debug_dtrace(2, "\tFSM Status:\n");

@@ -1704,7 +1696,7 @@ void ia_css_debug_print_sp_debug_state(const struct sh_css_sp_debug_state
}
#endif

-#if defined(HAS_INPUT_FORMATTER_VERSION_2) && !defined(HAS_NO_INPUT_FORMATTER)
+#if !defined(HAS_NO_INPUT_FORMATTER)
static void debug_print_rx_mipi_port_state(mipi_port_state_t *state)
{
int i;
@@ -1901,10 +1893,10 @@ static void debug_print_rx_state(receiver_state_t *state)
}
#endif

-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
void ia_css_debug_dump_rx_state(void)
{
-#if defined(HAS_INPUT_FORMATTER_VERSION_2) && !defined(HAS_NO_INPUT_FORMATTER)
+#if !defined(HAS_NO_INPUT_FORMATTER)
receiver_state_t state;

receiver_get_state(RX0_ID, &state);
@@ -2174,7 +2166,7 @@ void ia_css_debug_dump_isys_state(void)
return;
}
#endif
-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if defined(USE_INPUT_SYSTEM_VERSION_2401)
void ia_css_debug_dump_isys_state(void)
{
/* Android compilation fails if made a local variable
@@ -2195,7 +2187,7 @@ void ia_css_debug_dump_debug_info(const char *context)
context = "No Context provided";

ia_css_debug_dtrace(2, "CSS Debug Info dump [Context = %s]\n", context);
-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
ia_css_debug_dump_rx_state();
#endif
#if !defined(HAS_NO_INPUT_FORMATTER) && defined(USE_INPUT_SYSTEM_VERSION_2)
@@ -2243,7 +2235,7 @@ void ia_css_debug_dump_debug_info(const char *context)
state.irq_level_not_pulse);
}
#endif
-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if defined(USE_INPUT_SYSTEM_VERSION_2401)
ia_css_debug_dump_isys_state();
#endif
#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
@@ -2449,7 +2441,7 @@ void ia_css_debug_dump_isp_binary(void)

void ia_css_debug_dump_perf_counters(void)
{
-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
const struct ia_css_fw_info *fw;
int i;
unsigned int HIVE_ADDR_ia_css_isys_sp_error_cnt;
diff --git a/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c b/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c
index 38712530f566..2d06e124007e 100644
--- a/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c
+++ b/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c
@@ -32,24 +32,18 @@
#include "event_fifo.h"
#define __INLINE_SP__

-#if !defined(HAS_NO_INPUT_SYSTEM)
#include "input_system.h" /* MIPI_PREDICTOR_NONE,... */
-#endif

#include "assert_support.h"

/* System independent */
#include "sh_css_internal.h"
-#if !defined(HAS_NO_INPUT_SYSTEM)
#include "ia_css_isys.h"
-#endif

#define HBLANK_CYCLES (187)
#define MARKER_CYCLES (6)

-#if !defined(HAS_NO_INPUT_SYSTEM)
#include <hive_isp_css_streaming_to_mipi_types_hrt.h>
-#endif

/* The data type is used to send special cases:
* yuv420: odd lines (1, 3 etc) are twice as wide as even
@@ -67,9 +61,7 @@ enum inputfifo_mipi_data_type {
inputfifo_mipi_data_type_rgb,
};

-#if !defined(HAS_NO_INPUT_SYSTEM)
static unsigned int inputfifo_curr_ch_id, inputfifo_curr_fmt_type;
-#endif
struct inputfifo_instance {
unsigned int ch_id;
enum atomisp_input_format input_format;
@@ -81,7 +73,6 @@ struct inputfifo_instance {
enum inputfifo_mipi_data_type type;
};

-#if !defined(HAS_NO_INPUT_SYSTEM)
/*
* Maintain a basic streaming to Mipi administration with ch_id as index
* ch_id maps on the "Mipi virtual channel ID" and can have value 0..3
@@ -536,4 +527,3 @@ void ia_css_inputfifo_end_frame(
s2mi->streaming = false;
return;
}
-#endif /* #if !defined(HAS_NO_INPUT_SYSTEM) */
diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c
index de442f1fa6ba..13cb02ac2651 100644
--- a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c
+++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c
@@ -15,7 +15,6 @@

#include "input_system.h"

-#ifdef HAS_INPUT_SYSTEM_VERSION_2
#include "ia_css_isys.h"
#include "platform_support.h"

@@ -121,4 +120,3 @@ void ia_css_isys_uninit(void)
}
#endif

-#endif
diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c
index 4f0dcdfa13be..fa87afaff6e5 100644
--- a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c
+++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c
@@ -28,9 +28,7 @@ void ia_css_isys_rx_enable_all_interrupts(enum mipi_port_id port)
_HRT_CSS_RECEIVER_IRQ_ENABLE_REG_IDX);

bits |= (1U << _HRT_CSS_RECEIVER_IRQ_OVERRUN_BIT) |
-#if defined(HAS_RX_VERSION_2)
(1U << _HRT_CSS_RECEIVER_IRQ_INIT_TIMEOUT_BIT) |
-#endif
(1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_ENTRY_BIT) |
(1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_EXIT_BIT) |
(1U << _HRT_CSS_RECEIVER_IRQ_ERR_SOT_HS_BIT) |
@@ -117,10 +115,8 @@ unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits)

if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_OVERRUN_BIT))
infos |= IA_CSS_RX_IRQ_INFO_BUFFER_OVERRUN;
-#if defined(HAS_RX_VERSION_2)
if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_INIT_TIMEOUT_BIT))
infos |= IA_CSS_RX_IRQ_INFO_INIT_TIMEOUT;
-#endif
if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_ENTRY_BIT))
infos |= IA_CSS_RX_IRQ_INFO_ENTER_SLEEP_MODE;
if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_EXIT_BIT))
@@ -176,10 +172,8 @@ void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port,
/* MW: Why do we remap the receiver bitmap */
if (irq_infos & IA_CSS_RX_IRQ_INFO_BUFFER_OVERRUN)
bits |= 1U << _HRT_CSS_RECEIVER_IRQ_OVERRUN_BIT;
-#if defined(HAS_RX_VERSION_2)
if (irq_infos & IA_CSS_RX_IRQ_INFO_INIT_TIMEOUT)
bits |= 1U << _HRT_CSS_RECEIVER_IRQ_INIT_TIMEOUT_BIT;
-#endif
if (irq_infos & IA_CSS_RX_IRQ_INFO_ENTER_SLEEP_MODE)
bits |= 1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_ENTRY_BIT;
if (irq_infos & IA_CSS_RX_IRQ_INFO_EXIT_SLEEP_MODE)
@@ -484,7 +478,6 @@ unsigned int ia_css_csi2_calculate_input_system_alignment(
void ia_css_isys_rx_configure(const rx_cfg_t *config,
const enum ia_css_input_mode input_mode)
{
-#if defined(HAS_RX_VERSION_2)
bool port_enabled[N_MIPI_PORT_ID];
bool any_port_enabled = false;
enum mipi_port_id port;
@@ -580,9 +573,6 @@ void ia_css_isys_rx_configure(const rx_cfg_t *config,
* INPUT_SYSTEM_CSI_RECEIVER_SELECT_BACKENG, 1);
*/
input_system_reg_store(INPUT_SYSTEM0_ID, 0x207, 1);
-#else
-#error "rx.c: RX version must be one of {RX_VERSION_2}"
-#endif

return;
}
diff --git a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c
index 4b8e85bc2122..e34df58b124a 100644
--- a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c
+++ b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c
@@ -140,9 +140,7 @@ void ia_css_pipeline_start(enum ia_css_pipe_id pipe_id,
false, false, false, true, SH_CSS_BDS_FACTOR_1_00,
SH_CSS_PIPE_CONFIG_OVRD_NO_OVRD,
IA_CSS_INPUT_MODE_MEMORY, NULL, NULL,
-#if !defined(HAS_NO_INPUT_SYSTEM)
(enum mipi_port_id)0,
-#endif
NULL, NULL);

ia_css_pipeline_get_sp_thread_id(pipe_num, &thread_id);
diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c
index 8473e1437074..4f7984b75abc 100644
--- a/drivers/staging/media/atomisp/pci/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/sh_css.c
@@ -27,9 +27,7 @@
#include "sh_css_internal.h"
#include "sh_css_mipi.h"
#include "sh_css_sp.h" /* sh_css_sp_group */
-#if !defined(HAS_NO_INPUT_SYSTEM)
#include "ia_css_isys.h"
-#endif
#include "ia_css_frame.h"
#include "sh_css_defs.h"
#include "sh_css_firmware.h"
@@ -62,9 +60,7 @@
#if !defined(HAS_NO_INPUT_FORMATTER)
#include "ia_css_ifmtr.h"
#endif
-#if !defined(HAS_NO_INPUT_SYSTEM)
#include "input_system.h"
-#endif
#include "mmu_device.h" /* mmu_set_page_table_base_index(), ... */
#include "ia_css_mmu_private.h" /* sh_css_mmu_set_page_table_base_index() */
#include "gdc_device.h" /* HRT_GDC_N */
@@ -533,7 +529,7 @@ ia_css_stream_input_format_bits_per_pixel(struct ia_css_stream *stream)

#define GP_ISEL_TPG_MODE 0x90058

-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
static int
sh_css_config_input_network(struct ia_css_stream *stream) {
unsigned int fmt_type;
@@ -594,7 +590,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) {
"sh_css_config_input_network() leave:\n");
return 0;
}
-#elif !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401)
+#elif defined(USE_INPUT_SYSTEM_VERSION_2401)
static unsigned int csi2_protocol_calculate_max_subpixels_per_line(
enum atomisp_input_format format,
unsigned int pixels_per_line)
@@ -1375,12 +1371,7 @@ start_binary(struct ia_css_pipe *pipe,

(void)binary;

-#if !defined(HAS_NO_INPUT_SYSTEM)
stream = pipe->stream;
-#else
- (void)pipe;
- (void)stream;
-#endif

if (binary)
sh_css_metrics_start_binary(&binary->metrics);
@@ -1395,7 +1386,7 @@ start_binary(struct ia_css_pipe *pipe,
sh_binary_running = true;
#endif

-#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if !defined(USE_INPUT_SYSTEM_VERSION_2401)
if (stream->reconfigure_css_rx) {
ia_css_isys_rx_configure(&pipe->stream->csi_rx_config,
pipe->stream->config.mode);
@@ -1415,7 +1406,7 @@ start_copy_on_sp(struct ia_css_pipe *pipe,
if ((!pipe) || (!pipe->stream))
return -EINVAL;

-#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if !defined(USE_INPUT_SYSTEM_VERSION_2401)
if (pipe->stream->reconfigure_css_rx)
ia_css_isys_rx_disable();
#endif
@@ -1424,7 +1415,7 @@ start_copy_on_sp(struct ia_css_pipe *pipe,
return -EINVAL;
sh_css_sp_start_binary_copy(ia_css_pipe_get_pipe_num(pipe), out_frame, pipe->stream->config.pixels_per_clock == 2);

-#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if !defined(USE_INPUT_SYSTEM_VERSION_2401)
if (pipe->stream->reconfigure_css_rx)
{
ia_css_isys_rx_configure(&pipe->stream->csi_rx_config,
@@ -1461,9 +1452,6 @@ static void start_pipe(
const struct ia_css_coordinate *coord = NULL;
const struct ia_css_isp_parameters *params = NULL;

-#if defined(HAS_NO_INPUT_SYSTEM)
- (void)input_mode;
-#endif

IA_CSS_ENTER_PRIVATE("me = %p, copy_ovrd = %d, input_mode = %d",
me, copy_ovrd, input_mode);
@@ -1487,11 +1475,9 @@ static void start_pipe(
input_mode,
&me->stream->config.metadata_config,
&me->stream->info.metadata_info
-#if !defined(HAS_NO_INPUT_SYSTEM)
, (input_mode == IA_CSS_INPUT_MODE_MEMORY) ?
(enum mipi_port_id)0 :
me->stream->config.source.port.port,
-#endif
coord,
params);

@@ -1551,13 +1537,6 @@ enable_interrupts(enum ia_css_irq_type irq_type)
cnd_virq_enable_channel(
(enum virq_id)(IRQ_SW_CHANNEL1_ID + IRQ_SW_CHANNEL_OFFSET),
true);
-#if !defined(HAS_IRQ_MAP_VERSION_2)
- /* IRQ_SW_CHANNEL2_ID does not exist on 240x systems */
- cnd_virq_enable_channel(
- (enum virq_id)(IRQ_SW_CHANNEL2_ID + IRQ_SW_CHANNEL_OFFSET),
- true);
- virq_clear_all();
-#endif

#ifdef USE_INPUT_SYSTEM_VERSION_2
for (port = 0; port < N_MIPI_PORT_ID; port++)
@@ -1832,15 +1811,10 @@ ia_css_init(struct device *dev, const struct ia_css_env *env,
sh_css_init_buffer_queues();
*/

-#if defined(HAS_INPUT_SYSTEM_VERSION_2) && defined(HAS_INPUT_SYSTEM_VERSION_2401)
-#if defined(USE_INPUT_SYSTEM_VERSION_2)
- gp_device_reg_store(GP_DEVICE0_ID, _REG_GP_SWITCH_ISYS2401_ADDR, 0);
-#elif defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if defined(HAS_INPUT_SYSTEM_VERSION_2401)
gp_device_reg_store(GP_DEVICE0_ID, _REG_GP_SWITCH_ISYS2401_ADDR, 1);
#endif
-#endif

-#if !defined(HAS_NO_INPUT_SYSTEM)

if (!IS_ISP2401)
dma_set_max_burst_size(DMA0_ID, HIVE_DMA_BUS_DDR_CONN,
@@ -1851,7 +1825,6 @@ ia_css_init(struct device *dev, const struct ia_css_env *env,

if (ia_css_isys_init() != INPUT_SYSTEM_ERR_NO_ERROR)
err = -EINVAL;
-#endif

sh_css_params_map_and_store_default_gdc_lut();

@@ -2542,14 +2515,11 @@ ia_css_uninit(void)

sh_css_sp_reset_global_vars();

-#if !defined(HAS_NO_INPUT_SYSTEM)
ia_css_isys_uninit();
-#endif

ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_uninit() leave: return_void\n");
}

-#if defined(HAS_IRQ_MAP_VERSION_2)
int ia_css_irq_translate(
unsigned int *irq_infos)
{
@@ -2581,7 +2551,6 @@ int ia_css_irq_translate(
break;
case virq_isp:
break;
-#if !defined(HAS_NO_INPUT_SYSTEM)
case virq_isys_sof:
infos |= IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF;
break;
@@ -2591,7 +2560,6 @@ int ia_css_irq_translate(
case virq_isys_csi:
infos |= IA_CSS_IRQ_INFO_INPUT_SYSTEM_ERROR;
break;
-#endif
#if !defined(HAS_NO_INPUT_FORMATTER)
case virq_ifmt0_id:
infos |= IA_CSS_IRQ_INFO_IF_ERROR;
@@ -2672,9 +2640,6 @@ int ia_css_irq_enable(
return 0;
}

-#else
-#error "sh_css.c: IRQ MAP must be one of { IRQ_MAP_VERSION_2 }"
-#endif

static unsigned int
sh_css_get_sw_interrupt_value(unsigned int irq)
@@ -4050,9 +4015,7 @@ preview_start(struct ia_css_pipe *pipe) {
pipe->stream->config.mode,
&pipe->stream->config.metadata_config,
&pipe->stream->info.metadata_info,
-#if !defined(HAS_NO_INPUT_SYSTEM)
pipe->stream->config.source.port.port,
-#endif
coord,
params);

@@ -4076,9 +4039,7 @@ preview_start(struct ia_css_pipe *pipe) {
IA_CSS_INPUT_MODE_MEMORY,
&pipe->stream->config.metadata_config,
&pipe->stream->info.metadata_info,
-#if !defined(HAS_NO_INPUT_SYSTEM)
(enum mipi_port_id)0,
-#endif
coord,
params);
}
@@ -4097,9 +4058,7 @@ preview_start(struct ia_css_pipe *pipe) {
IA_CSS_INPUT_MODE_MEMORY,
NULL,
NULL,
-#if !defined(HAS_NO_INPUT_SYSTEM)
(enum mipi_port_id)0,
-#endif
coord,
params);
}
@@ -5286,7 +5245,7 @@ sh_css_pipes_have_stopped(struct ia_css_stream *stream)
return rval;
}

-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
unsigned int
sh_css_get_mipi_sizes_for_check(const unsigned int port, const unsigned int idx)
{
@@ -5413,13 +5372,7 @@ sh_css_pipe_get_grid_info(struct ia_css_pipe *pipe,
info->isp_in_height = binary->internal_frame_info.res.height;
}

-#if defined(HAS_VAMEM_VERSION_2)
info->vamem_type = IA_CSS_VAMEM_TYPE_2;
-#elif defined(HAS_VAMEM_VERSION_1)
- info->vamem_type = IA_CSS_VAMEM_TYPE_1;
-#else
-#error "Unknown VAMEM version"
-#endif

ERR :
IA_CSS_LEAVE_ERR_PRIVATE(err);
@@ -5867,9 +5820,7 @@ static int video_start(struct ia_css_pipe *pipe)
pipe->stream->config.mode,
&pipe->stream->config.metadata_config,
&pipe->stream->info.metadata_info,
-#if !defined(HAS_NO_INPUT_SYSTEM)
pipe->stream->config.source.port.port,
-#endif
coord,
params);

@@ -5892,9 +5843,7 @@ static int video_start(struct ia_css_pipe *pipe)
IA_CSS_INPUT_MODE_MEMORY,
&pipe->stream->config.metadata_config,
&pipe->stream->info.metadata_info,
-#if !defined(HAS_NO_INPUT_SYSTEM)
(enum mipi_port_id)0,
-#endif
coord,
params);
}
@@ -6754,7 +6703,7 @@ static int load_capture_binaries(
switch (pipe->config.default_capture_config.mode) {
case IA_CSS_CAPTURE_MODE_RAW:
err = load_copy_binaries(pipe);
-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if defined(USE_INPUT_SYSTEM_VERSION_2401)
if (!err)
pipe->pipe_settings.capture.copy_binary.online = pipe->stream->config.online;
#endif
@@ -7409,7 +7358,7 @@ static int yuvpp_start(struct ia_css_pipe *pipe)

/* multi stream video needs mipi buffers */

-#if !defined(HAS_NO_INPUT_SYSTEM) && (defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401))
+#if (defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401))
err = send_mipi_frames(pipe);
if (err) {
IA_CSS_LEAVE_ERR_PRIVATE(err);
@@ -7989,7 +7938,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) {
{
if (raw) {
ia_css_pipe_util_set_output_frames(out_frames, 0, out_frame);
-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if defined(USE_INPUT_SYSTEM_VERSION_2401)
if (!continuous) {
ia_css_pipe_get_generic_stage_desc(&stage_desc, copy_binary,
out_frames, in_frame, NULL);
@@ -8282,7 +8231,7 @@ static int capture_start(
}
start_pipe(pipe, copy_ovrd, pipe->stream->config.mode);

-#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if !defined(USE_INPUT_SYSTEM_VERSION_2401)
/*
* old isys: for IA_CSS_PIPE_MODE_COPY pipe, isys rx has to be configured,
* which is currently done in start_binary(); but COPY pipe contains no binary,
@@ -8332,7 +8281,6 @@ sh_css_pipe_get_output_frame_info(struct ia_css_pipe *pipe,
return 0;
}

-#if !defined(HAS_NO_INPUT_SYSTEM)
void
ia_css_stream_send_input_frame(const struct ia_css_stream *stream,
const unsigned short *data,
@@ -8387,7 +8335,6 @@ ia_css_stream_end_input_frame(const struct ia_css_stream *stream) {

ia_css_inputfifo_end_frame(stream->config.channel_id);
}
-#endif

static void
append_firmware(struct ia_css_fw_info **l, struct ia_css_fw_info *firmware) {
@@ -8762,12 +8709,10 @@ sh_css_init_host_sp_control_vars(void) {
#endif
store_sp_array_uint(host_sp_com, o, host2sp_cmd_ready);

-#if !defined(HAS_NO_INPUT_SYSTEM)
for (i = 0; i < N_CSI_PORTS; i++) {
sh_css_update_host2sp_num_mipi_frames
(my_css.num_mipi_frames[i]);
}
-#endif

ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"sh_css_init_host_sp_control_vars() leave: return_void\n");
@@ -9363,7 +9308,6 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,
}
#endif

-#if !defined(HAS_NO_INPUT_SYSTEM)
ia_css_debug_pipe_graph_dump_stream_config(stream_config);

/* check if mipi size specified */
@@ -9408,7 +9352,6 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,
return err;
}
}
-#endif

/* Currently we only supported metadata up to a certain size. */
err = metadata_info_init(&stream_config->metadata_config, &md_info);
@@ -9484,7 +9427,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,
#endif
break;
case IA_CSS_INPUT_MODE_TPG:
-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
IA_CSS_LOG("tpg_configuration: x_mask=%d, y_mask=%d, x_delta=%d, y_delta=%d, xy_mask=%d",
curr_stream->config.source.tpg.x_mask,
curr_stream->config.source.tpg.y_mask,
@@ -9501,7 +9444,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,
#endif
break;
case IA_CSS_INPUT_MODE_PRBS:
-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
IA_CSS_LOG("mode prbs");
sh_css_sp_configure_prbs(curr_stream->config.source.prbs.seed);
#endif
@@ -10003,15 +9946,13 @@ ia_css_stream_start(struct ia_css_stream *stream) {
return err;
}

-#if !defined(HAS_NO_INPUT_SYSTEM)
#if defined(USE_INPUT_SYSTEM_VERSION_2401)
if ((stream->config.mode == IA_CSS_INPUT_MODE_SENSOR) ||
(stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR))
stream_register_with_csi_rx(stream);
#endif
-#endif

-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
/* Initialize mipi size checks */
if (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR)
{
@@ -10025,14 +9966,12 @@ ia_css_stream_start(struct ia_css_stream *stream) {
}
#endif

-#if !defined(HAS_NO_INPUT_SYSTEM)
if (stream->config.mode != IA_CSS_INPUT_MODE_MEMORY)
{
err = sh_css_config_input_network(stream);
if (err)
return err;
}
-#endif /* !HAS_NO_INPUT_SYSTEM */

err = sh_css_pipe_start(stream);
IA_CSS_LEAVE_ERR(err);
@@ -10049,7 +9988,7 @@ ia_css_stream_stop(struct ia_css_stream *stream) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_stream_stop: stopping %d\n",
stream->last_pipe->mode);

-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
/* De-initialize mipi size checks */
if (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR)
{
@@ -10527,7 +10466,7 @@ void ia_css_pipe_map_queue(struct ia_css_pipe *pipe, bool map)

ia_css_pipeline_get_sp_thread_id(pipe_num, &thread_id);

-#if defined(HAS_NO_INPUT_SYSTEM) || defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if defined(USE_INPUT_SYSTEM_VERSION_2401)
need_input_queue = true;
#else
need_input_queue = pipe->stream->config.mode == IA_CSS_INPUT_MODE_MEMORY;
diff --git a/drivers/staging/media/atomisp/pci/sh_css_hrt.c b/drivers/staging/media/atomisp/pci/sh_css_hrt.c
index 06b502151af9..879c85311038 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_hrt.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_hrt.c
@@ -64,11 +64,7 @@ bool sh_css_hrt_system_is_idle(void)

int sh_css_hrt_sp_wait(void)
{
-#if defined(HAS_IRQ_MAP_VERSION_2)
irq_sw_channel_id_t irq_id = IRQ_SW_CHANNEL0_ID;
-#else
- irq_sw_channel_id_t irq_id = IRQ_SW_CHANNEL2_ID;
-#endif
/*
* Wait till SP is idle or till there is a SW2 interrupt
* The SW2 interrupt will be used when frameloop runs on SP
diff --git a/drivers/staging/media/atomisp/pci/sh_css_internal.h b/drivers/staging/media/atomisp/pci/sh_css_internal.h
index 5c25a25dce92..54847abf667a 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_internal.h
+++ b/drivers/staging/media/atomisp/pci/sh_css_internal.h
@@ -400,7 +400,7 @@ struct sh_css_sp_config {
set[SH_CSS_MAX_IF_CONFIGS]; /* CSI-2 port is used as index. */
} input_formatter;
#endif
-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
sync_generator_cfg_t sync_gen;
tpg_cfg_t tpg;
prbs_cfg_t prbs;
@@ -423,7 +423,7 @@ enum sh_css_stage_type {
#define SH_CSS_PIPE_CONFIG_SAMPLE_PARAMS_MASK \
((SH_CSS_PIPE_CONFIG_SAMPLE_PARAMS << SH_CSS_MAX_SP_THREADS) - 1)

-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if defined(USE_INPUT_SYSTEM_VERSION_2401)
struct sh_css_sp_pipeline_terminal {
union {
/* Input System 2401 */
@@ -679,7 +679,7 @@ struct sh_css_sp_stage {
struct sh_css_sp_group {
struct sh_css_sp_config config;
struct sh_css_sp_pipeline pipe[SH_CSS_MAX_SP_THREADS];
-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if defined(USE_INPUT_SYSTEM_VERSION_2401)
struct sh_css_sp_pipeline_io pipe_io[SH_CSS_MAX_SP_THREADS];
struct sh_css_sp_pipeline_io_status pipe_io_status;
#endif
@@ -987,7 +987,7 @@ sh_css_frame_info_set_width(struct ia_css_frame_info *info,
unsigned int width,
unsigned int aligned);

-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)

unsigned int
sh_css_get_mipi_sizes_for_check(const unsigned int port,
diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/sh_css_mipi.c
index 2ef5dbd62a6d..a0be171fba83 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c
@@ -246,7 +246,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width,
return err;
}

-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
int
ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port,
const unsigned int size_mem_words) {
diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c
index ba42be9b06eb..6d827ec67192 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_params.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_params.c
@@ -143,7 +143,6 @@ static int interleaved_lut_temp[4][HRT_GDC_N];
/* Digital Zoom lookup table. See documentation for more details about the
* contents of this table.
*/
-#if defined(HAS_GDC_VERSION_2)
#if defined(CONFIG_CSI2_PLUS)
/*
* Coefficients from
@@ -1196,10 +1195,6 @@ static const int zoom_table[4][HRT_GDC_N] = {
}
};
#endif
-#else
-#error "sh_css_params.c: GDC version must be \
-one of {GDC_VERSION_2}"
-#endif

static const struct ia_css_dz_config default_dz_config = {
HRT_GDC_N,
diff --git a/drivers/staging/media/atomisp/pci/sh_css_properties.c b/drivers/staging/media/atomisp/pci/sh_css_properties.c
index de588f9bd540..8ecd93d65a68 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_properties.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_properties.c
@@ -22,23 +22,13 @@ void
ia_css_get_properties(struct ia_css_properties *properties)
{
assert(properties);
-#if defined(HAS_GDC_VERSION_2) || defined(HAS_GDC_VERSION_3)
/*
* MW: We don't want to store the coordinates
* full range in memory: Truncate
*/
properties->gdc_coord_one = gdc_get_unity(GDC0_ID) / HRT_GDC_COORD_SCALE;
-#else
-#error "Unknown GDC version"
-#endif

properties->l1_base_is_index = true;

-#if defined(HAS_VAMEM_VERSION_1)
- properties->vamem_type = IA_CSS_VAMEM_TYPE_1;
-#elif defined(HAS_VAMEM_VERSION_2)
properties->vamem_type = IA_CSS_VAMEM_TYPE_2;
-#else
-#error "Unknown VAMEM version"
-#endif
}
diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.c b/drivers/staging/media/atomisp/pci/sh_css_sp.c
index a26680b1d0b0..9f681b2e9f99 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_sp.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_sp.c
@@ -38,9 +38,7 @@
#include "sh_css_params.h"
#include "sh_css_legacy.h"
#include "ia_css_frame_comm.h"
-#if !defined(HAS_NO_INPUT_SYSTEM)
#include "ia_css_isys.h"
-#endif

#include "gdc_device.h" /* HRT_GDC_N */

@@ -662,7 +660,7 @@ void sh_css_sp_set_if_configs(
}
#endif

-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
void
sh_css_sp_program_input_circuit(int fmt_type,
int ch_id,
@@ -681,7 +679,7 @@ sh_css_sp_program_input_circuit(int fmt_type,
}
#endif

-#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2)
+#if defined(USE_INPUT_SYSTEM_VERSION_2)
void
sh_css_sp_configure_sync_gen(int width, int height,
int hblank_cycles,
@@ -724,11 +722,7 @@ sh_css_sp_configure_enable_raw_pool_locking(bool lock_all)
void
sh_css_sp_enable_isys_event_queue(bool enable)
{
-#if !defined(HAS_NO_INPUT_SYSTEM)
sh_css_sp_group.config.enable_isys_event_queue = enable;
-#else
- (void)enable;
-#endif
}

void
@@ -1206,9 +1200,7 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me,
enum ia_css_input_mode input_mode,
const struct ia_css_metadata_config *md_config,
const struct ia_css_metadata_info *md_info,
-#if !defined(HAS_NO_INPUT_SYSTEM)
const enum mipi_port_id port_id,
-#endif
const struct ia_css_coordinate
*internal_frame_origin_bqs_on_sctbl, /* Origin of internal frame
positioned on shading table at shading correction in ISP. */
@@ -1226,7 +1218,6 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me,

assert(me);

-#if !defined(HAS_NO_INPUT_SYSTEM)
assert(me->stages);

first_binary = me->stages->binary;
@@ -1245,10 +1236,6 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me,
{
if_config_index = 0x0;
}
-#else
- (void)input_mode;
- if_config_index = SH_CSS_IF_CONFIG_NOT_NEEDED;
-#endif

ia_css_pipeline_get_sp_thread_id(pipe_num, &thread_id);
memset(&sh_css_sp_group.pipe[thread_id], 0, sizeof(struct sh_css_sp_pipeline));
@@ -1285,11 +1272,9 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me,
sh_css_sp_group.pipe[thread_id].num_execs = me->num_execs;
sh_css_sp_group.pipe[thread_id].pipe_qos_config = me->pipe_qos_config;
sh_css_sp_group.pipe[thread_id].required_bds_factor = required_bds_factor;
-#if !defined(HAS_NO_INPUT_SYSTEM)
sh_css_sp_group.pipe[thread_id].input_system_mode
= (uint32_t)input_mode;
sh_css_sp_group.pipe[thread_id].port_id = port_id;
-#endif
sh_css_sp_group.pipe[thread_id].dvs_frame_delay = (uint32_t)me->dvs_frame_delay;

/* TODO: next indicates from which queues parameters need to be
diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.h b/drivers/staging/media/atomisp/pci/sh_css_sp.h
index 153b005becda..18a1fefda4b5 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_sp.h
+++ b/drivers/staging/media/atomisp/pci/sh_css_sp.h
@@ -66,9 +66,7 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me,
enum ia_css_input_mode input_mode,
const struct ia_css_metadata_config *md_config,
const struct ia_css_metadata_info *md_info,
-#if !defined(HAS_NO_INPUT_SYSTEM)
const enum mipi_port_id port_id,
-#endif
const struct ia_css_coordinate
*internal_frame_origin_bqs_on_sctbl, /* Origin of internal frame
positioned on shading table at shading correction in ISP. */
--
2.26.2

2020-09-02 16:18:36

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 18/38] media: cx23885-alsa: number of pages should be unsigned long

As reported by smatch:

drivers/media//pci/cx23885/cx23885-alsa.c:83 cx23885_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type?

the number of patches should be unsigned long.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/pci/cx23885/cx23885-alsa.c | 7 ++++---
drivers/media/pci/cx23885/cx23885.h | 4 ++--
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c
index df44ed7393a0..141852f02236 100644
--- a/drivers/media/pci/cx23885/cx23885-alsa.c
+++ b/drivers/media/pci/cx23885/cx23885-alsa.c
@@ -68,7 +68,8 @@ MODULE_PARM_DESC(audio_debug, "enable debug messages [analog audio]");
#define AUD_INT_MCHG_IRQ (1 << 21)
#define GP_COUNT_CONTROL_RESET 0x3

-static int cx23885_alsa_dma_init(struct cx23885_audio_dev *chip, int nr_pages)
+static int cx23885_alsa_dma_init(struct cx23885_audio_dev *chip,
+ unsigned long nr_pages)
{
struct cx23885_audio_buffer *buf = chip->buf;
struct page *pg;
@@ -76,11 +77,11 @@ static int cx23885_alsa_dma_init(struct cx23885_audio_dev *chip, int nr_pages)

buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT);
if (NULL == buf->vaddr) {
- dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages);
+ dprintk(1, "vmalloc_32(%lu pages) failed\n", nr_pages);
return -ENOMEM;
}

- dprintk(1, "vmalloc is at addr %p, size=%d\n",
+ dprintk(1, "vmalloc is at addr %p, size=%lu\n",
buf->vaddr, nr_pages << PAGE_SHIFT);

memset(buf->vaddr, 0, nr_pages << PAGE_SHIFT);
diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h
index c472498e57c4..349462ee2c48 100644
--- a/drivers/media/pci/cx23885/cx23885.h
+++ b/drivers/media/pci/cx23885/cx23885.h
@@ -325,8 +325,8 @@ struct cx23885_audio_buffer {
struct cx23885_riscmem risc;
void *vaddr;
struct scatterlist *sglist;
- int sglen;
- int nr_pages;
+ int sglen;
+ unsigned long nr_pages;
};

struct cx23885_audio_dev {
--
2.26.2

2020-09-02 16:18:47

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 17/38] media: cx25821-alsa: number of pages should be unsigned long

As reported by smatch:

drivers/media/pci/cx25821/cx25821-alsa.c:146 cx25821_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type?

the number of patches should be unsigned long.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/pci/cx25821/cx25821-alsa.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/media/pci/cx25821/cx25821-alsa.c b/drivers/media/pci/cx25821/cx25821-alsa.c
index 301616426d8a..49892a88f528 100644
--- a/drivers/media/pci/cx25821/cx25821-alsa.c
+++ b/drivers/media/pci/cx25821/cx25821-alsa.c
@@ -53,8 +53,8 @@ struct cx25821_audio_buffer {
struct cx25821_riscmem risc;
void *vaddr;
struct scatterlist *sglist;
- int sglen;
- int nr_pages;
+ int sglen;
+ unsigned long nr_pages;
};

struct cx25821_audio_dev {
@@ -131,7 +131,8 @@ MODULE_PARM_DESC(debug, "enable debug messages");
#define PCI_MSK_AUD_EXT (1 << 4)
#define PCI_MSK_AUD_INT (1 << 3)

-static int cx25821_alsa_dma_init(struct cx25821_audio_dev *chip, int nr_pages)
+static int cx25821_alsa_dma_init(struct cx25821_audio_dev *chip,
+ unsigned long nr_pages)
{
struct cx25821_audio_buffer *buf = chip->buf;
struct page *pg;
@@ -139,11 +140,11 @@ static int cx25821_alsa_dma_init(struct cx25821_audio_dev *chip, int nr_pages)

buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT);
if (NULL == buf->vaddr) {
- dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages);
+ dprintk(1, "vmalloc_32(%lu pages) failed\n", nr_pages);
return -ENOMEM;
}

- dprintk(1, "vmalloc is at addr 0x%p, size=%d\n",
+ dprintk(1, "vmalloc is at addr 0x%p, size=%lu\n",
buf->vaddr,
nr_pages << PAGE_SHIFT);

--
2.26.2

2020-09-02 16:19:16

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 05/38] media: wl128x: get rid of a potential spectre issue

As reported by smatch:
drivers/media/radio/wl128x/fmdrv_common.c:736 fm_irq_handle_rdsdata_getcmd_resp() warn: potential spectre issue 'rds_fmt.data.groupdatabuff.buff>

Address it by using array_index_nospec().

While here, reorder the linux/ includes.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/radio/wl128x/fmdrv_common.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c
index 5c395da74e17..9abc8e0283c1 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -19,9 +19,11 @@
* Author: Manjunatha Halli <[email protected]>
*/

-#include <linux/module.h>
-#include <linux/firmware.h>
#include <linux/delay.h>
+#include <linux/firmware.h>
+#include <linux/module.h>
+#include <linux/nospec.h>
+
#include "fmdrv.h"
#include "fmdrv_v4l2.h"
#include "fmdrv_common.h"
@@ -700,7 +702,7 @@ static void fm_irq_handle_rdsdata_getcmd_resp(struct fmdev *fmdev)
struct fm_rds *rds = &fmdev->rx.rds;
unsigned long group_idx, flags;
u8 *rds_data, meta_data, tmpbuf[FM_RDS_BLK_SIZE];
- u8 type, blk_idx;
+ u8 type, blk_idx, idx;
u16 cur_picode;
u32 rds_len;

@@ -733,9 +735,11 @@ static void fm_irq_handle_rdsdata_getcmd_resp(struct fmdev *fmdev)
}

/* Skip checkword (control) byte and copy only data byte */
- memcpy(&rds_fmt.data.groupdatabuff.
- buff[blk_idx * (FM_RDS_BLK_SIZE - 1)],
- rds_data, (FM_RDS_BLK_SIZE - 1));
+ idx = array_index_nospec(blk_idx * (FM_RDS_BLK_SIZE - 1),
+ FM_RX_RDS_INFO_FIELD_MAX - (FM_RDS_BLK_SIZE - 1));
+
+ memcpy(&rds_fmt.data.groupdatabuff.buff[idx], rds_data,
+ FM_RDS_BLK_SIZE - 1);

rds->last_blk_idx = blk_idx;

--
2.26.2

2020-09-02 16:19:24

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 16/38] media: videobuf-dma-sg: number of pages should be unsigned long

As reported by smatch:

drivers/media/v4l2-core/videobuf-dma-sg.c:245 videobuf_dma_init_kernel() warn: should 'nr_pages << 12' be a 64 bit type?

The printk should not be using %d for the number of pages.

After looking better, the real problem here is that the
number of pages should be long int.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/v4l2-core/videobuf-dma-sg.c | 22 ++++++++++++----------
include/media/videobuf-dma-sg.h | 2 +-
2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c
index 46ff19df9f53..8dd0562de287 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -180,7 +180,7 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma,
if (rw == READ)
flags |= FOLL_WRITE;

- dprintk(1, "init user [0x%lx+0x%lx => %d pages]\n",
+ dprintk(1, "init user [0x%lx+0x%lx => %lu pages]\n",
data, size, dma->nr_pages);

err = pin_user_pages(data & PAGE_MASK, dma->nr_pages,
@@ -188,7 +188,7 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma,

if (err != dma->nr_pages) {
dma->nr_pages = (err >= 0) ? err : 0;
- dprintk(1, "pin_user_pages: err=%d [%d]\n", err,
+ dprintk(1, "pin_user_pages: err=%d [%lu]\n", err,
dma->nr_pages);
return err < 0 ? err : -EINVAL;
}
@@ -208,11 +208,11 @@ static int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction,
}

static int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction,
- int nr_pages)
+ unsigned long nr_pages)
{
int i;

- dprintk(1, "init kernel [%d pages]\n", nr_pages);
+ dprintk(1, "init kernel [%lu pages]\n", nr_pages);

dma->direction = direction;
dma->vaddr_pages = kcalloc(nr_pages, sizeof(*dma->vaddr_pages),
@@ -238,11 +238,11 @@ static int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction,
dma->vaddr = vmap(dma->vaddr_pages, nr_pages, VM_MAP | VM_IOREMAP,
PAGE_KERNEL);
if (NULL == dma->vaddr) {
- dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages);
+ dprintk(1, "vmalloc_32(%lu pages) failed\n", nr_pages);
goto out_free_pages;
}

- dprintk(1, "vmalloc is at addr %p, size=%d\n",
+ dprintk(1, "vmalloc is at addr %p, size=%lu\n",
dma->vaddr, nr_pages << PAGE_SHIFT);

memset(dma->vaddr, 0, nr_pages << PAGE_SHIFT);
@@ -267,9 +267,9 @@ static int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction,
}

static int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
- dma_addr_t addr, int nr_pages)
+ dma_addr_t addr, unsigned long nr_pages)
{
- dprintk(1, "init overlay [%d pages @ bus 0x%lx]\n",
+ dprintk(1, "init overlay [%lu pages @ bus 0x%lx]\n",
nr_pages, (unsigned long)addr);
dma->direction = direction;

@@ -500,9 +500,11 @@ static int __videobuf_iolock(struct videobuf_queue *q,
struct videobuf_buffer *vb,
struct v4l2_framebuffer *fbuf)
{
- int err, pages;
- dma_addr_t bus;
struct videobuf_dma_sg_memory *mem = vb->priv;
+ unsigned long pages;
+ dma_addr_t bus;
+ int err;
+
BUG_ON(!mem);

MAGIC_CHECK(mem->magic, MAGIC_SG_MEM);
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h
index 34450f7ad510..930ff8d454fc 100644
--- a/include/media/videobuf-dma-sg.h
+++ b/include/media/videobuf-dma-sg.h
@@ -60,7 +60,7 @@ struct videobuf_dmabuf {
/* common */
struct scatterlist *sglist;
int sglen;
- int nr_pages;
+ unsigned long nr_pages;
int direction;
};

--
2.26.2

2020-09-02 16:19:34

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 23/38] media: saa7134: avoid a shift overflow

As reported by smatch:
drivers/media/pci/saa7134//saa7134-tvaudio.c:686 saa_dsp_writel() warn: should 'reg << 2' be a 64 bit type?

On a 64-bits Kernel, the shift might be bigger than 32 bits.

In real, this should never happen, but let's shut up the warning.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/pci/saa7134/saa7134-tvaudio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/saa7134/saa7134-tvaudio.c b/drivers/media/pci/saa7134/saa7134-tvaudio.c
index 79e1afb71075..5cc4ef21f9d3 100644
--- a/drivers/media/pci/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/pci/saa7134/saa7134-tvaudio.c
@@ -683,7 +683,8 @@ int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value)
{
int err;

- audio_dbg(2, "dsp write reg 0x%x = 0x%06x\n", reg << 2, value);
+ audio_dbg(2, "dsp write reg 0x%x = 0x%06x\n",
+ (reg << 2) & 0xffffffff, value);
err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_WRR);
if (err < 0)
return err;
--
2.26.2

2020-09-02 16:19:52

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 29/38] media: atomisp: get rid of ibuf_ctrl abstraction

Just move the stuff there to the places where this header is
included.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
.../css_2401_system/host/ibuf_ctrl_local.h | 1 +
.../css_2401_system/host/ibuf_ctrl_private.h | 268 ------------------
.../host/ibuf_ctrl_public.h | 94 ------
.../pci/hive_isp_css_include/ibuf_ctrl.h | 47 ---
.../atomisp/pci/isp2401_input_system_global.h | 2 +-
.../atomisp/pci/isp2401_input_system_local.h | 1 -
.../pci/isp2401_input_system_private.h | 224 ++++++++++++++-
7 files changed, 220 insertions(+), 417 deletions(-)
delete mode 100644 drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h
delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h
delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h

diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h
index 4952b42d8191..f71841195ac1 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h
@@ -17,6 +17,7 @@
#define __IBUF_CTRL_LOCAL_H_INCLUDED__

#include "ibuf_ctrl_global.h"
+#include "ibuf_ctrl_local.h"

typedef struct ibuf_ctrl_proc_state_s ibuf_ctrl_proc_state_t;
typedef struct ibuf_ctrl_state_s ibuf_ctrl_state_t;
diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h
deleted file mode 100644
index a58e8477da6e..000000000000
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- */
-
-#ifndef __IBUF_CTRL_PRIVATE_H_INCLUDED__
-#define __IBUF_CTRL_PRIVATE_H_INCLUDED__
-
-#include "ibuf_ctrl_public.h"
-
-#include "device_access.h" /* ia_css_device_load_uint32 */
-
-#include "assert_support.h" /* assert */
-#include "print_support.h" /* print */
-
-/*****************************************************
- *
- * Native command interface (NCI).
- *
- *****************************************************/
-/**
- * @brief Get the ibuf-controller state.
- * Refer to "ibuf_ctrl_public.h" for details.
- */
-STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_get_state(
- const ibuf_ctrl_ID_t ID,
- ibuf_ctrl_state_t *state)
-{
- u32 i;
-
- state->recalc_words =
- ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_RECALC_WORDS_STATUS);
- state->arbiters =
- ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_ARBITERS_STATUS);
-
- /*
- * Get the values of the register-set per
- * ibuf-controller process.
- */
- for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) {
- ibuf_ctrl_get_proc_state(
- ID,
- i,
- &state->proc_state[i]);
- }
-}
-
-/**
- * @brief Get the state of the ibuf-controller process.
- * Refer to "ibuf_ctrl_public.h" for details.
- */
-STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_get_proc_state(
- const ibuf_ctrl_ID_t ID,
- const u32 proc_id,
- ibuf_ctrl_proc_state_t *state)
-{
- hrt_address reg_bank_offset;
-
- reg_bank_offset =
- _IBUF_CNTRL_PROC_REG_ALIGN * (1 + proc_id);
-
- state->num_items =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_ITEMS_PER_STORE);
-
- state->num_stores =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_STORES_PER_FRAME);
-
- state->dma_channel =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CHANNEL);
-
- state->dma_command =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CMD);
-
- state->ibuf_st_addr =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_START_ADDRESS);
-
- state->ibuf_stride =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_STRIDE);
-
- state->ibuf_end_addr =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_END_ADDRESS);
-
- state->dest_st_addr =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_START_ADDRESS);
-
- state->dest_stride =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_STRIDE);
-
- state->dest_end_addr =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_END_ADDRESS);
-
- state->sync_frame =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SYNC_FRAME);
-
- state->sync_command =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_SYNC_CMD);
-
- state->store_command =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_STORE_CMD);
-
- state->shift_returned_items =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SHIFT_ITEMS);
-
- state->elems_ibuf =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_IBUF);
-
- state->elems_dest =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_DEST);
-
- state->cur_stores =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_STORES);
-
- state->cur_acks =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ACKS);
-
- state->cur_s2m_ibuf_addr =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_S2M_IBUF_ADDR);
-
- state->cur_dma_ibuf_addr =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_IBUF_ADDR);
-
- state->cur_dma_dest_addr =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_DEST_ADDR);
-
- state->cur_isp_dest_addr =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ISP_DEST_ADDR);
-
- state->dma_cmds_send =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_NR_DMA_CMDS_SEND);
-
- state->main_cntrl_state =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_MAIN_CNTRL_STATE);
-
- state->dma_sync_state =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_SYNC_STATE);
-
- state->isp_sync_state =
- ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ISP_SYNC_STATE);
-}
-
-/**
- * @brief Dump the ibuf-controller state.
- * Refer to "ibuf_ctrl_public.h" for details.
- */
-STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_dump_state(
- const ibuf_ctrl_ID_t ID,
- ibuf_ctrl_state_t *state)
-{
- u32 i;
-
- ia_css_print("IBUF controller ID %d recalculate words 0x%x\n", ID,
- state->recalc_words);
- ia_css_print("IBUF controller ID %d arbiters 0x%x\n", ID, state->arbiters);
-
- /*
- * Dump the values of the register-set per
- * ibuf-controller process.
- */
- for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) {
- ia_css_print("IBUF controller ID %d Process ID %d num_items 0x%x\n", ID, i,
- state->proc_state[i].num_items);
- ia_css_print("IBUF controller ID %d Process ID %d num_stores 0x%x\n", ID, i,
- state->proc_state[i].num_stores);
- ia_css_print("IBUF controller ID %d Process ID %d dma_channel 0x%x\n", ID, i,
- state->proc_state[i].dma_channel);
- ia_css_print("IBUF controller ID %d Process ID %d dma_command 0x%x\n", ID, i,
- state->proc_state[i].dma_command);
- ia_css_print("IBUF controller ID %d Process ID %d ibuf_st_addr 0x%x\n", ID, i,
- state->proc_state[i].ibuf_st_addr);
- ia_css_print("IBUF controller ID %d Process ID %d ibuf_stride 0x%x\n", ID, i,
- state->proc_state[i].ibuf_stride);
- ia_css_print("IBUF controller ID %d Process ID %d ibuf_end_addr 0x%x\n", ID, i,
- state->proc_state[i].ibuf_end_addr);
- ia_css_print("IBUF controller ID %d Process ID %d dest_st_addr 0x%x\n", ID, i,
- state->proc_state[i].dest_st_addr);
- ia_css_print("IBUF controller ID %d Process ID %d dest_stride 0x%x\n", ID, i,
- state->proc_state[i].dest_stride);
- ia_css_print("IBUF controller ID %d Process ID %d dest_end_addr 0x%x\n", ID, i,
- state->proc_state[i].dest_end_addr);
- ia_css_print("IBUF controller ID %d Process ID %d sync_frame 0x%x\n", ID, i,
- state->proc_state[i].sync_frame);
- ia_css_print("IBUF controller ID %d Process ID %d sync_command 0x%x\n", ID, i,
- state->proc_state[i].sync_command);
- ia_css_print("IBUF controller ID %d Process ID %d store_command 0x%x\n", ID, i,
- state->proc_state[i].store_command);
- ia_css_print("IBUF controller ID %d Process ID %d shift_returned_items 0x%x\n",
- ID, i,
- state->proc_state[i].shift_returned_items);
- ia_css_print("IBUF controller ID %d Process ID %d elems_ibuf 0x%x\n", ID, i,
- state->proc_state[i].elems_ibuf);
- ia_css_print("IBUF controller ID %d Process ID %d elems_dest 0x%x\n", ID, i,
- state->proc_state[i].elems_dest);
- ia_css_print("IBUF controller ID %d Process ID %d cur_stores 0x%x\n", ID, i,
- state->proc_state[i].cur_stores);
- ia_css_print("IBUF controller ID %d Process ID %d cur_acks 0x%x\n", ID, i,
- state->proc_state[i].cur_acks);
- ia_css_print("IBUF controller ID %d Process ID %d cur_s2m_ibuf_addr 0x%x\n", ID,
- i,
- state->proc_state[i].cur_s2m_ibuf_addr);
- ia_css_print("IBUF controller ID %d Process ID %d cur_dma_ibuf_addr 0x%x\n", ID,
- i,
- state->proc_state[i].cur_dma_ibuf_addr);
- ia_css_print("IBUF controller ID %d Process ID %d cur_dma_dest_addr 0x%x\n", ID,
- i,
- state->proc_state[i].cur_dma_dest_addr);
- ia_css_print("IBUF controller ID %d Process ID %d cur_isp_dest_addr 0x%x\n", ID,
- i,
- state->proc_state[i].cur_isp_dest_addr);
- ia_css_print("IBUF controller ID %d Process ID %d dma_cmds_send 0x%x\n", ID, i,
- state->proc_state[i].dma_cmds_send);
- ia_css_print("IBUF controller ID %d Process ID %d main_cntrl_state 0x%x\n", ID,
- i,
- state->proc_state[i].main_cntrl_state);
- ia_css_print("IBUF controller ID %d Process ID %d dma_sync_state 0x%x\n", ID, i,
- state->proc_state[i].dma_sync_state);
- ia_css_print("IBUF controller ID %d Process ID %d isp_sync_state 0x%x\n", ID, i,
- state->proc_state[i].isp_sync_state);
- }
-}
-
-/* end of NCI */
-
-/*****************************************************
- *
- * Device level interface (DLI).
- *
- *****************************************************/
-/**
- * @brief Load the register value.
- * Refer to "ibuf_ctrl_public.h" for details.
- */
-STORAGE_CLASS_IBUF_CTRL_C hrt_data ibuf_ctrl_reg_load(
- const ibuf_ctrl_ID_t ID,
- const hrt_address reg)
-{
- assert(ID < N_IBUF_CTRL_ID);
- assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1);
- return ia_css_device_load_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data));
-}
-
-/**
- * @brief Store a value to the register.
- * Refer to "ibuf_ctrl_public.h" for details.
- */
-STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_reg_store(
- const ibuf_ctrl_ID_t ID,
- const hrt_address reg,
- const hrt_data value)
-{
- assert(ID < N_IBUF_CTRL_ID);
- assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1);
-
- ia_css_device_store_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data), value);
-}
-
-/* end of DLI */
-
-#endif /* __IBUF_CTRL_PRIVATE_H_INCLUDED__ */
diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h
deleted file mode 100644
index 54982b15d9a9..000000000000
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- */
-
-#ifndef __IBUF_CTRL_PUBLIC_H_INCLUDED__
-#define __IBUF_CTRL_PUBLIC_H_INCLUDED__
-
-#ifdef ISP2401
-/*****************************************************
- *
- * Native command interface (NCI).
- *
- *****************************************************/
-/**
- * @brief Get the ibuf-controller state.
- * Get the state of the ibuf-controller regiester-set.
- *
- * @param[in] id The global unique ID of the input-buffer controller.
- * @param[out] state Point to the register-state.
- */
-STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_get_state(
- const ibuf_ctrl_ID_t ID,
- ibuf_ctrl_state_t *state);
-
-/**
- * @brief Get the state of the ibuf-controller process.
- * Get the state of the register set per buf-controller process.
- *
- * @param[in] id The global unique ID of the input-buffer controller.
- * @param[in] proc_id The process ID.
- * @param[out] state Point to the process state.
- */
-STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_get_proc_state(
- const ibuf_ctrl_ID_t ID,
- const u32 proc_id,
- ibuf_ctrl_proc_state_t *state);
-/**
- * @brief Dump the ibuf-controller state.
- * Dump the state of the ibuf-controller regiester-set.
- *
- * @param[in] id The global unique ID of the input-buffer controller.
- * @param[in] state Pointer to the register-state.
- */
-STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_dump_state(
- const ibuf_ctrl_ID_t ID,
- ibuf_ctrl_state_t *state);
-/* end of NCI */
-
-/*****************************************************
- *
- * Device level interface (DLI).
- *
- *****************************************************/
-/**
- * @brief Load the register value.
- * Load the value of the register of the ibuf-controller.
- *
- * @param[in] ID The global unique ID for the ibuf-controller instance.
- * @param[in] reg The offset address of the register.
- *
- * @return the value of the register.
- */
-STORAGE_CLASS_IBUF_CTRL_H hrt_data ibuf_ctrl_reg_load(
- const ibuf_ctrl_ID_t ID,
- const hrt_address reg);
-
-/**
- * @brief Store a value to the register.
- * Store a value to the registe of the ibuf-controller.
- *
- * @param[in] ID The global unique ID for the ibuf-controller instance.
- * @param[in] reg The offset address of the register.
- * @param[in] value The value to be stored.
- *
- */
-STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_reg_store(
- const ibuf_ctrl_ID_t ID,
- const hrt_address reg,
- const hrt_data value);
-/* end of DLI */
-
-#endif /* ISP2401 */
-#endif /* __IBUF_CTRL_PUBLIC_H_INCLUDED__ */
diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h
deleted file mode 100644
index 218341041811..000000000000
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- */
-
-#ifndef __IBUF_CTRL_H_INCLUDED__
-#define __IBUF_CTRL_H_INCLUDED__
-
-/*
- * This file is included on every cell {SP,ISP,host} and on every system
- * that uses the input system device(s). It defines the API to DLI bridge
- *
- * System and cell specific interfaces and inline code are included
- * conditionally through Makefile path settings.
- *
- * - system and cell agnostic interfaces, constants and identifiers
- * - public: system agnostic, cell specific interfaces
- * - private: system dependent, cell specific interfaces &
- * inline implementations
- * - global: system specific constants and identifiers
- * - local: system and cell specific constants and identifiers
- */
-
-#include "system_local.h"
-#include "ibuf_ctrl_local.h"
-
-#ifndef __INLINE_IBUF_CTRL__
-#define STORAGE_CLASS_IBUF_CTRL_H extern
-#define STORAGE_CLASS_IBUF_CTRL_C
-#include "ibuf_ctrl_public.h"
-#else /* __INLINE_IBUF_CTRL__ */
-#define STORAGE_CLASS_IBUF_CTRL_H static inline
-#define STORAGE_CLASS_IBUF_CTRL_C static inline
-#include "ibuf_ctrl_private.h"
-#endif /* __INLINE_IBUF_CTRL__ */
-
-#endif /* __IBUF_CTRL_H_INCLUDED__ */
diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h
index 6407be9331ae..362644856a6c 100644
--- a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h
+++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h
@@ -26,7 +26,7 @@
* isys2401_dma_cfg_t
*/

-#include "ibuf_ctrl.h" /* ibuf_cfg_t,
+#include "ibuf_ctrl_local.h" /* ibuf_cfg_t,
* ibuf_ctrl_cfg_t
*/

diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h
index f52a8ca5f86b..c33b0341ce16 100644
--- a/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h
+++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h
@@ -19,7 +19,6 @@
#include "type_support.h"
#include "input_system_global.h"

-#include "ibuf_ctrl.h"
#include "csi_rx.h"
#include "pixelgen.h"
#include "isys_stream2mmio.h"
diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h
index f3ca5d1bcb01..e4c76428f6dd 100644
--- a/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h
+++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h
@@ -18,9 +18,222 @@

#include "input_system_public.h"

-STORAGE_CLASS_INPUT_SYSTEM_C input_system_err_t input_system_get_state(
- const input_system_ID_t ID,
- input_system_state_t *state)
+#include "device_access.h" /* ia_css_device_load_uint32 */
+
+#include "assert_support.h" /* assert */
+#include "print_support.h" /* print */
+
+/* Load the register value */
+static inline hrt_data ibuf_ctrl_reg_load(const ibuf_ctrl_ID_t ID,
+ const hrt_address reg)
+{
+ assert(ID < N_IBUF_CTRL_ID);
+ assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1);
+ return ia_css_device_load_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data));
+}
+
+/* Store a value to the register */
+static inline void ibuf_ctrl_reg_store(const ibuf_ctrl_ID_t ID,
+ const hrt_address reg,
+ const hrt_data value)
+{
+ assert(ID < N_IBUF_CTRL_ID);
+ assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1);
+
+ ia_css_device_store_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data), value);
+}
+
+/* Get the state of the ibuf-controller process */
+static inline void ibuf_ctrl_get_proc_state(const ibuf_ctrl_ID_t ID,
+ const u32 proc_id,
+ ibuf_ctrl_proc_state_t *state)
+{
+ hrt_address reg_bank_offset;
+
+ reg_bank_offset =
+ _IBUF_CNTRL_PROC_REG_ALIGN * (1 + proc_id);
+
+ state->num_items =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_ITEMS_PER_STORE);
+
+ state->num_stores =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_STORES_PER_FRAME);
+
+ state->dma_channel =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CHANNEL);
+
+ state->dma_command =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CMD);
+
+ state->ibuf_st_addr =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_START_ADDRESS);
+
+ state->ibuf_stride =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_STRIDE);
+
+ state->ibuf_end_addr =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_END_ADDRESS);
+
+ state->dest_st_addr =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_START_ADDRESS);
+
+ state->dest_stride =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_STRIDE);
+
+ state->dest_end_addr =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_END_ADDRESS);
+
+ state->sync_frame =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SYNC_FRAME);
+
+ state->sync_command =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_SYNC_CMD);
+
+ state->store_command =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_STORE_CMD);
+
+ state->shift_returned_items =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SHIFT_ITEMS);
+
+ state->elems_ibuf =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_IBUF);
+
+ state->elems_dest =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_DEST);
+
+ state->cur_stores =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_STORES);
+
+ state->cur_acks =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ACKS);
+
+ state->cur_s2m_ibuf_addr =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_S2M_IBUF_ADDR);
+
+ state->cur_dma_ibuf_addr =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_IBUF_ADDR);
+
+ state->cur_dma_dest_addr =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_DEST_ADDR);
+
+ state->cur_isp_dest_addr =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ISP_DEST_ADDR);
+
+ state->dma_cmds_send =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_NR_DMA_CMDS_SEND);
+
+ state->main_cntrl_state =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_MAIN_CNTRL_STATE);
+
+ state->dma_sync_state =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_SYNC_STATE);
+
+ state->isp_sync_state =
+ ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ISP_SYNC_STATE);
+}
+
+/* Get the ibuf-controller state. */
+static inline void ibuf_ctrl_get_state(const ibuf_ctrl_ID_t ID,
+ ibuf_ctrl_state_t *state)
+{
+ u32 i;
+
+ state->recalc_words =
+ ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_RECALC_WORDS_STATUS);
+ state->arbiters =
+ ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_ARBITERS_STATUS);
+
+ /*
+ * Get the values of the register-set per
+ * ibuf-controller process.
+ */
+ for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) {
+ ibuf_ctrl_get_proc_state(
+ ID,
+ i,
+ &state->proc_state[i]);
+ }
+}
+
+/* Dump the ibuf-controller state */
+static inline void ibuf_ctrl_dump_state(const ibuf_ctrl_ID_t ID,
+ ibuf_ctrl_state_t *state)
+{
+ u32 i;
+
+ ia_css_print("IBUF controller ID %d recalculate words 0x%x\n", ID,
+ state->recalc_words);
+ ia_css_print("IBUF controller ID %d arbiters 0x%x\n", ID, state->arbiters);
+
+ /*
+ * Dump the values of the register-set per
+ * ibuf-controller process.
+ */
+ for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) {
+ ia_css_print("IBUF controller ID %d Process ID %d num_items 0x%x\n", ID, i,
+ state->proc_state[i].num_items);
+ ia_css_print("IBUF controller ID %d Process ID %d num_stores 0x%x\n", ID, i,
+ state->proc_state[i].num_stores);
+ ia_css_print("IBUF controller ID %d Process ID %d dma_channel 0x%x\n", ID, i,
+ state->proc_state[i].dma_channel);
+ ia_css_print("IBUF controller ID %d Process ID %d dma_command 0x%x\n", ID, i,
+ state->proc_state[i].dma_command);
+ ia_css_print("IBUF controller ID %d Process ID %d ibuf_st_addr 0x%x\n", ID, i,
+ state->proc_state[i].ibuf_st_addr);
+ ia_css_print("IBUF controller ID %d Process ID %d ibuf_stride 0x%x\n", ID, i,
+ state->proc_state[i].ibuf_stride);
+ ia_css_print("IBUF controller ID %d Process ID %d ibuf_end_addr 0x%x\n", ID, i,
+ state->proc_state[i].ibuf_end_addr);
+ ia_css_print("IBUF controller ID %d Process ID %d dest_st_addr 0x%x\n", ID, i,
+ state->proc_state[i].dest_st_addr);
+ ia_css_print("IBUF controller ID %d Process ID %d dest_stride 0x%x\n", ID, i,
+ state->proc_state[i].dest_stride);
+ ia_css_print("IBUF controller ID %d Process ID %d dest_end_addr 0x%x\n", ID, i,
+ state->proc_state[i].dest_end_addr);
+ ia_css_print("IBUF controller ID %d Process ID %d sync_frame 0x%x\n", ID, i,
+ state->proc_state[i].sync_frame);
+ ia_css_print("IBUF controller ID %d Process ID %d sync_command 0x%x\n", ID, i,
+ state->proc_state[i].sync_command);
+ ia_css_print("IBUF controller ID %d Process ID %d store_command 0x%x\n", ID, i,
+ state->proc_state[i].store_command);
+ ia_css_print("IBUF controller ID %d Process ID %d shift_returned_items 0x%x\n",
+ ID, i,
+ state->proc_state[i].shift_returned_items);
+ ia_css_print("IBUF controller ID %d Process ID %d elems_ibuf 0x%x\n", ID, i,
+ state->proc_state[i].elems_ibuf);
+ ia_css_print("IBUF controller ID %d Process ID %d elems_dest 0x%x\n", ID, i,
+ state->proc_state[i].elems_dest);
+ ia_css_print("IBUF controller ID %d Process ID %d cur_stores 0x%x\n", ID, i,
+ state->proc_state[i].cur_stores);
+ ia_css_print("IBUF controller ID %d Process ID %d cur_acks 0x%x\n", ID, i,
+ state->proc_state[i].cur_acks);
+ ia_css_print("IBUF controller ID %d Process ID %d cur_s2m_ibuf_addr 0x%x\n", ID,
+ i,
+ state->proc_state[i].cur_s2m_ibuf_addr);
+ ia_css_print("IBUF controller ID %d Process ID %d cur_dma_ibuf_addr 0x%x\n", ID,
+ i,
+ state->proc_state[i].cur_dma_ibuf_addr);
+ ia_css_print("IBUF controller ID %d Process ID %d cur_dma_dest_addr 0x%x\n", ID,
+ i,
+ state->proc_state[i].cur_dma_dest_addr);
+ ia_css_print("IBUF controller ID %d Process ID %d cur_isp_dest_addr 0x%x\n", ID,
+ i,
+ state->proc_state[i].cur_isp_dest_addr);
+ ia_css_print("IBUF controller ID %d Process ID %d dma_cmds_send 0x%x\n", ID, i,
+ state->proc_state[i].dma_cmds_send);
+ ia_css_print("IBUF controller ID %d Process ID %d main_cntrl_state 0x%x\n", ID,
+ i,
+ state->proc_state[i].main_cntrl_state);
+ ia_css_print("IBUF controller ID %d Process ID %d dma_sync_state 0x%x\n", ID, i,
+ state->proc_state[i].dma_sync_state);
+ ia_css_print("IBUF controller ID %d Process ID %d isp_sync_state 0x%x\n", ID, i,
+ state->proc_state[i].isp_sync_state);
+ }
+}
+
+static inline input_system_err_t
+input_system_get_state(const input_system_ID_t ID,
+ input_system_state_t *state)
{
u32 i;

@@ -73,9 +286,8 @@ STORAGE_CLASS_INPUT_SYSTEM_C input_system_err_t input_system_get_state(
return INPUT_SYSTEM_ERR_NO_ERROR;
}

-STORAGE_CLASS_INPUT_SYSTEM_C void input_system_dump_state(
- const input_system_ID_t ID,
- input_system_state_t *state)
+static inline void input_system_dump_state(const input_system_ID_t ID,
+ input_system_state_t *state)
{
u32 i;

--
2.26.2

2020-09-02 16:19:55

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 08/38] media: serial_ir: use the right type for a dma address

As warned by smatch:
drivers/media/rc/serial_ir.c:550 serial_ir_probe() warn: should '8 << ioshift' be a 64 bit type?

the "8" constant should be unsigned long.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/rc/serial_ir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c
index d77507ba0fb5..5b5b3203f5a0 100644
--- a/drivers/media/rc/serial_ir.c
+++ b/drivers/media/rc/serial_ir.c
@@ -547,7 +547,7 @@ static int serial_ir_probe(struct platform_device *dev)

/* Reserve io region. */
if ((iommap &&
- (devm_request_mem_region(&dev->dev, iommap, 8 << ioshift,
+ (devm_request_mem_region(&dev->dev, iommap, 8UL << ioshift,
KBUILD_MODNAME) == NULL)) ||
(!iommap && (devm_request_region(&dev->dev, io, 8,
KBUILD_MODNAME) == NULL))) {
--
2.26.2

2020-09-02 16:20:13

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 10/38] media: vivid: place the logic which disables ioctl on a separate function

Move this code out of the long vivid_create_instance() function.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/test-drivers/vivid/vivid-core.c | 182 +++++++++---------
1 file changed, 96 insertions(+), 86 deletions(-)

diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
index d4785da440d9..f8cb4133e1ce 100644
--- a/drivers/media/test-drivers/vivid/vivid-core.c
+++ b/drivers/media/test-drivers/vivid/vivid-core.c
@@ -1001,6 +1001,100 @@ static int vivid_detect_feature_set(struct vivid_dev *dev, int inst,
return 0;
}

+static void vivid_disable_unused_ioctls(struct vivid_dev *dev,
+ bool has_tuner,
+ bool has_modulator,
+ unsigned in_type_counter[4],
+ unsigned out_type_counter[4])
+{
+ /* disable invalid ioctls based on the feature set */
+ if (!dev->has_audio_inputs) {
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_AUDIO);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_AUDIO);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUMAUDIO);
+ v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_AUDIO);
+ v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_AUDIO);
+ v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_ENUMAUDIO);
+ v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_AUDIO);
+ v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_AUDIO);
+ v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_ENUMAUDIO);
+ }
+ if (!dev->has_audio_outputs) {
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_AUDOUT);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_AUDOUT);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUMAUDOUT);
+ v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_S_AUDOUT);
+ v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_G_AUDOUT);
+ v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_ENUMAUDOUT);
+ v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_S_AUDOUT);
+ v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_G_AUDOUT);
+ v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_ENUMAUDOUT);
+ }
+ if (!in_type_counter[TV] && !in_type_counter[SVID]) {
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_STD);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_STD);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUMSTD);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_QUERYSTD);
+ }
+ if (!out_type_counter[SVID]) {
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_STD);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_STD);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUMSTD);
+ }
+ if (!has_tuner && !has_modulator) {
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_FREQUENCY);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_FREQUENCY);
+ v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_FREQUENCY);
+ v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_FREQUENCY);
+ v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_FREQUENCY);
+ v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_FREQUENCY);
+ }
+ if (!has_tuner) {
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_TUNER);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_TUNER);
+ v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_TUNER);
+ v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_TUNER);
+ v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_TUNER);
+ v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_TUNER);
+ }
+ if (in_type_counter[HDMI] == 0) {
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_EDID);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_EDID);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_DV_TIMINGS_CAP);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_DV_TIMINGS);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_DV_TIMINGS);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUM_DV_TIMINGS);
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_QUERY_DV_TIMINGS);
+ }
+ if (out_type_counter[HDMI] == 0) {
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_EDID);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_DV_TIMINGS_CAP);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_DV_TIMINGS);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_DV_TIMINGS);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_DV_TIMINGS);
+ }
+ if (!dev->has_fb) {
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_FBUF);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_FBUF);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_OVERLAY);
+ }
+ v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_HW_FREQ_SEEK);
+ v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_HW_FREQ_SEEK);
+ v4l2_disable_ioctl(&dev->sdr_cap_dev, VIDIOC_S_HW_FREQ_SEEK);
+ v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_HW_FREQ_SEEK);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_FREQUENCY);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_FREQUENCY);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_FRAMESIZES);
+ v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_FRAMEINTERVALS);
+ v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_S_FREQUENCY);
+ v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_G_FREQUENCY);
+ v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_S_FREQUENCY);
+ v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_G_FREQUENCY);
+ v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_S_PARM);
+ v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_ENUM_FRAMESIZES);
+ v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_ENUM_FRAMEINTERVALS);
+}
+
static int vivid_create_instance(struct platform_device *pdev, int inst)
{
static const struct v4l2_dv_timings def_dv_timings =
@@ -1189,92 +1283,8 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
(u32)bt->pixelclock / (htot * vtot));
}

- /* disable invalid ioctls based on the feature set */
- if (!dev->has_audio_inputs) {
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_AUDIO);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_AUDIO);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUMAUDIO);
- v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_AUDIO);
- v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_AUDIO);
- v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_ENUMAUDIO);
- v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_AUDIO);
- v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_AUDIO);
- v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_ENUMAUDIO);
- }
- if (!dev->has_audio_outputs) {
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_AUDOUT);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_AUDOUT);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUMAUDOUT);
- v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_S_AUDOUT);
- v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_G_AUDOUT);
- v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_ENUMAUDOUT);
- v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_S_AUDOUT);
- v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_G_AUDOUT);
- v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_ENUMAUDOUT);
- }
- if (!in_type_counter[TV] && !in_type_counter[SVID]) {
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_STD);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_STD);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUMSTD);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_QUERYSTD);
- }
- if (!out_type_counter[SVID]) {
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_STD);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_STD);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUMSTD);
- }
- if (!has_tuner && !has_modulator) {
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_FREQUENCY);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_FREQUENCY);
- v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_FREQUENCY);
- v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_FREQUENCY);
- v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_FREQUENCY);
- v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_FREQUENCY);
- }
- if (!has_tuner) {
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_TUNER);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_TUNER);
- v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_TUNER);
- v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_TUNER);
- v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_TUNER);
- v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_TUNER);
- }
- if (in_type_counter[HDMI] == 0) {
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_EDID);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_EDID);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_DV_TIMINGS_CAP);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_DV_TIMINGS);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_DV_TIMINGS);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUM_DV_TIMINGS);
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_QUERY_DV_TIMINGS);
- }
- if (out_type_counter[HDMI] == 0) {
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_EDID);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_DV_TIMINGS_CAP);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_DV_TIMINGS);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_DV_TIMINGS);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_DV_TIMINGS);
- }
- if (!dev->has_fb) {
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_FBUF);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_FBUF);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_OVERLAY);
- }
- v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_HW_FREQ_SEEK);
- v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_HW_FREQ_SEEK);
- v4l2_disable_ioctl(&dev->sdr_cap_dev, VIDIOC_S_HW_FREQ_SEEK);
- v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_HW_FREQ_SEEK);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_FREQUENCY);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_FREQUENCY);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_FRAMESIZES);
- v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_FRAMEINTERVALS);
- v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_S_FREQUENCY);
- v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_G_FREQUENCY);
- v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_S_FREQUENCY);
- v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_G_FREQUENCY);
- v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_S_PARM);
- v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_ENUM_FRAMESIZES);
- v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_ENUM_FRAMEINTERVALS);
+ vivid_disable_unused_ioctls(dev, has_tuner, has_modulator,
+ in_type_counter, out_type_counter);

/* configure internal data */
dev->fmt_cap = &vivid_formats[0];
--
2.26.2

2020-09-02 16:20:28

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 09/38] media: vivid: move the detection part out of vivid_create_instance

The vivid_create_instance() function is too harry. Smatch can't
process it, because it takes too long.

The detection part is an important piece of it. As such, there
are even comments before and after such block.

So, it makes sense to just move it to a separate function.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/test-drivers/vivid/vivid-core.c | 151 ++++++++++--------
1 file changed, 83 insertions(+), 68 deletions(-)

diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
index 931218fa955e..d4785da440d9 100644
--- a/drivers/media/test-drivers/vivid/vivid-core.c
+++ b/drivers/media/test-drivers/vivid/vivid-core.c
@@ -832,56 +832,16 @@ static int vivid_create_queue(struct vivid_dev *dev,
return vb2_queue_init(q);
}

-static int vivid_create_instance(struct platform_device *pdev, int inst)
+static int vivid_detect_feature_set(struct vivid_dev *dev, int inst,
+ unsigned node_type,
+ bool *has_tuner,
+ bool *has_modulator,
+ int *ccs_cap,
+ int *ccs_out,
+ unsigned in_type_counter[4],
+ unsigned out_type_counter[4])
{
- static const struct v4l2_dv_timings def_dv_timings =
- V4L2_DV_BT_CEA_1280X720P60;
- unsigned in_type_counter[4] = { 0, 0, 0, 0 };
- unsigned out_type_counter[4] = { 0, 0, 0, 0 };
- int ccs_cap = ccs_cap_mode[inst];
- int ccs_out = ccs_out_mode[inst];
- bool has_tuner;
- bool has_modulator;
- struct vivid_dev *dev;
- struct video_device *vfd;
- unsigned node_type = node_types[inst];
- v4l2_std_id tvnorms_cap = 0, tvnorms_out = 0;
- int ret;
int i;
-#ifdef CONFIG_VIDEO_VIVID_CEC
- unsigned int cec_tx_bus_cnt = 0;
-#endif
-
- /* allocate main vivid state structure */
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
- if (!dev)
- return -ENOMEM;
-
- dev->inst = inst;
-
-#ifdef CONFIG_MEDIA_CONTROLLER
- dev->v4l2_dev.mdev = &dev->mdev;
-
- /* Initialize media device */
- strscpy(dev->mdev.model, VIVID_MODULE_NAME, sizeof(dev->mdev.model));
- snprintf(dev->mdev.bus_info, sizeof(dev->mdev.bus_info),
- "platform:%s-%03d", VIVID_MODULE_NAME, inst);
- dev->mdev.dev = &pdev->dev;
- media_device_init(&dev->mdev);
- dev->mdev.ops = &vivid_media_ops;
-#endif
-
- /* register v4l2_device */
- snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name),
- "%s-%03d", VIVID_MODULE_NAME, inst);
- ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
- if (ret) {
- kfree(dev);
- return ret;
- }
- dev->v4l2_dev.release = vivid_dev_release;
-
- /* start detecting feature set */

/* do we use single- or multi-planar? */
dev->multiplanar = multiplanar[inst] > 1;
@@ -947,14 +907,12 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
!dev->has_vid_cap && !dev->has_meta_cap) {
v4l2_warn(&dev->v4l2_dev,
"Webcam or HDMI input without video or metadata nodes\n");
- kfree(dev);
return -EINVAL;
}
if ((in_type_counter[TV] || in_type_counter[SVID]) &&
!dev->has_vid_cap && !dev->has_vbi_cap && !dev->has_meta_cap) {
v4l2_warn(&dev->v4l2_dev,
"TV or S-Video input without video, VBI or metadata nodes\n");
- kfree(dev);
return -EINVAL;
}

@@ -976,13 +934,11 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
!dev->has_vid_out && !dev->has_vbi_out && !dev->has_meta_out) {
v4l2_warn(&dev->v4l2_dev,
"S-Video output without video, VBI or metadata nodes\n");
- kfree(dev);
return -EINVAL;
}
if (out_type_counter[HDMI] && !dev->has_vid_out && !dev->has_meta_out) {
v4l2_warn(&dev->v4l2_dev,
"HDMI output without video or metadata nodes\n");
- kfree(dev);
return -EINVAL;
}

@@ -999,25 +955,25 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
dev->has_tv_tuner = in_type_counter[TV];

/* do we have a tuner? */
- has_tuner = ((dev->has_vid_cap || dev->has_vbi_cap) && in_type_counter[TV]) ||
- dev->has_radio_rx || dev->has_sdr_cap;
+ *has_tuner = ((dev->has_vid_cap || dev->has_vbi_cap) && in_type_counter[TV]) ||
+ dev->has_radio_rx || dev->has_sdr_cap;

/* do we have a modulator? */
- has_modulator = dev->has_radio_tx;
+ *has_modulator = dev->has_radio_tx;

if (dev->has_vid_cap)
/* do we have a framebuffer for overlay testing? */
dev->has_fb = node_type & 0x10000;

/* can we do crop/compose/scaling while capturing? */
- if (no_error_inj && ccs_cap == -1)
- ccs_cap = 7;
+ if (no_error_inj && *ccs_cap == -1)
+ *ccs_cap = 7;

/* if ccs_cap == -1, then the user can select it using controls */
- if (ccs_cap != -1) {
- dev->has_crop_cap = ccs_cap & 1;
- dev->has_compose_cap = ccs_cap & 2;
- dev->has_scaler_cap = ccs_cap & 4;
+ if (*ccs_cap != -1) {
+ dev->has_crop_cap = *ccs_cap & 1;
+ dev->has_compose_cap = *ccs_cap & 2;
+ dev->has_scaler_cap = *ccs_cap & 4;
v4l2_info(&dev->v4l2_dev, "Capture Crop: %c Compose: %c Scaler: %c\n",
dev->has_crop_cap ? 'Y' : 'N',
dev->has_compose_cap ? 'Y' : 'N',
@@ -1025,14 +981,14 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
}

/* can we do crop/compose/scaling with video output? */
- if (no_error_inj && ccs_out == -1)
- ccs_out = 7;
+ if (no_error_inj && *ccs_out == -1)
+ *ccs_out = 7;

/* if ccs_out == -1, then the user can select it using controls */
- if (ccs_out != -1) {
- dev->has_crop_out = ccs_out & 1;
- dev->has_compose_out = ccs_out & 2;
- dev->has_scaler_out = ccs_out & 4;
+ if (*ccs_out != -1) {
+ dev->has_crop_out = *ccs_out & 1;
+ dev->has_compose_out = *ccs_out & 2;
+ dev->has_scaler_out = *ccs_out & 4;
v4l2_info(&dev->v4l2_dev, "Output Crop: %c Compose: %c Scaler: %c\n",
dev->has_crop_out ? 'Y' : 'N',
dev->has_compose_out ? 'Y' : 'N',
@@ -1042,7 +998,66 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
/* do we create a touch capture device */
dev->has_touch_cap = node_type & 0x80000;

- /* end detecting feature set */
+ return 0;
+}
+
+static int vivid_create_instance(struct platform_device *pdev, int inst)
+{
+ static const struct v4l2_dv_timings def_dv_timings =
+ V4L2_DV_BT_CEA_1280X720P60;
+ unsigned in_type_counter[4] = { 0, 0, 0, 0 };
+ unsigned out_type_counter[4] = { 0, 0, 0, 0 };
+ int ccs_cap = ccs_cap_mode[inst];
+ int ccs_out = ccs_out_mode[inst];
+ bool has_tuner;
+ bool has_modulator;
+ struct vivid_dev *dev;
+ struct video_device *vfd;
+ unsigned node_type = node_types[inst];
+ v4l2_std_id tvnorms_cap = 0, tvnorms_out = 0;
+ int ret;
+ int i;
+#ifdef CONFIG_VIDEO_VIVID_CEC
+ unsigned int cec_tx_bus_cnt = 0;
+#endif
+
+ /* allocate main vivid state structure */
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ if (!dev)
+ return -ENOMEM;
+
+ dev->inst = inst;
+
+#ifdef CONFIG_MEDIA_CONTROLLER
+ dev->v4l2_dev.mdev = &dev->mdev;
+
+ /* Initialize media device */
+ strscpy(dev->mdev.model, VIVID_MODULE_NAME, sizeof(dev->mdev.model));
+ snprintf(dev->mdev.bus_info, sizeof(dev->mdev.bus_info),
+ "platform:%s-%03d", VIVID_MODULE_NAME, inst);
+ dev->mdev.dev = &pdev->dev;
+ media_device_init(&dev->mdev);
+ dev->mdev.ops = &vivid_media_ops;
+#endif
+
+ /* register v4l2_device */
+ snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name),
+ "%s-%03d", VIVID_MODULE_NAME, inst);
+ ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
+ if (ret) {
+ kfree(dev);
+ return ret;
+ }
+ dev->v4l2_dev.release = vivid_dev_release;
+
+ ret = vivid_detect_feature_set(dev, inst, node_type,
+ &has_tuner, &has_modulator,
+ &ccs_cap, &ccs_out,
+ in_type_counter, out_type_counter);
+ if (ret) {
+ kfree(dev);
+ return ret;
+ }

if (dev->has_vid_cap) {
/* set up the capabilities of the video capture device */
--
2.26.2

2020-09-02 16:20:39

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 20/38] media: saa7134-alsa.c: number of pages should be unsigned long

As reported by smatch:

drivers/media/pci/saa7134/saa7134-alsa.c:267 saa7134_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type?

the number of patches should be unsigned long.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/pci/saa7134/saa7134-alsa.c | 7 ++++---
drivers/media/pci/saa7134/saa7134.h | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c
index 544ca57eee75..347ecb0bab2f 100644
--- a/drivers/media/pci/saa7134/saa7134-alsa.c
+++ b/drivers/media/pci/saa7134/saa7134-alsa.c
@@ -252,7 +252,8 @@ static int snd_card_saa7134_capture_trigger(struct snd_pcm_substream * substream
return err;
}

-static int saa7134_alsa_dma_init(struct saa7134_dev *dev, int nr_pages)
+static int saa7134_alsa_dma_init(struct saa7134_dev *dev,
+ unsigned long nr_pages)
{
struct saa7134_dmasound *dma = &dev->dmasound;
struct page *pg;
@@ -260,11 +261,11 @@ static int saa7134_alsa_dma_init(struct saa7134_dev *dev, int nr_pages)

dma->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT);
if (NULL == dma->vaddr) {
- pr_debug("vmalloc_32(%d pages) failed\n", nr_pages);
+ pr_debug("vmalloc_32(%lu pages) failed\n", nr_pages);
return -ENOMEM;
}

- pr_debug("vmalloc is at addr %p, size=%d\n",
+ pr_debug("vmalloc is at addr %p, size=%lu\n",
dma->vaddr, nr_pages << PAGE_SHIFT);

memset(dma->vaddr, 0, nr_pages << PAGE_SHIFT);
diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h
index 77c325e64a97..d29499cd7370 100644
--- a/drivers/media/pci/saa7134/saa7134.h
+++ b/drivers/media/pci/saa7134/saa7134.h
@@ -509,7 +509,7 @@ struct saa7134_dmasound {
void *vaddr;
struct scatterlist *sglist;
int sglen;
- int nr_pages;
+ unsigned long nr_pages;
unsigned int dma_blk;
unsigned int read_offset;
unsigned int read_count;
--
2.26.2

2020-09-02 16:20:55

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 04/38] media: av7110_v4l: avoid a typecast

While smatch reports an issue there:

drivers/media/pci/ttpci/av7110_v4l.c:163 ves1820_set_tv_freq() warn: unsigned 'freq' is never less than zero.
drivers/media/pci/ttpci/av7110_v4l.c:165 ves1820_set_tv_freq() warn: unsigned 'freq' is never less than zero.

The logic is actually fine. Yet, removing the typecast
shuts up smatch and makes the code more readable.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/pci/ttpci/av7110_v4l.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/ttpci/av7110_v4l.c b/drivers/media/pci/ttpci/av7110_v4l.c
index cabe006658dd..6d9c908be713 100644
--- a/drivers/media/pci/ttpci/av7110_v4l.c
+++ b/drivers/media/pci/ttpci/av7110_v4l.c
@@ -160,9 +160,9 @@ static int ves1820_set_tv_freq(struct saa7146_dev *dev, u32 freq)
buf[1] = div & 0xff;
buf[2] = 0x8e;

- if (freq < (u32) (16 * 168.25))
+ if (freq < 16U * 168.25)
config = 0xa0;
- else if (freq < (u32) (16 * 447.25))
+ else if (freq < 16U * 447.25)
config = 0x90;
else
config = 0x30;
--
2.26.2

2020-09-02 16:21:43

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 15/38] media: vivid: fix error path

If something fails after calling v4l2_device_register(),
it should call v4l2_device_put().

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/test-drivers/vivid/vivid-core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
index 54df7e0c13fc..48809991f037 100644
--- a/drivers/media/test-drivers/vivid/vivid-core.c
+++ b/drivers/media/test-drivers/vivid/vivid-core.c
@@ -1698,10 +1698,8 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
&has_tuner, &has_modulator,
&ccs_cap, &ccs_out,
in_type_counter, out_type_counter);
- if (ret) {
- kfree(dev);
- return ret;
- }
+ if (ret)
+ goto free_dev;

vivid_set_capabilities(dev);

--
2.26.2

2020-09-02 16:22:02

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 07/38] media: tda10021: avoid casts when using symbol_rate

The usage of castings and float point when checking for
the setup based at the symbol_rate cause those warnings
with smatch:

drivers/media/dvb-frontends/tda10021.c:153 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.
drivers/media/dvb-frontends/tda10021.c:155 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.
drivers/media/dvb-frontends/tda10021.c:157 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.
drivers/media/dvb-frontends/tda10021.c:159 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.

While the code should work with gcc, as it will evaluate the
values into a constant before compiling, other compilers
could do otherwise. So, get rid of float pointing math on it,
avoiding the need of doing typecasts.

While here, cleanup some coding style issues at the related
code.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/dvb-frontends/tda10021.c | 38 ++++++++++++++++----------
1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/media/dvb-frontends/tda10021.c b/drivers/media/dvb-frontends/tda10021.c
index 9fb207b41576..faa6e54b3372 100644
--- a/drivers/media/dvb-frontends/tda10021.c
+++ b/drivers/media/dvb-frontends/tda10021.c
@@ -137,26 +137,36 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate
{
s32 BDR;
s32 BDRI;
- s16 SFIL=0;
+ s16 SFIL = 0;
u16 NDEC = 0;
u32 tmp, ratio;

- if (symbolrate > XIN/2)
- symbolrate = XIN/2;
- if (symbolrate < 500000)
+ if (symbolrate > XIN / 2)
+ symbolrate = XIN / 2;
+ else if (symbolrate < 500000)
symbolrate = 500000;

- if (symbolrate < XIN/16) NDEC = 1;
- if (symbolrate < XIN/32) NDEC = 2;
- if (symbolrate < XIN/64) NDEC = 3;
+ if (symbolrate < XIN / 16)
+ NDEC = 1;
+ if (symbolrate < XIN / 32)
+ NDEC = 2;
+ if (symbolrate < XIN / 64)
+ NDEC = 3;

- if (symbolrate < (u32)(XIN/12.3)) SFIL = 1;
- if (symbolrate < (u32)(XIN/16)) SFIL = 0;
- if (symbolrate < (u32)(XIN/24.6)) SFIL = 1;
- if (symbolrate < (u32)(XIN/32)) SFIL = 0;
- if (symbolrate < (u32)(XIN/49.2)) SFIL = 1;
- if (symbolrate < (u32)(XIN/64)) SFIL = 0;
- if (symbolrate < (u32)(XIN/98.4)) SFIL = 1;
+ if (symbolrate < XIN * 10 / 123)
+ SFIL = 1;
+ if (symbolrate < XIN * 10 / 160)
+ SFIL = 0;
+ if (symbolrate < XIN * 10 / 246)
+ SFIL = 1;
+ if (symbolrate < XIN * 10 / 320)
+ SFIL = 0;
+ if (symbolrate < XIN * 10 / 492)
+ SFIL = 1;
+ if (symbolrate < XIN * 10 / 640)
+ SFIL = 0;
+ if (symbolrate < XIN * 10 / 984)
+ SFIL = 1;

symbolrate <<= NDEC;
ratio = (symbolrate << 4) / FIN;
--
2.26.2

2020-09-02 16:22:36

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 11/38] media: vivid: move set_capabilities logic to a separate function

Move such logic from vivid_create_instance(), as otherwise
smatch takes forever.

The vivid_create_instance() is still a too big for my taste.
So, further cleanups are still needed.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/test-drivers/vivid/vivid-core.c | 161 +++++++++---------
1 file changed, 83 insertions(+), 78 deletions(-)

diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
index f8cb4133e1ce..e3ffc2566623 100644
--- a/drivers/media/test-drivers/vivid/vivid-core.c
+++ b/drivers/media/test-drivers/vivid/vivid-core.c
@@ -1001,6 +1001,88 @@ static int vivid_detect_feature_set(struct vivid_dev *dev, int inst,
return 0;
}

+static void vivid_set_capabilities(struct vivid_dev *dev)
+{
+ if (dev->has_vid_cap) {
+ /* set up the capabilities of the video capture device */
+ dev->vid_cap_caps = dev->multiplanar ?
+ V4L2_CAP_VIDEO_CAPTURE_MPLANE :
+ V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY;
+ dev->vid_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+ if (dev->has_audio_inputs)
+ dev->vid_cap_caps |= V4L2_CAP_AUDIO;
+ if (dev->has_tv_tuner)
+ dev->vid_cap_caps |= V4L2_CAP_TUNER;
+ }
+ if (dev->has_vid_out) {
+ /* set up the capabilities of the video output device */
+ dev->vid_out_caps = dev->multiplanar ?
+ V4L2_CAP_VIDEO_OUTPUT_MPLANE :
+ V4L2_CAP_VIDEO_OUTPUT;
+ if (dev->has_fb)
+ dev->vid_out_caps |= V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
+ dev->vid_out_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+ if (dev->has_audio_outputs)
+ dev->vid_out_caps |= V4L2_CAP_AUDIO;
+ }
+ if (dev->has_vbi_cap) {
+ /* set up the capabilities of the vbi capture device */
+ dev->vbi_cap_caps = (dev->has_raw_vbi_cap ? V4L2_CAP_VBI_CAPTURE : 0) |
+ (dev->has_sliced_vbi_cap ? V4L2_CAP_SLICED_VBI_CAPTURE : 0);
+ dev->vbi_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+ if (dev->has_audio_inputs)
+ dev->vbi_cap_caps |= V4L2_CAP_AUDIO;
+ if (dev->has_tv_tuner)
+ dev->vbi_cap_caps |= V4L2_CAP_TUNER;
+ }
+ if (dev->has_vbi_out) {
+ /* set up the capabilities of the vbi output device */
+ dev->vbi_out_caps = (dev->has_raw_vbi_out ? V4L2_CAP_VBI_OUTPUT : 0) |
+ (dev->has_sliced_vbi_out ? V4L2_CAP_SLICED_VBI_OUTPUT : 0);
+ dev->vbi_out_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+ if (dev->has_audio_outputs)
+ dev->vbi_out_caps |= V4L2_CAP_AUDIO;
+ }
+ if (dev->has_sdr_cap) {
+ /* set up the capabilities of the sdr capture device */
+ dev->sdr_cap_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_TUNER;
+ dev->sdr_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+ }
+ /* set up the capabilities of the radio receiver device */
+ if (dev->has_radio_rx)
+ dev->radio_rx_caps = V4L2_CAP_RADIO | V4L2_CAP_RDS_CAPTURE |
+ V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_TUNER |
+ V4L2_CAP_READWRITE;
+ /* set up the capabilities of the radio transmitter device */
+ if (dev->has_radio_tx)
+ dev->radio_tx_caps = V4L2_CAP_RDS_OUTPUT | V4L2_CAP_MODULATOR |
+ V4L2_CAP_READWRITE;
+
+ /* set up the capabilities of meta capture device */
+ if (dev->has_meta_cap) {
+ dev->meta_cap_caps = V4L2_CAP_META_CAPTURE |
+ V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+ if (dev->has_audio_inputs)
+ dev->meta_cap_caps |= V4L2_CAP_AUDIO;
+ if (dev->has_tv_tuner)
+ dev->meta_cap_caps |= V4L2_CAP_TUNER;
+ }
+ /* set up the capabilities of meta output device */
+ if (dev->has_meta_out) {
+ dev->meta_out_caps = V4L2_CAP_META_OUTPUT |
+ V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+ if (dev->has_audio_outputs)
+ dev->meta_out_caps |= V4L2_CAP_AUDIO;
+ }
+ /* set up the capabilities of the touch capture device */
+ if (dev->has_touch_cap) {
+ dev->touch_cap_caps = V4L2_CAP_TOUCH | V4L2_CAP_STREAMING |
+ V4L2_CAP_READWRITE;
+ dev->touch_cap_caps |= dev->multiplanar ?
+ V4L2_CAP_VIDEO_CAPTURE_MPLANE : V4L2_CAP_VIDEO_CAPTURE;
+ }
+}
+
static void vivid_disable_unused_ioctls(struct vivid_dev *dev,
bool has_tuner,
bool has_modulator,
@@ -1153,84 +1235,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
return ret;
}

- if (dev->has_vid_cap) {
- /* set up the capabilities of the video capture device */
- dev->vid_cap_caps = dev->multiplanar ?
- V4L2_CAP_VIDEO_CAPTURE_MPLANE :
- V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY;
- dev->vid_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
- if (dev->has_audio_inputs)
- dev->vid_cap_caps |= V4L2_CAP_AUDIO;
- if (dev->has_tv_tuner)
- dev->vid_cap_caps |= V4L2_CAP_TUNER;
- }
- if (dev->has_vid_out) {
- /* set up the capabilities of the video output device */
- dev->vid_out_caps = dev->multiplanar ?
- V4L2_CAP_VIDEO_OUTPUT_MPLANE :
- V4L2_CAP_VIDEO_OUTPUT;
- if (dev->has_fb)
- dev->vid_out_caps |= V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
- dev->vid_out_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
- if (dev->has_audio_outputs)
- dev->vid_out_caps |= V4L2_CAP_AUDIO;
- }
- if (dev->has_vbi_cap) {
- /* set up the capabilities of the vbi capture device */
- dev->vbi_cap_caps = (dev->has_raw_vbi_cap ? V4L2_CAP_VBI_CAPTURE : 0) |
- (dev->has_sliced_vbi_cap ? V4L2_CAP_SLICED_VBI_CAPTURE : 0);
- dev->vbi_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
- if (dev->has_audio_inputs)
- dev->vbi_cap_caps |= V4L2_CAP_AUDIO;
- if (dev->has_tv_tuner)
- dev->vbi_cap_caps |= V4L2_CAP_TUNER;
- }
- if (dev->has_vbi_out) {
- /* set up the capabilities of the vbi output device */
- dev->vbi_out_caps = (dev->has_raw_vbi_out ? V4L2_CAP_VBI_OUTPUT : 0) |
- (dev->has_sliced_vbi_out ? V4L2_CAP_SLICED_VBI_OUTPUT : 0);
- dev->vbi_out_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
- if (dev->has_audio_outputs)
- dev->vbi_out_caps |= V4L2_CAP_AUDIO;
- }
- if (dev->has_sdr_cap) {
- /* set up the capabilities of the sdr capture device */
- dev->sdr_cap_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_TUNER;
- dev->sdr_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
- }
- /* set up the capabilities of the radio receiver device */
- if (dev->has_radio_rx)
- dev->radio_rx_caps = V4L2_CAP_RADIO | V4L2_CAP_RDS_CAPTURE |
- V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_TUNER |
- V4L2_CAP_READWRITE;
- /* set up the capabilities of the radio transmitter device */
- if (dev->has_radio_tx)
- dev->radio_tx_caps = V4L2_CAP_RDS_OUTPUT | V4L2_CAP_MODULATOR |
- V4L2_CAP_READWRITE;
-
- /* set up the capabilities of meta capture device */
- if (dev->has_meta_cap) {
- dev->meta_cap_caps = V4L2_CAP_META_CAPTURE |
- V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
- if (dev->has_audio_inputs)
- dev->meta_cap_caps |= V4L2_CAP_AUDIO;
- if (dev->has_tv_tuner)
- dev->meta_cap_caps |= V4L2_CAP_TUNER;
- }
- /* set up the capabilities of meta output device */
- if (dev->has_meta_out) {
- dev->meta_out_caps = V4L2_CAP_META_OUTPUT |
- V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
- if (dev->has_audio_outputs)
- dev->meta_out_caps |= V4L2_CAP_AUDIO;
- }
- /* set up the capabilities of the touch capture device */
- if (dev->has_touch_cap) {
- dev->touch_cap_caps = V4L2_CAP_TOUCH | V4L2_CAP_STREAMING |
- V4L2_CAP_READWRITE;
- dev->touch_cap_caps |= dev->multiplanar ?
- V4L2_CAP_VIDEO_CAPTURE_MPLANE : V4L2_CAP_VIDEO_CAPTURE;
- }
+ vivid_set_capabilities(dev);

ret = -ENOMEM;
/* initialize the test pattern generator */
--
2.26.2

2020-09-02 16:22:43

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 01/38] media: tda10086: cleanup symbol_rate setting logic

The original logic had an integer to unsigned integer
conversion, plus a float-point math. While gcc should be
able to do the match at compile time, other compilers might
not do the same. Also, those produce the following warnings
with static code analyzers:

drivers/media/dvb-frontends/tda10086.c:300 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
drivers/media/dvb-frontends/tda10086.c:303 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
drivers/media/dvb-frontends/tda10086.c:306 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
drivers/media/dvb-frontends/tda10086.c:309 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
drivers/media/dvb-frontends/tda10086.c:312 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
drivers/media/dvb-frontends/tda10086.c:315 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
drivers/media/dvb-frontends/tda10086.c:318 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
drivers/media/dvb-frontends/tda10086.c:321 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
drivers/media/dvb-frontends/tda10086.c:324 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
drivers/media/dvb-frontends/tda10086.c:327 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.

Change the logic to declare the reference constant as unsigned
and to not use float point math.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/dvb-frontends/tda10086.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/media/dvb-frontends/tda10086.c b/drivers/media/dvb-frontends/tda10086.c
index be6b40138f6e..cdcf97664bba 100644
--- a/drivers/media/dvb-frontends/tda10086.c
+++ b/drivers/media/dvb-frontends/tda10086.c
@@ -17,7 +17,7 @@
#include <media/dvb_frontend.h>
#include "tda10086.h"

-#define SACLK 96000000
+#define SACLK 96000000U

struct tda10086_state {
struct i2c_adapter* i2c;
@@ -297,34 +297,34 @@ static int tda10086_set_symbol_rate(struct tda10086_state *state,
dprintk ("%s %i\n", __func__, symbol_rate);

/* setup the decimation and anti-aliasing filters.. */
- if (symbol_rate < (u32) (SACLK * 0.0137)) {
+ if (symbol_rate < SACLK / 10000 * 137) {
dfn=4;
afs=1;
- } else if (symbol_rate < (u32) (SACLK * 0.0208)) {
+ } else if (symbol_rate < SACLK / 10000 * 208) {
dfn=4;
afs=0;
- } else if (symbol_rate < (u32) (SACLK * 0.0270)) {
+ } else if (symbol_rate < SACLK / 10000 * 270) {
dfn=3;
afs=1;
- } else if (symbol_rate < (u32) (SACLK * 0.0416)) {
+ } else if (symbol_rate < SACLK / 10000 * 416) {
dfn=3;
afs=0;
- } else if (symbol_rate < (u32) (SACLK * 0.0550)) {
+ } else if (symbol_rate < SACLK / 10000 * 550) {
dfn=2;
afs=1;
- } else if (symbol_rate < (u32) (SACLK * 0.0833)) {
+ } else if (symbol_rate < SACLK / 10000 * 833) {
dfn=2;
afs=0;
- } else if (symbol_rate < (u32) (SACLK * 0.1100)) {
+ } else if (symbol_rate < SACLK / 10000 * 1100) {
dfn=1;
afs=1;
- } else if (symbol_rate < (u32) (SACLK * 0.1666)) {
+ } else if (symbol_rate < SACLK / 10000 * 1666) {
dfn=1;
afs=0;
- } else if (symbol_rate < (u32) (SACLK * 0.2200)) {
+ } else if (symbol_rate < SACLK / 10000 * 2200) {
dfn=0;
afs=1;
- } else if (symbol_rate < (u32) (SACLK * 0.3333)) {
+ } else if (symbol_rate < SACLK / 10000 * 3333) {
dfn=0;
afs=0;
} else {
--
2.26.2

2020-09-02 16:23:18

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 13/38] media: vivid: move the create queues to a separate function

Instead of placing everything inside vivid_create_instance(),
we can move the part which creates per-type video queues
into a separate function.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/test-drivers/vivid/vivid-core.c | 175 +++++++++---------
1 file changed, 92 insertions(+), 83 deletions(-)

diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
index 3340b61e68c0..69cc8456a323 100644
--- a/drivers/media/test-drivers/vivid/vivid-core.c
+++ b/drivers/media/test-drivers/vivid/vivid-core.c
@@ -1218,6 +1218,93 @@ static int vivid_init_dv_timings(struct vivid_dev *dev)
return 0;
}

+static int vivid_create_queues(struct vivid_dev *dev)
+{
+ int ret;
+
+ /* start creating the vb2 queues */
+ if (dev->has_vid_cap) {
+ /* initialize vid_cap queue */
+ ret = vivid_create_queue(dev, &dev->vb_vid_cap_q,
+ V4L2_BUF_TYPE_VIDEO_CAPTURE, 2,
+ &vivid_vid_cap_qops);
+ if (ret)
+ return ret;
+ }
+
+ if (dev->has_vid_out) {
+ /* initialize vid_out queue */
+ ret = vivid_create_queue(dev, &dev->vb_vid_out_q,
+ V4L2_BUF_TYPE_VIDEO_OUTPUT, 2,
+ &vivid_vid_out_qops);
+ if (ret)
+ return ret;
+ }
+
+ if (dev->has_vbi_cap) {
+ /* initialize vbi_cap queue */
+ ret = vivid_create_queue(dev, &dev->vb_vbi_cap_q,
+ V4L2_BUF_TYPE_VBI_CAPTURE, 2,
+ &vivid_vbi_cap_qops);
+ if (ret)
+ return ret;
+ }
+
+ if (dev->has_vbi_out) {
+ /* initialize vbi_out queue */
+ ret = vivid_create_queue(dev, &dev->vb_vbi_out_q,
+ V4L2_BUF_TYPE_VBI_OUTPUT, 2,
+ &vivid_vbi_out_qops);
+ if (ret)
+ return ret;
+ }
+
+ if (dev->has_sdr_cap) {
+ /* initialize sdr_cap queue */
+ ret = vivid_create_queue(dev, &dev->vb_sdr_cap_q,
+ V4L2_BUF_TYPE_SDR_CAPTURE, 8,
+ &vivid_sdr_cap_qops);
+ if (ret)
+ return ret;
+ }
+
+ if (dev->has_meta_cap) {
+ /* initialize meta_cap queue */
+ ret = vivid_create_queue(dev, &dev->vb_meta_cap_q,
+ V4L2_BUF_TYPE_META_CAPTURE, 2,
+ &vivid_meta_cap_qops);
+ if (ret)
+ return ret;
+ }
+
+ if (dev->has_meta_out) {
+ /* initialize meta_out queue */
+ ret = vivid_create_queue(dev, &dev->vb_meta_out_q,
+ V4L2_BUF_TYPE_META_OUTPUT, 1,
+ &vivid_meta_out_qops);
+ if (ret)
+ return ret;
+ }
+
+ if (dev->has_touch_cap) {
+ /* initialize touch_cap queue */
+ ret = vivid_create_queue(dev, &dev->vb_touch_cap_q,
+ V4L2_BUF_TYPE_VIDEO_CAPTURE, 1,
+ &vivid_touch_cap_qops);
+ if (ret)
+ return ret;
+ }
+
+ if (dev->has_fb) {
+ /* Create framebuffer for testing capture/output overlay */
+ ret = vivid_fb_init(dev);
+ if (ret)
+ return ret;
+ v4l2_info(&dev->v4l2_dev, "Framebuffer device registered as fb%d\n",
+ dev->fb_info.node);
+ }
+ return 0;
+}

static int vivid_create_instance(struct platform_device *pdev, int inst)
{
@@ -1399,8 +1486,8 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
* Same as create_singlethread_workqueue, but now I can use the
* string formatting of alloc_ordered_workqueue.
*/
- dev->cec_workqueue =
- alloc_ordered_workqueue("vivid-%03d-cec", WQ_MEM_RECLAIM, inst);
+ dev->cec_workqueue = alloc_ordered_workqueue("vivid-%03d-cec",
+ WQ_MEM_RECLAIM, inst);
if (!dev->cec_workqueue) {
ret = -ENOMEM;
goto unreg_dev;
@@ -1409,87 +1496,9 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
if (allocators[inst] == 1)
dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));

- /* start creating the vb2 queues */
- if (dev->has_vid_cap) {
- /* initialize vid_cap queue */
- ret = vivid_create_queue(dev, &dev->vb_vid_cap_q,
- V4L2_BUF_TYPE_VIDEO_CAPTURE, 2,
- &vivid_vid_cap_qops);
- if (ret)
- goto unreg_dev;
- }
-
- if (dev->has_vid_out) {
- /* initialize vid_out queue */
- ret = vivid_create_queue(dev, &dev->vb_vid_out_q,
- V4L2_BUF_TYPE_VIDEO_OUTPUT, 2,
- &vivid_vid_out_qops);
- if (ret)
- goto unreg_dev;
- }
-
- if (dev->has_vbi_cap) {
- /* initialize vbi_cap queue */
- ret = vivid_create_queue(dev, &dev->vb_vbi_cap_q,
- V4L2_BUF_TYPE_VBI_CAPTURE, 2,
- &vivid_vbi_cap_qops);
- if (ret)
- goto unreg_dev;
- }
-
- if (dev->has_vbi_out) {
- /* initialize vbi_out queue */
- ret = vivid_create_queue(dev, &dev->vb_vbi_out_q,
- V4L2_BUF_TYPE_VBI_OUTPUT, 2,
- &vivid_vbi_out_qops);
- if (ret)
- goto unreg_dev;
- }
-
- if (dev->has_sdr_cap) {
- /* initialize sdr_cap queue */
- ret = vivid_create_queue(dev, &dev->vb_sdr_cap_q,
- V4L2_BUF_TYPE_SDR_CAPTURE, 8,
- &vivid_sdr_cap_qops);
- if (ret)
- goto unreg_dev;
- }
-
- if (dev->has_meta_cap) {
- /* initialize meta_cap queue */
- ret = vivid_create_queue(dev, &dev->vb_meta_cap_q,
- V4L2_BUF_TYPE_META_CAPTURE, 2,
- &vivid_meta_cap_qops);
- if (ret)
- goto unreg_dev;
- }
-
- if (dev->has_meta_out) {
- /* initialize meta_out queue */
- ret = vivid_create_queue(dev, &dev->vb_meta_out_q,
- V4L2_BUF_TYPE_META_OUTPUT, 1,
- &vivid_meta_out_qops);
- if (ret)
- goto unreg_dev;
- }
-
- if (dev->has_touch_cap) {
- /* initialize touch_cap queue */
- ret = vivid_create_queue(dev, &dev->vb_touch_cap_q,
- V4L2_BUF_TYPE_VIDEO_CAPTURE, 1,
- &vivid_touch_cap_qops);
- if (ret)
- goto unreg_dev;
- }
-
- if (dev->has_fb) {
- /* Create framebuffer for testing capture/output overlay */
- ret = vivid_fb_init(dev);
- if (ret)
- goto unreg_dev;
- v4l2_info(&dev->v4l2_dev, "Framebuffer device registered as fb%d\n",
- dev->fb_info.node);
- }
+ ret = vivid_create_queues(dev);
+ if (ret)
+ goto unreg_dev;

#ifdef CONFIG_VIDEO_VIVID_CEC
if (dev->has_vid_cap && in_type_counter[HDMI]) {
--
2.26.2

2020-09-02 16:23:22

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 02/38] media: v4l2-ioctl: avoid memory leaks on some time32 compat functions

There are some reports about possible memory leaks:

drivers/media/v4l2-core//v4l2-ioctl.c:3203 video_put_user() warn: check that 'ev32' doesn't leak information (struct has a hole after 'type')
drivers/media/v4l2-core//v4l2-ioctl.c:3230 video_put_user() warn: check that 'vb32' doesn't leak information (struct has a hole after 'memory')

While smatch seems to be reporting a false positive (line 3203),
there's indeed a possible leak with reserved2 at vb32.

We might have fixed just that one, but smatch checks won't
be able to check leaks at ev32. So, re-work the code in a way
that will ensure that the var contents will be zeroed before
filling it.

With that, we don't need anymore to touch reserved fields.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/v4l2-core/v4l2-ioctl.c | 48 ++++++++++++++--------------
1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index a556880f225a..6f3fe9c4b64a 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -3189,17 +3189,16 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd)
#ifdef CONFIG_COMPAT_32BIT_TIME
case VIDIOC_DQEVENT_TIME32: {
struct v4l2_event *ev = parg;
- struct v4l2_event_time32 ev32 = {
- .type = ev->type,
- .pending = ev->pending,
- .sequence = ev->sequence,
- .timestamp.tv_sec = ev->timestamp.tv_sec,
- .timestamp.tv_nsec = ev->timestamp.tv_nsec,
- .id = ev->id,
- };
+ struct v4l2_event_time32 ev32;

+ memset(&ev32, 0, sizeof(ev32));
+ ev32.type = ev->type,
+ ev32.pending = ev->pending,
+ ev32.sequence = ev->sequence,
+ ev32.timestamp.tv_sec = ev->timestamp.tv_sec,
+ ev32.timestamp.tv_nsec = ev->timestamp.tv_nsec,
+ ev32.id = ev->id,
memcpy(&ev32.u, &ev->u, sizeof(ev->u));
- memcpy(&ev32.reserved, &ev->reserved, sizeof(ev->reserved));

if (copy_to_user(arg, &ev32, sizeof(ev32)))
return -EFAULT;
@@ -3210,21 +3209,22 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd)
case VIDIOC_DQBUF_TIME32:
case VIDIOC_PREPARE_BUF_TIME32: {
struct v4l2_buffer *vb = parg;
- struct v4l2_buffer_time32 vb32 = {
- .index = vb->index,
- .type = vb->type,
- .bytesused = vb->bytesused,
- .flags = vb->flags,
- .field = vb->field,
- .timestamp.tv_sec = vb->timestamp.tv_sec,
- .timestamp.tv_usec = vb->timestamp.tv_usec,
- .timecode = vb->timecode,
- .sequence = vb->sequence,
- .memory = vb->memory,
- .m.userptr = vb->m.userptr,
- .length = vb->length,
- .request_fd = vb->request_fd,
- };
+ struct v4l2_buffer_time32 vb32;
+
+ memset(&vb32, 0, sizeof(vb32));
+ vb32.index = vb->index,
+ vb32.type = vb->type,
+ vb32.bytesused = vb->bytesused,
+ vb32.flags = vb->flags,
+ vb32.field = vb->field,
+ vb32.timestamp.tv_sec = vb->timestamp.tv_sec,
+ vb32.timestamp.tv_usec = vb->timestamp.tv_usec,
+ vb32.timecode = vb->timecode,
+ vb32.sequence = vb->sequence,
+ vb32.memory = vb->memory,
+ vb32.length = vb->length,
+ vb32.request_fd = vb->request_fd,
+ memcpy(&vb32.m, &vb->m, sizeof(vb->m));

if (copy_to_user(arg, &vb32, sizeof(vb32)))
return -EFAULT;
--
2.26.2

2020-09-02 16:28:14

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH 02/38] media: v4l2-ioctl: avoid memory leaks on some time32 compat functions

Hi Mauro,

Thank you for the patch.

On Wed, Sep 02, 2020 at 06:10:05PM +0200, Mauro Carvalho Chehab wrote:
> There are some reports about possible memory leaks:
>
> drivers/media/v4l2-core//v4l2-ioctl.c:3203 video_put_user() warn: check that 'ev32' doesn't leak information (struct has a hole after 'type')
> drivers/media/v4l2-core//v4l2-ioctl.c:3230 video_put_user() warn: check that 'vb32' doesn't leak information (struct has a hole after 'memory')
>
> While smatch seems to be reporting a false positive (line 3203),
> there's indeed a possible leak with reserved2 at vb32.
>
> We might have fixed just that one, but smatch checks won't
> be able to check leaks at ev32. So, re-work the code in a way
> that will ensure that the var contents will be zeroed before
> filling it.
>
> With that, we don't need anymore to touch reserved fields.
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
> ---
> drivers/media/v4l2-core/v4l2-ioctl.c | 48 ++++++++++++++--------------
> 1 file changed, 24 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index a556880f225a..6f3fe9c4b64a 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -3189,17 +3189,16 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd)
> #ifdef CONFIG_COMPAT_32BIT_TIME
> case VIDIOC_DQEVENT_TIME32: {
> struct v4l2_event *ev = parg;
> - struct v4l2_event_time32 ev32 = {
> - .type = ev->type,
> - .pending = ev->pending,
> - .sequence = ev->sequence,
> - .timestamp.tv_sec = ev->timestamp.tv_sec,
> - .timestamp.tv_nsec = ev->timestamp.tv_nsec,
> - .id = ev->id,
> - };
> + struct v4l2_event_time32 ev32;
>
> + memset(&ev32, 0, sizeof(ev32));
> + ev32.type = ev->type,

The lines should end with ';', not ','.

With this fixed,

Reviewed-by: Laurent Pinchart <[email protected]>

> + ev32.pending = ev->pending,
> + ev32.sequence = ev->sequence,
> + ev32.timestamp.tv_sec = ev->timestamp.tv_sec,
> + ev32.timestamp.tv_nsec = ev->timestamp.tv_nsec,
> + ev32.id = ev->id,
> memcpy(&ev32.u, &ev->u, sizeof(ev->u));
> - memcpy(&ev32.reserved, &ev->reserved, sizeof(ev->reserved));
>
> if (copy_to_user(arg, &ev32, sizeof(ev32)))
> return -EFAULT;
> @@ -3210,21 +3209,22 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd)
> case VIDIOC_DQBUF_TIME32:
> case VIDIOC_PREPARE_BUF_TIME32: {
> struct v4l2_buffer *vb = parg;
> - struct v4l2_buffer_time32 vb32 = {
> - .index = vb->index,
> - .type = vb->type,
> - .bytesused = vb->bytesused,
> - .flags = vb->flags,
> - .field = vb->field,
> - .timestamp.tv_sec = vb->timestamp.tv_sec,
> - .timestamp.tv_usec = vb->timestamp.tv_usec,
> - .timecode = vb->timecode,
> - .sequence = vb->sequence,
> - .memory = vb->memory,
> - .m.userptr = vb->m.userptr,
> - .length = vb->length,
> - .request_fd = vb->request_fd,
> - };
> + struct v4l2_buffer_time32 vb32;
> +
> + memset(&vb32, 0, sizeof(vb32));
> + vb32.index = vb->index,
> + vb32.type = vb->type,
> + vb32.bytesused = vb->bytesused,
> + vb32.flags = vb->flags,
> + vb32.field = vb->field,
> + vb32.timestamp.tv_sec = vb->timestamp.tv_sec,
> + vb32.timestamp.tv_usec = vb->timestamp.tv_usec,
> + vb32.timecode = vb->timecode,
> + vb32.sequence = vb->sequence,
> + vb32.memory = vb->memory,
> + vb32.length = vb->length,
> + vb32.request_fd = vb->request_fd,
> + memcpy(&vb32.m, &vb->m, sizeof(vb->m));
>
> if (copy_to_user(arg, &vb32, sizeof(vb32)))
> return -EFAULT;

--
Regards,

Laurent Pinchart

2020-09-02 17:38:00

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 38/38] media: atomisp: cleanup isys_irq headers

Don't need to declare those functions with extern:
drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h:51:35: warning: function 'isys_irqc_state_dump' with external linkage has definition
drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h:68:35: warning: function 'isys_irqc_reg_store' with external linkage has definition
drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h:85:39: warning: function 'isys_irqc_reg_load' with external linkage has definition
drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c:31:35: warning: function 'isys_irqc_status_enable' with external linkage has definition

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
.../pci/css_2401_system/host/isys_irq.c | 3 +--
.../css_2401_system/host/isys_irq_private.h | 8 +++---
.../host/isys_irq_public.h | 25 ++++++++-----------
.../pci/hive_isp_css_include/isys_irq.h | 12 ---------
4 files changed, 15 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c
index 99576af4713c..b6135c4b6eea 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c
@@ -28,8 +28,7 @@
#endif

/* Public interface */
-STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_status_enable(
- const isys_irq_ID_t isys_irqc_id)
+void isys_irqc_status_enable(const isys_irq_ID_t isys_irqc_id)
{
assert(isys_irqc_id < N_ISYS_IRQ_ID);

diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h
index 1e96f0267ac0..fb168c25bdfc 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h
@@ -29,7 +29,7 @@
* @brief Get the isys irq status.
* Refer to "isys_irq.h" for details.
*/
-STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_get(
+void isys_irqc_state_get(
const isys_irq_ID_t isys_irqc_id,
isys_irqc_state_t *state)
{
@@ -48,7 +48,7 @@ STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_get(
* @brief Dump the isys irq status.
* Refer to "isys_irq.h" for details.
*/
-STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_dump(
+void isys_irqc_state_dump(
const isys_irq_ID_t isys_irqc_id,
const isys_irqc_state_t *state)
{
@@ -65,7 +65,7 @@ STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_dump(
+ -------------------------------------------------------*/

/* Support functions */
-STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_reg_store(
+void isys_irqc_reg_store(
const isys_irq_ID_t isys_irqc_id,
const unsigned int reg_idx,
const hrt_data value)
@@ -82,7 +82,7 @@ STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_reg_store(
ia_css_device_store_uint32(reg_addr, value);
}

-STORAGE_CLASS_ISYS2401_IRQ_C hrt_data isys_irqc_reg_load(
+hrt_data isys_irqc_reg_load(
const isys_irq_ID_t isys_irqc_id,
const unsigned int reg_idx)
{
diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h
index cd738f4b65a0..736cbc4e3705 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h
@@ -21,25 +21,20 @@

#if defined(ISP2401)

-STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_state_get(
- const isys_irq_ID_t isys_irqc_id,
- isys_irqc_state_t *state);
+void isys_irqc_state_get(const isys_irq_ID_t isys_irqc_id,
+ isys_irqc_state_t *state);

-STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_state_dump(
- const isys_irq_ID_t isys_irqc_id,
- const isys_irqc_state_t *state);
+void isys_irqc_state_dump(const isys_irq_ID_t isys_irqc_id,
+ const isys_irqc_state_t *state);

-STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_reg_store(
- const isys_irq_ID_t isys_irqc_id,
- const unsigned int reg_idx,
- const hrt_data value);
+void isys_irqc_reg_store(const isys_irq_ID_t isys_irqc_id,
+ const unsigned int reg_idx,
+ const hrt_data value);

-STORAGE_CLASS_ISYS2401_IRQ_H hrt_data isys_irqc_reg_load(
- const isys_irq_ID_t isys_irqc_id,
- const unsigned int reg_idx);
+hrt_data isys_irqc_reg_load(const isys_irq_ID_t isys_irqc_id,
+ const unsigned int reg_idx);

-STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_status_enable(
- const isys_irq_ID_t isys_irqc_id);
+void isys_irqc_status_enable(const isys_irq_ID_t isys_irqc_id);

#endif /* defined(ISP2401) */

diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h
index 06bc9e1450ec..001c55ea970b 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h
@@ -21,20 +21,8 @@

#if defined(ISP2401)

-#ifndef __INLINE_ISYS2401_IRQ__
-
-#define STORAGE_CLASS_ISYS2401_IRQ_H extern
-#define STORAGE_CLASS_ISYS2401_IRQ_C extern
#include "isys_irq_public.h"

-#else /* __INLINE_ISYS2401_IRQ__ */
-
-#define STORAGE_CLASS_ISYS2401_IRQ_H static inline
-#define STORAGE_CLASS_ISYS2401_IRQ_C static inline
-#include "isys_irq_private.h"
-
-#endif /* __INLINE_ISYS2401_IRQ__ */
-
#endif /* defined(ISP2401) */

#endif /* __IA_CSS_ISYS_IRQ_H__ */
--
2.26.2

2020-09-02 17:38:09

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 36/38] media: atomisp: csi_rx.c: add a missing includes

Due to that, smatch warns with:

drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:18:11: warning: symbol 'N_SHORT_PACKET_LUT_ENTRIES' was not declared. Should it be static?
drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:24:11: warning: symbol 'N_LONG_PACKET_LUT_ENTRIES' was not declared. Should it be static?
drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:30:11: warning: symbol 'N_CSI_RX_FE_CTRL_DLANES' was not declared. Should it be static?
drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:37:11: warning: symbol 'N_CSI_RX_BE_SID_WIDTH' was not declared. Should it be static?
drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c:19:11: warning: symbol 'N_IBUF_CTRL_PROCS' was not declared. Should it be static?

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c | 1 +
.../staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c
index 8e661091f7d9..9a8d8f546da7 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c
@@ -14,6 +14,7 @@
*/

#include "system_global.h"
+#include "csi_rx_global.h"

const u32 N_SHORT_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = {
4, /* 4 entries at CSI_RX_BACKEND0_ID*/
diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c
index 58fec54a914d..8d19c9875a71 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c
@@ -15,6 +15,7 @@

#include <type_support.h>
#include "system_global.h"
+#include "ibuf_ctrl_global.h"

const u32 N_IBUF_CTRL_PROCS[N_IBUF_CTRL_ID] = {
8, /* IBUF_CTRL0_ID supports at most 8 processes */
--
2.26.2

2020-09-02 18:47:31

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 02/38] media: v4l2-ioctl: avoid memory leaks on some time32 compat functions

On Wed, Sep 2, 2020 at 6:10 PM Mauro Carvalho Chehab
<[email protected]> wrote:
>
> There are some reports about possible memory leaks:
>
> drivers/media/v4l2-core//v4l2-ioctl.c:3203 video_put_user() warn: check that 'ev32' doesn't leak information (struct has a hole after 'type')
> drivers/media/v4l2-core//v4l2-ioctl.c:3230 video_put_user() warn: check that 'vb32' doesn't leak information (struct has a hole after 'memory')
>
> While smatch seems to be reporting a false positive (line 3203),
> there's indeed a possible leak with reserved2 at vb32.
>
> We might have fixed just that one, but smatch checks won't
> be able to check leaks at ev32. So, re-work the code in a way
> that will ensure that the var contents will be zeroed before
> filling it.
>
> With that, we don't need anymore to touch reserved fields.
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>

Isn't this the same as commit 4ffb879ea648 ("media: media/v4l2-core:
Fix kernel-infoleak
in video_put_user()") that you already applied (aside from the issue
that Laurent
pointed out)?

Arnd

2020-09-03 06:03:24

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: [PATCH 02/38] media: v4l2-ioctl: avoid memory leaks on some time32 compat functions

Em Wed, 2 Sep 2020 20:45:53 +0200
Arnd Bergmann <[email protected]> escreveu:

> On Wed, Sep 2, 2020 at 6:10 PM Mauro Carvalho Chehab
> <[email protected]> wrote:
> >
> > There are some reports about possible memory leaks:
> >
> > drivers/media/v4l2-core//v4l2-ioctl.c:3203 video_put_user() warn: check that 'ev32' doesn't leak information (struct has a hole after 'type')
> > drivers/media/v4l2-core//v4l2-ioctl.c:3230 video_put_user() warn: check that 'vb32' doesn't leak information (struct has a hole after 'memory')
> >
> > While smatch seems to be reporting a false positive (line 3203),
> > there's indeed a possible leak with reserved2 at vb32.
> >
> > We might have fixed just that one, but smatch checks won't
> > be able to check leaks at ev32. So, re-work the code in a way
> > that will ensure that the var contents will be zeroed before
> > filling it.
> >
> > With that, we don't need anymore to touch reserved fields.
> >
> > Signed-off-by: Mauro Carvalho Chehab <[email protected]>
>
> Isn't this the same as commit 4ffb879ea648 ("media: media/v4l2-core:
> Fix kernel-infoleak
> in video_put_user()") that you already applied (aside from the issue
> that Laurent
> pointed out)?

Oh! I completely forgot about that one which is at the fixes branch.

Yeah, you're right! I'll drop this one from the series.

Thanks!

Mauro

2020-09-03 07:50:56

by John Hubbard

[permalink] [raw]
Subject: Re: [PATCH 16/38] media: videobuf-dma-sg: number of pages should be unsigned long

On 9/2/20 9:10 AM, Mauro Carvalho Chehab wrote:
> As reported by smatch:
>
> drivers/media/v4l2-core/videobuf-dma-sg.c:245 videobuf_dma_init_kernel() warn: should 'nr_pages << 12' be a 64 bit type?
>
> The printk should not be using %d for the number of pages.
>
> After looking better, the real problem here is that the
> number of pages should be long int.
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
> ---
> drivers/media/v4l2-core/videobuf-dma-sg.c | 22 ++++++++++++----------
> include/media/videobuf-dma-sg.h | 2 +-
> 2 files changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c
> index 46ff19df9f53..8dd0562de287 100644
> --- a/drivers/media/v4l2-core/videobuf-dma-sg.c
> +++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
> @@ -180,7 +180,7 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma,
> if (rw == READ)
> flags |= FOLL_WRITE;
>
> - dprintk(1, "init user [0x%lx+0x%lx => %d pages]\n",
> + dprintk(1, "init user [0x%lx+0x%lx => %lu pages]\n",
> data, size, dma->nr_pages);
>
> err = pin_user_pages(data & PAGE_MASK, dma->nr_pages,


One pre-existing detail to remember is that the gup/pup routines,
specifically pin_user_pages() in this case, use an "int" for the
incoming nr_pages. (I wonder if that should be changed? It's now
becoming a pitfall.) So it's now possible to overflow.

In other situations like this (see xsdfec_table_write() in
drivers/misc/xilinx_sdfec.c), we've added checks such as:

u32 n;
...

if (WARN_ON_ONCE(n > INT_MAX))
return -EINVAL;

nr_pages = n;

res = pin_user_pages_fast((unsigned long)src_ptr, nr_pages, 0, pages);

...in other words, check the value while it's stored in a 64-bit type,
before sending it down into a 32-bit API.

...other than that, everything else looks fine.

thanks,
--
John Hubbard
NVIDIA

2020-09-07 10:20:24

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH 00/38] media sparse/smatch warn fixes

On 02/09/2020 18:10, Mauro Carvalho Chehab wrote:
> While I was lately relying on Jenkins to report smatch/sparse issues,
> I discovered this week that the reports were missing such warnings
>
> I got it fixed already at builder.linuxtv.org, but there are several new
> warnings that got added over time.
>
> This series is meant to solve the ones that are reported on x86_64
> without pre-building the smatch database.
>
> It should allow receiving cleaner error reports.
>
> While most of the patches are meant to shut up the static analizers,
> some contain real bug fixes.
>
> Mauro Carvalho Chehab (38):
> media: tda10086: cleanup symbol_rate setting logic
> media: v4l2-ioctl: avoid memory leaks on some time32 compat functions
> media: qt1010: fix usage of unititialized value
> media: av7110_v4l: avoid a typecast
> media: wl128x: get rid of a potential spectre issue
> media: venus: place extern venus_fw_debug on a header file
> media: tda10021: avoid casts when using symbol_rate
> media: serial_ir: use the right type for a dma address
> media: vivid: move the detection part out of vivid_create_instance
> media: vivid: place the logic which disables ioctl on a separate
> function
> media: vivid: move set_capabilities logic to a separate function
> media: vivid: place dt timings init code on a separate function
> media: vivid: move the create queues to a separate function
> media: vivid: move the devnode creation logic to a separate function
> media: vivid: fix error path

For these vivid patches and after fixing the "unused variable 'i'" warning
as reported by the kernel test robot:

Reviewed-by: Hans Verkuil <[email protected]>

Thank you for working on this!

Regards,

Hans

> media: videobuf-dma-sg: number of pages should be unsigned long
> media: cx25821-alsa: number of pages should be unsigned long
> media: cx23885-alsa: number of pages should be unsigned long
> media: cx88-alsa: number of pages should be unsigned long
> media: saa7134-alsa.c: number of pages should be unsigned long
> media: dvb-ttusb-budget: don't use stack for USB transfers
> media: dvb-ttusb-budget: cleanup printk logic
> media: saa7134: avoid a shift overflow
> media: atomisp: fix casts at atomisp_compat_ioctl32.c
> media: atomisp: get rid of some unused code
> media: atomisp: cleanup ifdefs from ia_css_debug.c
> media: atomisp: get rid of version-dependent globals
> media: atomisp: get rid of isys_dma.h and isys_dma_local.h
> media: atomisp: get rid of ibuf_ctrl abstraction
> media: atomisp: don't check for ISP version for includes
> media: atomisp: unify INPUT error return type
> media: atomisp: de-duplicate names at *_input_system_global.h
> media: atomisp: reorder functions at pixelgen_private.h
> media: atomisp: remove compile-time tests from input_system_global.h
> media: atomisp: fix some bad indents
> media: atomisp: csi_rx.c: add a missing includes
> media: atomisp: atomisp_gmin_platform: check before use
> media: atomisp: cleanup isys_irq headers
>
> drivers/media/dvb-frontends/tda10021.c | 38 +-
> drivers/media/dvb-frontends/tda10086.c | 22 +-
> drivers/media/pci/cx23885/cx23885-alsa.c | 7 +-
> drivers/media/pci/cx23885/cx23885.h | 4 +-
> drivers/media/pci/cx25821/cx25821-alsa.c | 11 +-
> drivers/media/pci/cx88/cx88-alsa.c | 13 +-
> drivers/media/pci/saa7134/saa7134-alsa.c | 7 +-
> drivers/media/pci/saa7134/saa7134-tvaudio.c | 3 +-
> drivers/media/pci/saa7134/saa7134.h | 2 +-
> drivers/media/pci/ttpci/av7110_v4l.c | 4 +-
> drivers/media/platform/qcom/venus/core.h | 2 +
> drivers/media/platform/qcom/venus/dbgfs.c | 2 -
> drivers/media/radio/wl128x/fmdrv_common.c | 16 +-
> drivers/media/rc/serial_ir.c | 2 +-
> drivers/media/test-drivers/vivid/vivid-core.c | 645 ++++++------
> drivers/media/tuners/qt1010.c | 25 +-
> .../media/usb/ttusb-budget/dvb-ttusb-budget.c | 197 ++--
> drivers/media/v4l2-core/v4l2-ioctl.c | 48 +-
> drivers/media/v4l2-core/videobuf-dma-sg.c | 22 +-
> drivers/staging/media/atomisp/Makefile | 12 +-
> .../atomisp/pci/atomisp_compat_ioctl32.c | 84 +-
> .../media/atomisp/pci/atomisp_gmin_platform.c | 5 +-
> .../atomisp/pci/css_2401_system/host/csi_rx.c | 1 +
> .../pci/css_2401_system/host/ibuf_ctrl.c | 1 +
> .../css_2401_system/host/ibuf_ctrl_local.h | 1 +
> .../css_2401_system/host/ibuf_ctrl_private.h | 268 -----
> .../pci/css_2401_system/host/isys_dma.c | 10 +-
> .../pci/css_2401_system/host/isys_dma_local.h | 21 -
> .../css_2401_system/host/isys_dma_private.h | 12 +-
> .../pci/css_2401_system/host/isys_irq.c | 3 +-
> .../pci/css_2401_system/host/isys_irq_local.h | 4 +-
> .../css_2401_system/host/isys_irq_private.h | 12 +-
> .../css_2401_system/host/pixelgen_private.h | 73 +-
> .../pci/css_2401_system/ibuf_ctrl_global.h | 6 +-
> .../pci/css_2401_system/isys_irq_global.h | 4 +-
> .../pci/css_2401_system/pixelgen_global.h | 8 +-
> .../host/input_formatter.c | 2 +-
> .../hive_isp_css_common/host/input_system.c | 70 +-
> .../hive_isp_css_include/host/csi_rx_public.h | 4 +-
> .../host/ibuf_ctrl_public.h | 94 --
> .../host/isys_dma_public.h | 8 +-
> .../host/isys_irq_public.h | 29 +-
> .../hive_isp_css_include/host/isys_public.h | 4 +-
> .../host/pixelgen_public.h | 4 +-
> .../pci/hive_isp_css_include/ibuf_ctrl.h | 47 -
> .../pci/hive_isp_css_include/isys_dma.h | 47 -
> .../pci/hive_isp_css_include/isys_irq.h | 16 +-
> drivers/staging/media/atomisp/pci/hmm/hmm.c | 6 +-
> .../staging/media/atomisp/pci/ia_css_mipi.h | 2 -
> .../staging/media/atomisp/pci/ia_css_stream.h | 4 +-
> .../media/atomisp/pci/input_system_global.h | 29 +-
> .../kernels/ctc/ctc_1.0/ia_css_ctc_param.h | 7 -
> .../ctc/ctc_1.0/ia_css_ctc_table.host.c | 145 ---
> .../kernels/gc/gc_1.0/ia_css_gc_table.host.c | 144 ---
> .../kernels/gc/gc_2/ia_css_gc2_table.host.c | 53 -
> .../isp/kernels/raw/raw_1.0/ia_css_raw.host.c | 4 +-
> .../kernels/xnr/xnr_1.0/ia_css_xnr_param.h | 7 -
> .../xnr/xnr_1.0/ia_css_xnr_table.host.c | 31 -
> .../atomisp/pci/isp2400_input_system_global.h | 21 +-
> .../atomisp/pci/isp2400_input_system_local.h | 17 +-
> .../atomisp/pci/isp2400_input_system_public.h | 26 +-
> .../media/atomisp/pci/isp2400_system_global.h | 16 -
> .../atomisp/pci/isp2401_input_system_global.h | 30 +-
> .../atomisp/pci/isp2401_input_system_local.h | 3 -
> .../pci/isp2401_input_system_private.h | 224 ++++-
> .../media/atomisp/pci/isp2401_system_global.h | 19 -
> .../atomisp/pci/runtime/binary/src/binary.c | 919 +++++++++---------
> .../runtime/bufq/interface/ia_css_bufq_comm.h | 10 -
> .../media/atomisp/pci/runtime/bufq/src/bufq.c | 26 +-
> .../runtime/debug/interface/ia_css_debug.h | 6 -
> .../pci/runtime/debug/src/ia_css_debug.c | 193 +---
> .../atomisp/pci/runtime/ifmtr/src/ifmtr.c | 2 +-
> .../pci/runtime/inputfifo/src/inputfifo.c | 10 -
> .../pci/runtime/isys/interface/ia_css_isys.h | 18 +-
> .../runtime/isys/interface/ia_css_isys_comm.h | 4 +-
> .../pci/runtime/isys/src/csi_rx_rmgr.c | 2 +-
> .../pci/runtime/isys/src/isys_dma_rmgr.c | 2 +-
> .../atomisp/pci/runtime/isys/src/isys_init.c | 20 +-
> .../runtime/isys/src/isys_stream2mmio_rmgr.c | 2 +-
> .../media/atomisp/pci/runtime/isys/src/rx.c | 24 +-
> .../pci/runtime/isys/src/virtual_isys.c | 58 +-
> .../pipeline/interface/ia_css_pipeline.h | 2 +-
> .../pci/runtime/pipeline/src/pipeline.c | 4 +-
> drivers/staging/media/atomisp/pci/sh_css.c | 296 ++----
> .../staging/media/atomisp/pci/sh_css_defs.h | 4 -
> .../staging/media/atomisp/pci/sh_css_hrt.c | 4 -
> .../media/atomisp/pci/sh_css_internal.h | 36 +-
> .../staging/media/atomisp/pci/sh_css_mipi.c | 34 +-
> .../media/atomisp/pci/sh_css_param_shading.c | 2 +-
> .../staging/media/atomisp/pci/sh_css_params.c | 538 ----------
> .../media/atomisp/pci/sh_css_properties.c | 10 -
> drivers/staging/media/atomisp/pci/sh_css_sp.c | 39 +-
> drivers/staging/media/atomisp/pci/sh_css_sp.h | 8 +-
> .../staging/media/atomisp/pci/sh_css_struct.h | 2 -
> .../staging/media/atomisp/pci/system_global.h | 23 -
> include/media/videobuf-dma-sg.h | 2 +-
> 96 files changed, 1708 insertions(+), 3300 deletions(-)
> delete mode 100644 drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h
> delete mode 100644 drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h
> delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h
> delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h
> delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_dma.h
> delete mode 100644 drivers/staging/media/atomisp/pci/isp2400_system_global.h
> delete mode 100644 drivers/staging/media/atomisp/pci/isp2401_system_global.h
>