[PATCH 37/38] media: atomisp: atomisp_gmin_platform: check before use

2020-09-02 Thread Mauro Carvalho Chehab
solve 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.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c 
b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index c49d27038d27..8652f71dfff6 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -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)
-- 
2.26.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 32/38] media: atomisp: de-duplicate names at *_input_system_global.h

2020-09-02 Thread Mauro Carvalho Chehab
There 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.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../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(-)

diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h
index ce7b06b3f3c8..56c5ed89b3cc 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h
@@ -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 @@ structib_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;
diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h
index 75722ef572d0..f131f03cb8fa 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h
@@ -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_tsync_gen_cfg;
+   isp2401_sync_generator_cfg_tsync_gen_cfg;
 };
 
 /* end of Pixel-generator: TPG. ("pixelgen_global.h") */
diff --git 
a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c 
b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
index cd516e4554fb..0f5a231672a8 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
@@ -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_tchannel);
@@ -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_tID,
 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_tID,
 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_tID,
@@ -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_

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

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

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

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

diff --git a/drivers/staging/media/atomisp/Makefile 
b/drivers/staging/media/atomisp/Makefile
index 205d0f8cc2e1..1dfad0dd02d0 100644
--- a/drivers/staging/media/atomisp/Makefile
+++ b/drivers/staging/media/atomisp/Makefile
@@ -307,18 +307,12 @@ INCLUDES += \
-I$(atomisp)/pci/runtime/queue/src/ \
-I$(atomisp)/pci/runtime/rmgr/interface/ \
-I$(atomisp)/pci/runtime/spctrl/interface/ \
-   -I$(atomisp)/pci/runtime/tagger/interface/
-
-INCLUDES_byt += \
+   -I$(atomisp)/pci/runtime/tagger/interface/ \
-I$(atomisp)/pci/css_2400_system/hive/ \
-
-INCLUDES_cht += \
-I$(atomisp)/pci/css_2401_system/ \
-I$(atomisp)/pci/css_2401_system/host/ \
-I$(atomisp)/pci/css_2401_system/hive/ \
-   -I$(atomisp)/pci/css_2401_system/hrt/ \
-
-#  -I$(atomisp)/pci/css_2401_system/hive_isp_css_2401_system_generated/ \
+   -I$(atomisp)/pci/css_2401_system/hrt/
 
 DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST -DHRT_USE_VIR_ADDRS -D__HOST__
 #DEFINES += -DUSE_DYNAMIC_BIN
@@ -330,11 +324,9 @@ DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST 
-DHRT_USE_VIR_ADDRS -D__HOST__
 
 ifeq ($(CONFIG_VIDEO_ATOMISP_ISP2401),y)
 atomisp-objs += $(obj-cht)
-INCLUDES += $(INCLUDES_cht)
 DEFINES += -DISP2401 -DISP2401_NEW_INPUT_SYSTEM 
-DSYSTEM_hive_isp_css_2401_system
 else
 atomisp-objs += $(obj-byt)
-INCLUDES += $(INCLUDES_byt)
 DEFINES += -DISP2400 -DSYSTEM_hive_isp_css_2400_system
 endif
 
-- 
2.26.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 35/38] media: atomisp: fix some bad indents

2020-09-02 Thread Mauro Carvalho Chehab
As 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.

Signed-off-by: Mauro Carvalho Chehab 
---
 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(-)

diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c 
b/drivers/staging/media/atomisp/pci/hmm/hmm.c
index 2bd39b4939f1..e0eaff0f8a22 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
@@ -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;
 
diff --git a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c 
b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
index a77c2072db13..060d38749570 100644
--- a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
+++ b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
@@ -135,52 +135,30 @@ struct sh_css_binary_sc_requirements {
at shading 
correction. */
 };
 
-/* Get the requirements for the shading correction. */
+/* ISP2400: Get the requirements for the shading correction. */
 static int
