media sparse/smatch warn fixes
Subsystems (13)
PATCH 5/38 media: wl128x: get rid of a potential spectre issue
In reply to Mauro Carvalho ChehabAs 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.
--- drivers/media/radio/wl128x/fmdrv_common.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/media/radio/wl128x/fmdrv_common.c +10 -6
@@ -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;
Signature · 1 line
2.26.2
PATCH 12/38 media: vivid: place dt timings init code on a separate function
In reply to Mauro Carvalho ChehabMove those out of the big vivid_create_instance() function.
--- drivers/media/test-drivers/vivid/vivid-core.c | 76 +++++++++++-------- 1 file changed, 44 insertions(+), 32 deletions(-)
drivers/media/test-drivers/vivid/vivid-core.c +44 -32
@@ -1177,6 +1177,48 @@ static void vivid_disable_unused_ioctls(struct vivid_dev *dev,v4l2_disable_ioctl (&dev->touch_cap_dev,VIDIOC_ENUM_FRAMEINTERVALS ); } +static int vivid_init_dv_timings (struct vivid_dev *dev) +{ +int i; + +while (v4l2_dv_timings_presets[dev->query_dv_timings_size].bt.width) + dev->query_dv_timings_size++; + +/* +* Create a char pointer array that points to the names of all the +* preset timings +*/ + dev->query_dv_timings_qmenu =kmalloc_array (dev->query_dv_timings_size, +sizeof (char *),GFP_KERNEL ); +/* +* Create a string array containing the names of all the preset +* timings. Each name is max 31 chars long (+ terminating 0). +*/ + dev->query_dv_timings_qmenu_strings = +kmalloc_array (dev->query_dv_timings_size,32 ,GFP_KERNEL ); + +if (!dev->query_dv_timings_qmenu || + !dev->query_dv_timings_qmenu_strings) +return -ENOMEM ; + +for (i =0 ; i < dev->query_dv_timings_size; i++) { +const struct v4l2_bt_timings *bt = &v4l2_dv_timings_presets[i].bt; +char *p = dev->query_dv_timings_qmenu_strings + i *32 ; +u32 htot, vtot; + + dev->query_dv_timings_qmenu[i] = p; + + htot =V4L2_DV_BT_FRAME_WIDTH (bt); + vtot =V4L2_DV_BT_FRAME_HEIGHT (bt); +snprintf (p,32 ,"%ux%u%s%u" , + bt->width, bt->height, bt->interlaced ?"i" :"p" , + (u32 )bt->pixelclock / (htot * vtot)); + } + +return 0 ; +} + +static int vivid_create_instance (struct platform_device *pdev,int inst) { static const struct v4l2_dv_timings def_dv_timings =
@@ -1254,40 +1296,10 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)if (!dev->edid) goto free_dev; -while (v4l2_dv_timings_presets[dev->query_dv_timings_size].bt.width) - dev->query_dv_timings_size++; - -/* -* Create a char pointer array that points to the names of all the -* preset timings -*/ - dev->query_dv_timings_qmenu =kmalloc_array (dev->query_dv_timings_size, -sizeof (char *),GFP_KERNEL ); -/* -* Create a string array containing the names of all the preset -* timings. Each name is max 31 chars long (+ terminating 0). -*/ - dev->query_dv_timings_qmenu_strings = -kmalloc_array (dev->query_dv_timings_size,32 ,GFP_KERNEL ); - -if (!dev->query_dv_timings_qmenu || - !dev->query_dv_timings_qmenu_strings) + ret =vivid_init_dv_timings (dev); +if (ret <0 ) goto free_dev; -for (i =0 ; i < dev->query_dv_timings_size; i++) { -const struct v4l2_bt_timings *bt = &v4l2_dv_timings_presets[i].bt; -char *p = dev->query_dv_timings_qmenu_strings + i *32 ; -u32 htot, vtot; - - dev->query_dv_timings_qmenu[i] = p; - - htot =V4L2_DV_BT_FRAME_WIDTH (bt); - vtot =V4L2_DV_BT_FRAME_HEIGHT (bt); -snprintf (p,32 ,"%ux%u%s%u" , - bt->width, bt->height, bt->interlaced ?"i" :"p" , - (u32 )bt->pixelclock / (htot * vtot)); - } -vivid_disable_unused_ioctls (dev, has_tuner, has_modulator, in_type_counter, out_type_counter);
Signature · 1 line
2.26.2
PATCH 3/38 media: qt1010: fix usage of unititialized value
In reply to Mauro Carvalho ChehabAs pointed by smatch:
drivers/media/tuners/qt1010.c:239 qt1010_init_meas1() error: uninitialized symbol 'val2'. drivers/media/tuners/qt1010.c:273 qt1010_init_meas2() error: uninitialized symbol 'val'.
The logic is ok, but it is hard for static analyzers to parse it, as it depends on a value read in the middle of a loop.
Also, it takes a while for humans to verify.
Re-write the first function to use a more direct way.
At the second one, I opted to just initialize the read var, in order to shut up the report.
While here, address a few coding style issues at the function code.
--- drivers/media/tuners/qt1010.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/media/tuners/qt1010.c +14 -11
@@ -222,23 +222,24 @@ static int qt1010_init_meas1(struct qt1010_priv *priv, { QT1010_WR, reg, reg_init_val }, { QT1010_WR, 0x1e, 0x00 }, { QT1010_WR, 0x1e, oper }, - { QT1010_RD, reg, 0xff } };for (i =0 ; i <ARRAY_SIZE (i2c_data); i++) { -if (i2c_data[i].oper ==QT1010_WR ) { - err =qt1010_writereg (priv, i2c_data[i].reg, - i2c_data[i].val); - }else { - err =qt1010_readreg (priv, i2c_data[i].reg, &val2); - } -if (err)return err; + err =qt1010_writereg (priv, i2c_data[i].reg, + i2c_data[i].val); +if (err) +return err; } + err =qt1010_readreg (priv, reg, &val2); +if (err) +return err;do { val1 = val2; err =qt1010_readreg (priv, reg, &val2); -if (err)return err; +if (err) +return err; +dev_dbg (&priv->i2c->dev,"%s: compare reg:%02x %02x %02x\n" , __func__, reg, val1, val2); }while (val1 != val2);
@@ -250,7 +251,7 @@ static int qt1010_init_meas1(struct qt1010_priv *priv,static int qt1010_init_meas2 (struct qt1010_priv *priv,u8 reg_init_val,u8 *retval) { -u8 i, val; +u8 i, val =0xff ;int err;qt1010_i2c_oper_t i2c_data[] = { {QT1010_WR ,0x07 , reg_init_val },
@@ -261,6 +262,7 @@ static int qt1010_init_meas2(struct qt1010_priv *priv, { QT1010_WR, 0x1e, 0x00 }, { QT1010_WR, 0x22, 0xff } }; +for (i =0 ; i <ARRAY_SIZE (i2c_data); i++) {if (i2c_data[i].oper ==QT1010_WR ) { err = qt1010_writereg(priv, i2c_data[i].reg,
@@ -268,7 +270,8 @@ static int qt1010_init_meas2(struct qt1010_priv *priv, }else { err =qt1010_readreg (priv, i2c_data[i].reg, &val); } -if (err)return err; +if (err) +return err; } *retval = val;return 0 ;
Signature · 1 line
2.26.2
PATCH 19/38 media: cx88-alsa: number of pages should be unsigned long
In reply to Mauro Carvalho ChehabAs reported by smatch:
drivers/media/pci/cx88/cx88-alsa.c:286 cx88_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type?
the number of patches should be unsigned long.
--- drivers/media/pci/cx88/cx88-alsa.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/media/pci/cx88/cx88-alsa.c +7 -6
@@ -42,12 +42,12 @@*/ struct cx88_audio_buffer { -unsigned int bpl; -struct cx88_riscmem risc; +unsigned int bpl; +struct cx88_riscmem risc;void *vaddr;struct scatterlist *sglist;int sglen; -int nr_pages; +unsigned long nr_pages; };struct cx88_audio_dev {
@@ -271,7 +271,8 @@ static irqreturn_t cx8801_irq(int irq, void *dev_id)return IRQ_RETVAL (handled); } -static int cx88_alsa_dma_init (struct cx88_audio_dev *chip,int nr_pages) +static int cx88_alsa_dma_init (struct cx88_audio_dev *chip, +unsigned long nr_pages) {struct cx88_audio_buffer *buf = chip->buf;struct page *pg;
@@ -279,11 +280,11 @@ static int cx88_alsa_dma_init(struct cx88_audio_dev *chip, int nr_pages) buf->vaddr =vmalloc_32 (nr_pages <<PAGE_SHIFT );if (!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 );
Signature · 1 line
2.26.2
PATCH 34/38 media: atomisp: remove compile-time tests from input_system_global.h
In reply to Mauro Carvalho ChehabNow that there's no duplication between ISP2400 and ISP2401 input system functions, we can include both at the system global.
--- drivers/staging/media/atomisp/pci/input_system_global.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/media/atomisp/pci/input_system_global.h +2 -5
@@ -24,10 +24,7 @@ typedef enum {INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED , } input_system_err_t; -#ifdef ISP2401 -# include "isp2401_input_system_global.h" -#else -# include "isp2400_input_system_global.h" -#endif +#include "isp2401_input_system_global.h" +#include "isp2400_input_system_global.h" #endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */
Signature · 1 line
2.26.2
PATCH 6/38 media: venus: place extern venus_fw_debug on a header file
In reply to Mauro Carvalho ChehabSparse warns about this symbol:
drivers/media/platform/qcom/venus/hfi_venus.c:133:5: warning: symbol 'venus_fw_debug' was not declared. Should it be static?
Because hfi_venus.c doesn't include a header file with the extern. So, move it to core.h, with is included by both hfi_venus.c and dbgfs.c.
This way, if something changes with it, warnings or errors will be produced.
--- drivers/media/platform/qcom/venus/core.h | 2 ++ drivers/media/platform/qcom/venus/dbgfs.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/venus/core.h +2 -0
@@ -24,6 +24,8 @@#define VIDC_VCODEC_CLKS_NUM_MAX 2#define VIDC_PMDOMAINS_NUM_MAX 3 +extern int venus_fw_debug; +struct freq_tbl {unsigned int load;unsigned long freq;
drivers/media/platform/qcom/venus/dbgfs.c +0 -2
@@ -7,8 +7,6 @@#include "core.h" -extern int venus_fw_debug; -void venus_dbgfs_init (struct venus_core *core) { core->root =debugfs_create_dir ("venus" ,NULL );
Signature · 1 line
2.26.2
PATCH 27/38 media: atomisp: get rid of version-dependent globals
In reply to Mauro Carvalho ChehabReplace all occurrences along the atomisp tree for the conditional compilation macros found at system_global.h, replacing them by tests wheather ISP2401 is defined or not.
--- .../pci/css_2401_system/host/isys_irq_local.h | 4 +- .../css_2401_system/host/isys_irq_private.h | 4 +- .../pci/css_2401_system/isys_irq_global.h | 4 +- .../host/input_formatter.c | 2 +- .../hive_isp_css_common/host/input_system.c | 2 +- .../hive_isp_css_include/host/csi_rx_public.h | 4 +- .../host/ibuf_ctrl_public.h | 4 +- .../host/isys_dma_public.h | 4 +- .../host/isys_irq_public.h | 4 +- .../hive_isp_css_include/host/isys_public.h | 4 +- .../host/pixelgen_public.h | 4 +- .../pci/hive_isp_css_include/isys_irq.h | 4 +- .../staging/media/atomisp/pci/ia_css_stream.h | 4 +- .../isp/kernels/raw/raw_1.0/ia_css_raw.host.c | 4 +- .../atomisp/pci/isp2400_input_system_public.h | 4 +- .../media/atomisp/pci/isp2400_system_global.h | 16 - .../media/atomisp/pci/isp2401_system_global.h | 19 - .../atomisp/pci/runtime/binary/src/binary.c | 2 +- .../runtime/bufq/interface/ia_css_bufq_comm.h | 6 - .../atomisp/pci/runtime/ifmtr/src/ifmtr.c | 2 +- .../pci/runtime/isys/interface/ia_css_isys.h | 12 +- .../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 | 10 +- .../runtime/isys/src/isys_stream2mmio_rmgr.c | 2 +- .../media/atomisp/pci/runtime/isys/src/rx.c | 12 +- .../pci/runtime/isys/src/virtual_isys.c | 2 +- .../pipeline/interface/ia_css_pipeline.h | 2 +- .../pci/runtime/pipeline/src/pipeline.c | 2 +- drivers/staging/media/atomisp/pci/sh_css.c | 158 +++--- .../staging/media/atomisp/pci/sh_css_defs.h | 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 | 533 ------------------ drivers/staging/media/atomisp/pci/sh_css_sp.c | 24 +- drivers/staging/media/atomisp/pci/sh_css_sp.h | 6 +- .../staging/media/atomisp/pci/sh_css_struct.h | 2 - .../staging/media/atomisp/pci/system_global.h | 23 - 40 files changed, 155 insertions(+), 818 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/isp2400_system_global.h delete mode 100644 drivers/staging/media/atomisp/pci/isp2401_system_global.h
drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h +2 -2
@@ -18,7 +18,7 @@#include <type_support.h> -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 )typedef struct isys_irqc_state_s isys_irqc_state_t ;
@@ -31,6 +31,6 @@ struct isys_irqc_state_s {/*hrt_data clear; */ /* write-only register */ }; -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_LOCAL_H__ */
drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h +2 -2
@@ -19,7 +19,7 @@#include "isys_irq_global.h" #include "isys_irq_local.h" -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 )/* -------------------------------------------------------+ | Native command interface (NCI) |
@@ -102,6 +102,6 @@ STORAGE_CLASS_ISYS2401_IRQ_C hrt_data isys_irqc_reg_load(/* end of DLI */ -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_PRIVATE_H__ */
drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h +2 -2
@@ -16,7 +16,7 @@#ifndef __ISYS_IRQ_GLOBAL_H__#define __ISYS_IRQ_GLOBAL_H__ -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 )/* Register offset/index from base location */ #define ISYS_IRQ_EDGE_REG_IDX (0)
@@ -31,6 +31,6 @@#define ISYS_IRQ_CLEAR_REG_VALUE (0xFFFF)#define ISYS_IRQ_ENABLE_REG_VALUE (0xFFFF) -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_GLOBAL_H__ */
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter.c +1 -1
@@ -15,7 +15,7 @@#include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 #include "input_formatter.h" #include <type_support.h>
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c +1 -1
@@ -15,7 +15,7 @@#include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 #include "input_system.h" #include <type_support.h>
drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h +2 -2
@@ -16,7 +16,7 @@#ifndef __CSI_RX_PUBLIC_H_INCLUDED__#define __CSI_RX_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /***************************************************** * * Native command interface (NCI).
@@ -132,5 +132,5 @@ void csi_rx_be_ctrl_reg_store(const hrt_address reg, const hrt_data value);/* end of DLI */ -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __CSI_RX_PUBLIC_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h +2 -2
@@ -16,7 +16,7 @@#ifndef __IBUF_CTRL_PUBLIC_H_INCLUDED__#define __IBUF_CTRL_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /***************************************************** * * Native command interface (NCI).
@@ -90,5 +90,5 @@ STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_reg_store( const hrt_data value);/* end of DLI */ -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __IBUF_CTRL_PUBLIC_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h +2 -2
@@ -16,7 +16,7 @@#ifndef __ISYS_DMA_PUBLIC_H_INCLUDED__#define __ISYS_DMA_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "system_local.h" #include "type_support.h"
@@ -34,6 +34,6 @@ void isys2401_dma_set_max_burst_size(const isys2401_dma_ID_t dma_id, uint32_t max_burst_size); -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __ISYS_DMA_PUBLIC_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h +2 -2
@@ -19,7 +19,7 @@#include "isys_irq_global.h" #include "isys_irq_local.h" -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 ) STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_state_get( const isys_irq_ID_t isys_irqc_id,
@@ -41,6 +41,6 @@ STORAGE_CLASS_ISYS2401_IRQ_H hrt_data isys_irqc_reg_load( STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_status_enable(const isys_irq_ID_t isys_irqc_id); -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_PUBLIC_H__ */
drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_public.h +2 -2
@@ -16,7 +16,7 @@#ifndef __ISYS_PUBLIC_H_INCLUDED__#define __ISYS_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /*! Read the state of INPUT_SYSTEM[ID] \param ID[in] INPUT_SYSTEM identifier \param state[out] pointer to input system state structure
@@ -34,5 +34,5 @@ STORAGE_CLASS_INPUT_SYSTEM_H input_system_err_t input_system_get_state( STORAGE_CLASS_INPUT_SYSTEM_H void input_system_dump_state(const input_system_ID_t ID ,input_system_state_t *state); -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __ISYS_PUBLIC_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/hive_isp_css_include/host/pixelgen_public.h +2 -2
@@ -16,7 +16,7 @@#ifndef __PIXELGEN_PUBLIC_H_INCLUDED__#define __PIXELGEN_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /***************************************************** * * Native command interface (NCI).
@@ -76,5 +76,5 @@ STORAGE_CLASS_PIXELGEN_H void pixelgen_ctrl_reg_store( const hrt_data value);/* end of DLI */ -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __PIXELGEN_PUBLIC_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h +2 -2
@@ -19,7 +19,7 @@#include <type_support.h> #include <system_local.h> -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 )#ifndef __INLINE_ISYS2401_IRQ__
@@ -35,6 +35,6 @@#endif /* __INLINE_ISYS2401_IRQ__ */ -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __IA_CSS_ISYS_IRQ_H__ */
drivers/staging/media/atomisp/pci/ia_css_stream.h +2 -2
@@ -18,7 +18,7 @@#include <type_support.h> #include <system_local.h> -#if !defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if !defined(ISP2401 )#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(USE_INPUT_SYSTEM_VERSION_2401 ) +#if !defined(ISP2401 )rx_cfg_t csi_rx_config;#endif bool reconfigure_css_rx;
drivers/staging/media/atomisp/pci/isp/kernels/raw/raw_1.0/ia_css_raw.host.c +2 -2
@@ -81,7 +81,7 @@ ia_css_raw_config(const struct ia_css_frame_info *internal_info = from->internal_info; (void )size; -#if !defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if !defined(ISP2401 )/* 2401 input system uses input width width */ in_info = internal_info;#else
@@ -105,7 +105,7 @@ ia_css_raw_config( to->two_ppc = from->two_ppc; to->stream_format =css2isp_stream_format (from->stream_format); to->deinterleaved = from->deinterleaved; -#if (defined(USE_INPUT_SYSTEM_VERSION_2401 ) || defined(CONFIG_CSI2_PLUS )) +#if defined(ISP2401 ) to->start_column = in_info->crop_info.start_column; to->start_line = in_info->crop_info.start_line; to->enable_left_padding = from->enable_left_padding;
drivers/staging/media/atomisp/pci/isp2400_input_system_public.h +2 -2
@@ -17,7 +17,7 @@#define __INPUT_SYSTEM_PUBLIC_H_INCLUDED__#include <type_support.h> -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "isys_public.h" #else
@@ -365,6 +365,6 @@ input_system_error_t input_system_gpfifo_channel_cfg(u32 nof_frames, target_cfg2400_t target ); -#endif /* #ifdef USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* #ifdef ISP2401 */ #endif /* __INPUT_SYSTEM_PUBLIC_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/isp2400_system_global.h deleted +0 -16
@@ -1,16 +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. -*/ - -#define USE_INPUT_SYSTEM_VERSION_2
drivers/staging/media/atomisp/pci/isp2401_system_global.h deleted +0 -19
@@ -1,19 +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. -*/ - -#define HAS_NO_INPUT_FORMATTER -#define USE_INPUT_SYSTEM_VERSION_2401 -#define HAS_INPUT_SYSTEM_VERSION_2401 -#define CSI2P_DISABLE_ISYS2401_ONLINE_MODE
drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c +1 -1
@@ -1045,7 +1045,7 @@ binary_in_frame_padded_width(int in_frame_width,int rval;int nr_of_left_paddings;/* number of paddings pixels on the left of an image line */ -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 )/* the output image line of Input System 2401 does not have the left paddings */ nr_of_left_paddings =0 ;#else
drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h +0 -6
@@ -27,15 +27,9 @@ enum sh_css_queue_id {SH_CSS_QUEUE_E_ID ,SH_CSS_QUEUE_F_ID ,SH_CSS_QUEUE_G_ID , -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)SH_CSS_QUEUE_H_ID ,/* for metadata */ -#endif -#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) -#endif };
drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c +1 -1
@@ -16,7 +16,7 @@#include "system_global.h" #include <linux/kernel.h> -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 #include "ia_css_ifmtr.h" #include <math_support.h>
drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h +5 -7
@@ -24,7 +24,7 @@#include <system_global.h> #include "ia_css_isys_comm.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /** * Virtual Input System. (Input System 2401) */
@@ -32,14 +32,12 @@ typedef input_system_cfg_t ia_css_isys_descr_t;/* end of Virtual Input System */ #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )input_system_error_t ia_css_isys_init (void );void ia_css_isys_uninit (void );enum mipi_port_id ia_css_isys_port_to_mipi_port (enum mipi_port_id api_port); -#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 )/** * @brief Register one (virtual) stream. This is used to track when all
@@ -78,7 +76,7 @@ unsigned int ia_css_csi2_calculate_input_system_alignment( enum atomisp_input_format fmt_type);#endif -#if !defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if !defined(ISP2401 )/* CSS Receiver */ void ia_css_isys_rx_configure( const rx_cfg_t *config,
@@ -95,7 +93,7 @@ void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port, unsigned int irq_infos);unsigned int ia_css_isys_rx_translate_irq_infos (unsigned int bits); -#endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* #if !defined(ISP2401) */ /* @brief Translate format and compression to format type. *
@@ -113,7 +111,7 @@ int ia_css_isys_convert_stream_format_to_mipi_format(mipi_predictor_t compression, unsigned int *fmt_type); -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /** * Virtual Input System. (Input System 2401) */
drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys_comm.h +2 -2
@@ -19,7 +19,7 @@#include <type_support.h> #include <input_system.h> -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include <platform_support.h> /* inline */ #include <input_system_global.h> #include <ia_css_stream_public.h> /* IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH */
@@ -50,5 +50,5 @@ static inline uint32_t ia_css_isys_generate_stream_id(return sp_thread_id *IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH + stream_id; } -#endif /* USE_INPUT_SYSTEM_VERSION_2401*/ +#endif /* ISP2401*/ #endif /*_IA_CSS_ISYS_COMM_H */
drivers/staging/media/atomisp/pci/runtime/isys/src/csi_rx_rmgr.c +1 -1
@@ -15,7 +15,7 @@#include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "assert_support.h" #include "platform_support.h"
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_dma_rmgr.c +1 -1
@@ -15,7 +15,7 @@#include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "assert_support.h" #include "platform_support.h"
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c +5 -5
@@ -18,12 +18,12 @@#include "ia_css_isys.h" #include "platform_support.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "isys_dma.h" /* isys2401_dma_set_max_burst_size() */ #include "isys_irq.h" #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) +#if !defined(ISP2401 )input_system_error_t ia_css_isys_init (void ) {backend_channel_cfg_t backend_ch0;
@@ -86,7 +86,7 @@ input_system_error_t ia_css_isys_init(void) return error; } -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) +#elif defined(ISP2401)input_system_error_t ia_css_isys_init (void ) {ia_css_isys_csi_rx_lut_rmgr_init ();
@@ -106,11 +106,11 @@ input_system_error_t ia_css_isys_init(void) }#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) +#if !defined(ISP2401 )void ia_css_isys_uninit (void ) { } -#elif defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#elif defined(ISP2401 )void ia_css_isys_uninit (void ) {ia_css_isys_csi_rx_lut_rmgr_uninit ();
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_stream2mmio_rmgr.c +1 -1
@@ -15,7 +15,7 @@#include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "assert_support.h" #include "platform_support.h"
drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c +6 -6
@@ -20,7 +20,7 @@#include "ia_css_irq.h" #include "sh_css_internal.h" -#if !defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if !defined(ISP2401 )void ia_css_isys_rx_enable_all_interrupts (enum mipi_port_id port) { hrt_data bits = receiver_port_reg_load(RX0_ID,
@@ -209,7 +209,7 @@ void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port,return ; } -#endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* #if !defined(ISP2401) */ int ia_css_isys_convert_stream_format_to_mipi_format( enum atomisp_input_format input_format,
@@ -311,7 +311,7 @@ int ia_css_isys_convert_stream_format_to_mipi_format(case ATOMISP_INPUT_FORMAT_EMBEDDED : *fmt_type =MIPI_FORMAT_EMBEDDED ;break ; -#ifndef USE_INPUT_SYSTEM_VERSION_2401 +#ifndef ISP2401 case ATOMISP_INPUT_FORMAT_RAW_16 :/* This is not specified by Arasan, so we use * 17 for now.
@@ -356,7 +356,7 @@ int ia_css_isys_convert_stream_format_to_mipi_format(return 0 ; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 )static mipi_predictor_t sh_css_csi2_compression_type_2_mipi_predictor (enum ia_css_csi2_compression_type type) {
@@ -474,7 +474,7 @@ unsigned int ia_css_csi2_calculate_input_system_alignment(#endif -#if !defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if !defined(ISP2401 )void ia_css_isys_rx_configure (const rx_cfg_t *config,const enum ia_css_input_mode input_mode) {
@@ -588,4 +588,4 @@ void ia_css_isys_rx_disable(void) }return ; } -#endif /* if !defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* if !defined(ISP2401) */
drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c +1 -1
@@ -17,7 +17,7 @@#include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "ia_css_isys.h" #include "ia_css_debug.h"
drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h +1 -1
@@ -243,7 +243,7 @@ bool ia_css_pipeline_uses_params(struct ia_css_pipeline *pipeline);*/ bool ia_css_pipeline_get_sp_thread_id (unsigned int key,unsigned int *val); -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 )/** * @brief Get the pipeline io status *
drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c +1 -1
@@ -455,7 +455,7 @@ bool ia_css_pipeline_has_stopped(struct ia_css_pipeline *pipeline)return sp_group.pipe[thread_id].num_stages ==0 ; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 )struct sh_css_sp_pipeline_io_status *ia_css_pipeline_get_pipe_io_status (void ) {return (&sh_css_sp_group.pipe_io_status);
drivers/staging/media/atomisp/pci/sh_css.c +71 -87
616 lines not on this page · raw message
drivers/staging/media/atomisp/pci/sh_css_defs.h +0 -4
@@ -397,10 +397,6 @@ RGB[0,8191],coef[-8192,8191] -> RGB[0,8191]#define SH_CSS_MAX_STAGES 8/* primary_stage[1-6], capture_pp, vf_pp */ /* For CSI2+ input system, it requires extra paddinga from vmem */ -#ifdef CONFIG_CSI2_PLUS -#define _ISP_EXTRA_PADDING_VECS 2 -#else #define _ISP_EXTRA_PADDING_VECS 0 -#endif /* CONFIG_CSI2_PLUS */ #endif /* _SH_CSS_DEFS_H_ */
drivers/staging/media/atomisp/pci/sh_css_internal.h +9 -27
@@ -22,7 +22,7 @@#include <platform_support.h> #include <stdarg.h> -#if !defined(HAS_NO_INPUT_FORMATTER ) +#if !defined(ISP2401 )#include "input_formatter.h" #endif #include "input_system.h"
@@ -86,11 +86,9 @@#define SH_CSS_MAX_IF_CONFIGS 3/* Must match with IA_CSS_NR_OF_CONFIGS (not defined yet).*/ #define SH_CSS_IF_CONFIG_NOT_NEEDED 0xFF -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )#define SH_CSS_ENABLE_METADATA -#endif -#if defined(SH_CSS_ENABLE_METADATA ) && !defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(SH_CSS_ENABLE_METADATA ) && !defined(ISP2401 )#define SH_CSS_ENABLE_METADATA_THREAD #endif
@@ -320,15 +318,9 @@ struct sh_css_sp_debug_state {#elif SP_DEBUG ==SP_DEBUG_TRACE -#if 1 /* Example of just one global trace */ #define SH_CSS_SP_DBG_NR_OF_TRACES (1)#define SH_CSS_SP_DBG_TRACE_DEPTH (40) -#else -/* E.g. if you like separate traces for 4 threads */ -#define SH_CSS_SP_DBG_NR_OF_TRACES (4) -#define SH_CSS_SP_DBG_TRACE_DEPTH (10) -#endif #define SH_CSS_SP_DBG_TRACE_FILE_ID_BIT_POS (13)
@@ -371,7 +363,7 @@ struct sh_css_sp_debug_command {u32 dma_sw_reg; }; -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) /* SP input formatter configuration.*/ struct sh_css_sp_input_formatter_set { u32 stream_format;
@@ -391,7 +383,7 @@ struct sh_css_sp_config {frames are locked when their EOF event is successfully sent to the host (true) or when they are passed to the preview/video pipe (false). */ -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) struct { u8 a_changed; u8 b_changed;
@@ -400,7 +392,7 @@ struct sh_css_sp_config { set[SH_CSS_MAX_IF_CONFIGS]; /* CSI-2 port is used as index. */ } input_formatter;#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) +#if !defined(ISP2401 )sync_generator_cfg_t sync_gen;tpg_cfg_t tpg;prbs_cfg_t prbs;
@@ -423,7 +415,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(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) struct sh_css_sp_pipeline_terminal { union { /* Input System 2401 */
@@ -679,7 +671,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(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 )struct sh_css_sp_pipeline_io pipe_io[SH_CSS_MAX_SP_THREADS ];struct sh_css_sp_pipeline_io_status pipe_io_status;#endif
@@ -828,11 +820,9 @@ struct host_sp_communication {ia_css_ptr host2sp_offline_frames[NUM_CONTINUOUS_FRAMES ];ia_css_ptr host2sp_offline_metadata[NUM_CONTINUOUS_FRAMES ]; -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )ia_css_ptr host2sp_mipi_frames[N_CSI_PORTS ][NUM_MIPI_FRAMES_PER_STREAM ];ia_css_ptr host2sp_mipi_metadata[N_CSI_PORTS ][NUM_MIPI_FRAMES_PER_STREAM ];u32 host2sp_num_mipi_frames[N_CSI_PORTS ]; -#endif u32 host2sp_cont_avail_num_raw_frames;u32 host2sp_cont_extra_num_raw_frames;u32 host2sp_cont_target_num_raw_frames;
@@ -840,20 +830,12 @@ struct host_sp_communication { }; -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )#define SIZE_OF_HOST_SP_COMMUNICATION_STRUCT \ (sizeof(uint32_t) + \ (NUM_CONTINUOUS_FRAMES * SIZE_OF_HRT_VADDRESS * 2) + \ (N_CSI_PORTS * NUM_MIPI_FRAMES_PER_STREAM * SIZE_OF_HRT_VADDRESS * 2) + \ ((3 + N_CSI_PORTS) * sizeof(uint32_t)) + \ (NR_OF_PIPELINES * SIZE_OF_SH_CSS_EVENT_IRQ_MASK_STRUCT)) -#else -#define SIZE_OF_HOST_SP_COMMUNICATION_STRUCT \ - (sizeof(uint32_t) + \ - (NUM_CONTINUOUS_FRAMES * SIZE_OF_HRT_VADDRESS * 2) + \ - (3 * sizeof(uint32_t)) + \ - (NR_OF_PIPELINES * SIZE_OF_SH_CSS_EVENT_IRQ_MASK_STRUCT)) -#endif struct host_sp_queues {/*
@@ -987,7 +969,7 @@ sh_css_frame_info_set_width(struct ia_css_frame_info *info,unsigned int width, unsigned int aligned); -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) +#if !defined(ISP2401 ) unsigned int sh_css_get_mipi_sizes_for_check(const unsigned int port,
@@ -1036,7 +1018,7 @@ sh_css_continuous_is_enabled(uint8_t pipe_num);struct ia_css_pipe *find_pipe_by_num (uint32_t pipe_num); -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 void ia_css_get_crop_offsets( struct ia_css_pipe *pipe,
drivers/staging/media/atomisp/pci/sh_css_mipi.c +8 -26
@@ -30,10 +30,8 @@#include "sh_css_sp.h" /* sh_css_update_host2sp_mipi_frame sh_css_update_host2sp_num_mipi_frames ... */ #include "sw_event_global.h" /* IA_CSS_PSYS_SW_EVENT_MIPI_BUFFERS_READY */ -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )static u32 ref_count_mipi_allocation[N_CSI_PORTS ];/* Initialized in mipi_init */ -#endif int ia_css_mipi_frame_specify(const unsigned int size_mem_words,
@@ -120,7 +118,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width,unsigned int mem_words =0 ;unsigned int width_padded = width; -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 )/* The changes will be reverted as soon as RAW * Buffers are deployed by the 2401 Input System * in the non-continuous use scenario.
@@ -246,7 +244,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width,return err; } -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) +#if !defined(ISP2401 )int ia_css_mipi_frame_enable_check_on_size (const enum mipi_port_id port,const unsigned int size_mem_words) {
@@ -275,19 +273,17 @@ ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port,void mipi_init (void ) { -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )unsigned int i;for (i =0 ; i <N_CSI_PORTS ; i++) ref_count_mipi_allocation[i] =0 ; -#endif }int calculate_mipi_buff_size (struct ia_css_stream_config *stream_cfg,unsigned int *size_mem_words) { -#if !defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if !defined(ISP2401 )int err = -EINVAL ; (void )stream_cfg; (void )size_mem_words;
@@ -409,7 +405,6 @@ static bool buffers_needed(struct ia_css_pipe *pipe)int allocate_mipi_frames (struct ia_css_pipe *pipe,struct ia_css_stream_info *info) { -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )int err = -EINVAL ;unsigned int port;struct ia_css_frame_info mipi_intermediate_info;
@@ -427,7 +422,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,return -EINVAL ; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (pipe->stream->config.online) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
@@ -459,13 +454,13 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,return -EINVAL ; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 err =calculate_mipi_buff_size ( &pipe->stream->config, &my_css.mipi_frame_size[port]);#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) +#if !defined(ISP2401 )if (ref_count_mipi_allocation[port] !=0 ) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
@@ -560,16 +555,10 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, "allocate_mipi_frames(%p) exit:\n", pipe);return err; -#else - (void )pipe; - (void )info; -return 0 ; -#endif }int free_mipi_frames (struct ia_css_pipe *pipe) { -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )int err = -EINVAL ;unsigned int port;
@@ -609,7 +598,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) { }if (ref_count_mipi_allocation[port] >0 ) { -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) +#if !defined(ISP2401 )assert (ref_count_mipi_allocation[port] ==1 );if (ref_count_mipi_allocation[port] !=1 ) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
@@ -641,7 +630,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) {ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE ,"free_mipi_frames(%p) exit (deallocated).\n" , pipe); } -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 ) else {/* 2401 system allows multiple streams to use same physical port. This is not * true for 2400 system. Currently 2401 uses MIPI buffers as a temporary solution.
@@ -675,15 +664,11 @@ free_mipi_frames(struct ia_css_pipe *pipe) { ref_count_mipi_allocation[port] =0 ; } } -#else - (void )pipe; -#endif return 0 ; }int send_mipi_frames (struct ia_css_pipe *pipe) { -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )int err = -EINVAL ;unsigned int i;#ifndef ISP2401
@@ -751,8 +736,5 @@ send_mipi_frames(struct ia_css_pipe *pipe) { (uint8_t )my_css.num_mipi_frames[port], 0 /* not used */);IA_CSS_LEAVE_ERR_PRIVATE (0 ); -#else - (void )pipe; -#endif return 0 ; }
drivers/staging/media/atomisp/pci/sh_css_param_shading.c +1 -1
@@ -258,7 +258,7 @@ prepare_shading_table(const struct ia_css_shading_table *in_table,/* We use the ISP input resolution for the shading table because shading correction is performed in the bayer domain (before bayer down scaling). */ -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 ) padded_width =CEIL_MUL (binary->effective_in_frame_res.width +2 *ISP_VEC_NELEMS ,2 *ISP_VEC_NELEMS );
drivers/staging/media/atomisp/pci/sh_css_params.c +0 -533
551 lines not on this page · raw message
drivers/staging/media/atomisp/pci/sh_css_sp.c +10 -14
@@ -17,7 +17,7 @@#include "sh_css_sp.h" -#if !defined(HAS_NO_INPUT_FORMATTER ) +#if !defined(ISP2401 )#include "input_formatter.h" #endif
@@ -227,7 +227,7 @@ sh_css_sp_start_binary_copy(unsigned int pipe_num,IA_CSS_LOG ("pipe_id %d port_config %08x" , pipe->pipe_id, pipe->inout_port_config); -#if !defined(HAS_NO_INPUT_FORMATTER ) +#if !defined(ISP2401 ) sh_css_sp_group.config.input_formatter.isp_2ppc = (uint8_t )two_ppc;#else (void )two_ppc;
@@ -305,7 +305,7 @@ sh_css_sp_start_raw_copy(struct ia_css_frame *out_frame,IA_CSS_LOG ("pipe_id %d port_config %08x" , pipe->pipe_id, pipe->inout_port_config); -#if !defined(HAS_NO_INPUT_FORMATTER ) +#if !defined(ISP2401 ) sh_css_sp_group.config.input_formatter.isp_2ppc = (uint8_t )two_ppc;#else (void )two_ppc;
@@ -636,7 +636,7 @@ set_view_finder_buffer(const struct ia_css_frame *frame) {return 0 ; } -#if !defined(HAS_NO_INPUT_FORMATTER ) +#if !defined(ISP2401 ) void sh_css_sp_set_if_configs( const input_formatter_cfg_t *config_a, const input_formatter_cfg_t *config_b,
@@ -660,7 +660,7 @@ void sh_css_sp_set_if_configs( }#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) +#if !defined(ISP2401 ) void sh_css_sp_program_input_circuit(int fmt_type, int ch_id,
@@ -679,7 +679,7 @@ sh_css_sp_program_input_circuit(int fmt_type, }#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) +#if !defined(ISP2401 ) void sh_css_sp_configure_sync_gen(int width, int height, int hblank_cycles,
@@ -760,7 +760,7 @@ sh_css_sp_init_group(bool two_ppc, bool no_isp_sync, uint8_t if_config_index) { -#if !defined(HAS_NO_INPUT_FORMATTER ) +#if !defined(ISP2401 ) sh_css_sp_group.config.input_formatter.isp_2ppc = two_ppc;#else (void )two_ppc;
@@ -769,7 +769,7 @@ sh_css_sp_init_group(bool two_ppc, sh_css_sp_group.config.no_isp_sync = (uint8_t )no_isp_sync;/* decide whether the frame is processed online or offline */ if (if_config_index ==SH_CSS_IF_CONFIG_NOT_NEEDED )return ; -#if !defined(HAS_NO_INPUT_FORMATTER ) +#if !defined(ISP2401 )assert (if_config_index <SH_CSS_MAX_IF_CONFIGS ); sh_css_sp_group.config.input_formatter.set[if_config_index].stream_format = input_format;
@@ -934,7 +934,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary,return 0 ; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) +#if defined(ISP2401 ) (void )continuous; sh_css_sp_stage.deinterleaved =0 ;#else
@@ -1019,7 +1019,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary,if (err)return err; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (stage ==0 ) { pipe =find_pipe_by_num (sh_css_sp_group.pipe[thread_id].pipe_num);if (!pipe)
@@ -1255,12 +1255,10 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, offline, if_config_index); }/* if (first_binary != NULL) */ -#if defined(USE_INPUT_SYSTEM_VERSION_2401 ) || defined(USE_INPUT_SYSTEM_VERSION_2 )/* Signal the host immediately after start for SP_ISYS_COPY only */ if ((me->num_stages ==1 ) && me->stages && (me->stages->sp_func ==IA_CSS_PIPELINE_ISYS_COPY )) sh_css_sp_group.config.no_isp_sync = true; -#endif /* Init stage data */ sh_css_init_host2sp_frame_data ();
@@ -1467,7 +1465,6 @@ sh_css_update_host2sp_offline_frame(store_sp_array_uint (host_sp_com, offset, metadata ? metadata->address :0 ); } -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )/* * @brief Update the mipi frame information in host_sp_communication. * Refer to "sh_css_sp.h" for more details.
@@ -1532,7 +1529,6 @@ sh_css_update_host2sp_num_mipi_frames(unsigned int num_frames)store_sp_array_uint (host_sp_com, offset, num_frames); } -#endif void sh_css_update_host2sp_cont_num_raw_frames(unsigned int num_frames,
drivers/staging/media/atomisp/pci/sh_css_sp.h +2 -4
@@ -18,7 +18,7 @@#include <system_global.h> #include <type_support.h> -#if !defined(HAS_NO_INPUT_FORMATTER ) +#if !defined(ISP2401 )#include "input_formatter.h" #endif
@@ -96,7 +96,6 @@ sh_css_update_host2sp_offline_frame(struct ia_css_frame *frame, struct ia_css_metadata *metadata); -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )/** * @brief Update the mipi frame information in host_sp_communication. *
@@ -126,7 +125,6 @@ sh_css_update_host2sp_mipi_metadata(*/ void sh_css_update_host2sp_num_mipi_frames (unsigned int num_frames); -#endif /** * @brief Update the nr of offline frames to use in host_sp_communication.
@@ -156,7 +154,7 @@ sh_css_sp_get_debug_state(struct sh_css_sp_debug_state *state);#endif -#if !defined(HAS_NO_INPUT_FORMATTER ) +#if !defined(ISP2401 ) void sh_css_sp_set_if_configs( const input_formatter_cfg_t *config_a,
drivers/staging/media/atomisp/pci/sh_css_struct.h +0 -2
@@ -55,7 +55,6 @@ struct sh_css {bool check_system_idle;unsigned int num_cont_raw_frames; -#if defined(USE_INPUT_SYSTEM_VERSION_2 ) || defined(USE_INPUT_SYSTEM_VERSION_2401 )unsigned int num_mipi_frames[N_CSI_PORTS ];struct ia_css_frame *mipi_frames[N_CSI_PORTS ][NUM_MIPI_FRAMES_PER_STREAM ];
@@ -64,7 +63,6 @@ struct sh_css {unsigned int mipi_sizes_for_check[N_CSI_PORTS ][IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT ];unsigned int mipi_frame_size[N_CSI_PORTS ]; -#endif ia_css_ptr sp_bin_addr;hrt_data page_table_base_index;
drivers/staging/media/atomisp/pci/system_global.h +0 -23
@@ -25,23 +25,6 @@* N.B. the 3 input formatters are of 2 different classess */ -#define HAS_MMU_VERSION_2 -#define HAS_DMA_VERSION_2 -#define HAS_GDC_VERSION_2 -#define HAS_VAMEM_VERSION_2 -#define HAS_HMEM_VERSION_1 -#define HAS_BAMEM_VERSION_2 -#define HAS_IRQ_VERSION_2 -#define HAS_IRQ_MAP_VERSION_2 -#define HAS_INPUT_FORMATTER_VERSION_2 -#define HAS_INPUT_SYSTEM_VERSION_2 -#define HAS_BUFFERED_SENSOR -#define HAS_FIFO_MONITORS_VERSION_2 -#define HAS_GP_DEVICE_VERSION_2 -#define HAS_GPIO_VERSION_1 -#define HAS_TIMED_CTRL_VERSION_1 -#define HAS_RX_VERSION_2 -/* per-frame parameter handling support */ #define SH_CSS_ENABLE_PER_FRAME_PARAMS
@@ -64,12 +47,6 @@#define ISP2400_DMA_MAX_BURST_LENGTH 128#define ISP2401_DMA_MAX_BURST_LENGTH 2 -#ifdef ISP2401 -# include "isp2401_system_global.h" -#else -# include "isp2400_system_global.h" -#endif -#include <hive_isp_css_defs.h> #include <type_support.h>
Signature · 1 line
2.26.2
PATCH 35/38 media: atomisp: fix some bad indents
In reply to Mauro Carvalho ChehabAs smatch reports, there are several bad indents:
drivers/staging/media/atomisp/pci/hmm/hmm.c:271 hmm_alloc() warn: inconsistent indenting drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c:390 ia_css_bufq_enqueue_psys_event() warn: inconsistent indenting drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2132 ia_css_debug_dump_isys_state() warn: inconsistent indenting drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c:246 sh_css_binary_get_sc_requirements() warn: inconsistent indenting drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c:565 ia_css_binary_get_shading_info_type_1() warn: inconsistent indenting drivers/staging/media/atomisp/pci/sh_css.c:5109 sh_css_pipes_stop() warn: inconsistent indenting drivers/staging/media/atomisp/pci/sh_css.c:8791 ia_css_pipe_create() warn: inconsistent indenting
Some of them are due to ifdefs. Get rid of them by either getting a common code that would work for both ISP2400 and ISP2401 or by creating separate functions, one for each ISP version.
--- drivers/staging/media/atomisp/pci/hmm/hmm.c | 6 +- .../atomisp/pci/runtime/binary/src/binary.c | 917 +++++++++--------- .../media/atomisp/pci/runtime/bufq/src/bufq.c | 3 +- .../pci/runtime/debug/src/ia_css_debug.c | 4 +- drivers/staging/media/atomisp/pci/sh_css.c | 77 +- 5 files changed, 489 insertions(+), 518 deletions(-)
drivers/staging/media/atomisp/pci/hmm/hmm.c +3 -3
@@ -268,9 +268,9 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,if (attrs &ATOMISP_MAP_FLAG_CLEARED )hmm_set (bo->start,0 , bytes); -dev_dbg (atomisp_dev, -"%s: pages: 0x%08x (%ld bytes), type: %d from highmem %d, user ptr %p, cached %d\n" , - __func__, bo->start, bytes, type, from_highmem, userptr, cached); +dev_dbg (atomisp_dev, +"%s: pages: 0x%08x (%ld bytes), type: %d from highmem %d, user ptr %p, cached %d\n" , + __func__, bo->start, bytes, type, from_highmem, userptr, cached);return bo->start;
drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c +455 -462
1,009 lines not on this page · raw message
drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c +1 -2
@@ -385,8 +385,7 @@ int ia_css_bufq_enqueue_psys_event(u8 evt_payload_1, uint8_t evt_payload_2) { - - int error = 0; + int error = 0;ia_css_queue_t *q;IA_CSS_ENTER_PRIVATE ("evt_id=%d" , evt_id);
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +2 -2
@@ -2127,9 +2127,9 @@ void ia_css_debug_dump_isys_state(void)input_system_get_state (INPUT_SYSTEM0_ID , &state);#ifndef ISP2401 -debug_print_isys_state (&state); +debug_print_isys_state (&state);#else -input_system_dump_state (INPUT_SYSTEM0_ID , &state); +input_system_dump_state (INPUT_SYSTEM0_ID , &state);#endif }
drivers/staging/media/atomisp/pci/sh_css.c +28 -49
99 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 38/38 media: atomisp: cleanup isys_irq headers
In reply to Mauro Carvalho ChehabDon'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
--- .../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(-)
drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c +1 -2
@@ -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 );
drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h +4 -4
@@ -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) {
drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h +10 -15
@@ -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) */
drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h +0 -12
@@ -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__ */
Signature · 1 line
2.26.2
PATCH 37/38 media: atomisp: atomisp_gmin_platform: check before use
In reply to Mauro Carvalho Chehabsolve this smatch warning:
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c:842 gmin_v1p8_ctrl() warn: variable dereferenced before check 'gs' (see line 832)
By moving the check to happen before its usage.
--- drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +3 -2
@@ -829,6 +829,9 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on)int ret;int value; +if (!gs || gs->v1p8_on == on) +return 0 ; +if (gs->v1p8_gpio >=0 ) {pr_info ("atomisp_gmin_platform: 1.8v power on GPIO %d\n" , gs->v1p8_gpio);
@@ -839,8 +842,6 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on)pr_err ("V1P8 GPIO initialization failed\n" ); } -if (!gs || gs->v1p8_on == on) -return 0 ; gs->v1p8_on = on;if (gs->v1p8_gpio >=0 )
Signature · 1 line
2.26.2
PATCH 32/38 media: atomisp: de-duplicate names at *_input_system_global.h
In reply to Mauro Carvalho ChehabThere are some duplicated names between the ISP2401 and ISP2400 for the input system, with different meanings.
In order to avoid ubiquity, let's prepend those with the name of the ISP.
--- .../pci/css_2401_system/ibuf_ctrl_global.h | 6 +- .../pci/css_2401_system/pixelgen_global.h | 8 +-- .../hive_isp_css_common/host/input_system.c | 12 ++-- .../atomisp/pci/isp2400_input_system_global.h | 14 ++--- .../atomisp/pci/isp2400_input_system_local.h | 8 +-- .../atomisp/pci/isp2401_input_system_global.h | 6 +- .../pci/runtime/isys/interface/ia_css_isys.h | 4 +- .../media/atomisp/pci/runtime/isys/src/rx.c | 2 +- .../pci/runtime/isys/src/virtual_isys.c | 56 +++++++++---------- 9 files changed, 58 insertions(+), 58 deletions(-)
drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h +3 -3
@@ -33,7 +33,7 @@#define _IBUF_CNTRL_DMA_SYNC_WAIT_FOR_SYNC 1#define _IBUF_CNTRL_DMA_SYNC_FSM_WAIT_FOR_ACK (0x3 << 1) -struct ib_buffer_s { +struct isp2401_ib_buffer_s {u32 start_addr;/* start address of the buffer in the * "input-buffer hardware block" */
@@ -41,7 +41,7 @@ struct ib_buffer_s {u32 stride;/* stride per buffer line (in bytes) */ u32 lines;/* lines in the buffer */ }; -typedef struct ib_buffer_s ib_buffer_t ; +typedef struct isp2401_ib_buffer_s isp2401_ib_buffer_t ;typedef struct ibuf_ctrl_cfg_s ibuf_ctrl_cfg_t ;struct ibuf_ctrl_cfg_s {
@@ -58,7 +58,7 @@ struct ibuf_ctrl_cfg_s {u32 elems_per_word_in_dest; } dma_cfg; -ib_buffer_t ib_buffer; +isp2401_ib_buffer_t ib_buffer;struct {u32 stride;
drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h +4 -4
@@ -24,8 +24,8 @@/* * Duplicates "sync_generator_cfg_t" in "input_system_global.h". */ -typedef struct sync_generator_cfg_s sync_generator_cfg_t ; -struct sync_generator_cfg_s { +typedef struct isp2401_sync_generator_cfg_s isp2401_sync_generator_cfg_t ; +struct isp2401_sync_generator_cfg_s {u32 hblank_cycles;u32 vblank_cycles;u32 pixels_per_clock;
@@ -72,7 +72,7 @@ struct pixelgen_tpg_cfg_s {s32 v_delta;/* vertical delta? */ } delta_cfg; -sync_generator_cfg_t sync_gen_cfg; +isp2401_sync_generator_cfg_t sync_gen_cfg; };/*
@@ -84,7 +84,7 @@ struct pixelgen_prbs_cfg_s {s32 seed0;s32 seed1; -sync_generator_cfg_t sync_gen_cfg; +isp2401_sync_generator_cfg_t sync_gen_cfg; };/* end of Pixel-generator: TPG. ("pixelgen_global.h") */
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c +6 -6
@@ -30,7 +30,7 @@#define ZERO (0x0)#define ONE (1U) -static const ib_buffer_t IB_BUFFER_NULL = {0 ,0 ,0 }; +static const isp2400_ib_buffer_t IB_BUFFER_NULL = {0 ,0 ,0 };static input_system_err_t input_system_configure_channel (const channel_cfg_t channel);
@@ -48,12 +48,12 @@ static void input_system_network_rst(const input_system_ID_t ID);static void capture_unit_configure (const input_system_ID_t ID ,const sub_system_ID_t sub_id, -const ib_buffer_t *const cfg); +const isp2400_ib_buffer_t *const cfg);static void acquisition_unit_configure (const input_system_ID_t ID ,const sub_system_ID_t sub_id, -const ib_buffer_t *const cfg); +const isp2400_ib_buffer_t *const cfg); static void ctrl_unit_configure( const input_system_ID_t ID,
@@ -953,7 +953,7 @@ static input_system_err_t input_buffer_configuration(void)u32 current_address =0 ;u32 unallocated_memory =IB_CAPACITY_IN_WORDS ; -ib_buffer_t candidate_buffer_acq =IB_BUFFER_NULL ; +isp2400_ib_buffer_t candidate_buffer_acq =IB_BUFFER_NULL ;u32 size_requested;input_system_config_flags_t acq_already_specified =INPUT_SYSTEM_CFG_FLAG_RESET ;input_system_csi_port_t port;
@@ -1062,7 +1062,7 @@ static input_system_err_t input_buffer_configuration(void)static void capture_unit_configure (const input_system_ID_t ID ,const sub_system_ID_t sub_id, -const ib_buffer_t *const cfg) +const isp2400_ib_buffer_t *const cfg) {assert (ID <N_INPUT_SYSTEM_ID ); assert(/*(sub_id >= CAPTURE_UNIT0_ID) &&*/ (sub_id <=
@@ -1088,7 +1088,7 @@ static void capture_unit_configure(static void acquisition_unit_configure (const input_system_ID_t ID ,const sub_system_ID_t sub_id, -const ib_buffer_t *const cfg) +const isp2400_ib_buffer_t *const cfg) {assert (ID <N_INPUT_SYSTEM_ID );assert (sub_id ==ACQUISITION_UNIT0_ID );
drivers/staging/media/atomisp/pci/isp2400_input_system_global.h +7 -7
@@ -75,13 +75,13 @@ typedef enum {N_INPUT_SYSTEM_BUFFERING_MODE } buffering_mode_t; -typedef struct input_system_cfg_s input_system_cfg_t ; +typedef struct isp2400_input_system_cfg_s input_system_cfg_t ;typedef struct sync_generator_cfg_s sync_generator_cfg_t ;typedef struct tpg_cfg_s tpg_cfg_t ;typedef struct prbs_cfg_s prbs_cfg_t ;/* MW: uint16_t should be sufficient */ -struct input_system_cfg_s { +struct isp2400_input_system_cfg_s {u32 no_side_band;u32 fmt_type;u32 ch_id;
@@ -118,7 +118,7 @@ struct gpfifo_cfg_s {typedef struct gpfifo_cfg_s gpfifo_cfg_t ;//ALX:Commented out to pass the compilation. -//typedef struct input_system_cfg_s input_system_cfg_t; +//typedef struct isp2400_input_system_cfg_s input_system_cfg_t; struct ib_buffer_s {u32 mem_reg_size;
@@ -126,13 +126,13 @@ struct ib_buffer_s {u32 mem_reg_addr; }; -typedef struct ib_buffer_s ib_buffer_t ; +typedef struct ib_buffer_s isp2400_ib_buffer_t ;struct csi_cfg_s {u32 csi_port;buffering_mode_t buffering_mode; -ib_buffer_t csi_buffer; -ib_buffer_t acquisition_buffer; +isp2400_ib_buffer_t csi_buffer; +isp2400_ib_buffer_t acquisition_buffer;u32 nof_xmem_buffers; };
@@ -144,6 +144,6 @@ typedef enum {INPUT_SYSTEM_CFG_FLAG_BLOCKED =1U <<1 ,INPUT_SYSTEM_CFG_FLAG_REQUIRED =1U <<2 , INPUT_SYSTEM_CFG_FLAG_CONFLICT = 1U << 3 // To mark a conflicting configuration. -} input_system_cfg_flag_t; +} isp2400_input_system_cfg_flag_t;typedef u32 input_system_config_flags_t ;
drivers/staging/media/atomisp/pci/isp2400_input_system_local.h +4 -4
@@ -52,8 +52,8 @@ typedef struct input_switch_cfg_channel_s input_switch_cfg_channel_t;typedef struct input_switch_cfg_s input_switch_cfg_t ;struct ctrl_unit_cfg_s { -ib_buffer_t buffer_mipi[N_CAPTURE_UNIT_ID ]; -ib_buffer_t buffer_acquire[N_ACQUISITION_UNIT_ID ]; +isp2400_ib_buffer_t buffer_mipi[N_CAPTURE_UNIT_ID ]; +isp2400_ib_buffer_t buffer_acquire[N_ACQUISITION_UNIT_ID ]; };struct input_system_network_cfg_s {
@@ -128,9 +128,9 @@ struct input_system_cfg2400_s {// Possible another struct for ib. // This buffers set at the end, based on the all configurations. -ib_buffer_t csi_buffer[N_CSI_PORTS ]; +isp2400_ib_buffer_t csi_buffer[N_CSI_PORTS ];input_system_config_flags_t csi_buffer_flags[N_CSI_PORTS ]; -ib_buffer_t acquisition_buffer_unique; +isp2400_ib_buffer_t acquisition_buffer_unique;input_system_config_flags_t acquisition_buffer_unique_flags;u32 unallocated_ib_mem_words;// Used for check.DEFAULT = IB_CAPACITY_IN_WORDS. //uint32_t acq_allocated_ib_mem_words;
drivers/staging/media/atomisp/pci/isp2401_input_system_global.h +3 -3
@@ -55,7 +55,7 @@ struct input_system_channel_s {stream2mmio_sid_ID_t stream2mmio_sid_id;ibuf_ctrl_ID_t ibuf_ctrl_id; -ib_buffer_t ib_buffer; +isp2401_ib_buffer_t ib_buffer;isys2401_dma_ID_t dma_id;isys2401_dma_channel dma_channel;
@@ -105,8 +105,8 @@ struct input_system_input_port_cfg_s { } pixelgen_cfg; }; -typedef struct input_system_cfg_s input_system_cfg_t ; -struct input_system_cfg_s { +typedef struct isp2401_input_system_cfg_s isp2401_input_system_cfg_t ; +struct isp2401_input_system_cfg_s {input_system_input_port_ID_t input_port_id;input_system_source_type_t mode;
drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h +2 -2
@@ -28,7 +28,7 @@/** * Virtual Input System. (Input System 2401) */ -typedef input_system_cfg_t ia_css_isys_descr_t ; +typedef isp2401_input_system_cfg_t ia_css_isys_descr_t ;/* end of Virtual Input System */ #endif
@@ -71,7 +71,7 @@ int ia_css_isys_csi_rx_unregister_stream(int ia_css_isys_convert_compressed_format (struct ia_css_csi2_compression *comp, -struct input_system_cfg_s *cfg); +struct isp2401_input_system_cfg_s *cfg);unsigned int ia_css_csi2_calculate_input_system_alignment (enum atomisp_input_format fmt_type);#endif
drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c +1 -1
@@ -376,7 +376,7 @@ static mipi_predictor_t sh_css_csi2_compression_type_2_mipi_predictor(int ia_css_isys_convert_compressed_format (struct ia_css_csi2_compression *comp, -struct input_system_cfg_s *cfg) +struct isp2401_input_system_cfg_s *cfg) {int err =0 ;
drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c +28 -28
207 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 31/38 media: atomisp: unify INPUT error return type
In reply to Mauro Carvalho ChehabThere is a typedef for INPUT errors. This is different between ISP2401 and ISP2400. Place both at the same struct, at the global header file.
--- .../pci/css_2401_system/ibuf_ctrl_global.h | 2 +- .../hive_isp_css_common/host/input_system.c | 56 +++++++++---------- .../media/atomisp/pci/input_system_global.h | 22 ++++++++ .../atomisp/pci/isp2400_input_system_global.h | 7 --- .../atomisp/pci/isp2400_input_system_local.h | 9 --- .../atomisp/pci/isp2400_input_system_public.h | 22 ++++---- .../atomisp/pci/isp2401_input_system_global.h | 19 ------- .../atomisp/pci/isp2401_input_system_local.h | 2 - .../pci/runtime/isys/interface/ia_css_isys.h | 2 +- .../atomisp/pci/runtime/isys/src/isys_init.c | 6 +- 10 files changed, 66 insertions(+), 81 deletions(-)
drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h +1 -1
@@ -33,7 +33,6 @@#define _IBUF_CNTRL_DMA_SYNC_WAIT_FOR_SYNC 1#define _IBUF_CNTRL_DMA_SYNC_FSM_WAIT_FOR_ACK (0x3 << 1) -typedef struct ib_buffer_s ib_buffer_t ;struct ib_buffer_s {u32 start_addr;/* start address of the buffer in the * "input-buffer hardware block"
@@ -42,6 +41,7 @@ struct ib_buffer_s {u32 stride;/* stride per buffer line (in bytes) */ u32 lines;/* lines in the buffer */ }; +typedef struct ib_buffer_s ib_buffer_t ;typedef struct ibuf_ctrl_cfg_s ibuf_ctrl_cfg_t ;struct ibuf_ctrl_cfg_s {
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c +28 -28
196 lines not on this page · raw message
drivers/staging/media/atomisp/pci/input_system_global.h +22 -0
@@ -4,8 +4,30 @@* (c) 2020 Mauro Carvalho Chehab <[email protected]> */ + +#ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ +#define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ +typedef enum { +INPUT_SYSTEM_ERR_NO_ERROR =0 , +/* ISP2401 */ +INPUT_SYSTEM_ERR_CREATE_CHANNEL_FAIL , +INPUT_SYSTEM_ERR_CONFIGURE_CHANNEL_FAIL , +INPUT_SYSTEM_ERR_OPEN_CHANNEL_FAIL , +INPUT_SYSTEM_ERR_TRANSFER_FAIL , +INPUT_SYSTEM_ERR_CREATE_INPUT_PORT_FAIL , +INPUT_SYSTEM_ERR_CONFIGURE_INPUT_PORT_FAIL , +INPUT_SYSTEM_ERR_OPEN_INPUT_PORT_FAIL , +/* ISP2400 */ +INPUT_SYSTEM_ERR_GENERIC , +INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET , +INPUT_SYSTEM_ERR_CONFLICT_ON_RESOURCE , +INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED , +}input_system_err_t ; +#ifdef ISP2401 # include "isp2401_input_system_global.h" #else # include "isp2400_input_system_global.h" #endif + +#endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/isp2400_input_system_global.h +0 -7
@@ -13,11 +13,6 @@* more details. */ -#ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ -#define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ - -#define IS_INPUT_SYSTEM_VERSION_2 -#include <type_support.h> //CSI reveiver has 3 ports.
@@ -152,5 +147,3 @@ typedef enum { } input_system_cfg_flag_t;typedef u32 input_system_config_flags_t ; - -#endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/isp2400_input_system_local.h +0 -9
@@ -33,15 +33,6 @@#include "isp_acquisition_defs.h" #include "input_system_ctrl_defs.h" -typedef enum { -INPUT_SYSTEM_ERR_NO_ERROR =0 , -INPUT_SYSTEM_ERR_GENERIC , -INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET , -INPUT_SYSTEM_ERR_CONFLICT_ON_RESOURCE , -INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED , -N_INPUT_SYSTEM_ERR -}input_system_error_t ; - typedef enum { INPUT_SYSTEM_PORT_A = 0, INPUT_SYSTEM_PORT_B,
drivers/staging/media/atomisp/pci/isp2400_input_system_public.h +11 -11
@@ -251,11 +251,11 @@ STORAGE_CLASS_INPUT_SYSTEM_H hrt_data input_system_sub_system_reg_load(// Function that resets current configuration. // remove the argument since it should be private. -input_system_error_t input_system_configuration_reset (void ); +input_system_err_t input_system_configuration_reset (void );// Function that commits current configuration. // remove the argument since it should be private. -input_system_error_t input_system_configuration_commit (void ); +input_system_err_t input_system_configuration_commit (void );/////////////////////////////////////////////////////////////////////////// //
@@ -269,14 +269,14 @@ input_system_error_t input_system_configuration_commit(void);// FIFO channel config function user -input_system_error_t input_system_csi_fifo_channel_cfg ( +input_system_err_t input_system_csi_fifo_channel_cfg (u32 ch_id,input_system_csi_port_t port,backend_channel_cfg_t backend_ch,target_cfg2400_t target ); -input_system_error_t input_system_csi_fifo_channel_with_counting_cfg( +input_system_err_t input_system_csi_fifo_channel_with_counting_cfg( u32 ch_id, u32 nof_frame, input_system_csi_port_t port,
@@ -288,7 +288,7 @@ input_system_error_t input_system_csi_fifo_channel_with_counting_cfg(// SRAM channel config function user -input_system_error_t input_system_csi_sram_channel_cfg( +input_system_err_t input_system_csi_sram_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch,
@@ -299,7 +299,7 @@ input_system_error_t input_system_csi_sram_channel_cfg(//XMEM channel config function user -input_system_error_t input_system_csi_xmem_channel_cfg( +input_system_err_t input_system_csi_xmem_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch,
@@ -311,7 +311,7 @@ input_system_error_t input_system_csi_xmem_channel_cfg(uint32_t nof_xmem_buffers ); -input_system_error_t input_system_csi_xmem_capture_only_channel_cfg( +input_system_err_t input_system_csi_xmem_capture_only_channel_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port,
@@ -322,7 +322,7 @@ input_system_error_t input_system_csi_xmem_capture_only_channel_cfg(target_cfg2400_t target ); -input_system_error_t input_system_csi_xmem_acquire_only_channel_cfg( +input_system_err_t input_system_csi_xmem_acquire_only_channel_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port,
@@ -334,7 +334,7 @@ input_system_error_t input_system_csi_xmem_acquire_only_channel_cfg(// Non - CSI channel config function user -input_system_error_t input_system_prbs_channel_cfg( +input_system_err_t input_system_prbs_channel_cfg( u32 ch_id, u32 nof_frames, u32 seed,
@@ -345,7 +345,7 @@ input_system_error_t input_system_prbs_channel_cfg(target_cfg2400_t target ); -input_system_error_t input_system_tpg_channel_cfg( +input_system_err_t input_system_tpg_channel_cfg( u32 ch_id, u32 nof_frames,//not used yet u32 x_mask,
@@ -360,7 +360,7 @@ input_system_error_t input_system_tpg_channel_cfg(target_cfg2400_t target ); -input_system_error_t input_system_gpfifo_channel_cfg ( +input_system_err_t input_system_gpfifo_channel_cfg (u32 ch_id,u32 nof_frames, target_cfg2400_t target
drivers/staging/media/atomisp/pci/isp2401_input_system_global.h +0 -19
@@ -13,11 +13,6 @@* more details. */ -#ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ -#define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ - -#define IS_INPUT_SYSTEM_VERSION_VERSION_2401 -/* CSI reveiver has 3 ports. */ #define N_CSI_PORTS (3)
@@ -41,18 +36,6 @@#define INPUT_SYSTEM_N_STREAM_ID 6/* maximum number of simultaneous virtual channels supported*/ -typedef enum { -INPUT_SYSTEM_ERR_NO_ERROR =0 , -INPUT_SYSTEM_ERR_CREATE_CHANNEL_FAIL , -INPUT_SYSTEM_ERR_CONFIGURE_CHANNEL_FAIL , -INPUT_SYSTEM_ERR_OPEN_CHANNEL_FAIL , -INPUT_SYSTEM_ERR_TRANSFER_FAIL , -INPUT_SYSTEM_ERR_CREATE_INPUT_PORT_FAIL , -INPUT_SYSTEM_ERR_CONFIGURE_INPUT_PORT_FAIL , -INPUT_SYSTEM_ERR_OPEN_INPUT_PORT_FAIL , -N_INPUT_SYSTEM_ERR -}input_system_err_t ; - typedef enum { INPUT_SYSTEM_SOURCE_TYPE_UNDEFINED = 0, INPUT_SYSTEM_SOURCE_TYPE_SENSOR,
@@ -203,5 +186,3 @@ struct virtual_input_system_stream_cfg_s {#define NUM_OF_LINES_PER_BUF 2#define LINES_OF_ISP_INPUT_BUF (NUM_OF_INPUT_BUF * NUM_OF_LINES_PER_BUF)#define ISP_INPUT_BUF_STRIDE SH_CSS_MAX_SENSOR_WIDTH - -#endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/isp2401_input_system_local.h +0 -2
@@ -24,8 +24,6 @@#include "isys_stream2mmio.h" #include "isys_irq.h" -typedef input_system_err_t input_system_error_t ; - typedef enum { MIPI_FORMAT_SHORT1 = 0x08, MIPI_FORMAT_SHORT2,
drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h +1 -1
@@ -32,7 +32,7 @@ typedef input_system_cfg_t ia_css_isys_descr_t;/* end of Virtual Input System */ #endif -input_system_error_t ia_css_isys_init (void ); +input_system_err_t ia_css_isys_init (void );void ia_css_isys_uninit (void );enum mipi_port_id ia_css_isys_port_to_mipi_port (enum mipi_port_id api_port);
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c +3 -3
@@ -24,7 +24,7 @@#endif #if !defined(ISP2401 ) -input_system_error_t ia_css_isys_init (void ) +input_system_err_t ia_css_isys_init (void ) {backend_channel_cfg_t backend_ch0;backend_channel_cfg_t backend_ch1;
@@ -32,7 +32,7 @@ input_system_error_t ia_css_isys_init(void)target_cfg2400_t targetC;u32 acq_mem_region_size =24 ;u32 acq_nof_mem_regions =2 ; -input_system_error_t error =INPUT_SYSTEM_ERR_NO_ERROR ; +input_system_err_t error =INPUT_SYSTEM_ERR_NO_ERROR ;memset (&backend_ch0,0 ,sizeof (backend_channel_cfg_t));memset (&backend_ch1,0 ,sizeof (backend_channel_cfg_t));
@@ -87,7 +87,7 @@ input_system_error_t ia_css_isys_init(void) return error; }#elif defined(ISP2401) -input_system_error_t ia_css_isys_init (void ) +input_system_err_t ia_css_isys_init (void ) {ia_css_isys_csi_rx_lut_rmgr_init ();ia_css_isys_ibuf_rmgr_init ();
Signature · 1 line
2.26.2
PATCH 25/38 media: atomisp: get rid of some unused code
In reply to Mauro Carvalho ChehabNow 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.
--- .../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(-)
drivers/staging/media/atomisp/pci/ia_css_mipi.h +0 -2
@@ -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. *
drivers/staging/media/atomisp/pci/ia_css_stream.h +2 -2
@@ -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;
drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h +0 -7
@@ -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 */
drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c +0 -145
162 lines not on this page · raw message
drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c +0 -144
161 lines not on this page · raw message
drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c +0 -53
73 lines not on this page · raw message
drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h +0 -7
@@ -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 */
drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c +0 -31
@@ -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 }
drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h +1 -5
@@ -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)
drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c +0 -23
@@ -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 }
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +7 -15
@@ -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;
drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c +0 -10
@@ -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) */
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c +0 -2
@@ -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
drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c +0 -10
@@ -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 ; }
drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c +0 -2
@@ -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);
drivers/staging/media/atomisp/pci/sh_css.c +16 -77
363 lines not on this page · raw message
drivers/staging/media/atomisp/pci/sh_css_hrt.c +0 -4
@@ -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
drivers/staging/media/atomisp/pci/sh_css_internal.h +4 -4
@@ -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,
drivers/staging/media/atomisp/pci/sh_css_mipi.c +1 -1
@@ -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) {
drivers/staging/media/atomisp/pci/sh_css_params.c +0 -5
@@ -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 ,
drivers/staging/media/atomisp/pci/sh_css_properties.c +0 -10
@@ -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 }
drivers/staging/media/atomisp/pci/sh_css_sp.c +2 -17
@@ -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
drivers/staging/media/atomisp/pci/sh_css_sp.h +0 -2
@@ -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. */
Signature · 1 line
2.26.2
PATCH 26/38 media: atomisp: cleanup ifdefs from ia_css_debug.c
In reply to Mauro Carvalho ChehabThere 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.
--- .../runtime/debug/interface/ia_css_debug.h | 6 - .../pci/runtime/debug/src/ia_css_debug.c | 187 ++++-------------- 2 files changed, 42 insertions(+), 151 deletions(-)
drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h +0 -6
@@ -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
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +42 -145
410 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 22/38 media: dvb-ttusb-budget: cleanup printk logic
In reply to Mauro Carvalho ChehabInstead of calling printk(), use pr_foo() macros.
While here, do some cleanup at the printed messages, as some has __func__, while others have the module name (sometimes spelled as "ttusb_dvb").
--- .../media/usb/ttusb-budget/dvb-ttusb-budget.c | 118 ++++++++---------- 1 file changed, 52 insertions(+), 66 deletions(-)
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c +52 -66
@@ -5,6 +5,9 @@* Copyright (c) 2002 Holger Waechtler <[email protected]> * Copyright (c) 2003 Felix Domke <[email protected]> */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/init.h> #include <linux/slab.h> #include <linux/wait.h>
@@ -59,7 +62,12 @@ MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");DVB_DEFINE_MOD_OPT_ADAPTER_NR (adapter_nr); -#define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0) +#define dprintk(fmt, arg...) do { \ + if (debug) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) +#define ISO_BUF_COUNT 4#define FRAMES_PER_ISO_BUF 4
@@ -139,20 +147,19 @@ static int ttusb_cmd(struct ttusb *ttusb, u8 *data, int len, int len_result)return -EAGAIN ;if (debug >=3 ) -printk (KERN_DEBUG "> %*ph\n" , len, data); +dprintk ("> %*ph\n" , len, data);memcpy (data, ttusb->send_buf, len); err =usb_bulk_msg (ttusb->dev, ttusb->bulk_out_pipe, ttusb->send_buf, len, &actual_len,1000 );if (err !=0 ) { -dprintk ("%s: usb_bulk_msg(send) failed, err == %i!\n" , - __func__, err); +dprintk ("usb_bulk_msg(send) failed, err == %i!\n" , err); goto err; }if (actual_len != len) { err = -EIO ; -dprintk ("%s: only wrote %d of %d bytes\n" , __func__, +dprintk ("only wrote %d of %d bytes\n" , actual_len, len); goto err; }
@@ -161,14 +168,13 @@ static int ttusb_cmd(struct ttusb *ttusb, u8 *data, int len, int len_result) ttusb->last_result, MAX_RCV, &actual_len, 1000);if (err !=0 ) { -printk ("%s: failed, receive error %d\n" , __func__, - err); +pr_err ("cmd xter failed, receive error %d\n" , err); goto err; }if (debug >=3 ) { actual_len = ttusb->last_result[3 ] +4 ; -printk (KERN_DEBUG "< %*ph\n" , actual_len, ttusb->last_result); +dprintk ("< %*ph\n" , actual_len, ttusb->last_result); }if (len_result)
@@ -212,9 +218,8 @@ static int ttusb_i2c_msg(struct ttusb *ttusb,if (rcv_len >0 ) {if (err || b[0 ] !=0x55 || b[1 ] != id) { -dprintk - ("%s: usb_bulk_msg(recv) failed, err == %i, id == %02x, b == " , - __func__, err, id); +dprintk ("usb_bulk_msg(recv) failed, err == %i, id == %02x, b == " , + err, id);return -EREMOTEIO ; }
@@ -258,7 +263,7 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num snd_buf, snd_len, rcv_buf, rcv_len);if (err < rcv_len) { -dprintk ("%s: i == %i\n" , __func__, i); +dprintk ("i == %i\n" , i);break ; }
@@ -278,7 +283,7 @@ static int ttusb_boot_dsp(struct ttusb *ttusb) err =request_firmware (&fw,"ttusb-budget/dspbootcode.bin" , &ttusb->dev->dev);if (err) { -printk (KERN_ERR "ttusb-budget: failed to request firmware\n" ); +pr_err ("failed to request firmware\n" );return err; }
@@ -318,8 +323,7 @@ static int ttusb_boot_dsp(struct ttusb *ttusb) done:release_firmware (fw);if (err) { -dprintk ("%s: usb_bulk_msg() failed, return value %i!\n" , - __func__, err); +dprintk ("usb_bulk_msg() failed, return value %i!\n" , err); }return err;
@@ -413,18 +417,16 @@ static int ttusb_init_controller(struct ttusb *ttusb) sizeof(get_version), sizeof(get_version))))return err; -dprintk ("%s: stc-version: %c%c%c%c%c\n" , __func__, - get_version[4 ], get_version[5 ], get_version[6 ], - get_version[7 ], get_version[8 ]); +dprintk ("stc-version: %c%c%c%c%c\n" , get_version[4 ], get_version[5 ], + get_version[6 ], get_version[7 ], get_version[8 ]);if (memcmp (get_version +4 ,"V 0.0" ,5 ) &&memcmp (get_version +4 ,"V 1.1" ,5 ) &&memcmp (get_version +4 ,"V 2.1" ,5 ) &&memcmp (get_version +4 ,"V 2.2" ,5 )) { -printk - ("%s: unknown STC version %c%c%c%c%c, please report!\n" , - __func__, get_version[4 ], get_version[5 ], - get_version[6 ], get_version[7 ], get_version[8 ]); +pr_err ("unknown STC version %c%c%c%c%c, please report!\n" , + get_version[4 ], get_version[5 ], + get_version[6 ], get_version[7 ], get_version[8 ]); } ttusb->revision = ((get_version[6] - '0') << 4) |
@@ -436,7 +438,7 @@ static int ttusb_init_controller(struct ttusb *ttusb)if (err)return err; -printk ("%s: dsp-version: %c%c%c\n" , __func__, +pr_info ("dsp-version: %c%c%c\n" , get_dsp_version[4 ], get_dsp_version[5 ], get_dsp_version[6 ]);return 0 ; }
@@ -458,8 +460,7 @@ static int ttusb_send_diseqc(struct dvb_frontend* fe,/* Diseqc */ if ((err =ttusb_cmd (ttusb, b,4 + b[3 ],0 ))) { -dprintk ("%s: usb_bulk_msg() failed, return value %i!\n" , - __func__, err); +dprintk ("usb_bulk_msg() failed, return value %i!\n" , err); }return err;
@@ -476,8 +477,7 @@ static int ttusb_update_lnb(struct ttusb *ttusb)/* SetLNB */ if ((err =ttusb_cmd (ttusb, b,sizeof (b),0 ))) { -dprintk ("%s: usb_bulk_msg() failed, return value %i!\n" , - __func__, err); +dprintk ("usb_bulk_msg() failed, return value %i!\n" , err); }return err;
@@ -511,8 +511,7 @@ static void ttusb_set_led_freq(struct ttusb *ttusb, u8 freq) err =ttusb_cmd (ttusb, b,sizeof (b),0 );if (err) { -dprintk ("%s: usb_bulk_msg() failed, return value %i!\n" , - __func__, err); +dprintk ("usb_bulk_msg() failed, return value %i!\n" , err); } }#endif
@@ -536,7 +535,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack,int i;if (len <4 || len &0x1 ) { -pr_warn ("%s: muxpack has invalid len %d\n" , __func__, len); +pr_warn ("muxpack has invalid len %d\n" , len); numinvalid++;return ; }
@@ -544,8 +543,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack,for (i =0 ; i < len; i +=2 ) csum ^=le16_to_cpup ((__le16 *) (muxpack + i));if (csum) { -printk ("%s: muxpack with incorrect checksum, ignoring\n" , - __func__); +pr_warn ("muxpack with incorrect checksum, ignoring\n" ); numinvalid++;return ; }
@@ -553,8 +551,8 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, cc = (muxpack[len -4 ] <<8 ) | muxpack[len -3 ]; cc &=0x7FFF ;if ((cc != ttusb->cc) && (ttusb->cc !=-1 )) -printk ("%s: cc discontinuity (%d frames missing)\n" , - __func__, (cc - ttusb->cc) &0x7FFF ); +pr_warn ("cc discontinuity (%d frames missing)\n" , + (cc - ttusb->cc) &0x7FFF ); ttusb->cc = (cc +1 ) &0x7FFF ;if (muxpack[0 ] &0x80 ) {#ifdef TTUSB_HWSECTIONS
@@ -575,7 +573,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, !!(ttusb->muxpack[1] & 1)) data++;#warning TODO: pusi -printk ("cc: %04x\n" , (data[0 ] <<8 ) | data[1 ]); +dprintk ("cc: %04x\n" , (data[0 ] <<8 ) | data[1 ]);#endif numsec++; }else if (muxpack[0 ] ==0x47 ) {
@@ -594,7 +592,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack,dvb_dmx_swfilter_packets (&ttusb->dvb_demux, muxpack,1 ); }else if (muxpack[0 ] !=0 ) { numinvalid++; -printk ("illegal muxpack type %02x\n" , muxpack[0 ]); +pr_err ("illegal muxpack type %02x\n" , muxpack[0 ]); }else numstuff++; }
@@ -604,7 +602,7 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len)int maxwork =1024 ;while (len) {if (!(maxwork--)) { -printk ("%s: too much work\n" , __func__); +pr_err ("too much work\n" );break ; }
@@ -618,10 +616,7 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len)else { ttusb->mux_state =0 ;if (ttusb->insync) { -dprintk ("%s: %02x\n" , - __func__, data[-1 ]); -printk (KERN_INFO "%s: lost sync.\n" , - __func__); +pr_info ("lost sync.\n" ); ttusb->insync =0 ; } }
@@ -677,10 +672,8 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len) ttusb->muxpack[1 ] +2 +4 ; else { -dprintk - ("%s: invalid state: first byte is %x\n" , - __func__, - ttusb->muxpack[0 ]); +dprintk ("invalid state: first byte is %x\n" , + ttusb->muxpack[0 ]); ttusb->mux_state =0 ; } }
@@ -729,12 +722,6 @@ static void ttusb_iso_irq(struct urb *urb)if (!ttusb->iso_streaming)return ; -#if 0 -printk ("%s: status %d, errcount == %d, length == %i\n" , - __func__, - urb->status, urb->error_count, urb->actual_length); -#endif -if (!urb->status) {for (i =0 ; i < urb->number_of_packets; ++i) { numpkt++;
@@ -807,7 +794,7 @@ static int ttusb_start_iso_xfer(struct ttusb *ttusb)int i, j, err, buffer_offset =0 ;if (ttusb->iso_streaming) { -printk ("%s: iso xfer already running!\n" , __func__); +pr_err ("iso xfer already running!\n" );return 0 ; }
@@ -841,9 +828,8 @@ static int ttusb_start_iso_xfer(struct ttusb *ttusb)for (i =0 ; i <ISO_BUF_COUNT ; i++) {if ((err =usb_submit_urb (ttusb->iso_urb[i],GFP_ATOMIC ))) {ttusb_stop_iso_xfer (ttusb); -printk - ("%s: failed urb submission (%i: err = %i)!\n" , - __func__, i, err); +pr_err ("failed urb submission (%i: err = %i)!\n" , + i, err);return err; } }
@@ -1403,7 +1389,7 @@ static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe)if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl (fe,1 );if (i2c_transfer (&ttusb->i2c_adap, &tuner_msg,1 ) !=1 ) { -printk ("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 1\n" ); +pr_err ("dvbc_philips_tdm1316l_pll_set Error 1\n" );return -EIO ; }
@@ -1412,7 +1398,7 @@ static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe)if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl (fe,1 );if (i2c_transfer (&ttusb->i2c_adap, &tuner_msg,1 ) !=1 ) { -printk ("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 2\n" ); +pr_err ("dvbc_philips_tdm1316l_pll_set Error 2\n" );return -EIO ; }
@@ -1589,12 +1575,12 @@ static void frontend_init(struct ttusb* ttusb) }if (ttusb->fe ==NULL ) { -printk ("dvb-ttusb-budget: A frontend driver was not found for device [%04x:%04x]\n" , +pr_err ("no frontend driver found for device [%04x:%04x]\n" ,le16_to_cpu (ttusb->dev->descriptor.idVendor),le16_to_cpu (ttusb->dev->descriptor.idProduct)); }else {if (dvb_register_frontend (&ttusb->adapter, ttusb->fe)) { -printk ("dvb-ttusb-budget: Frontend registration failed!\n" ); +pr_err ("Frontend registration failed!\n" );dvb_frontend_detach (ttusb->fe); ttusb->fe =NULL ; }
@@ -1614,7 +1600,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *istruct ttusb *ttusb;int result; -dprintk ("%s: TTUSB DVB connected\n" , __func__); +dprintk ("TTUSB DVB connected\n" ); udev =interface_to_usbdev (intf);
@@ -1636,14 +1622,14 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i result =ttusb_alloc_iso_urbs (ttusb);if (result <0 ) { -dprintk ("%s: ttusb_alloc_iso_urbs - failed\n" , __func__); +dprintk ("ttusb_alloc_iso_urbs - failed\n" );mutex_unlock (&ttusb->semi2c);kfree (ttusb);return result; }if (ttusb_init_controller (ttusb)) -printk ("ttusb_init_controller: error\n" ); +pr_err ("ttusb_init_controller: error\n" );mutex_unlock (&ttusb->semi2c);
@@ -1688,7 +1674,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i result =dvb_dmx_init (&ttusb->dvb_demux);if (result <0 ) { -printk ("ttusb_dvb: dvb_dmx_init failed (errno = %d)\n" , result); +pr_err ("dvb_dmx_init failed (errno = %d)\n" , result); result = -ENODEV ; goto err_i2c_del_adapter; }
@@ -1699,14 +1685,14 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i result =dvb_dmxdev_init (&ttusb->dmxdev, &ttusb->adapter);if (result <0 ) { -printk ("ttusb_dvb: dvb_dmxdev_init failed (errno = %d)\n" , +pr_err ("dvb_dmxdev_init failed (errno = %d)\n" , result); result = -ENODEV ; goto err_release_dmx; }if (dvb_net_init (&ttusb->adapter, &ttusb->dvbnet, &ttusb->dvb_demux.dmx)) { -printk ("ttusb_dvb: dvb_net_init failed!\n" ); +pr_err ("dvb_net_init failed!\n" ); result = -ENODEV ; goto err_release_dmxdev; }
@@ -1755,7 +1741,7 @@ static void ttusb_disconnect(struct usb_interface *intf)kfree (ttusb); -dprintk ("%s: TTUSB DVB disconnected\n" , __func__); +dprintk ("TTUSB DVB disconnected\n" ); }static const struct usb_device_id ttusb_table[] = {
Signature · 1 line
2.26.2
PATCH 36/38 media: atomisp: csi_rx.c: add a missing includes
In reply to Mauro Carvalho ChehabDue 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?
--- 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(+)
drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c +1 -0
@@ -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*/
drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c +1 -0
@@ -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 */
Signature · 1 line
2.26.2
cover 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
Signature · 1 line
2.26.2
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.
--- .../atomisp/pci/atomisp_compat_ioctl32.c | 84 +++++++++++-------- 1 file changed, 48 insertions(+), 36 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c +48 -36
@@ -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 __userget_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 *kpassign_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 *kpassign_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 __uif (!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 ;
Signature · 1 line
2.26.2
PATCH 29/38 media: atomisp: get rid of ibuf_ctrl abstraction
In reply to Mauro Carvalho ChehabJust move the stuff there to the places where this header is included.
--- .../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
drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h +1 -0
@@ -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 ;
drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h deleted +0 -268
268 lines not on this page · raw message
drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h deleted +0 -94
94 lines not on this page · raw message
drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h deleted +0 -47
47 lines not on this page · raw message
drivers/staging/media/atomisp/pci/isp2401_input_system_global.h +1 -1
@@ -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 */
drivers/staging/media/atomisp/pci/isp2401_input_system_local.h +0 -1
@@ -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"
drivers/staging/media/atomisp/pci/isp2401_input_system_private.h +218 -6
236 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 33/38 media: atomisp: reorder functions at pixelgen_private.h
In reply to Mauro Carvalho ChehabReorder functions in order to declare before usage.
--- .../css_2401_system/host/pixelgen_private.h | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-)
drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h +37 -36
@@ -20,6 +20,43 @@#include "device_access.h" /* ia_css_device_load_uint32 */ #include "assert_support.h" /* assert */ +/***************************************************** +* +* Device level interface (DLI). +* +*****************************************************/ +/** +* @brief Load the register value. +* Refer to "pixelgen_public.h" for details. +*/ +STORAGE_CLASS_PIXELGEN_C hrt_data pixelgen_ctrl_reg_load( +const pixelgen_ID_t ID , +const hrt_address reg) +{ +assert (ID <N_PIXELGEN_ID ); +assert (PIXELGEN_CTRL_BASE [ID ] != (hrt_address) -1 ); +return ia_css_device_load_uint32 (PIXELGEN_CTRL_BASE [ID ] + reg *sizeof ( + hrt_data)); +} + +/** +* @brief Store a value to the register. +* Refer to "pixelgen_ctrl_public.h" for details. +*/ +STORAGE_CLASS_PIXELGEN_C void pixelgen_ctrl_reg_store( +const pixelgen_ID_t ID , +const hrt_address reg, +const hrt_data value) +{ +assert (ID <N_PIXELGEN_ID ); +assert (PIXELGEN_CTRL_BASE [ID ] != (hrt_address)-1 ); + +ia_css_device_store_uint32 (PIXELGEN_CTRL_BASE [ID ] + reg *sizeof (hrt_data), + value); +} + +/* end of DLI */ +/***************************************************** * * Native command interface (NCI).
@@ -144,40 +181,4 @@ STORAGE_CLASS_PIXELGEN_C void pixelgen_ctrl_dump_state( }/* end of NCI */ -/***************************************************** -* -* Device level interface (DLI). -* -*****************************************************/ -/** -* @brief Load the register value. -* Refer to "pixelgen_public.h" for details. -*/ -STORAGE_CLASS_PIXELGEN_C hrt_data pixelgen_ctrl_reg_load( -const pixelgen_ID_t ID , -const hrt_address reg) -{ -assert (ID <N_PIXELGEN_ID ); -assert (PIXELGEN_CTRL_BASE [ID ] != (hrt_address) -1 ); -return ia_css_device_load_uint32 (PIXELGEN_CTRL_BASE [ID ] + reg *sizeof ( - hrt_data)); -} - -/** -* @brief Store a value to the register. -* Refer to "pixelgen_ctrl_public.h" for details. -*/ -STORAGE_CLASS_PIXELGEN_C void pixelgen_ctrl_reg_store( -const pixelgen_ID_t ID , -const hrt_address reg, -const hrt_data value) -{ -assert (ID <N_PIXELGEN_ID ); -assert (PIXELGEN_CTRL_BASE [ID ] != (hrt_address)-1 ); - -ia_css_device_store_uint32 (PIXELGEN_CTRL_BASE [ID ] + reg *sizeof (hrt_data), - value); -} - -/* end of DLI */ #endif /* __PIXELGEN_PRIVATE_H_INCLUDED__ */
Signature · 1 line
2.26.2
PATCH 30/38 media: atomisp: don't check for ISP version for includes
In reply to Mauro Carvalho ChehabAs 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.
--- drivers/staging/media/atomisp/Makefile | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/staging/media/atomisp/Makefile +2 -10
@@ -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
Signature · 1 line
2.26.2
PATCH 14/38 media: vivid: move the devnode creation logic to a separate function
In reply to Mauro Carvalho ChehabIn order to reduce even further the size of the big vivid_create_instance() function, let's place the part of the logic which creates the device nodes into a separate function.
With this and the past patches, those warnings finally vanishes:
drivers/media/test-drivers/vivid/vivid-core.c: drivers/media/test-drivers/vivid/vivid-core.c:1189 vivid_create_instance() parse error: turning off implications after 60 seconds drivers/media/test-drivers/vivid/vivid-core.c: drivers/media/test-drivers/vivid/vivid-core.c:1257 vivid_create_instance() parse error: __split_smt: function too hairy. Giving up after 303 seconds
The init code also seems more organized after breaking the long function into a smaller set.
--- drivers/media/test-drivers/vivid/vivid-core.c | 670 +++++++++--------- 1 file changed, 344 insertions(+), 326 deletions(-)
drivers/media/test-drivers/vivid/vivid-core.c +344 -326
@@ -1306,6 +1306,346 @@ static int vivid_create_queues(struct vivid_dev *dev)return 0 ; } +static int vivid_create_devnodes (struct platform_device *pdev, +struct vivid_dev *dev,int inst, +unsigned int cec_tx_bus_cnt, +v4l2_std_id tvnorms_cap, +v4l2_std_id tvnorms_out, +unsigned in_type_counter[4 ], +unsigned out_type_counter[4 ]) +{ +struct video_device *vfd; +int ret, i; + +if (dev->has_vid_cap) { + vfd = &dev->vid_cap_dev; +snprintf (vfd->name,sizeof (vfd->name), +"vivid-%03d-vid-cap" , inst); + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->vid_cap_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_vid_cap_q; + vfd->tvnorms = tvnorms_cap; + +/* +* Provide a mutex to v4l2 core. It will be used to protect +* all fops and v4l2 ioctls. +*/ + vfd->lock = &dev->mutex; +video_set_drvdata (vfd, dev); + +#ifdef CONFIG_MEDIA_CONTROLLER + dev->vid_cap_pad.flags =MEDIA_PAD_FL_SINK ; + ret =media_entity_pads_init (&vfd->entity,1 , &dev->vid_cap_pad); +if (ret) +return ret; +#endif + +#ifdef CONFIG_VIDEO_VIVID_CEC +if (in_type_counter[HDMI ]) { + ret =cec_register_adapter (dev->cec_rx_adap, &pdev->dev); +if (ret <0 ) { +cec_delete_adapter (dev->cec_rx_adap); + dev->cec_rx_adap =NULL ; +return ret; + } +cec_s_phys_addr (dev->cec_rx_adap,0 , false); +v4l2_info (&dev->v4l2_dev,"CEC adapter %s registered for HDMI input 0\n" , +dev_name (&dev->cec_rx_adap->devnode.dev)); + } +#endif + + ret =video_register_device (vfd,VFL_TYPE_VIDEO , vid_cap_nr[inst]); +if (ret <0 ) +return ret; +v4l2_info (&dev->v4l2_dev,"V4L2 capture device registered as %s\n" , +video_device_node_name (vfd)); + } + +if (dev->has_vid_out) { + vfd = &dev->vid_out_dev; +snprintf (vfd->name,sizeof (vfd->name), +"vivid-%03d-vid-out" , inst); + vfd->vfl_dir =VFL_DIR_TX ; + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->vid_out_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_vid_out_q; + vfd->tvnorms = tvnorms_out; + +/* +* Provide a mutex to v4l2 core. It will be used to protect +* all fops and v4l2 ioctls. +*/ + vfd->lock = &dev->mutex; +video_set_drvdata (vfd, dev); + +#ifdef CONFIG_MEDIA_CONTROLLER + dev->vid_out_pad.flags =MEDIA_PAD_FL_SOURCE ; + ret =media_entity_pads_init (&vfd->entity,1 , &dev->vid_out_pad); +if (ret) +return ret; +#endif + +#ifdef CONFIG_VIDEO_VIVID_CEC +for (i =0 ; i < cec_tx_bus_cnt; i++) { + ret =cec_register_adapter (dev->cec_tx_adap[i], &pdev->dev); +if (ret <0 ) { +for (; i < cec_tx_bus_cnt; i++) { +cec_delete_adapter (dev->cec_tx_adap[i]); + dev->cec_tx_adap[i] =NULL ; + } +return ret; + } +v4l2_info (&dev->v4l2_dev,"CEC adapter %s registered for HDMI output %d\n" , +dev_name (&dev->cec_tx_adap[i]->devnode.dev), i); +if (i < out_type_counter[HDMI ]) +cec_s_phys_addr (dev->cec_tx_adap[i], (i +1 ) <<12 , false); +else +cec_s_phys_addr (dev->cec_tx_adap[i],0x1000 , false); + } +#endif + + ret =video_register_device (vfd,VFL_TYPE_VIDEO , vid_out_nr[inst]); +if (ret <0 ) +return ret; +v4l2_info (&dev->v4l2_dev,"V4L2 output device registered as %s\n" , +video_device_node_name (vfd)); + } + +if (dev->has_vbi_cap) { + vfd = &dev->vbi_cap_dev; +snprintf (vfd->name,sizeof (vfd->name), +"vivid-%03d-vbi-cap" , inst); + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->vbi_cap_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_vbi_cap_q; + vfd->lock = &dev->mutex; + vfd->tvnorms = tvnorms_cap; +video_set_drvdata (vfd, dev); + +#ifdef CONFIG_MEDIA_CONTROLLER + dev->vbi_cap_pad.flags =MEDIA_PAD_FL_SINK ; + ret =media_entity_pads_init (&vfd->entity,1 , &dev->vbi_cap_pad); +if (ret) +return ret; +#endif + + ret =video_register_device (vfd,VFL_TYPE_VBI , vbi_cap_nr[inst]); +if (ret <0 ) +return ret; +v4l2_info (&dev->v4l2_dev,"V4L2 capture device registered as %s, supports %s VBI\n" , +video_device_node_name (vfd), + (dev->has_raw_vbi_cap && dev->has_sliced_vbi_cap) ? +"raw and sliced" : + (dev->has_raw_vbi_cap ?"raw" :"sliced" )); + } + +if (dev->has_vbi_out) { + vfd = &dev->vbi_out_dev; +snprintf (vfd->name,sizeof (vfd->name), +"vivid-%03d-vbi-out" , inst); + vfd->vfl_dir =VFL_DIR_TX ; + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->vbi_out_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_vbi_out_q; + vfd->lock = &dev->mutex; + vfd->tvnorms = tvnorms_out; +video_set_drvdata (vfd, dev); + +#ifdef CONFIG_MEDIA_CONTROLLER + dev->vbi_out_pad.flags =MEDIA_PAD_FL_SOURCE ; + ret =media_entity_pads_init (&vfd->entity,1 , &dev->vbi_out_pad); +if (ret) +return ret; +#endif + + ret =video_register_device (vfd,VFL_TYPE_VBI , vbi_out_nr[inst]); +if (ret <0 ) +return ret; +v4l2_info (&dev->v4l2_dev,"V4L2 output device registered as %s, supports %s VBI\n" , +video_device_node_name (vfd), + (dev->has_raw_vbi_out && dev->has_sliced_vbi_out) ? +"raw and sliced" : + (dev->has_raw_vbi_out ?"raw" :"sliced" )); + } + +if (dev->has_sdr_cap) { + vfd = &dev->sdr_cap_dev; +snprintf (vfd->name,sizeof (vfd->name), +"vivid-%03d-sdr-cap" , inst); + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->sdr_cap_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_sdr_cap_q; + vfd->lock = &dev->mutex; +video_set_drvdata (vfd, dev); + +#ifdef CONFIG_MEDIA_CONTROLLER + dev->sdr_cap_pad.flags =MEDIA_PAD_FL_SINK ; + ret =media_entity_pads_init (&vfd->entity,1 , &dev->sdr_cap_pad); +if (ret) +return ret; +#endif + + ret =video_register_device (vfd,VFL_TYPE_SDR , sdr_cap_nr[inst]); +if (ret <0 ) +return ret; +v4l2_info (&dev->v4l2_dev,"V4L2 capture device registered as %s\n" , +video_device_node_name (vfd)); + } + +if (dev->has_radio_rx) { + vfd = &dev->radio_rx_dev; +snprintf (vfd->name,sizeof (vfd->name), +"vivid-%03d-rad-rx" , inst); + vfd->fops = &vivid_radio_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->radio_rx_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->lock = &dev->mutex; +video_set_drvdata (vfd, dev); + + ret =video_register_device (vfd,VFL_TYPE_RADIO , radio_rx_nr[inst]); +if (ret <0 ) +return ret; +v4l2_info (&dev->v4l2_dev,"V4L2 receiver device registered as %s\n" , +video_device_node_name (vfd)); + } + +if (dev->has_radio_tx) { + vfd = &dev->radio_tx_dev; +snprintf (vfd->name,sizeof (vfd->name), +"vivid-%03d-rad-tx" , inst); + vfd->vfl_dir =VFL_DIR_TX ; + vfd->fops = &vivid_radio_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->radio_tx_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->lock = &dev->mutex; +video_set_drvdata (vfd, dev); + + ret =video_register_device (vfd,VFL_TYPE_RADIO , radio_tx_nr[inst]); +if (ret <0 ) +return ret; +v4l2_info (&dev->v4l2_dev,"V4L2 transmitter device registered as %s\n" , +video_device_node_name (vfd)); + } + +if (dev->has_meta_cap) { + vfd = &dev->meta_cap_dev; +snprintf (vfd->name,sizeof (vfd->name), +"vivid-%03d-meta-cap" , inst); + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->meta_cap_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_meta_cap_q; + vfd->lock = &dev->mutex; + vfd->tvnorms = tvnorms_cap; +video_set_drvdata (vfd, dev); +#ifdef CONFIG_MEDIA_CONTROLLER + dev->meta_cap_pad.flags =MEDIA_PAD_FL_SINK ; + ret =media_entity_pads_init (&vfd->entity,1 , + &dev->meta_cap_pad); +if (ret) +return ret; +#endif + ret =video_register_device (vfd,VFL_TYPE_VIDEO , + meta_cap_nr[inst]); +if (ret <0 ) +return ret; +v4l2_info (&dev->v4l2_dev, +"V4L2 metadata capture device registered as %s\n" , +video_device_node_name (vfd)); + } + +if (dev->has_meta_out) { + vfd = &dev->meta_out_dev; +snprintf (vfd->name,sizeof (vfd->name), +"vivid-%03d-meta-out" , inst); + vfd->vfl_dir =VFL_DIR_TX ; + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->meta_out_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_meta_out_q; + vfd->lock = &dev->mutex; + vfd->tvnorms = tvnorms_out; +video_set_drvdata (vfd, dev); +#ifdef CONFIG_MEDIA_CONTROLLER + dev->meta_out_pad.flags =MEDIA_PAD_FL_SOURCE ; + ret =media_entity_pads_init (&vfd->entity,1 , + &dev->meta_out_pad); +if (ret) +return ret; +#endif + ret =video_register_device (vfd,VFL_TYPE_VIDEO , + meta_out_nr[inst]); +if (ret <0 ) +return ret; +v4l2_info (&dev->v4l2_dev, +"V4L2 metadata output device registered as %s\n" , +video_device_node_name (vfd)); + } + +if (dev->has_touch_cap) { + vfd = &dev->touch_cap_dev; +snprintf (vfd->name,sizeof (vfd->name), +"vivid-%03d-touch-cap" , inst); + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->touch_cap_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_touch_cap_q; + vfd->tvnorms = tvnorms_cap; + vfd->lock = &dev->mutex; +video_set_drvdata (vfd, dev); +#ifdef CONFIG_MEDIA_CONTROLLER + dev->touch_cap_pad.flags =MEDIA_PAD_FL_SINK ; + ret =media_entity_pads_init (&vfd->entity,1 , + &dev->touch_cap_pad); +if (ret) +return ret; +#endif + ret =video_register_device (vfd,VFL_TYPE_TOUCH , + touch_cap_nr[inst]); +if (ret <0 ) +return ret; +v4l2_info (&dev->v4l2_dev, +"V4L2 touch capture device registered as %s\n" , +video_device_node_name (vfd)); + } + +#ifdef CONFIG_MEDIA_CONTROLLER +/* Register the media device */ + ret =media_device_register (&dev->mdev); +if (ret) { +dev_err (dev->mdev.dev, +"media device register failed (err=%d)\n" , ret); +return ret; + } +#endif +return 0 ; +} +static int vivid_create_instance (struct platform_device *pdev,int inst) { static const struct v4l2_dv_timings def_dv_timings =
@@ -1317,7 +1657,6 @@ static int vivid_create_instance(struct platform_device *pdev, int 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;
@@ -1545,332 +1884,11 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)v4l2_ctrl_handler_setup (&dev->ctrl_hdl_touch_cap);/* finally start creating the device nodes */ -if (dev->has_vid_cap) { - vfd = &dev->vid_cap_dev; -snprintf (vfd->name,sizeof (vfd->name), -"vivid-%03d-vid-cap" , inst); - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->vid_cap_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_vid_cap_q; - vfd->tvnorms = tvnorms_cap; - -/* -* Provide a mutex to v4l2 core. It will be used to protect -* all fops and v4l2 ioctls. -*/ - vfd->lock = &dev->mutex; -video_set_drvdata (vfd, dev); - -#ifdef CONFIG_MEDIA_CONTROLLER - dev->vid_cap_pad.flags =MEDIA_PAD_FL_SINK ; - ret =media_entity_pads_init (&vfd->entity,1 , &dev->vid_cap_pad); -if (ret) - goto unreg_dev; -#endif - -#ifdef CONFIG_VIDEO_VIVID_CEC -if (in_type_counter[HDMI ]) { - ret =cec_register_adapter (dev->cec_rx_adap, &pdev->dev); -if (ret <0 ) { -cec_delete_adapter (dev->cec_rx_adap); - dev->cec_rx_adap =NULL ; - goto unreg_dev; - } -cec_s_phys_addr (dev->cec_rx_adap,0 , false); -v4l2_info (&dev->v4l2_dev,"CEC adapter %s registered for HDMI input 0\n" , -dev_name (&dev->cec_rx_adap->devnode.dev)); - } -#endif - - ret =video_register_device (vfd,VFL_TYPE_VIDEO , vid_cap_nr[inst]); -if (ret <0 ) - goto unreg_dev; -v4l2_info (&dev->v4l2_dev,"V4L2 capture device registered as %s\n" , -video_device_node_name (vfd)); - } - -if (dev->has_vid_out) { - vfd = &dev->vid_out_dev; -snprintf (vfd->name,sizeof (vfd->name), -"vivid-%03d-vid-out" , inst); - vfd->vfl_dir =VFL_DIR_TX ; - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->vid_out_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_vid_out_q; - vfd->tvnorms = tvnorms_out; - -/* -* Provide a mutex to v4l2 core. It will be used to protect -* all fops and v4l2 ioctls. -*/ - vfd->lock = &dev->mutex; -video_set_drvdata (vfd, dev); - -#ifdef CONFIG_MEDIA_CONTROLLER - dev->vid_out_pad.flags =MEDIA_PAD_FL_SOURCE ; - ret =media_entity_pads_init (&vfd->entity,1 , &dev->vid_out_pad); -if (ret) - goto unreg_dev; -#endif - -#ifdef CONFIG_VIDEO_VIVID_CEC -for (i =0 ; i < cec_tx_bus_cnt; i++) { - ret =cec_register_adapter (dev->cec_tx_adap[i], &pdev->dev); -if (ret <0 ) { -for (; i < cec_tx_bus_cnt; i++) { -cec_delete_adapter (dev->cec_tx_adap[i]); - dev->cec_tx_adap[i] =NULL ; - } - goto unreg_dev; - } -v4l2_info (&dev->v4l2_dev,"CEC adapter %s registered for HDMI output %d\n" , -dev_name (&dev->cec_tx_adap[i]->devnode.dev), i); -if (i < out_type_counter[HDMI ]) -cec_s_phys_addr (dev->cec_tx_adap[i], (i +1 ) <<12 , false); -else -cec_s_phys_addr (dev->cec_tx_adap[i],0x1000 , false); - } -#endif - - ret =video_register_device (vfd,VFL_TYPE_VIDEO , vid_out_nr[inst]); -if (ret <0 ) - goto unreg_dev; -v4l2_info (&dev->v4l2_dev,"V4L2 output device registered as %s\n" , -video_device_node_name (vfd)); - } - -if (dev->has_vbi_cap) { - vfd = &dev->vbi_cap_dev; -snprintf (vfd->name,sizeof (vfd->name), -"vivid-%03d-vbi-cap" , inst); - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->vbi_cap_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_vbi_cap_q; - vfd->lock = &dev->mutex; - vfd->tvnorms = tvnorms_cap; -video_set_drvdata (vfd, dev); - -#ifdef CONFIG_MEDIA_CONTROLLER - dev->vbi_cap_pad.flags =MEDIA_PAD_FL_SINK ; - ret =media_entity_pads_init (&vfd->entity,1 , &dev->vbi_cap_pad); -if (ret) - goto unreg_dev; -#endif - - ret =video_register_device (vfd,VFL_TYPE_VBI , vbi_cap_nr[inst]); -if (ret <0 ) - goto unreg_dev; -v4l2_info (&dev->v4l2_dev,"V4L2 capture device registered as %s, supports %s VBI\n" , -video_device_node_name (vfd), - (dev->has_raw_vbi_cap && dev->has_sliced_vbi_cap) ? -"raw and sliced" : - (dev->has_raw_vbi_cap ?"raw" :"sliced" )); - } - -if (dev->has_vbi_out) { - vfd = &dev->vbi_out_dev; -snprintf (vfd->name,sizeof (vfd->name), -"vivid-%03d-vbi-out" , inst); - vfd->vfl_dir =VFL_DIR_TX ; - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->vbi_out_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_vbi_out_q; - vfd->lock = &dev->mutex; - vfd->tvnorms = tvnorms_out; -video_set_drvdata (vfd, dev); - -#ifdef CONFIG_MEDIA_CONTROLLER - dev->vbi_out_pad.flags =MEDIA_PAD_FL_SOURCE ; - ret =media_entity_pads_init (&vfd->entity,1 , &dev->vbi_out_pad); -if (ret) - goto unreg_dev; -#endif - - ret =video_register_device (vfd,VFL_TYPE_VBI , vbi_out_nr[inst]); -if (ret <0 ) - goto unreg_dev; -v4l2_info (&dev->v4l2_dev,"V4L2 output device registered as %s, supports %s VBI\n" , -video_device_node_name (vfd), - (dev->has_raw_vbi_out && dev->has_sliced_vbi_out) ? -"raw and sliced" : - (dev->has_raw_vbi_out ?"raw" :"sliced" )); - } - -if (dev->has_sdr_cap) { - vfd = &dev->sdr_cap_dev; -snprintf (vfd->name,sizeof (vfd->name), -"vivid-%03d-sdr-cap" , inst); - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->sdr_cap_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_sdr_cap_q; - vfd->lock = &dev->mutex; -video_set_drvdata (vfd, dev); - -#ifdef CONFIG_MEDIA_CONTROLLER - dev->sdr_cap_pad.flags =MEDIA_PAD_FL_SINK ; - ret =media_entity_pads_init (&vfd->entity,1 , &dev->sdr_cap_pad); -if (ret) - goto unreg_dev; -#endif - - ret =video_register_device (vfd,VFL_TYPE_SDR , sdr_cap_nr[inst]); -if (ret <0 ) - goto unreg_dev; -v4l2_info (&dev->v4l2_dev,"V4L2 capture device registered as %s\n" , -video_device_node_name (vfd)); - } - -if (dev->has_radio_rx) { - vfd = &dev->radio_rx_dev; -snprintf (vfd->name,sizeof (vfd->name), -"vivid-%03d-rad-rx" , inst); - vfd->fops = &vivid_radio_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->radio_rx_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->lock = &dev->mutex; -video_set_drvdata (vfd, dev); - - ret =video_register_device (vfd,VFL_TYPE_RADIO , radio_rx_nr[inst]); -if (ret <0 ) - goto unreg_dev; -v4l2_info (&dev->v4l2_dev,"V4L2 receiver device registered as %s\n" , -video_device_node_name (vfd)); - } - -if (dev->has_radio_tx) { - vfd = &dev->radio_tx_dev; -snprintf (vfd->name,sizeof (vfd->name), -"vivid-%03d-rad-tx" , inst); - vfd->vfl_dir =VFL_DIR_TX ; - vfd->fops = &vivid_radio_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->radio_tx_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->lock = &dev->mutex; -video_set_drvdata (vfd, dev); - - ret =video_register_device (vfd,VFL_TYPE_RADIO , radio_tx_nr[inst]); -if (ret <0 ) - goto unreg_dev; -v4l2_info (&dev->v4l2_dev,"V4L2 transmitter device registered as %s\n" , -video_device_node_name (vfd)); - } - -if (dev->has_meta_cap) { - vfd = &dev->meta_cap_dev; -snprintf (vfd->name,sizeof (vfd->name), -"vivid-%03d-meta-cap" , inst); - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->meta_cap_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_meta_cap_q; - vfd->lock = &dev->mutex; - vfd->tvnorms = tvnorms_cap; -video_set_drvdata (vfd, dev); -#ifdef CONFIG_MEDIA_CONTROLLER - dev->meta_cap_pad.flags =MEDIA_PAD_FL_SINK ; - ret =media_entity_pads_init (&vfd->entity,1 , - &dev->meta_cap_pad); -if (ret) - goto unreg_dev; -#endif - ret =video_register_device (vfd,VFL_TYPE_VIDEO , - meta_cap_nr[inst]); -if (ret <0 ) - goto unreg_dev; -v4l2_info (&dev->v4l2_dev, -"V4L2 metadata capture device registered as %s\n" , -video_device_node_name (vfd)); - } - -if (dev->has_meta_out) { - vfd = &dev->meta_out_dev; -snprintf (vfd->name,sizeof (vfd->name), -"vivid-%03d-meta-out" , inst); - vfd->vfl_dir =VFL_DIR_TX ; - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->meta_out_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_meta_out_q; - vfd->lock = &dev->mutex; - vfd->tvnorms = tvnorms_out; -video_set_drvdata (vfd, dev); -#ifdef CONFIG_MEDIA_CONTROLLER - dev->meta_out_pad.flags =MEDIA_PAD_FL_SOURCE ; - ret =media_entity_pads_init (&vfd->entity,1 , - &dev->meta_out_pad); -if (ret) - goto unreg_dev; -#endif - ret =video_register_device (vfd,VFL_TYPE_VIDEO , - meta_out_nr[inst]); -if (ret <0 ) - goto unreg_dev; -v4l2_info (&dev->v4l2_dev, -"V4L2 metadata output device registered as %s\n" , -video_device_node_name (vfd)); - } - -if (dev->has_touch_cap) { - vfd = &dev->touch_cap_dev; -snprintf (vfd->name,sizeof (vfd->name), -"vivid-%03d-touch-cap" , inst); - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->touch_cap_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_touch_cap_q; - vfd->tvnorms = tvnorms_cap; - vfd->lock = &dev->mutex; -video_set_drvdata (vfd, dev); -#ifdef CONFIG_MEDIA_CONTROLLER - dev->touch_cap_pad.flags =MEDIA_PAD_FL_SINK ; - ret =media_entity_pads_init (&vfd->entity,1 , - &dev->touch_cap_pad); -if (ret) - goto unreg_dev; -#endif - ret =video_register_device (vfd,VFL_TYPE_TOUCH , - touch_cap_nr[inst]); -if (ret <0 ) - goto unreg_dev; -v4l2_info (&dev->v4l2_dev, -"V4L2 touch capture device registered as %s\n" , -video_device_node_name (vfd)); - } - -#ifdef CONFIG_MEDIA_CONTROLLER -/* Register the media device */ - ret =media_device_register (&dev->mdev); -if (ret) { -dev_err (dev->mdev.dev, -"media device register failed (err=%d)\n" , ret); + ret =vivid_create_devnodes (pdev, dev, inst, cec_tx_bus_cnt, + tvnorms_cap, tvnorms_out, + in_type_counter, out_type_counter); +if (ret) goto unreg_dev; - } -#endif /* Now that everything is fine, let's add it to device list */ vivid_devs[inst] = dev;
Signature · 1 line
2.26.2
PATCH 28/38 media: atomisp: get rid of isys_dma.h and isys_dma_local.h
In reply to Mauro Carvalho ChehabThere aren't much on this abstraction. Just move the defines to isys_dma_private.h and isys_dma_public.h, cleaning up the includes.
--- .../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 ++--- .../host/isys_dma_public.h | 4 +- .../pci/hive_isp_css_include/isys_dma.h | 47 ------------------- .../atomisp/pci/isp2401_input_system_global.h | 3 +- .../atomisp/pci/runtime/isys/src/isys_init.c | 2 +- 7 files changed, 12 insertions(+), 87 deletions(-) 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/isys_dma.h
drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c +2 -8
@@ -13,16 +13,10 @@* more details. */ -#include "isys_dma.h" +#include "system_local.h" +#include "isys_dma_global.h" #include "assert_support.h" - -#ifndef __INLINE_ISYS2401_DMA__ -/* -* Include definitions for isys dma register access functions. isys_dma.h -* includes declarations of these functions by including isys_dma_public.h. -*/ #include "isys_dma_private.h" -#endif const isys2401_dma_channel N_ISYS2401_DMA_CHANNEL_PROCS [N_ISYS2401_DMA_ID ] = {N_ISYS2401_DMA_CHANNEL
drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h deleted +0 -21
@@ -1,21 +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 __ISYS_DMA_LOCAL_H_INCLUDED__ -#define __ISYS_DMA_LOCAL_H_INCLUDED__ - -#include "isys_dma_global.h" - -#endif /* __ISYS_DMA_LOCAL_H_INCLUDED__ */
drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h +5 -7
@@ -23,10 +23,9 @@#include "dma_v2_defs.h" #include "print_support.h" -STORAGE_CLASS_ISYS2401_DMA_C void isys2401_dma_reg_store( -const isys2401_dma_ID_t dma_id, -const unsigned int reg, -const hrt_data value) +void isys2401_dma_reg_store (const isys2401_dma_ID_t dma_id, +const unsigned int reg, +const hrt_data value) {unsigned int reg_loc;
@@ -40,9 +39,8 @@ STORAGE_CLASS_ISYS2401_DMA_C void isys2401_dma_reg_store(ia_css_device_store_uint32 (reg_loc, value); } -STORAGE_CLASS_ISYS2401_DMA_C hrt_data isys2401_dma_reg_load( -const isys2401_dma_ID_t dma_id, -const unsigned int reg) +hrt_data isys2401_dma_reg_load (const isys2401_dma_ID_t dma_id, +const unsigned int reg) {unsigned int reg_loc;hrt_data value;
drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h +2 -2
@@ -21,12 +21,12 @@#include "system_local.h" #include "type_support.h" -STORAGE_CLASS_ISYS2401_DMA_H void isys2401_dma_reg_store( +extern void isys2401_dma_reg_store (const isys2401_dma_ID_t dma_id,const unsigned int reg,const hrt_data value); -STORAGE_CLASS_ISYS2401_DMA_H hrt_data isys2401_dma_reg_load( +extern hrt_data isys2401_dma_reg_load (const isys2401_dma_ID_t dma_id,const unsigned int reg);
drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_dma.h deleted +0 -47
47 lines not on this page · raw message
drivers/staging/media/atomisp/pci/isp2401_input_system_global.h +2 -1
@@ -21,7 +21,8 @@/* CSI reveiver has 3 ports. */ #define N_CSI_PORTS (3) -#include "isys_dma.h" /* isys2401_dma_channel, +#include "system_local.h" +#include "isys_dma_global.h" /* isys2401_dma_channel, * isys2401_dma_cfg_t */
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c +1 -1
@@ -19,7 +19,7 @@#include "platform_support.h" #ifdef ISP2401 -#include "isys_dma.h" /* isys2401_dma_set_max_burst_size() */ +#include "isys_dma_public.h" /* isys2401_dma_set_max_burst_size() */ #include "isys_irq.h" #endif
Signature · 1 line
2.26.2
PATCH 21/38 media: dvb-ttusb-budget: don't use stack for USB transfers
In reply to Mauro Carvalho ChehabAs 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.
--- .../media/usb/ttusb-budget/dvb-ttusb-budget.c | 83 +++++++------------ 1 file changed, 30 insertions(+), 53 deletions(-)
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c +30 -53
@@ -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 ;
Signature · 1 line
2.26.2
PATCH 20/38 media: saa7134-alsa.c: number of pages should be unsigned long
In reply to Mauro Carvalho ChehabAs 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.
--- drivers/media/pci/saa7134/saa7134-alsa.c | 7 ++++--- drivers/media/pci/saa7134/saa7134.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/media/pci/saa7134/saa7134-alsa.c +4 -3
@@ -252,7 +252,8 @@ static int snd_card_saa7134_capture_trigger(struct snd_pcm_substream * substreamreturn 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 );
drivers/media/pci/saa7134/saa7134.h +1 -1
@@ -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;
Signature · 1 line
2.26.2
PATCH 17/38 media: cx25821-alsa: number of pages should be unsigned long
In reply to Mauro Carvalho ChehabAs 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.
--- drivers/media/pci/cx25821/cx25821-alsa.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/media/pci/cx25821/cx25821-alsa.c +6 -5
@@ -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 );
Signature · 1 line
2.26.2
PATCH 18/38 media: cx23885-alsa: number of pages should be unsigned long
In reply to Mauro Carvalho ChehabAs 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.
--- drivers/media/pci/cx23885/cx23885-alsa.c | 7 ++++--- drivers/media/pci/cx23885/cx23885.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/media/pci/cx23885/cx23885-alsa.c +4 -3
@@ -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 );
drivers/media/pci/cx23885/cx23885.h +2 -2
@@ -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 {
Signature · 1 line
2.26.2
PATCH 23/38 media: saa7134: avoid a shift overflow
In reply to Mauro Carvalho ChehabAs 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.
--- drivers/media/pci/saa7134/saa7134-tvaudio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/pci/saa7134/saa7134-tvaudio.c +2 -1
@@ -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;
Signature · 1 line
2.26.2
PATCH 16/38 media: videobuf-dma-sg: number of pages should be unsigned long
In reply to Mauro Carvalho ChehabAs 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.
--- drivers/media/v4l2-core/videobuf-dma-sg.c | 22 ++++++++++++---------- include/media/videobuf-dma-sg.h | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-)
drivers/media/v4l2-core/videobuf-dma-sg.c +12 -10
@@ -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 );
include/media/videobuf-dma-sg.h +1 -1
@@ -60,7 +60,7 @@ struct videobuf_dmabuf {/* common */ struct scatterlist *sglist;int sglen; -int nr_pages; +unsigned long nr_pages;int direction; };
Signature · 1 line
2.26.2
PATCH 15/38 media: vivid: fix error path
In reply to Mauro Carvalho ChehabIf something fails after calling v4l2_device_register(), it should call v4l2_device_put().
--- drivers/media/test-drivers/vivid/vivid-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/media/test-drivers/vivid/vivid-core.c +2 -4
@@ -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);
Signature · 1 line
2.26.2
PATCH 8/38 media: serial_ir: use the right type for a dma address
In reply to Mauro Carvalho ChehabAs 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.
--- drivers/media/rc/serial_ir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/serial_ir.c +1 -1
@@ -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 ))) {
Signature · 1 line
2.26.2
PATCH 7/38 media: tda10021: avoid casts when using symbol_rate
In reply to Mauro Carvalho ChehabThe 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.
--- drivers/media/dvb-frontends/tda10021.c | 38 ++++++++++++++++---------- 1 file changed, 24 insertions(+), 14 deletions(-)
drivers/media/dvb-frontends/tda10021.c +24 -14
@@ -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 ;
Signature · 1 line
2.26.2
PATCH 1/38 media: tda10086: cleanup symbol_rate setting logic
In reply to Mauro Carvalho ChehabThe 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.
--- drivers/media/dvb-frontends/tda10086.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/media/dvb-frontends/tda10086.c +11 -11
@@ -17,7 +17,7 @@#include <media/dvb_frontend.h> #include "tda10086.h" -#define SACLK 96000000 +#define SACLK 96000000Ustruct 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 {
Signature · 1 line
2.26.2
PATCH 10/38 media: vivid: place the logic which disables ioctl on a separate function
In reply to Mauro Carvalho ChehabMove this code out of the long vivid_create_instance() function.
--- drivers/media/test-drivers/vivid/vivid-core.c | 182 +++++++++--------- 1 file changed, 96 insertions(+), 86 deletions(-)
drivers/media/test-drivers/vivid/vivid-core.c +96 -86
@@ -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 ];
Signature · 1 line
2.26.2
PATCH 4/38 media: av7110_v4l: avoid a typecast
In reply to Mauro Carvalho ChehabWhile 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.
--- drivers/media/pci/ttpci/av7110_v4l.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/ttpci/av7110_v4l.c +2 -2
@@ -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 ;
Signature · 1 line
2.26.2
PATCH 9/38 media: vivid: move the detection part out of vivid_create_instance
In reply to Mauro Carvalho ChehabThe 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.
--- drivers/media/test-drivers/vivid/vivid-core.c | 151 ++++++++++-------- 1 file changed, 83 insertions(+), 68 deletions(-)
drivers/media/test-drivers/vivid/vivid-core.c +83 -68
@@ -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 */
Signature · 1 line
2.26.2
PATCH 11/38 media: vivid: move set_capabilities logic to a separate function
In reply to Mauro Carvalho ChehabMove 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.
--- drivers/media/test-drivers/vivid/vivid-core.c | 161 +++++++++--------- 1 file changed, 83 insertions(+), 78 deletions(-)
drivers/media/test-drivers/vivid/vivid-core.c +83 -78
@@ -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 */
Signature · 1 line
2.26.2
PATCH 2/38 media: v4l2-ioctl: avoid memory leaks on some time32 compat functions
In reply to Mauro Carvalho ChehabThere 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.
--- drivers/media/v4l2-core/v4l2-ioctl.c | 48 ++++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/media/v4l2-core/v4l2-ioctl.c +24 -24
@@ -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 ;
Signature · 1 line
2.26.2
PATCH 13/38 media: vivid: move the create queues to a separate function
In reply to Mauro Carvalho ChehabInstead of placing everything inside vivid_create_instance(), we can move the part which creates per-type video queues into a separate function.
--- drivers/media/test-drivers/vivid/vivid-core.c | 175 +++++++++--------- 1 file changed, 92 insertions(+), 83 deletions(-)
drivers/media/test-drivers/vivid/vivid-core.c +92 -83
@@ -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 ]) {
Signature · 1 line
2.26.2
Re: [PATCH 02/38] media: v4l2-ioctl: avoid memory leaks on some time32 compat functions
In reply to Mauro Carvalho ChehabHi Mauro,
Thank you for the patch.
Quoted 30 lines · Mauro Carvalho Chehab
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:3230video_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(-)drivers/media/v4l2-core/v4l2-ioctl.c +0
-2@@ -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,
drivers/media/v4l2-core/v4l2-ioctl.c static int video_put_user(void __user *arg, void *parg, unsigned int cmd) · line 3195
Quoted 10 lines
drivers/media/v4l2-core/v4l2-ioctl.c +3
-6- .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,
Quoted 48 lines
drivers/media/v4l2-core/v4l2-ioctl.c +21
-16+ 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 ;
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 02/38] media: v4l2-ioctl: avoid memory leaks on some time32 compat functions
In reply to Mauro Carvalho ChehabQuoted 9 lines · Mauro Carvalho Chehab
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:3230video_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.
Quoted 8 lines
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
kernel test robot
build botRe: [PATCH 14/38] media: vivid: move the devnode creation logic to a separate function
In reply to Mauro Carvalho ChehabI love your patch! Yet something to improve:
Hi Mauro,
I love your patch! Yet something to improve:
[auto build test ERROR on linuxtv-media/master]
[cannot apply to v5.9-rc3 next-20200902]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/media-sparse-smatch-warn-fixes/20200903-002025 base: git://linuxtv.org/media_tree.git master config: s390-randconfig-s031-20200902 (attached as .config) compiler: s390-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-191-g10164920-dirty
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=s390
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/media/test-drivers/vivid/vivid-core.c: In function 'vivid_create_devnodes':
drivers/media/test-drivers/vivid/vivid-core.c:1318:11: warning: unused variable 'i' [-Wunused-variable]
1318 | int ret, i;
| ^
drivers/media/test-drivers/vivid/vivid-core.c: In function 'vivid_create_instance':
>> drivers/media/test-drivers/vivid/vivid-core.c:1887:47: error: 'cec_tx_bus_cnt' undeclared (first use in this function) 1887 | ret = vivid_create_devnodes(pdev, dev, inst, cec_tx_bus_cnt,
| ^~~~~~~~~~~~~~
drivers/media/test-drivers/vivid/vivid-core.c:1887:47: note: each undeclared identifier is reported only once for each function it appears in
# https://github.com/0day-ci/linux/commit/cd6461a9795132db179f4416123658efbf8a92b7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Mauro-Carvalho-Chehab/media-sparse-smatch-warn-fixes/20200903-002025 git checkout cd6461a9795132db179f4416123658efbf8a92b7
vim +/cec_tx_bus_cnt +1887 drivers/media/test-drivers/vivid/vivid-core.c
1874
1875 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_vid_cap);
1876 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_vid_out);
1877 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_vbi_cap);
1878 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_vbi_out);
1879 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_radio_rx);
1880 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_radio_tx);
1881 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_sdr_cap);
1882 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_meta_cap);
1883 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_meta_out);
1884 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_touch_cap);
1885
1886 /* finally start creating the device nodes */
> 1887 ret = vivid_create_devnodes(pdev, dev, inst, cec_tx_bus_cnt,
1888 tvnorms_cap, tvnorms_out,
1889 in_type_counter, out_type_counter);
1890 if (ret)
1891 goto unreg_dev;
1892
1893 /* Now that everything is fine, let's add it to device list */
1894 vivid_devs[inst] = dev;
1895
1896 return 0;
1897
1898 unreg_dev:
1899 vb2_video_unregister_device(&dev->touch_cap_dev);
1900 vb2_video_unregister_device(&dev->meta_out_dev);
1901 vb2_video_unregister_device(&dev->meta_cap_dev);
1902 video_unregister_device(&dev->radio_tx_dev);
1903 video_unregister_device(&dev->radio_rx_dev);
1904 vb2_video_unregister_device(&dev->sdr_cap_dev);
1905 vb2_video_unregister_device(&dev->vbi_out_dev);
1906 vb2_video_unregister_device(&dev->vbi_cap_dev);
1907 vb2_video_unregister_device(&dev->vid_out_dev);
1908 vb2_video_unregister_device(&dev->vid_cap_dev);
1909 cec_unregister_adapter(dev->cec_rx_adap);
1910 for (i = 0; i < MAX_OUTPUTS; i++)
1911 cec_unregister_adapter(dev->cec_tx_adap[i]);
1912 if (dev->cec_workqueue) {
1913 vivid_cec_bus_free_work(dev);
1914 destroy_workqueue(dev->cec_workqueue);
1915 }
1916 free_dev:
1917 v4l2_device_put(&dev->v4l2_dev);
1918 return ret;
1919 }
1920
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH 14/38] media: vivid: move the devnode creation logic to a separate function
In reply to Mauro Carvalho ChehabI love your patch! Yet something to improve:
Hi Mauro,
I love your patch! Yet something to improve:
[auto build test ERROR on linuxtv-media/master]
[cannot apply to v5.9-rc3 next-20200902]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/media-sparse-smatch-warn-fixes/20200903-002025 base: git://linuxtv.org/media_tree.git master config: arm-randconfig-r015-20200902 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 224d8153b53b16cf535ea1a55afdfe1ec5b1374f)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/media/test-drivers/vivid/vivid-core.c:1318:11: warning: unused variable 'i' [-Wunused-variable]
int ret, i;
^
>> drivers/media/test-drivers/vivid/vivid-core.c:1887:47: error: use of undeclared identifier 'cec_tx_bus_cnt' ret = vivid_create_devnodes(pdev, dev, inst, cec_tx_bus_cnt,
^
1 warning and 1 error generated.
# https://github.com/0day-ci/linux/commit/cd6461a9795132db179f4416123658efbf8a92b7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Mauro-Carvalho-Chehab/media-sparse-smatch-warn-fixes/20200903-002025 git checkout cd6461a9795132db179f4416123658efbf8a92b7
vim +/cec_tx_bus_cnt +1887 drivers/media/test-drivers/vivid/vivid-core.c
1874
1875 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_vid_cap);
1876 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_vid_out);
1877 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_vbi_cap);
1878 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_vbi_out);
1879 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_radio_rx);
1880 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_radio_tx);
1881 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_sdr_cap);
1882 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_meta_cap);
1883 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_meta_out);
1884 v4l2_ctrl_handler_setup(&dev->ctrl_hdl_touch_cap);
1885
1886 /* finally start creating the device nodes */
> 1887 ret = vivid_create_devnodes(pdev, dev, inst, cec_tx_bus_cnt,
1888 tvnorms_cap, tvnorms_out,
1889 in_type_counter, out_type_counter);
1890 if (ret)
1891 goto unreg_dev;
1892
1893 /* Now that everything is fine, let's add it to device list */
1894 vivid_devs[inst] = dev;
1895
1896 return 0;
1897
1898 unreg_dev:
1899 vb2_video_unregister_device(&dev->touch_cap_dev);
1900 vb2_video_unregister_device(&dev->meta_out_dev);
1901 vb2_video_unregister_device(&dev->meta_cap_dev);
1902 video_unregister_device(&dev->radio_tx_dev);
1903 video_unregister_device(&dev->radio_rx_dev);
1904 vb2_video_unregister_device(&dev->sdr_cap_dev);
1905 vb2_video_unregister_device(&dev->vbi_out_dev);
1906 vb2_video_unregister_device(&dev->vbi_cap_dev);
1907 vb2_video_unregister_device(&dev->vid_out_dev);
1908 vb2_video_unregister_device(&dev->vid_cap_dev);
1909 cec_unregister_adapter(dev->cec_rx_adap);
1910 for (i = 0; i < MAX_OUTPUTS; i++)
1911 cec_unregister_adapter(dev->cec_tx_adap[i]);
1912 if (dev->cec_workqueue) {
1913 vivid_cec_bus_free_work(dev);
1914 destroy_workqueue(dev->cec_workqueue);
1915 }
1916 free_dev:
1917 v4l2_device_put(&dev->v4l2_dev);
1918 return ret;
1919 }
1920
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCH 02/38] media: v4l2-ioctl: avoid memory leaks on some time32 compat functions
In reply to Arnd BergmannEm Wed, 2 Sep 2020 20:45:53 +0200
Arnd Bergmann <[email protected]> escreveu:
Quoted 18 lines
Quoted 16 lines · Mauro Carvalho Chehab
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:3230video_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.
Quoted 7 lines
Quoted 1 line
Signed-off-by Mauro Carvalho Chehab <[email protected]>Isn't this the same as commit
4ffb879ea648("media: media/v4l2-core:
Fix kernel-infoleak
invideo_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
Re: [PATCH 16/38] media: videobuf-dma-sg: number of pages should be unsigned long
In reply to Mauro Carvalho ChehabQuoted 20 lines · Mauro Carvalho Chehab
As reported by smatch:
drivers/media/v4l2-core/videobuf-dma-sg.c:245videobuf_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(-)drivers/media/v4l2-core/videobuf-dma-sg.c +0
-0
drivers/media/v4l2-core/videobuf-dma-sg.c static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, · line 186
Quoted 8 lines
drivers/media/v4l2-core/videobuf-dma-sg.c +1
-1@@ -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,
Signature · 2 lines
John Hubbard NVIDIA
Quoted 23 lines · Mauro Carvalho Chehab
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_64without 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: cleanupsymbol_ratesetting 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 externvenus_fw_debugon a header file
media: tda10021: avoid casts when usingsymbol_rate
media:serial_ir: use the right type for a dma address
Quoted 8 lines
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: moveset_capabilitieslogic 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:
Thank you for working on this!
Regards,
Hans
Quoted 129 lines
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 atatomisp_compat_ioctl32.c
media: atomisp: get rid of some unused code
media: atomisp: cleanup ifdefs fromia_css_debug.c
media: atomisp: get rid of version-dependent globals
media: atomisp: get rid ofisys_dma.handisys_dma_local.h
media: atomisp: get rid ofibuf_ctrlabstraction
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 atpixelgen_private.h
media: atomisp: remove compile-time tests frominput_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: cleanupisys_irqheadersdrivers/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
Re: [PATCH 06/38] media: venus: place extern venus_fw_debug on a header file
In reply to Mauro Carvalho ChehabHi Mauro,
Thanks for the fix!
Quoted 8 lines · Mauro Carvalho Chehab
Sparse warns about this symbol:
drivers/media/platform/qcom/venus/hfi_venus.c:133:5: warning: symbol 'venus_fw_debug' was not declared. Should it be static?Because
hfi_venus.cdoesn't include a header file with the extern. So, move it tocore.h, with is included by bothhfi_venus.canddbgfs.c.
Quoted 8 lines
This way, if something changes with it, warnings or errors will be produced.
Signed-off-by Mauro Carvalho Chehab <[email protected]>--- drivers/media/platform/qcom/venus/core.h | 2 ++ drivers/media/platform/qcom/venus/dbgfs.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 28 lines
drivers/media/platform/qcom/venus/core.h +2
-0@@ -24,6 +24,8 @@#define VIDC_VCODEC_CLKS_NUM_MAX 2#define VIDC_PMDOMAINS_NUM_MAX 3 +extern int venus_fw_debug; +struct freq_tbl {unsigned int load;unsigned long freq;drivers/media/platform/qcom/venus/dbgfs.c +0
-2@@ -7,8 +7,6 @@#include "core.h" -extern int venus_fw_debug; -void venus_dbgfs_init (struct venus_core *core) { core->root =debugfs_create_dir ("venus" ,NULL );
Signature · 2 lines
regards, Stan