-#ifndef ISP2401
 ia_css_binary_compute_shading_table_bayer_origin(
 const struct ia_css_binary *binary,/* [in] 
*/
 unsigned int required_bds_factor,  /* [in] */
 const struct ia_css_stream_config *stream_config,  /* [in] */
 struct sh_css_shading_table_bayer_origin_compute_results *res) /* 
[out] */
-#else
-sh_css_binary_get_sc_requirements(
-const struct ia_css_binary *binary,/* [in] */
-unsigned int required_bds_factor,  /* [in] */
-const struct ia_css_stream_config *stream_config,  /* [in] */
-struct sh_css_binary_sc_requirements *scr) /* [out] */
-#endif
 {
int err;
 
-#ifndef ISP2401
/* Numerator and denominator of the fixed bayer downscaling factor.
(numerator >= denominator) */
-#else
-   /* Numerator and denominator of the fixed bayer downscaling factor. 
(numerator >= denominator) */
-#endif
unsigned int bds_num, bds_den;
 
-#ifndef ISP2401
/* Horizontal/Vertical ratio of bayer scaling
between input area and output area. */
unsigned int bs_hor_ratio_in;
unsigned int bs_hor_ratio_out;
unsigned int bs_ver_ratio_in;
unsigned int bs_ver_ratio_out;
-#else
-   /* Horizontal/Vertical ratio of bayer scaling between input area and 
output area. */
-   unsigned int bs_hor_ratio_in, bs_hor_ratio_out, bs_ver_ratio_in, 
bs_ver_ratio_out;
-#endif
 
/* Left padding set by InputFormatter. */
-#ifndef ISP2401
unsigned int left_padding_bqs;  /* in bqs */
-#else
-   unsigned int left_padding_bqs;
-#endif
 
-#ifndef ISP2401
/* Flag for the NEED_BDS_FACTOR_2_00 macro defined in isp kernels. */
unsigned int need_bds_factor_2_00;
 
@@ -201,7 +179,106 @@ sh_css_binary_get_sc_requirements(
err = sh_css_bds_factor_get_numerator_denominator
(required_bds_factor, &bds_num, &bds_den);
if (err)
-#else
+   return

[PATCH 27/38] media: atomisp: get rid of version-dependent globals

2020-09-02 Thread Mauro Carvalho Chehab
Replace 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.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../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

diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h
index e3d6d5e1634e..a76987190292 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h
@@ -18,7 +18,7 @@
 
 #include 
 
-#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__ */
diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h
index 91ef000d76dc..1e96f0267ac0 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h
@@ -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__ */
diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h
index 156b4c95277e..a81e4d13ac9f 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h
@@ -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   (0x)
 #define ISYS_IRQ_ENABLE_REG_VALUE  (0x)
 
-#endif /

[PATCH v2 2/2] staging: gdm724x: gdm_tty: replaced macro with a function

2020-09-02 Thread Antoni Przybylik
Changed return type to bool and removed inline specifier. Also added
 static specifier.

Signed-off-by: Antoni Przybylik 
---
 drivers/staging/gdm724x/gdm_tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gdm724x/gdm_tty.c 
b/drivers/staging/gdm724x/gdm_tty.c
index 34a13d98c029..179fc9b9400b 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -34,7 +34,7 @@ static DEFINE_MUTEX(gdm_table_lock);
 static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
 static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
 
-inline int gdm_tty_ready(struct gdm *gdm)
+static bool gdm_tty_ready(struct gdm *gdm)
 {
return (gdm && gdm->tty_dev && gdm->port.count);
 }
-- 
2.28.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 1/2] staging: gdm724x: gdm_tty: replaced macro with a function

2020-09-02 Thread Antoni Przybylik
This approach is more elegant and prevents some problems related to
macros such as operator precedence in expanded expression.

Signed-off-by: Antoni Przybylik 
---
 drivers/staging/gdm724x/gdm_tty.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_tty.c 
b/drivers/staging/gdm724x/gdm_tty.c
index 6e813693a766..34a13d98c029 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -27,8 +27,6 @@
 
 #define MUX_TX_MAX_SIZE 2048
 
-#define GDM_TTY_READY(gdm) (gdm && gdm->tty_dev && gdm->port.count)
-
 static struct tty_driver *gdm_driver[TTY_MAX_COUNT];
 static struct gdm *gdm_table[TTY_MAX_COUNT][GDM_TTY_MINOR];
 static DEFINE_MUTEX(gdm_table_lock);
@@ -36,6 +34,11 @@ static DEFINE_MUTEX(gdm_table_lock);
 static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
 static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
 
+inline int gdm_tty_ready(struct gdm *gdm)
+{
+   return (gdm && gdm->tty_dev && gdm->port.count);
+}
+
 static void gdm_port_destruct(struct tty_port *port)
 {
struct gdm *gdm = container_of(port, struct gdm, port);
@@ -119,7 +122,7 @@ static int gdm_tty_recv_complete(void *data,
 {
struct gdm *gdm = tty_dev->gdm[index];
 
-   if (!GDM_TTY_READY(gdm)) {
+   if (!gdm_tty_ready(gdm)) {
if (complete == RECV_PACKET_PROCESS_COMPLETE)
gdm->tty_dev->recv_func(gdm->tty_dev->priv_dev,
gdm_tty_recv_complete);
@@ -146,7 +149,7 @@ static void gdm_tty_send_complete(void *arg)
 {
struct gdm *gdm = arg;
 
-   if (!GDM_TTY_READY(gdm))
+   if (!gdm_tty_ready(gdm))
return;
 
tty_port_tty_wakeup(&gdm->port);
@@ -160,7 +163,7 @@ static int gdm_tty_write(struct tty_struct *tty, const 
unsigned char *buf,
int sent_len = 0;
int sending_len = 0;
 
-   if (!GDM_TTY_READY(gdm))
+   if (!gdm_tty_ready(gdm))
return -ENODEV;
 
if (!len)
@@ -187,7 +190,7 @@ static int gdm_tty_write_room(struct tty_struct *tty)
 {
struct gdm *gdm = tty->driver_data;
 
-   if (!GDM_TTY_READY(gdm))
+   if (!gdm_tty_ready(gdm))
return -ENODEV;
 
return WRITE_SIZE;
-- 
2.28.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 2/2] staging: gdm724x: gdm_tty: replaced macro with a function

2020-09-02 Thread Randy Dunlap
On 9/2/20 9:16 AM, Antoni Przybylik wrote:
> Changed return type to bool and removed inline specifier. Also added
>  static specifier.

why remove the inline specifier?
thanks.

> Signed-off-by: Antoni Przybylik 
> ---
>  drivers/staging/gdm724x/gdm_tty.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/gdm724x/gdm_tty.c 
> b/drivers/staging/gdm724x/gdm_tty.c
> index 34a13d98c029..179fc9b9400b 100644
> --- a/drivers/staging/gdm724x/gdm_tty.c
> +++ b/drivers/staging/gdm724x/gdm_tty.c
> @@ -34,7 +34,7 @@ static DEFINE_MUTEX(gdm_table_lock);
>  static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
>  static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
>  
> -inline int gdm_tty_ready(struct gdm *gdm)
> +static bool gdm_tty_ready(struct gdm *gdm)
>  {
>   return (gdm && gdm->tty_dev && gdm->port.count);
>  }
> 


-- 
~Randy

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH][next] staging: media: atomisp: fix memory leak of object flash

2020-09-02 Thread Colin King
From: Colin Ian King 

In the case where the call to lm3554_platform_data_func returns an
error there is a memory leak on the error return path of object
flash.  Fix this by adding an error return path that will free
flash and rename labels fail2 to fail3 and fail1 to fail2.

Fixes: 9289cdf39992 ("staging: media: atomisp: Convert to GPIO descriptors")
Signed-off-by: Colin Ian King 
---
 .../media/atomisp/i2c/atomisp-lm3554.c| 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c 
b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
index 7ca7378b1859..5516c98f63bc 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
@@ -843,8 +843,10 @@ static int lm3554_probe(struct i2c_client *client)
return -ENOMEM;
 
flash->pdata = lm3554_platform_data_func(client);
-   if (IS_ERR(flash->pdata))
-   return PTR_ERR(flash->pdata);
+   if (IS_ERR(flash->pdata)) {
+   err = PTR_ERR(flash->pdata);
+   goto fail1;
+   }
 
v4l2_i2c_subdev_init(&flash->sd, client, &lm3554_ops);
flash->sd.internal_ops = &lm3554_internal_ops;
@@ -856,7 +858,7 @@ static int lm3554_probe(struct i2c_client *client)
   ARRAY_SIZE(lm3554_controls));
if (ret) {
dev_err(&client->dev, "error initialize a ctrl_handler.\n");
-   goto fail2;
+   goto fail3;
}
 
for (i = 0; i < ARRAY_SIZE(lm3554_controls); i++)
@@ -865,14 +867,14 @@ static int lm3554_probe(struct i2c_client *client)
 
if (flash->ctrl_handler.error) {
dev_err(&client->dev, "ctrl_handler error.\n");
-   goto fail2;
+   goto fail3;
}
 
flash->sd.ctrl_handler = &flash->ctrl_handler;
err = media_entity_pads_init(&flash->sd.entity, 0, NULL);
if (err) {
dev_err(&client->dev, "error initialize a media entity.\n");
-   goto fail1;
+   goto fail2;
}
 
flash->sd.entity.function = MEDIA_ENT_F_FLASH;
@@ -884,14 +886,15 @@ static int lm3554_probe(struct i2c_client *client)
err = lm3554_gpio_init(client);
if (err) {
dev_err(&client->dev, "gpio request/direction_output fail");
-   goto fail2;
+   goto fail3;
}
return atomisp_register_i2c_module(&flash->sd, NULL, LED_FLASH);
-fail2:
+fail3:
media_entity_cleanup(&flash->sd.entity);
v4l2_ctrl_handler_free(&flash->ctrl_handler);
-fail1:
+fail2:
v4l2_device_unregister_subdev(&flash->sd);
+fail1:
kfree(flash);
 
return err;
-- 
2.27.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 2/2] staging: gdm724x: gdm_tty: replaced macro with a function

2020-09-02 Thread antoni.przyby...@wp.pl

On 02.09.2020 18:21, Randy Dunlap wrote:

On 9/2/20 9:16 AM, Antoni Przybylik wrote:

Changed return type to bool and removed inline specifier. Also added
  static specifier.

why remove the inline specifier?


Greg KH wrote to me:

And really, no need to make it inline, just make it a normal function
and the compiler will inline it if needed.


thanks.


Signed-off-by: Antoni Przybylik 
---
  drivers/staging/gdm724x/gdm_tty.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gdm724x/gdm_tty.c 
b/drivers/staging/gdm724x/gdm_tty.c
index 34a13d98c029..179fc9b9400b 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -34,7 +34,7 @@ static DEFINE_MUTEX(gdm_table_lock);
  static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
  static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
  
-inline int gdm_tty_ready(struct gdm *gdm)

+static bool gdm_tty_ready(struct gdm *gdm)
  {
return (gdm && gdm->tty_dev && gdm->port.count);
  }




Antoni Przybylik
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 2/2] staging: gdm724x: gdm_tty: replaced macro with a function

2020-09-02 Thread Randy Dunlap
On 9/2/20 10:07 AM, antoni.przyby...@wp.pl wrote:
> On 02.09.2020 18:21, Randy Dunlap wrote:
>> On 9/2/20 9:16 AM, Antoni Przybylik wrote:
>>> Changed return type to bool and removed inline specifier. Also added
>>>   static specifier.
>> why remove the inline specifier?
> 
> Greg KH wrote to me:
> 
> And really, no need to make it inline, just make it a normal function
> and the compiler will inline it if needed.
> 
>> thanks.

OK, thanks.
Sometimes the compiler will also ignore inline if it wants to.
That's why we have to use __always_inline.

>>
>>> Signed-off-by: Antoni Przybylik 
>>> ---
>>>   drivers/staging/gdm724x/gdm_tty.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/staging/gdm724x/gdm_tty.c 
>>> b/drivers/staging/gdm724x/gdm_tty.c
>>> index 34a13d98c029..179fc9b9400b 100644
>>> --- a/drivers/staging/gdm724x/gdm_tty.c
>>> +++ b/drivers/staging/gdm724x/gdm_tty.c
>>> @@ -34,7 +34,7 @@ static DEFINE_MUTEX(gdm_table_lock);
>>>   static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
>>>   static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
>>>   -inline int gdm_tty_ready(struct gdm *gdm)
>>> +static bool gdm_tty_ready(struct gdm *gdm)
>>>   {
>>>   return (gdm && gdm->tty_dev && gdm->port.count);
>>>   }
>>>
>>
> Antoni Przybylik


-- 
~Randy
Reported-by: Randy Dunlap 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH][next] staging: media: atomisp: fix memory leak of object flash

2020-09-02 Thread Andy Shevchenko
On Wed, Sep 2, 2020 at 8:02 PM Colin King  wrote:
>
> From: Colin Ian King 
>
> In the case where the call to lm3554_platform_data_func returns an
> error there is a memory leak on the error return path of object
> flash.  Fix this by adding an error return path that will free
> flash and rename labels fail2 to fail3 and fail1 to fail2.
>

Wouldn't be proper fix to move to devm_kmalloc() and return
dev_err_probe() where appropriate?

> Fixes: 9289cdf39992 ("staging: media: atomisp: Convert to GPIO descriptors")
> Signed-off-by: Colin Ian King 
> ---
>  .../media/atomisp/i2c/atomisp-lm3554.c| 19 +++
>  1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c 
> b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
> index 7ca7378b1859..5516c98f63bc 100644
> --- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
> +++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
> @@ -843,8 +843,10 @@ static int lm3554_probe(struct i2c_client *client)
> return -ENOMEM;
>
> flash->pdata = lm3554_platform_data_func(client);
> -   if (IS_ERR(flash->pdata))
> -   return PTR_ERR(flash->pdata);
> +   if (IS_ERR(flash->pdata)) {
> +   err = PTR_ERR(flash->pdata);
> +   goto fail1;
> +   }
>
> v4l2_i2c_subdev_init(&flash->sd, client, &lm3554_ops);
> flash->sd.internal_ops = &lm3554_internal_ops;
> @@ -856,7 +858,7 @@ static int lm3554_probe(struct i2c_client *client)
>ARRAY_SIZE(lm3554_controls));
> if (ret) {
> dev_err(&client->dev, "error initialize a ctrl_handler.\n");
> -   goto fail2;
> +   goto fail3;
> }
>
> for (i = 0; i < ARRAY_SIZE(lm3554_controls); i++)
> @@ -865,14 +867,14 @@ static int lm3554_probe(struct i2c_client *client)
>
> if (flash->ctrl_handler.error) {
> dev_err(&client->dev, "ctrl_handler error.\n");
> -   goto fail2;
> +   goto fail3;
> }
>
> flash->sd.ctrl_handler = &flash->ctrl_handler;
> err = media_entity_pads_init(&flash->sd.entity, 0, NULL);
> if (err) {
> dev_err(&client->dev, "error initialize a media entity.\n");
> -   goto fail1;
> +   goto fail2;
> }
>
> flash->sd.entity.function = MEDIA_ENT_F_FLASH;
> @@ -884,14 +886,15 @@ static int lm3554_probe(struct i2c_client *client)
> err = lm3554_gpio_init(client);
> if (err) {
> dev_err(&client->dev, "gpio request/direction_output fail");
> -   goto fail2;
> +   goto fail3;
> }
> return atomisp_register_i2c_module(&flash->sd, NULL, LED_FLASH);
> -fail2:
> +fail3:
> media_entity_cleanup(&flash->sd.entity);
> v4l2_ctrl_handler_free(&flash->ctrl_handler);
> -fail1:
> +fail2:
> v4l2_device_unregister_subdev(&flash->sd);
> +fail1:
> kfree(flash);
>
> return err;
> --
> 2.27.0
>


-- 
With Best Regards,
Andy Shevchenko
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: media: atomisp: Fix error path in lm3554_probe()

2020-09-02 Thread Alex Dewar
The error path for lm3554_probe() contains a number of bugs, including:
 * resource leaks
 * jumping to error labels out of sequence
 * not setting the return value appropriately

Fix it up and give the labels more memorable names.

This issue has existed since the code was originally contributed in
commit a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2"),
although the code was subsequently removed altogether and then
reinstated with commit ad85094b293e ("Revert "media: staging: atomisp: Remove 
driver"").

Addresses-Coverity: ("Resource leak")
Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Alex Dewar 
---
 .../media/atomisp/i2c/atomisp-lm3554.c| 47 ++-
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c 
b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
index 7ca7378b1859..9aad6721fc84 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
@@ -833,7 +833,6 @@ static void *lm3554_platform_data_func(struct i2c_client 
*client)
 
 static int lm3554_probe(struct i2c_client *client)
 {
-   int err = 0;
struct lm3554 *flash;
unsigned int i;
int ret;
@@ -843,36 +842,38 @@ static int lm3554_probe(struct i2c_client *client)
return -ENOMEM;
 
flash->pdata = lm3554_platform_data_func(client);
-   if (IS_ERR(flash->pdata))
-   return PTR_ERR(flash->pdata);
+   if (IS_ERR(flash->pdata)) {
+   ret = PTR_ERR(flash->pdata);
+   goto err_free_flash;
+   }
 
v4l2_i2c_subdev_init(&flash->sd, client, &lm3554_ops);
flash->sd.internal_ops = &lm3554_internal_ops;
flash->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
flash->mode = ATOMISP_FLASH_MODE_OFF;
flash->timeout = LM3554_MAX_TIMEOUT / LM3554_TIMEOUT_STEPSIZE - 1;
-   ret =
-   v4l2_ctrl_handler_init(&flash->ctrl_handler,
-  ARRAY_SIZE(lm3554_controls));
+   ret = v4l2_ctrl_handler_init(&flash->ctrl_handler,
+ARRAY_SIZE(lm3554_controls));
if (ret) {
-   dev_err(&client->dev, "error initialize a ctrl_handler.\n");
-   goto fail2;
+   dev_err(&client->dev, "error initializing ctrl_handler");
+   goto err_unregister_sd;
}
 
for (i = 0; i < ARRAY_SIZE(lm3554_controls); i++)
v4l2_ctrl_new_custom(&flash->ctrl_handler, &lm3554_controls[i],
 NULL);
 
-   if (flash->ctrl_handler.error) {
-   dev_err(&client->dev, "ctrl_handler error.\n");
-   goto fail2;
+   ret = flash->ctrl_handler.error;
+   if (ret) {
+   dev_err(&client->dev, "ctrl_handler error");
+   goto err_free_ctrl_handler;
}
 
flash->sd.ctrl_handler = &flash->ctrl_handler;
-   err = media_entity_pads_init(&flash->sd.entity, 0, NULL);
-   if (err) {
-   dev_err(&client->dev, "error initialize a media entity.\n");
-   goto fail1;
+   ret = media_entity_pads_init(&flash->sd.entity, 0, NULL);
+   if (ret) {
+   dev_err(&client->dev, "error initializing media entity");
+   goto err_free_ctrl_handler;
}
 
flash->sd.entity.function = MEDIA_ENT_F_FLASH;
@@ -881,20 +882,22 @@ static int lm3554_probe(struct i2c_client *client)
 
timer_setup(&flash->flash_off_delay, lm3554_flash_off_delay, 0);
 
-   err = lm3554_gpio_init(client);
-   if (err) {
+   ret = lm3554_gpio_init(client);
+   if (ret) {
dev_err(&client->dev, "gpio request/direction_output fail");
-   goto fail2;
+   goto err_cleanup_entity;
}
return atomisp_register_i2c_module(&flash->sd, NULL, LED_FLASH);
-fail2:
+
+err_cleanup_entity:
media_entity_cleanup(&flash->sd.entity);
+err_free_ctrl_handler:
v4l2_ctrl_handler_free(&flash->ctrl_handler);
-fail1:
+err_unregister_sd:
v4l2_device_unregister_subdev(&flash->sd);
+err_free_flash:
kfree(flash);
-
-   return err;
+   return ret;
 }
 
 static int lm3554_remove(struct i2c_client *client)
-- 
2.28.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-02 Thread Jim Quinlan
On Tue, Sep 1, 2020 at 4:24 AM Christoph Hellwig  wrote:
>
> I've applied this to the dma-mapping tree.
>
> I had to resolve a conflict in drivers/of/address.c with a recent
> mainline commit.  I also applied the minor tweaks Andy pointed out
> plus a few more style changes.  A real change is that I changed the
> prototype for dma_copy_dma_range_map to require less boilerplate code.
>
> The result is here:
>
> 
> http://git.infradead.org/users/hch/dma-mapping.git/commitdiff/eef520b232c60e74eb8b33a5a7863ad8f2b4a5c7
>
> please double check that everyting works as expected.
Tested-by: Jim Quinlan 

Thanks Christoph
Jim
>
> I can cut a stable branch with this if you need it for other trees, but
> I'd like to wait a few days to see if there is any fallout first.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8723bs: os_dep: added blank line to fix coding style issue

2020-09-02 Thread Ross Schmidt
Fixed a coding style issue by adding a blank line after declarations in
sdio_intf.c to fix a checkpatch warning.

Signed-off-by: Ross Schmidt 
---
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c 
b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index f1e2829a19a7..79b55ec827a4 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -131,6 +131,7 @@ static irqreturn_t gpio_hostwakeup_irq_thread(int irq, void 
*data)
 static u8 gpio_hostwakeup_alloc_irq(struct adapter *padapter)
 {
int err;
+
if (oob_irq == 0) {
DBG_871X("oob_irq ZERO!\n");
return _FAIL;
-- 
2.26.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-02 Thread Nathan Chancellor
On Mon, Aug 24, 2020 at 03:30:20PM -0400, Jim Quinlan wrote:
> The new field 'dma_range_map' in struct device is used to facilitate the
> use of single or multiple offsets between mapping regions of cpu addrs and
> dma addrs.  It subsumes the role of "dev->dma_pfn_offset" which was only
> capable of holding a single uniform offset and had no region bounds
> checking.
> 
> The function of_dma_get_range() has been modified so that it takes a single
> argument -- the device node -- and returns a map, NULL, or an error code.
> The map is an array that holds the information regarding the DMA regions.
> Each range entry contains the address offset, the cpu_start address, the
> dma_start address, and the size of the region.
> 
> of_dma_configure() is the typical manner to set range offsets but there are
> a number of ad hoc assignments to "dev->dma_pfn_offset" in the kernel
> driver code.  These cases now invoke the function
> dma_attach_offset_range(dev, cpu_addr, dma_addr, size).
> 
> Signed-off-by: Jim Quinlan 
> ---
>  arch/arm/include/asm/dma-mapping.h| 10 +--
>  arch/arm/mach-keystone/keystone.c | 17 +++--
>  arch/sh/drivers/pci/pcie-sh7786.c |  9 +--
>  arch/x86/pci/sta2x11-fixup.c  |  7 +-
>  drivers/acpi/arm64/iort.c |  5 +-
>  drivers/base/core.c   |  2 +
>  drivers/gpu/drm/sun4i/sun4i_backend.c |  5 +-
>  drivers/iommu/io-pgtable-arm.c|  2 +-
>  .../platform/sunxi/sun4i-csi/sun4i_csi.c  |  5 +-
>  .../platform/sunxi/sun6i-csi/sun6i_csi.c  |  4 +-
>  drivers/of/address.c  | 72 +--
>  drivers/of/device.c   | 43 ++-
>  drivers/of/of_private.h   | 10 +--
>  drivers/of/unittest.c | 34 ++---
>  drivers/remoteproc/remoteproc_core.c  |  8 ++-
>  .../staging/media/sunxi/cedrus/cedrus_hw.c|  7 +-
>  drivers/usb/core/message.c|  9 ++-
>  drivers/usb/core/usb.c|  7 +-
>  include/linux/device.h|  4 +-
>  include/linux/dma-direct.h|  8 +--
>  include/linux/dma-mapping.h   | 36 ++
>  kernel/dma/coherent.c | 10 +--
>  kernel/dma/mapping.c  | 66 +
>  23 files changed, 265 insertions(+), 115 deletions(-)

Apologies if this has already been reported or is known but this commit
is now in next-20200902 and it causes my Raspberry Pi 4 to no longer
make it to userspace, instead spewing mmc errors:

That commit causes my Raspberry Pi 4 to no longer make it to userspace,
instead spewing mmc errors:

[0.00] Booting Linux on physical CPU 0x00 [0x410fd083]
[0.00] Linux version 5.9.0-rc3-4-geef520b232c6-dirty 
(nathan@ubuntu-n2-xlarge-x86) (ClangBuiltLinux clang version 12.0.0 
(https://github.com/llvm/llvm-project.git 
b21ddded8f04fee925bbf9e6458347104b5b99eb), LLD 12.0.0 
(https://github.com/llvm/llvm-project.git 
b21ddded8f04fee925bbf9e6458347104b5b99eb)) #1 SMP PREEMPT Wed Sep 2 13:48:49 
MST 2020
[0.00] Machine model: Raspberry Pi 4 Model B Rev 1.2
...
[1.459752] raspberrypi-firmware soc:firmware: Attached to firmware from 
2020-08-24T18:50:56
[1.57] dwc2 fe98.usb: supply vusb_d not found, using dummy regulator
[1.507454] dwc2 fe98.usb: supply vusb_a not found, using dummy regulator
[1.615547] dwc2 fe98.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[1.627537] sdhci-iproc fe30.sdhci: allocated mmc-pwrseq
[1.665497] mmc0: SDHCI controller on fe30.sdhci [fe30.sdhci] using 
PIO
[1.690601] mmc0: queuing unknown CIS tuple 0x80 (2 bytes)
[1.697892] mmc0: queuing unknown CIS tuple 0x80 (3 bytes)
[1.705173] mmc0: queuing unknown CIS tuple 0x80 (3 bytes)
[1.713788] mmc0: queuing unknown CIS tuple 0x80 (7 bytes)
[1.721228] mmc0: queuing unknown CIS tuple 0x80 (3 bytes)
[1.732062] mmc1: SDHCI controller on fe34.emmc2 [fe34.emmc2] using 
ADMA
[1.741828] ALSA device list:
[1.744885]   No soundcards found.
[1.748540] Waiting for root device PARTUUID=45a8dd8a-02...
[1.788865] random: fast init done
[1.793489] mmc1: unrecognised SCR structure version 4
[1.798814] mmc1: error -22 whilst initialising SD card
[1.813969] mmc0: new high speed SDIO card at address 0001
[1.883178] mmc1: unrecognised SCR structure version 2
[1.888423] mmc1: error -22 whilst initialising SD card
[1.964069] mmc1: unrecognised SCR structure version 4
[1.969314] mmc1: error -22 whilst initialising SD card
[2.061225] mmc1: unrecognised SCR structure version 4
[2.066470] mmc1: error -22 whilst initialising

Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-02 Thread Nathan Chancellor
On Wed, Sep 02, 2020 at 06:11:08PM -0400, Jim Quinlan wrote:
> On Wed, Sep 2, 2020 at 5:53 PM Nathan Chancellor
>  wrote:
> >
> > On Mon, Aug 24, 2020 at 03:30:20PM -0400, Jim Quinlan wrote:
> > > The new field 'dma_range_map' in struct device is used to facilitate the
> > > use of single or multiple offsets between mapping regions of cpu addrs and
> > > dma addrs.  It subsumes the role of "dev->dma_pfn_offset" which was only
> > > capable of holding a single uniform offset and had no region bounds
> > > checking.
> > >
> > > The function of_dma_get_range() has been modified so that it takes a 
> > > single
> > > argument -- the device node -- and returns a map, NULL, or an error code.
> > > The map is an array that holds the information regarding the DMA regions.
> > > Each range entry contains the address offset, the cpu_start address, the
> > > dma_start address, and the size of the region.
> > >
> > > of_dma_configure() is the typical manner to set range offsets but there 
> > > are
> > > a number of ad hoc assignments to "dev->dma_pfn_offset" in the kernel
> > > driver code.  These cases now invoke the function
> > > dma_attach_offset_range(dev, cpu_addr, dma_addr, size).
> > >
> > > Signed-off-by: Jim Quinlan 
> > > ---
> > >  arch/arm/include/asm/dma-mapping.h| 10 +--
> > >  arch/arm/mach-keystone/keystone.c | 17 +++--
> > >  arch/sh/drivers/pci/pcie-sh7786.c |  9 +--
> > >  arch/x86/pci/sta2x11-fixup.c  |  7 +-
> > >  drivers/acpi/arm64/iort.c |  5 +-
> > >  drivers/base/core.c   |  2 +
> > >  drivers/gpu/drm/sun4i/sun4i_backend.c |  5 +-
> > >  drivers/iommu/io-pgtable-arm.c|  2 +-
> > >  .../platform/sunxi/sun4i-csi/sun4i_csi.c  |  5 +-
> > >  .../platform/sunxi/sun6i-csi/sun6i_csi.c  |  4 +-
> > >  drivers/of/address.c  | 72 +--
> > >  drivers/of/device.c   | 43 ++-
> > >  drivers/of/of_private.h   | 10 +--
> > >  drivers/of/unittest.c | 34 ++---
> > >  drivers/remoteproc/remoteproc_core.c  |  8 ++-
> > >  .../staging/media/sunxi/cedrus/cedrus_hw.c|  7 +-
> > >  drivers/usb/core/message.c|  9 ++-
> > >  drivers/usb/core/usb.c|  7 +-
> > >  include/linux/device.h|  4 +-
> > >  include/linux/dma-direct.h|  8 +--
> > >  include/linux/dma-mapping.h   | 36 ++
> > >  kernel/dma/coherent.c | 10 +--
> > >  kernel/dma/mapping.c  | 66 +
> > >  23 files changed, 265 insertions(+), 115 deletions(-)
> >
> > Apologies if this has already been reported or is known but this commit
> > is now in next-20200902 and it causes my Raspberry Pi 4 to no longer
> > make it to userspace, instead spewing mmc errors:
> >
> > That commit causes my Raspberry Pi 4 to no longer make it to userspace,
> > instead spewing mmc errors:
> >
> > [0.00] Booting Linux on physical CPU 0x00 [0x410fd083]
> > [0.00] Linux version 5.9.0-rc3-4-geef520b232c6-dirty 
> > (nathan@ubuntu-n2-xlarge-x86) (ClangBuiltLinux clang version 12.0.0 
> > (https://github.com/llvm/llvm-project.git 
> > b21ddded8f04fee925bbf9e6458347104b5b99eb), LLD 12.0.0 
> > (https://github.com/llvm/llvm-project.git 
> > b21ddded8f04fee925bbf9e6458347104b5b99eb)) #1 SMP PREEMPT Wed Sep 2 
> > 13:48:49 MST 2020
> > [0.00] Machine model: Raspberry Pi 4 Model B Rev 1.2
> > ...
> > [1.459752] raspberrypi-firmware soc:firmware: Attached to firmware from 
> > 2020-08-24T18:50:56
> > [1.57] dwc2 fe98.usb: supply vusb_d not found, using dummy 
> > regulator
> > [1.507454] dwc2 fe98.usb: supply vusb_a not found, using dummy 
> > regulator
> > [1.615547] dwc2 fe98.usb: EPs: 8, dedicated fifos, 4080 entries in 
> > SPRAM
> > [1.627537] sdhci-iproc fe30.sdhci: allocated mmc-pwrseq
> > [1.665497] mmc0: SDHCI controller on fe30.sdhci [fe30.sdhci] 
> > using PIO
> > [1.690601] mmc0: queuing unknown CIS tuple 0x80 (2 bytes)
> > [1.697892] mmc0: queuing unknown CIS tuple 0x80 (3 bytes)
> > [1.705173] mmc0: queuing unknown C

[PATCH] staging: pi433: break long lines

2020-09-02 Thread Bryan Brattlof


scripts/checkpatch.pl is warning about some lines exceeding 100
charecters. This will cleanup the warnings.

Signed-off-by: Bryan Brattlof 
---
 drivers/staging/pi433/pi433_if.h | 26 ++
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.h b/drivers/staging/pi433/pi433_if.h
index 16c5b7fba249..d5c1521192c1 100644
--- a/drivers/staging/pi433/pi433_if.h
+++ b/drivers/staging/pi433/pi433_if.h
@@ -117,9 +117,15 @@ struct pi433_rx_cfg {
 
/* packet format */
enum option_on_off  enable_sync;
-   enum option_on_off  enable_length_byte;   /* should be used in 
combination with sync, only */
-   enum address_filtering  enable_address_filtering; /* operational with 
sync, only */
-   enum option_on_off  enable_crc;   /* only operational, 
if sync on and fixed length or length byte is used */
+
+   /* should be used in combination with sync, only */
+   enum option_on_off  enable_length_byte;
+
+   /* operational with sync, only */
+   enum address_filtering  enable_address_filtering;
+
+   /* only operational, if sync on and fixed length or length byte is used 
*/
+   enum option_on_off  enable_crc;
 
__u8sync_length;
__u8fixed_message_length;
@@ -130,12 +136,16 @@ struct pi433_rx_cfg {
__u8broadcast_address;
 };
 
-#define PI433_IOC_MAGIC'r'
+#define PI433_IOC_MAGIC'r'
 
-#define PI433_IOC_RD_TX_CFG_IOR(PI433_IOC_MAGIC, PI433_TX_CFG_IOCTL_NR, 
char[sizeof(struct pi433_tx_cfg)])
-#define PI433_IOC_WR_TX_CFG_IOW(PI433_IOC_MAGIC, PI433_TX_CFG_IOCTL_NR, 
char[sizeof(struct pi433_tx_cfg)])
+#define PI433_IOC_RD_TX_CFG \
+   _IOR(PI433_IOC_MAGIC, PI433_TX_CFG_IOCTL_NR, char[sizeof(struct 
pi433_tx_cfg)])
+#define PI433_IOC_WR_TX_CFG \
+   _IOW(PI433_IOC_MAGIC, PI433_TX_CFG_IOCTL_NR, char[sizeof(struct 
pi433_tx_cfg)])
 
-#define PI433_IOC_RD_RX_CFG_IOR(PI433_IOC_MAGIC, PI433_RX_CFG_IOCTL_NR, 
char[sizeof(struct pi433_rx_cfg)])
-#define PI433_IOC_WR_RX_CFG_IOW(PI433_IOC_MAGIC, PI433_RX_CFG_IOCTL_NR, 
char[sizeof(struct pi433_rx_cfg)])
+#define PI433_IOC_RD_RX_CFG \
+   _IOR(PI433_IOC_MAGIC, PI433_RX_CFG_IOCTL_NR, char[sizeof(struct 
pi433_rx_cfg)])
+#define PI433_IOC_WR_RX_CFG \
+   _IOW(PI433_IOC_MAGIC, PI433_RX_CFG_IOCTL_NR, char[sizeof(struct 
pi433_rx_cfg)])
 
 #endif /* PI433_H */
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-02 Thread Florian Fainelli




On 9/2/2020 3:38 PM, Nathan Chancellor wrote:
[snip]

Hello Nathan,

Can you tell me how much memory your RPI has and if all of it is


This is the 4GB version.


accessible by the PCIe device?  Could you also please include the DTS
of the PCIe node?  IIRC, the RPI firmware does some mangling of the
PCIe DT before Linux boots -- could you describe what is going on
there?


Unfortunately, I am not familiar with how to get this information. If
you could provide some instructions for how to do so, I am more than
happy to. I am not very knowleagable about the inner working of the Pi,
I mainly use it as a test platform for making sure that LLVM does not
cause problems on real devices.


Can you bring the dtc application to your Pi root filesystem, and if so, 
can you run the following:


dtc -I fs -O dtb /proc/device-tree -f > /tmp/device.dtb

or cat /sys/firmware/fdt > device.dtb

and attach the resulting file?




Finally, can you attach the text of the full boot log?


I have attached a working and broken boot log. Thank you for the quick
response!


Is it possible for you to rebuild your kernel with CONFIG_MMC_DEBUG by 
any chance?


I have a suspicion that this part of the DTS for the bcm2711.dtsi 
platform is at fault:


https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/bcm2711.dtsi#n264

and the resulting dma-ranges parsing is just not working for reasons to 
be determined.

--
Florian
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-02 Thread Nathan Chancellor
On Wed, Sep 02, 2020 at 05:36:29PM -0700, Florian Fainelli wrote:
> 
> 
> On 9/2/2020 3:38 PM, Nathan Chancellor wrote:
> [snip]
> > > Hello Nathan,
> > > 
> > > Can you tell me how much memory your RPI has and if all of it is
> > 
> > This is the 4GB version.
> > 
> > > accessible by the PCIe device?  Could you also please include the DTS
> > > of the PCIe node?  IIRC, the RPI firmware does some mangling of the
> > > PCIe DT before Linux boots -- could you describe what is going on
> > > there?
> > 
> > Unfortunately, I am not familiar with how to get this information. If
> > you could provide some instructions for how to do so, I am more than
> > happy to. I am not very knowleagable about the inner working of the Pi,
> > I mainly use it as a test platform for making sure that LLVM does not
> > cause problems on real devices.
> 
> Can you bring the dtc application to your Pi root filesystem, and if so, can
> you run the following:
> 
> dtc -I fs -O dtb /proc/device-tree -f > /tmp/device.dtb

Sure, the result is attached.

> or cat /sys/firmware/fdt > device.dtb
> 
> and attach the resulting file?
> 
> > 
> > > Finally, can you attach the text of the full boot log?
> > 
> > I have attached a working and broken boot log. Thank you for the quick
> > response!
> 
> Is it possible for you to rebuild your kernel with CONFIG_MMC_DEBUG by any
> chance?

Of course. A new log is attached with the debug output from that config.

> I have a suspicion that this part of the DTS for the bcm2711.dtsi platform
> is at fault:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/bcm2711.dtsi#n264
> 
> and the resulting dma-ranges parsing is just not working for reasons to be
> determined.
> --
> Florian

Let me know if you need anything else out of me.

Cheers,
Nathan


device.dtb
Description: Binary data
[0.00] Booting Linux on physical CPU 0x00 [0x410fd083]
[0.00] Linux version 5.9.0-rc3-next-20200902-dirty 
(nathan@ubuntu-n2-xlarge-x86) (ClangBuiltLinux clang version 12.0.0 
(https://github.com/llvm/llvm-project.git 
b21ddded8f04fee925bbf9e6458347104b5b99eb), LLD 12.0.0 
(https://github.com/llvm/llvm-project.git 
b21ddded8f04fee925bbf9e6458347104b5b99eb)) #1 SMP PREEMPT Wed Sep 2 17:41:42 
MST 2020
[0.00] Machine model: Raspberry Pi 4 Model B Rev 1.2
[0.00] efi: UEFI not found.
[0.00] Reserved memory: created CMA memory pool at 0x3740, 
size 64 MiB
[0.00] OF: reserved mem: initialized node linux,cma, compatible id 
shared-dma-pool
[0.00] NUMA: No NUMA configuration found
[0.00] NUMA: Faking a node at [mem 
0x-0xfbff]
[0.00] NUMA: NODE_DATA [mem 0xfb81f100-0xfb820fff]
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x3fff]
[0.00]   DMA32[mem 0x4000-0xfbff]
[0.00]   Normal   empty
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x3b3f]
[0.00]   node   0: [mem 0x4000-0xfbff]
[0.00] Initmem setup node 0 [mem 0x-0xfbff]
[0.00] percpu: Embedded 23 pages/cpu s54168 r8192 d31848 u94208
[0.00] Detected PIPT I-cache on CPU0
[0.00] CPU features: detected: EL2 vector hardening
[0.00] CPU features: kernel page table isolation forced ON by KASLR
[0.00] CPU features: detected: Kernel page table isolation (KPTI)
[0.00] ARM_SMCCC_ARCH_WORKAROUND_1 missing from firmware
[0.00] CPU features: detected: ARM errata 1165522, 1319367, or 1530923
[0.00] Built 1 zonelists, mobility grouping on.  Total pages: 996912
[0.00] Policy zone: DMA32
[0.00] Kernel command line:  dma.dmachans=0x71f5 
bcm2709.boardrev=0xc03112 bcm2709.serial=0xb78d398 bcm2709.uart_clock=4800 
bcm2709.disk_led_gpio=42 bcm2709.disk_led_active_low=0 
smsc95xx.macaddr=DC:A6:32:60:6C:87 vc_mem.mem_base=0x3ec0 
vc_mem.mem_size=0x4000  console=ttyS1,115200 console=tty1 
root=PARTUUID=45a8dd8a-02 rootfstype=ext4 elevator=deadline fsck.repair=yes 
rootwait plymouth.ignore-serial-consoles
[0.00] Kernel parameter elevator= does not have any effect anymore.
[0.00] Please use sysfs to set IO scheduler for individual devices.
[0.00] Dentry cache hash table entries: 524288 (order: 10, 4194304 
bytes, linear)
[0.00] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, 
linear)
[0.00] mem auto-init: stack:off, heap alloc:off, heap free:off
[0.00] software IO TLB: mapped [mem 0x3340-0x3740] (64

Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-02 Thread Jim Quinlan
On Wed, Sep 2, 2020 at 5:53 PM Nathan Chancellor
 wrote:
>
> On Mon, Aug 24, 2020 at 03:30:20PM -0400, Jim Quinlan wrote:
> > The new field 'dma_range_map' in struct device is used to facilitate the
> > use of single or multiple offsets between mapping regions of cpu addrs and
> > dma addrs.  It subsumes the role of "dev->dma_pfn_offset" which was only
> > capable of holding a single uniform offset and had no region bounds
> > checking.
> >
> > The function of_dma_get_range() has been modified so that it takes a single
> > argument -- the device node -- and returns a map, NULL, or an error code.
> > The map is an array that holds the information regarding the DMA regions.
> > Each range entry contains the address offset, the cpu_start address, the
> > dma_start address, and the size of the region.
> >
> > of_dma_configure() is the typical manner to set range offsets but there are
> > a number of ad hoc assignments to "dev->dma_pfn_offset" in the kernel
> > driver code.  These cases now invoke the function
> > dma_attach_offset_range(dev, cpu_addr, dma_addr, size).
> >
> > Signed-off-by: Jim Quinlan 
> > ---
> >  arch/arm/include/asm/dma-mapping.h| 10 +--
> >  arch/arm/mach-keystone/keystone.c | 17 +++--
> >  arch/sh/drivers/pci/pcie-sh7786.c |  9 +--
> >  arch/x86/pci/sta2x11-fixup.c  |  7 +-
> >  drivers/acpi/arm64/iort.c |  5 +-
> >  drivers/base/core.c   |  2 +
> >  drivers/gpu/drm/sun4i/sun4i_backend.c |  5 +-
> >  drivers/iommu/io-pgtable-arm.c|  2 +-
> >  .../platform/sunxi/sun4i-csi/sun4i_csi.c  |  5 +-
> >  .../platform/sunxi/sun6i-csi/sun6i_csi.c  |  4 +-
> >  drivers/of/address.c  | 72 +--
> >  drivers/of/device.c   | 43 ++-
> >  drivers/of/of_private.h   | 10 +--
> >  drivers/of/unittest.c | 34 ++---
> >  drivers/remoteproc/remoteproc_core.c  |  8 ++-
> >  .../staging/media/sunxi/cedrus/cedrus_hw.c|  7 +-
> >  drivers/usb/core/message.c|  9 ++-
> >  drivers/usb/core/usb.c|  7 +-
> >  include/linux/device.h|  4 +-
> >  include/linux/dma-direct.h|  8 +--
> >  include/linux/dma-mapping.h   | 36 ++
> >  kernel/dma/coherent.c | 10 +--
> >  kernel/dma/mapping.c  | 66 +
> >  23 files changed, 265 insertions(+), 115 deletions(-)
>
> Apologies if this has already been reported or is known but this commit
> is now in next-20200902 and it causes my Raspberry Pi 4 to no longer
> make it to userspace, instead spewing mmc errors:
>
> That commit causes my Raspberry Pi 4 to no longer make it to userspace,
> instead spewing mmc errors:
>
> [0.00] Booting Linux on physical CPU 0x00 [0x410fd083]
> [0.00] Linux version 5.9.0-rc3-4-geef520b232c6-dirty 
> (nathan@ubuntu-n2-xlarge-x86) (ClangBuiltLinux clang version 12.0.0 
> (https://github.com/llvm/llvm-project.git 
> b21ddded8f04fee925bbf9e6458347104b5b99eb), LLD 12.0.0 
> (https://github.com/llvm/llvm-project.git 
> b21ddded8f04fee925bbf9e6458347104b5b99eb)) #1 SMP PREEMPT Wed Sep 2 13:48:49 
> MST 2020
> [0.00] Machine model: Raspberry Pi 4 Model B Rev 1.2
> ...
> [1.459752] raspberrypi-firmware soc:firmware: Attached to firmware from 
> 2020-08-24T18:50:56
> [1.57] dwc2 fe98.usb: supply vusb_d not found, using dummy 
> regulator
> [1.507454] dwc2 fe98.usb: supply vusb_a not found, using dummy 
> regulator
> [1.615547] dwc2 fe98.usb: EPs: 8, dedicated fifos, 4080 entries in 
> SPRAM
> [1.627537] sdhci-iproc fe30.sdhci: allocated mmc-pwrseq
> [1.665497] mmc0: SDHCI controller on fe30.sdhci [fe30.sdhci] 
> using PIO
> [1.690601] mmc0: queuing unknown CIS tuple 0x80 (2 bytes)
> [1.697892] mmc0: queuing unknown CIS tuple 0x80 (3 bytes)
> [1.705173] mmc0: queuing unknown CIS tuple 0x80 (3 bytes)
> [1.713788] mmc0: queuing unknown CIS tuple 0x80 (7 bytes)
> [1.721228] mmc0: queuing unknown CIS tuple 0x80 (3 bytes)
> [1.732062] mmc1: SDHCI controller on fe34.emmc2 [fe34.emmc2] 
> using ADMA
> [1.741828] ALSA device list:
> [1.744885]   No soundcards found.
> [1.748540] Waiting for root device PARTUUID=45a8dd8a-02...
> [1.788865] random: fast init done
> [1.793489] mmc1: unrecognised SCR

Re: [PATCH v3] staging: qlge: fix build breakage with dumping enabled

2020-09-02 Thread Benjamin Poirier
On 2020-09-02 22:00 +0800, Coiby Xu wrote:
> This fixes commit 0107635e15ac
> ("staging: qlge: replace pr_err with netdev_err") which introduced an
> build breakage of missing `struct ql_adapter *qdev` for some functions
> and a warning of type mismatch with dumping enabled, i.e.,
> 
> $ make CFLAGS_MODULE="QL_ALL_DUMP=1 QL_OB_DUMP=1 QL_CB_DUMP=1 \
>   QL_IB_DUMP=1 QL_REG_DUMP=1 QL_DEV_DUMP=1" M=drivers/staging/qlge
> 
> qlge_dbg.c: In function ‘ql_dump_ob_mac_rsp’:
> qlge_dbg.c:2051:13: error: ‘qdev’ undeclared (first use in this function); 
> did you mean ‘cdev’?
>  2051 |  netdev_err(qdev->ndev, "%s\n", __func__);
>   | ^~~~
> qlge_dbg.c: In function ‘ql_dump_routing_entries’:
> qlge_dbg.c:1435:10: warning: format ‘%s’ expects argument of type ‘char *’, 
> but argument 3 has type ‘int’ [-Wformat=]
>  1435 |"%s: Routing Mask %d = 0x%.08x\n",
>   | ~^
>   |  |
>   |  char *
>   | %d
>  1436 |i, value);
>   |~
>   ||
>   |int
> qlge_dbg.c:1435:37: warning: format ‘%x’ expects a matching ‘unsigned int’ 
> argument [-Wformat=]
>  1435 |"%s: Routing Mask %d = 0x%.08x\n",
>   | ^
>   | |
>   | unsigned int
> 
> Fixes: 0107635e15ac ("staging: qlge: replace pr_err with netdev_err")
> Reported-by: Benjamin Poirier 
> Suggested-by: Benjamin Poirier 
> Signed-off-by: Coiby Xu 
> ---

Thanks for following up on this issue.

[...]
> @@ -1632,8 +1635,8 @@ void ql_dump_wqicb(struct wqicb *wqicb)
> 
>  void ql_dump_tx_ring(struct tx_ring *tx_ring)
>  {
> - if (!tx_ring)
> - return;
> + struct ql_adapter *qdev = tx_ring->qdev;
> +
>   netdev_err(qdev->ndev, "= Dumping tx_ring %d 
> ===\n",
>  tx_ring->wq_id);
>   netdev_err(qdev->ndev, "tx_ring->base = %p\n", tx_ring->wq_base);

Did you actually check to confirm that the test can be removed?

This is something that you should mention in the changelog at the very
least since that change is not directly about fixing the build breakage
and if it's wrong, it can lead to null pointer deref.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Nutzen Sie diese Gelegenheit

2020-09-02 Thread Ying Chongan
Schöne Grüße,

Ich habe Ihre Antwort-E-Mail zu meinem Investitionsvorschlag noch nicht
erhalten.

Wir bieten ein schnelles Darlehen zu einem niedrigen Zinssatz an. Wenn Sie
interessiert sind, antworten Sie bitte an yingchon...@gmail.com, um
weitere Informationen zu erhalten.

Mit freundlichen Grüßen: Ying Chongan

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: gdm724x: gdm_tty: replaced macro with a function

2020-09-02 Thread Joe Perches
On Tue, 2020-09-01 at 22:16 +0200, Antoni Przybylik wrote:
> This approach is more elegant and prevents some problems related to
> macros such as operator precedence in expanded expression.
[]
> diff --git a/drivers/staging/gdm724x/gdm_tty.c 
> b/drivers/staging/gdm724x/gdm_tty.c
[]
> @@ -36,6 +34,11 @@ static DEFINE_MUTEX(gdm_table_lock);
>  static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
>  static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
>  
> +static int gdm_tty_ready(struct gdm *gdm)
> +{
> + return (gdm && gdm->tty_dev && gdm->port.count);
> +}

static bool  gdm_tty_ready might be better.


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Nutzen Sie diese Gelegenheit

2020-09-02 Thread Ying Chongan
Schöne Grüße,

Ich melde mich bei Ihnen, um in ein lukratives Geschäft in Ihrem Land zu
investieren.

Wir bieten ein schnelles Darlehen zu einem niedrigen Zinssatz an. Wenn
Sie interessiert sind, antworten Sie bitte an yingchon...@naver.com, um
weitere Informationen zu erhalten.

Mit freundlichen Grüßen: Ying Chongan

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: gdm724x: gdm_tty: replaced macro with a function

2020-09-02 Thread Antoni Przybylik
This approach is more elegant and prevents some problems related to
macros such as operator precedence in expanded expression.
---
Changed return type to bool and removed inline sepcifier.

Signed-off-by: Antoni Przybylik 
---
 drivers/staging/gdm724x/gdm_tty.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_tty.c 
b/drivers/staging/gdm724x/gdm_tty.c
index 6e813693a766..179fc9b9400b 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -27,8 +27,6 @@
 
 #define MUX_TX_MAX_SIZE 2048
 
-#define GDM_TTY_READY(gdm) (gdm && gdm->tty_dev && gdm->port.count)
-
 static struct tty_driver *gdm_driver[TTY_MAX_COUNT];
 static struct gdm *gdm_table[TTY_MAX_COUNT][GDM_TTY_MINOR];
 static DEFINE_MUTEX(gdm_table_lock);
@@ -36,6 +34,11 @@ static DEFINE_MUTEX(gdm_table_lock);
 static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
 static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
 
+static bool gdm_tty_ready(struct gdm *gdm)
+{
+   return (gdm && gdm->tty_dev && gdm->port.count);
+}
+
 static void gdm_port_destruct(struct tty_port *port)
 {
struct gdm *gdm = container_of(port, struct gdm, port);
@@ -119,7 +122,7 @@ static int gdm_tty_recv_complete(void *data,
 {
struct gdm *gdm = tty_dev->gdm[index];
 
-   if (!GDM_TTY_READY(gdm)) {
+   if (!gdm_tty_ready(gdm)) {
if (complete == RECV_PACKET_PROCESS_COMPLETE)
gdm->tty_dev->recv_func(gdm->tty_dev->priv_dev,
gdm_tty_recv_complete);
@@ -146,7 +149,7 @@ static void gdm_tty_send_complete(void *arg)
 {
struct gdm *gdm = arg;
 
-   if (!GDM_TTY_READY(gdm))
+   if (!gdm_tty_ready(gdm))
return;
 
tty_port_tty_wakeup(&gdm->port);
@@ -160,7 +163,7 @@ static int gdm_tty_write(struct tty_struct *tty, const 
unsigned char *buf,
int sent_len = 0;
int sending_len = 0;
 
-   if (!GDM_TTY_READY(gdm))
+   if (!gdm_tty_ready(gdm))
return -ENODEV;
 
if (!len)
@@ -187,7 +190,7 @@ static int gdm_tty_write_room(struct tty_struct *tty)
 {
struct gdm *gdm = tty->driver_data;
 
-   if (!GDM_TTY_READY(gdm))
+   if (!gdm_tty_ready(gdm))
return -ENODEV;
 
return WRITE_SIZE;
-- 
2.28.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: gdm724x: gdm_tty: replaced macro with a function v2

2020-09-02 Thread Antoni Przybylik
This approach is more elegant and prevents some problems related to
macros such as operator precedence in expanded expression.
---
Changed return type to bool and removed inline sepcifier.

Signed-off-by: Antoni Przybylik 
---
 drivers/staging/gdm724x/gdm_tty.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_tty.c 
b/drivers/staging/gdm724x/gdm_tty.c
index 6e813693a766..179fc9b9400b 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -27,8 +27,6 @@
 
 #define MUX_TX_MAX_SIZE 2048
 
-#define GDM_TTY_READY(gdm) (gdm && gdm->tty_dev && gdm->port.count)
-
 static struct tty_driver *gdm_driver[TTY_MAX_COUNT];
 static struct gdm *gdm_table[TTY_MAX_COUNT][GDM_TTY_MINOR];
 static DEFINE_MUTEX(gdm_table_lock);
@@ -36,6 +34,11 @@ static DEFINE_MUTEX(gdm_table_lock);
 static const char *DRIVER_STRING[TTY_MAX_COUNT] = {"GCTATC", "GCTDM"};
 static char *DEVICE_STRING[TTY_MAX_COUNT] = {"GCT-ATC", "GCT-DM"};
 
+static bool gdm_tty_ready(struct gdm *gdm)
+{
+   return (gdm && gdm->tty_dev && gdm->port.count);
+}
+
 static void gdm_port_destruct(struct tty_port *port)
 {
struct gdm *gdm = container_of(port, struct gdm, port);
@@ -119,7 +122,7 @@ static int gdm_tty_recv_complete(void *data,
 {
struct gdm *gdm = tty_dev->gdm[index];
 
-   if (!GDM_TTY_READY(gdm)) {
+   if (!gdm_tty_ready(gdm)) {
if (complete == RECV_PACKET_PROCESS_COMPLETE)
gdm->tty_dev->recv_func(gdm->tty_dev->priv_dev,
gdm_tty_recv_complete);
@@ -146,7 +149,7 @@ static void gdm_tty_send_complete(void *arg)
 {
struct gdm *gdm = arg;
 
-   if (!GDM_TTY_READY(gdm))
+   if (!gdm_tty_ready(gdm))
return;
 
tty_port_tty_wakeup(&gdm->port);
@@ -160,7 +163,7 @@ static int gdm_tty_write(struct tty_struct *tty, const 
unsigned char *buf,
int sent_len = 0;
int sending_len = 0;
 
-   if (!GDM_TTY_READY(gdm))
+   if (!gdm_tty_ready(gdm))
return -ENODEV;
 
if (!len)
@@ -187,7 +190,7 @@ static int gdm_tty_write_room(struct tty_struct *tty)
 {
struct gdm *gdm = tty->driver_data;
 
-   if (!GDM_TTY_READY(gdm))
+   if (!gdm_tty_ready(gdm))
return -ENODEV;
 
return WRITE_SIZE;
-- 
2.28.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: gdm724x: gdm_tty: replaced macro with a function v2

2020-09-02 Thread Dan Carpenter
On Wed, Sep 02, 2020 at 03:25:59PM +0200, Antoni Przybylik wrote:
> This approach is more elegant and prevents some problems related to
> macros such as operator precedence in expanded expression.
> ---
> Changed return type to bool and removed inline sepcifier.
> 
> Signed-off-by: Antoni Przybylik 
> ---
  ^^^
See this line.

No that doesn't work at all.  Try applying your patch and reviewing the
git log.  Look the the email archive to see how to send a v2 patch.

1) subject says [PATCH v2]
2) comments under the --- line

>  drivers/staging/gdm724x/gdm_tty.c | 15 +--
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] staging: qlge: fix build breakage with dumping enabled

2020-09-02 Thread Coiby Xu
This fixes commit 0107635e15ac
("staging: qlge: replace pr_err with netdev_err") which introduced an
build breakage of missing `struct ql_adapter *qdev` for some functions
and a warning of type mismatch with dumping enabled, i.e.,

$ make CFLAGS_MODULE="QL_ALL_DUMP=1 QL_OB_DUMP=1 QL_CB_DUMP=1 \
  QL_IB_DUMP=1 QL_REG_DUMP=1 QL_DEV_DUMP=1" M=drivers/staging/qlge

qlge_dbg.c: In function ‘ql_dump_ob_mac_rsp’:
qlge_dbg.c:2051:13: error: ‘qdev’ undeclared (first use in this function); did 
you mean ‘cdev’?
 2051 |  netdev_err(qdev->ndev, "%s\n", __func__);
  | ^~~~
qlge_dbg.c: In function ‘ql_dump_routing_entries’:
qlge_dbg.c:1435:10: warning: format ‘%s’ expects argument of type ‘char *’, but 
argument 3 has type ‘int’ [-Wformat=]
 1435 |"%s: Routing Mask %d = 0x%.08x\n",
  | ~^
  |  |
  |  char *
  | %d
 1436 |i, value);
  |~
  ||
  |int
qlge_dbg.c:1435:37: warning: format ‘%x’ expects a matching ‘unsigned int’ 
argument [-Wformat=]
 1435 |"%s: Routing Mask %d = 0x%.08x\n",
  | ^
  | |
  | unsigned int

Fixes: 0107635e15ac ("staging: qlge: replace pr_err with netdev_err")
Reported-by: Benjamin Poirier 
Suggested-by: Benjamin Poirier 
Signed-off-by: Coiby Xu 
---
 drivers/staging/qlge/qlge.h  | 20 ++--
 drivers/staging/qlge/qlge_dbg.c  | 28 ++--
 drivers/staging/qlge/qlge_main.c |  8 
 3 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h
index 483ce04789ed..7f6798b223ef 100644
--- a/drivers/staging/qlge/qlge.h
+++ b/drivers/staging/qlge/qlge.h
@@ -2338,21 +2338,21 @@ void ql_dump_hw_cb(struct ql_adapter *qdev, int size, 
u32 bit, u16 q_id);
 #endif

 #ifdef QL_OB_DUMP
-void ql_dump_tx_desc(struct tx_buf_desc *tbd);
-void ql_dump_ob_mac_iocb(struct ob_mac_iocb_req *ob_mac_iocb);
-void ql_dump_ob_mac_rsp(struct ob_mac_iocb_rsp *ob_mac_rsp);
-#define QL_DUMP_OB_MAC_IOCB(ob_mac_iocb) ql_dump_ob_mac_iocb(ob_mac_iocb)
-#define QL_DUMP_OB_MAC_RSP(ob_mac_rsp) ql_dump_ob_mac_rsp(ob_mac_rsp)
+void ql_dump_tx_desc(struct ql_adapter *qdev, struct tx_buf_desc *tbd);
+void ql_dump_ob_mac_iocb(struct ql_adapter *qdev, struct ob_mac_iocb_req 
*ob_mac_iocb);
+void ql_dump_ob_mac_rsp(struct ql_adapter *qdev, struct ob_mac_iocb_rsp 
*ob_mac_rsp);
+#define QL_DUMP_OB_MAC_IOCB(qdev, ob_mac_iocb) ql_dump_ob_mac_iocb(qdev, 
ob_mac_iocb)
+#define QL_DUMP_OB_MAC_RSP(qdev, ob_mac_rsp) ql_dump_ob_mac_rsp(qdev, 
ob_mac_rsp)
 #else
-#define QL_DUMP_OB_MAC_IOCB(ob_mac_iocb)
-#define QL_DUMP_OB_MAC_RSP(ob_mac_rsp)
+#define QL_DUMP_OB_MAC_IOCB(qdev, ob_mac_iocb)
+#define QL_DUMP_OB_MAC_RSP(qdev, ob_mac_rsp)
 #endif

 #ifdef QL_IB_DUMP
-void ql_dump_ib_mac_rsp(struct ib_mac_iocb_rsp *ib_mac_rsp);
-#define QL_DUMP_IB_MAC_RSP(ib_mac_rsp) ql_dump_ib_mac_rsp(ib_mac_rsp)
+void ql_dump_ib_mac_rsp(struct ql_adapter *qdev, struct ib_mac_iocb_rsp 
*ib_mac_rsp);
+#define QL_DUMP_IB_MAC_RSP(qdev, ib_mac_rsp) ql_dump_ib_mac_rsp(qdev, 
ib_mac_rsp)
 #else
-#define QL_DUMP_IB_MAC_RSP(ib_mac_rsp)
+#define QL_DUMP_IB_MAC_RSP(qdev, ib_mac_rsp)
 #endif

 #ifdef QL_ALL_DUMP
diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c
index a55bf0b3e9dc..e139e15516fa 100644
--- a/drivers/staging/qlge/qlge_dbg.c
+++ b/drivers/staging/qlge/qlge_dbg.c
@@ -1431,7 +1431,7 @@ void ql_dump_routing_entries(struct ql_adapter *qdev)
}
if (value)
netdev_err(qdev->ndev,
-  "%s: Routing Mask %d = 0x%.08x\n",
+  "Routing Mask %d = 0x%.08x\n",
   i, value);
}
ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
@@ -1617,6 +1617,9 @@ void ql_dump_qdev(struct ql_adapter *qdev)
 #ifdef QL_CB_DUMP
 void ql_dump_wqicb(struct wqicb *wqicb)
 {
+   struct tx_ring *tx_ring = container_of(wqicb, struct tx_ring, wqicb);
+   struct ql_adapter *qdev = tx_ring->qdev;
+
netdev_err(qdev->ndev, "Dumping wqicb stuff...\n");
netdev_err(qdev->ndev, "wqicb->len = 0x%x\n", le16_to_cpu(wqicb->len));
netdev_err(qdev->ndev, "wqicb->flags = %x\n",
@@ -1632,8 +1635,8 @@ void ql_dump_wqicb(struct wqicb *wqicb)

 void ql_dump_tx_ring(struct tx_ring *tx_ring)
 {
-   if (!tx_ring)
-   return;
+   struct ql_adapter *qdev = tx_ring->qdev;
+
netdev_err(qdev->ndev, "= Dumping tx_ring %d 
===\n",
   tx_ring->wq_id);
netdev_err(qdev->ndev, "tx_ring->base = %p\n", tx_ring->wq_base);
@@ -1656,6 +1659,8 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)

 void ql_dump_ricb(struct ricb *ricb)
 {
+   struct ql_adapter *qdev =
+   container_of(ricb, struct ql_adapte

Re: [PATCH v2] staging: qlge: fix build breakage with dumping enabled

2020-09-02 Thread Coiby Xu

On Thu, Aug 27, 2020 at 09:50:10AM +0900, Benjamin Poirier wrote:

On 2020-08-27 07:27 +0800, Coiby Xu wrote:

This fixes commit 0107635e15ac
("staging: qlge: replace pr_err with netdev_err") which introduced an
build breakage of missing `struct ql_adapter *qdev` for some functions
and a warning of type mismatch with dumping enabled, i.e.,

$ make CFLAGS_MODULE="QL_ALL_DUMP=1 QL_OB_DUMP=1 QL_CB_DUMP=1 \
  QL_IB_DUMP=1 QL_REG_DUMP=1 QL_DEV_DUMP=1" M=drivers/staging/qlge

qlge_dbg.c: In function ‘ql_dump_ob_mac_rsp’:
qlge_dbg.c:2051:13: error: ‘qdev’ undeclared (first use in this function); did 
you mean ‘cdev’?
 2051 |  netdev_err(qdev->ndev, "%s\n", __func__);
  | ^~~~
qlge_dbg.c: In function ‘ql_dump_routing_entries’:
qlge_dbg.c:1435:10: warning: format ‘%s’ expects argument of type ‘char *’, but 
argument 3 has type ‘int’ [-Wformat=]
 1435 |"%s: Routing Mask %d = 0x%.08x\n",
  | ~^
  |  |
  |  char *
  | %d
 1436 |i, value);
  |~
  ||
  |int
qlge_dbg.c:1435:37: warning: format ‘%x’ expects a matching ‘unsigned int’ 
argument [-Wformat=]
 1435 |"%s: Routing Mask %d = 0x%.08x\n",
  | ^
  | |
  | unsigned int

Fixes: 0107635e15ac ("staging: qlge: replace pr_err with netdev_err")
Reported-by: Benjamin Poirier 
Suggested-by: Benjamin Poirier 
Signed-off-by: Coiby Xu 
---
 drivers/staging/qlge/qlge.h  | 20 ++--
 drivers/staging/qlge/qlge_dbg.c  | 24 ++--
 drivers/staging/qlge/qlge_main.c |  8 
 3 files changed, 32 insertions(+), 20 deletions(-)


[...]

@@ -1632,6 +1635,8 @@ void ql_dump_wqicb(struct wqicb *wqicb)

 void ql_dump_tx_ring(struct tx_ring *tx_ring)
 {
+   struct ql_adapter *qdev = tx_ring->qdev;
+
if (!tx_ring)
return;


Given the null check for tx_ring, it seems unwise to dereference tx_ring
before the check.

Looking at ql_dump_all(), I'm not sure that the check is needed at all
though. Maybe it should be removed.

Same problem in ql_dump_rx_ring().


Thank you for the spotting this issue! I'll remove the check.




netdev_err(qdev->ndev, "= Dumping tx_ring %d 
===\n",
@@ -1657,6 +1662,8 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)
 void ql_dump_ricb(struct ricb *ricb)
 {
int i;
+   struct ql_adapter *qdev =
+   container_of(ricb, struct ql_adapter, ricb);


Here, davem would point out that the variables are not declared in
"reverse xmas tree" order.


I'll make davem happy then:)

--
Best regards,
Coiby
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: gdm724x: gdm_tty: replaced macro with a function

2020-09-02 Thread Greg KH
On Wed, Sep 02, 2020 at 03:24:19PM +0200, Antoni Przybylik wrote:
> This approach is more elegant and prevents some problems related to
> macros such as operator precedence in expanded expression.
> ---
> Changed return type to bool and removed inline sepcifier.

What is this here for?

Please read the documentation for how to properly version patches, it
should be in the submitting patches file somewhere...

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Vorschlag

2020-09-02 Thread B-88 SALVADORA LAMBAYEQUE B-88. b-088
Ein Vorschlag für Sie
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [staging:staging-testing 62/88] drivers/staging/emxx_udc/emxx_udc.c:839:9: warning: Variable 'result' is reassigned a value before the old one has been used.

2020-09-02 Thread Alex Dewar
On Wed, Sep 02, 2020 at 11:15:47AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
> staging-testing
> head:   4c6491a343e91a5a2a699b0b545f8ba1ec1e8c65
> commit: fbcfdfab4a2c4ec5e2195929528506fec39388f3 [62/88] staging: emxx_udc: 
> Allow for building on !ARM
> compiler: riscv32-linux-gcc (GCC) 9.3.0

[snip]

> >> drivers/staging/emxx_udc/emxx_udc.c:2095:48: warning: Uninitialized 
> >> variable: ep [uninitvar]
> list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) {
>   ^
This warning's bogus. The ep here refers to a member name, not the
variable ep. I'll send a patch for the other warnings though.

> 
> # 
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?id=fbcfdfab4a2c4ec5e2195929528506fec39388f3
> git remote add staging 
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
> git fetch --no-tags staging staging-testing
> git checkout fbcfdfab4a2c4ec5e2195929528506fec39388f3
> vim +/result +839 drivers/staging/emxx_udc/emxx_udc.c
> 
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  785  
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  786  
> /*-*/
> e2d34dfdffcfd1 Cristian Sicilia2018-11-17  787  static int 
> _nbu2ss_out_dma(struct nbu2ss_udc *udc, struct nbu2ss_req *req,
> e2d34dfdffcfd1 Cristian Sicilia2018-11-17  788   u32 
> num, u32 length)
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  789  {
> 5a012f67cbcb20 Alexis Lothoré  2017-05-10  790dma_addr_t  
> p_buffer;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  791u32 mpkt;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  792u32 lmpkt;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  793u32 dmacnt;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  794u32 burst = 
> 1;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  795u32 data;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  796int result 
> = -EINVAL;
> 64407f6e7d158e Carmeli Tamir   2018-11-07  797struct fc_regs __iomem 
> *preg = udc->p_regs;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  798  
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  799if (req->dma_flag)
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  800return 1;   
> /* DMA is forwarded */
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  801  
> 8b77d94e69c33f Saiyam Doshi2019-09-08  802req->dma_flag = true;
> 5a012f67cbcb20 Alexis Lothoré  2017-05-10  803p_buffer = req->req.dma;
> 5a012f67cbcb20 Alexis Lothoré  2017-05-10  804p_buffer += 
> req->req.actual;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  805  
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  806/* DMA Address */
> 5a012f67cbcb20 Alexis Lothoré  2017-05-10  807
> _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)p_buffer);
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  808  
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  809/* Number of transfer 
> packets */
> 75d9c393763da3 Alexis Lothoré  2017-05-10  810mpkt = 
> _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPN_MPKT;
> 599b87809594e2 Janani Ravichandran 2016-02-11  811dmacnt = length / mpkt;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  812lmpkt = (length % mpkt) 
> & ~(u32)0x03;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  813  
> 2866914ce1f84f Cristina Moraru 2015-09-29  814if (dmacnt > 
> DMA_MAX_COUNT) {
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  815dmacnt = 
> DMA_MAX_COUNT;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  816lmpkt = 0;
> 2866914ce1f84f Cristina Moraru 2015-09-29  817} else if (lmpkt != 0) {
> 2866914ce1f84f Cristina Moraru 2015-09-29  818if (dmacnt == 0)
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  819burst = 
> 0;  /* Burst OFF */
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  820dmacnt++;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  821}
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  822  
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  823data = mpkt | (lmpkt << 
> 16);
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  824
> _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, data);
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  825  
> 75d9c393763da3 Alexis Lothoré  2017-05-10  826data = ((dmacnt & 0xff) 
> << 16) | DCR1_EPN_DIR0 | DCR1_EPN_REQEN;
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  827
> _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR1, data);
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  828  
> 2866914ce1f84f Cristina Moraru 2015-09-29  829if (burst == 0) {
> 33aa8d45a4fea3 Magnus Damm 2014-06-06  830
> _nbu2ss_writel(&preg->EP_REGS[num].EP_

[PATCH] staging/emxx_udc: Remove pointless variable assignments

2020-09-02 Thread Alex Dewar
In a number of places in emxx_udc.c, there are variables which are
assigned to without that value ever being used. Remove these pointless
assignments.

Reported-by: kernel test robot 
Fixes: 33aa8d45a4fe ("staging: emxx_udc: Add Emma Mobile USB Gadget driver")
Signed-off-by: Alex Dewar 
---
 drivers/staging/emxx_udc/emxx_udc.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c 
b/drivers/staging/emxx_udc/emxx_udc.c
index d0725bc8b48a..4ceaf1ead123 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -793,7 +793,7 @@ static int _nbu2ss_out_dma(struct nbu2ss_udc *udc, struct 
nbu2ss_req *req,
u32 dmacnt;
u32 burst = 1;
u32 data;
-   int result = -EINVAL;
+   int result;
struct fc_regs __iomem *preg = udc->p_regs;
 
if (req->dma_flag)
@@ -1288,8 +1288,6 @@ static void _nbu2ss_set_endpoint_stall(struct nbu2ss_udc 
*udc,
 
_nbu2ss_bitset(&preg->EP_REGS[num].EP_CONTROL, data);
} else {
-   /* Clear STALL */
-   ep->stalled = false;
if (ep_adrs & USB_DIR_IN) {
_nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL
, EPN_ISTL);
@@ -1304,6 +1302,7 @@ static void _nbu2ss_set_endpoint_stall(struct nbu2ss_udc 
*udc,
, data);
}
 
+   /* Clear STALL */
ep->stalled = false;
if (ep->halted) {
ep->halted = false;
@@ -3073,8 +3072,8 @@ static int nbu2ss_drv_contest_init(struct platform_device 
*pdev,
  */
 static int nbu2ss_drv_probe(struct platform_device *pdev)
 {
-   int status = -ENODEV;
-   struct nbu2ss_udc   *udc;
+   int status;
+   struct nbu2ss_udc *udc;
int irq;
void __iomem *mmio_base;
 
-- 
2.28.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 28/38] media: atomisp: get rid of isys_dma.h and isys_dma_local.h

2020-09-02 Thread Mauro Carvalho Chehab
There aren't much on this abstraction. Just move the defines
to isys_dma_private.h and isys_dma_public.h, cleaning up
the includes.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../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

diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c
index 5809dbb6e5aa..2a5159945a44 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c
@@ -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
diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h
deleted file mode 100644
index 878933261a43..
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h
+++ /dev/null
@@ -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__ */
diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h
index eb35b7bcead4..a313e1dc7c71 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h
@@ -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_tdma_id,
-const unsigned int reg,
-const hrt_data value)
+void isys2401_dma_reg_store(const isys2401_dma_ID_tdma_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_tdma_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;
diff --git 
a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h 
b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h
index 88ac78f69e7b..d9b6af898c06 100644
--- 
a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h
+++ 
b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h
@@ -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);
 
diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_dma.h 
b/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_d

[PATCH 33/38] media: atomisp: reorder functions at pixelgen_private.h

2020-09-02 Thread Mauro Carvalho Chehab
Reorder functions in order to declare before usage.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../css_2401_system/host/pixelgen_private.h   | 73 ++-
 1 file changed, 37 insertions(+), 36 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h
index 4faa519219ee..1c7938d8ccb5 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h
@@ -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__ */
-- 
2.26.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/38] media sparse/smatch warn fixes

2020-09-02 Thread 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_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|  

[PATCH 31/38] media: atomisp: unify INPUT error return type

2020-09-02 Thread Mauro Carvalho Chehab
There is a typedef for INPUT errors. This is different between
ISP2401 and ISP2400. Place both at the same struct, at the
global header file.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../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(-)

diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h
index 1b9f03d57659..ce7b06b3f3c8 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h
@@ -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 @@ structib_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 {
diff --git 
a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c 
b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
index 4f3d75fac3e3..cd516e4554fb 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
@@ -32,15 +32,15 @@
 
 static const ib_buffer_t   IB_BUFFER_NULL = {0, 0, 0 };
 
-static input_system_error_t input_system_configure_channel(
+static input_system_err_t input_system_configure_channel(
 const channel_cfg_tchannel);
 
-static input_system_error_t input_system_configure_channel_sensor(
+static input_system_err_t input_system_configure_channel_sensor(
 const channel_cfg_tchannel);
 
-static input_system_error_t input_buffer_configuration(void);
+static input_system_err_t input_buffer_configuration(void);
 
-static input_system_error_t configuration_to_registers(void);
+static input_system_err_t configuration_to_registers(void);
 
 static void receiver_rst(const rx_ID_t ID);
 static void input_system_network_rst(const input_system_ID_t ID);
@@ -65,17 +65,17 @@ static void input_system_network_configure(
 const input_system_network_cfg_t *const cfg);
 
 // MW: CSI is previously named as "rx" short for "receiver"
-static input_system_error_t set_csi_cfg(
+static input_system_err_t set_csi_cfg(
 csi_cfg_t *const lhs,
 const csi_cfg_t *const rhs,
 input_system_config_flags_t *const flags);
 
-static input_system_error_t set_source_type(
+static input_system_err_t set_source_type(
 input_system_source_t *const lhs,
 const input_system_source_trhs,
 input_system_config_flags_t *const flags);
 
-static input_system_error_t input_system_multiplexer_cfg(
+static input_system_err_t input_system_multiplexer_cfg(
 input_system_multiplex_t *const lhs,
 const input_system_multiplex_t rhs,
 input_system_config_flags_t *const flags);
@@ -848,7 +848,7 @@ static void input_system_network_rst(const 
input_system_ID_t ID)
 }
 
 // Function that resets current configuration.
-input_system_error_t input_system_configuration_reset(void)
+input_system_err_t input_system_configuration_reset(void)
 {
unsigned int i;
 
@@ -890,10 +890,10 @@ input_system_error_t 
input_system_configuration_reset(void)
 
 // MW: Comments are good, but doxygen is required, place it at the declaration
 // Function that appends the channel to current configuration.
-static input_system_error_t input_system_configure_channel(
+static input_system_err_t input_system_configure_channel(
 const channel_cfg_tchannel)
 {
-   input_system_error_t error = INPUT_SYSTEM_ERR_NO_ERROR;
+   input_system_err_t error = INPUT_SYSTEM_ERR_NO_ERROR;
// Check if channel is not already configured.
if (config.ch_flags[channel.ch_id] & INPUT_SYSTEM_CFG_FLAG_SET) {
return INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET;
@@ -948,7 +948,7 @@ static input_system_error_t input_system_configure_channel(
 }
 
 // Function that partitions i

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

2020-09-02 Thread Mauro Carvalho Chehab
Due to that, smatch warns with:

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

drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c:19:11:  
warning: symbol 'N_IBUF_CTRL_PROCS' was not declared. Should it be static?

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

diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c
index 8e661091f7d9..9a8d8f546da7 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c
@@ -14,6 +14,7 @@
  */
 
 #include "system_global.h"
+#include "csi_rx_global.h"
 
 const u32 N_SHORT_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = {
4,  /* 4 entries at CSI_RX_BACKEND0_ID*/
diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c
index 58fec54a914d..8d19c9875a71 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c
@@ -15,6 +15,7 @@
 
 #include 
 #include "system_global.h"
+#include "ibuf_ctrl_global.h"
 
 const u32 N_IBUF_CTRL_PROCS[N_IBUF_CTRL_ID] = {
8,  /* IBUF_CTRL0_ID supports at most 8 processes */
-- 
2.26.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 34/38] media: atomisp: remove compile-time tests from input_system_global.h

2020-09-02 Thread Mauro Carvalho Chehab
Now that there's no duplication between ISP2400 and ISP2401
input system functions, we can include both at the system
global.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/staging/media/atomisp/pci/input_system_global.h | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/input_system_global.h 
b/drivers/staging/media/atomisp/pci/input_system_global.h
index 5929d529950b..1450964445f6 100644
--- a/drivers/staging/media/atomisp/pci/input_system_global.h
+++ b/drivers/staging/media/atomisp/pci/input_system_global.h
@@ -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__ */
-- 
2.26.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2020-09-02 Thread Mauro Carvalho Chehab
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]

[PATCH 38/38] media: atomisp: cleanup isys_irq headers

2020-09-02 Thread Mauro Carvalho Chehab
Don't need to declare those functions with extern:

drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h:51:35:
  warning: function 'isys_irqc_state_dump' with external linkage has definition

drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h:68:35:
  warning: function 'isys_irqc_reg_store' with external linkage has definition

drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h:85:39:
  warning: function 'isys_irqc_reg_load' with external linkage has definition

drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c:31:35:  
warning: function 'isys_irqc_status_enable' with external linkage has definition

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

diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c
index 99576af4713c..b6135c4b6eea 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c
@@ -28,8 +28,7 @@
 #endif
 
 /* Public interface */
-STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_status_enable(
-const isys_irq_ID_tisys_irqc_id)
+void isys_irqc_status_enable(const isys_irq_ID_t   isys_irqc_id)
 {
assert(isys_irqc_id < N_ISYS_IRQ_ID);
 
diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h
index 1e96f0267ac0..fb168c25bdfc 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h
@@ -29,7 +29,7 @@
 * @brief Get the isys irq status.
 * Refer to "isys_irq.h" for details.
 */
-STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_get(
+void isys_irqc_state_get(
 const isys_irq_ID_tisys_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_tisys_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_tisys_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_tisys_irqc_id,
 const unsigned int reg_idx)
 {
diff --git 
a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h 
b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h
index cd738f4b65a0..736cbc4e3705 100644
--- 
a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h
+++ 
b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h
@@ -21,25 +21,20 @@
 
 #if defined(ISP2401)
 
-STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_state_get(
-const isys_irq_ID_tisys_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_tisys_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_tisys_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_tisys_irqc_id,
-const unsigned int reg_idx);
+hrt_data isys_irqc_reg_load(const isys_irq_ID_tisys_irqc_id,
+   const unsigned int  reg_idx);
 
-STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_status_enable(
-const isys_irq_ID_tisys_irqc_id);
+void isys_irqc_status_enable(const isys

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

2020-09-02 Thread Mauro Carvalho Chehab
There are lots of code dependency there. Get rid of most of
them.

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

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

diff --git 
a/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h 
b/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h
index e04d2485ea75..0f9b7eb17647 100644
--- a/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h
+++ b/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h
@@ -158,12 +158,6 @@ void ia_css_debug_set_dtrace_level(
  */
 unsigned int ia_css_debug_get_dtrace_level(void);
 
-/*! @brief Dump input formatter state.
- * Dumps the input formatter state to tracing output.
- * @return None
- */
-void ia_css_debug_dump_if_state(void);
-
 /*! @brief Dump isp hardware state.
  * Dumps the isp hardware state to tracing output.
  * @return None
diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c 
b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
index 56d5d90634fa..ec598a1697b1 100644
--- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
+++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
@@ -52,9 +52,7 @@
 
 #include "fifo_monitor.h"
 
-#if !defined(HAS_NO_INPUT_FORMATTER)
 #include "input_formatter.h"
-#endif
 #include "dma.h"
 #include "irq.h"
 #include "gp_device.h"
@@ -63,9 +61,7 @@
 #include "type_support.h"
 #include "math_support.h" /* CEIL_DIV */
 #include "input_system.h"  /* input_formatter_reg_load */
-#if defined(USE_INPUT_SYSTEM_VERSION_2) || 
defined(USE_INPUT_SYSTEM_VERSION_2401)
 #include "ia_css_tagger_common.h"
-#endif
 
 #include "sh_css_internal.h"
 #include "ia_css_isys.h"
@@ -105,17 +101,6 @@
 
 #define ENABLE_LINE_MAX_LENGTH (25)
 
-#ifdef ISP2401
-#define DBG_EXT_CMD_TRACE_PNTS_DUMP BIT(8)
-#define DBG_EXT_CMD_PUB_CFG_DUMP BIT(9)
-#define DBG_EXT_CMD_GAC_REG_DUMP BIT(10)
-#define DBG_EXT_CMD_GAC_ACB_REG_DUMP BIT(11)
-#define DBG_EXT_CMD_FIFO_DUMP BIT(12)
-#define DBG_EXT_CMD_QUEUE_DUMP BIT(13)
-#define DBG_EXT_CMD_DMA_DUMP BIT(14)
-#define DBG_EXT_CMD_MASK 0xABCD
-
-#endif
 /*
  * TODO:SH_CSS_MAX_SP_THREADS is not the max number of sp threads
  * future rework should fix this and remove the define MAX_THREAD_NUM
@@ -449,23 +434,21 @@ void ia_css_debug_dump_isp_state(void)
debug_print_isp_state(&state, "ISP");
 
if (state.is_stalling) {
-#if !defined(HAS_NO_INPUT_FORMATTER)
-   ia_css_debug_dtrace(2, "\t%-32s: %d\n",
-   "[0] if_prim_a_FIFO stalled", stall.fifo0);
-   ia_css_debug_dtrace(2, "\t%-32s: %d\n",
-   "[1] if_prim_b_FIFO stalled", stall.fifo1);
-#endif
+   if (!IS_ISP2401) {
+   ia_css_debug_dtrace(2, "\t%-32s: %d\n",
+   "[0] if_prim_a_FIFO stalled", 
stall.fifo0);
+   ia_css_debug_dtrace(2, "\t%-32s: %d\n",
+   "[1] if_prim_b_FIFO stalled", 
stall.fifo1);
+   }
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[2] dma_FIFO stalled",
stall.fifo2);
 
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[3] gdc0_FIFO stalled",
stall.fifo3);
-#if !defined(IS_ISP_2500_SYSTEM)
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[4] gdc1_FIFO stalled",
stall.fifo4);
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[5] gpio_FIFO stalled",
stall.fifo5);
-#endif
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[6] sp_FIFO stalled",
stall.fifo6);
ia_css_debug_dtrace(2, "\t%-32s: %d\n",
@@ -505,24 +488,21 @@ void ia_css_debug_dump_sp_state(void)
"str_to_mem_FIFO stalled", stall.fifo2);
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "dma_FIFO stalled",
stall.fifo3);
-#if !defined(HAS_NO_INPUT_FORMATTER)
-   ia_css_debug_dtrace(2, "\t%-32s: %d\n",
-   "if_prim_a_FIFO stalled", stall.fifo4);
-#endif
+   if (!IS_ISP2401)
+   ia_css_debug_dtrace(2, "\t%-32s: %d\n",
+   "if_prim_a_FIFO stalled", 
stall.fifo4);
+
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "isp_FIFO stalled",
stall.fifo5);
ia_css_debug_dtrace(2, "\t%-32s: %d\n", "gp_FIFO stalled",
  

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

2020-09-02 Thread Mauro Carvalho Chehab
Just move the stuff there to the places where this header is
included.

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

diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h
index 4952b42d8191..f71841195ac1 100644
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h
+++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h
@@ -17,6 +17,7 @@
 #define __IBUF_CTRL_LOCAL_H_INCLUDED__
 
 #include "ibuf_ctrl_global.h"
+#include "ibuf_ctrl_local.h"
 
 typedef struct ibuf_ctrl_proc_state_s  ibuf_ctrl_proc_state_t;
 typedef struct ibuf_ctrl_state_s   ibuf_ctrl_state_t;
diff --git 
a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h 
b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h
deleted file mode 100644
index a58e8477da6e..
--- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- */
-
-#ifndef __IBUF_CTRL_PRIVATE_H_INCLUDED__
-#define __IBUF_CTRL_PRIVATE_H_INCLUDED__
-
-#include "ibuf_ctrl_public.h"
-
-#include "device_access.h" /* ia_css_device_load_uint32 */
-
-#include "assert_support.h" /* assert */
-#include "print_support.h" /* print */
-
-/*
- *
- * Native command interface (NCI).
- *
- */
-/**
- * @brief Get the ibuf-controller state.
- * Refer to "ibuf_ctrl_public.h" for details.
- */
-STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_get_state(
-const ibuf_ctrl_ID_t ID,
-ibuf_ctrl_state_t *state)
-{
-   u32 i;
-
-   state->recalc_words =
-   ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_RECALC_WORDS_STATUS);
-   state->arbiters =
-   ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_ARBITERS_STATUS);
-
-   /*
-* Get the values of the register-set per
-* ibuf-controller process.
-*/
-   for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) {
-   ibuf_ctrl_get_proc_state(
-   ID,
-   i,
-   &state->proc_state[i]);
-   }
-}
-
-/**
- * @brief Get the state of the ibuf-controller process.
- * Refer to "ibuf_ctrl_public.h" for details.
- */
-STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_get_proc_state(
-const ibuf_ctrl_ID_t ID,
-const u32 proc_id,
-ibuf_ctrl_proc_state_t *state)
-{
-   hrt_address reg_bank_offset;
-
-   reg_bank_offset =
-   _IBUF_CNTRL_PROC_REG_ALIGN * (1 + proc_id);
-
-   state->num_items =
-   ibuf_ctrl_reg_load(ID, reg_bank_offset + 
_IBUF_CNTRL_NUM_ITEMS_PER_STORE);
-
-   state->num_stores =
-   ibuf_ctrl_reg_load(ID, reg_bank_offset + 
_IBUF_CNTRL_NUM_STORES_PER_FRAME);
-
-   state->dma_channel =
-   ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CHANNEL);
-
-   state->dma_command =
-   ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CMD);
-
-   state->ibuf_st_addr =
-   ibuf_ctrl_reg_load(ID, reg_bank_offset + 
_IBUF_CNTRL_BUFFER_START_ADDRESS);
-
-   state->ibuf_stride =
-   ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_STRIDE);
-
-   state->ibuf_end_addr =
-   ibuf_ctrl_reg_load(ID, reg_bank_offset + 
_IBUF_CNTRL_BUFFER_END_ADDRESS);
-
-   state->dest_st_addr =
-   ibuf_ctrl_reg_load(ID, reg_bank_offset + 
_IBUF_CNTRL_DEST_START_ADDRESS);
-
-   state->dest_stride =
-   ibuf_ctrl_reg_load(ID, reg_bank_offset + _IB

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

2020-09-02 Thread Mauro Carvalho Chehab
Now that the defines which are common for both ISP2400 and ISP2401
are at system_global.h, we can get rid of the code not used by
those versions.

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

diff --git a/drivers/staging/media/atomisp/pci/ia_css_mipi.h 
b/drivers/staging/media/atomisp/pci/ia_css_mipi.h
index 56a2fca8117f..7b6d796d6ee0 100644
--- a/drivers/staging/media/atomisp/pci/ia_css_mipi.h
+++ b/drivers/staging/media/atomisp/pci/ia_css_mipi.h
@@ -42,7 +42,6 @@ int
 ia_css_mipi_frame_specify(const unsigned int   size_mem_words,
  const bool contiguous);
 
-#if !defined(HAS_NO_INPUT_SYSTEM)
 /* @brief Register size of a CSS MIPI frame for check during capturing.
  *
  * @param[in]  portCSI-2 port this check is registered.
@@ -58,7 +57,6 @@ ia_css_mipi_frame_specify(const unsigned int  size_mem_words,
 int
 ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port,
   const unsigned int   size_mem_words);
-#endif
 
 /* @brief Calculate the size of a mipi frame.
  *
diff --git a/drivers/staging/media/atomisp/pci/ia_css_stream.h 
b/drivers/staging/media/atomisp/pci/ia_css_stream.h
index e3e7a8a03b04..4dffc6d7c8d8 100644
--- a/drivers/staging/media/atomisp/pci/ia_css_stream.h
+++ b/drivers/staging/media/atomisp/pci/ia_css_stream.h
@@ -18,7 +18,7 @@
 
 #include 
 #include 
-#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if !defined(USE_INPUT_SYSTEM_VERSION_2401)
 #include 
 #endif
 #include "ia_css_types.h"
@@ -30,7 +30,7 @@
 struct ia_css_stream {
struct ia_css_stream_configconfig;
struct ia_css_stream_info  info;
-#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401)
+#if !defined(USE_INPUT_SYSTEM_VERSION_2401)
rx_cfg_t   csi_rx_config;
 #endif
bool   reconfigure_css_rx;
diff --git 
a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h 
b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h
index 7e2fa192a0fe..eaad708c611c 100644
--- 
a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h
+++ 
b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h
@@ -22,15 +22,8 @@
 #include "ia_css_ctc_types.h"
 
 #ifndef PIPE_GENERATION
-#if defined(HAS_VAMEM_VERSION_2)
 #define SH_CSS_ISP_CTC_TABLE_SIZE_LOG2   IA_CSS_VAMEM_2_CTC_TABLE_SIZE_LOG2
 #define SH_CSS_ISP_CTC_TABLE_SIZEIA_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_SIZEIA_CSS_VAMEM_1_CTC_TABLE_SIZE
-#else
-#error "VAMEM should be {VERSION1, VERSION2}"
-#endif
 
 #else
 /* For pipe generation, the size is not relevant */
diff --git 
a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c
 
b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c
index f13b79586963..6a7925c8493a 100644
--- 
a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c
+++ 
b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c
@@ -23,7 +23,6 @@
 
 struct ia_css_ctc_table   default_ctc_table;
 
-#if defined(HAS_VAMEM_VERSION_2)
 
 static const uint16_t
 default_ctc_table_data[IA_CSS_VAMEM_2_CTC_TABLE_SIZE] = {
@@ -62,155 +61,11 @@ default_ctc_table_data[IA_CSS_VAMEM_2_CTC_TABLE_SIZE] = {
0
 };
 
-#elif defined(HAS_VAMEM_VERSION_1)
-
-/* Default P