[PATCH 0/7] media: atomisp: Address several clang warnings

2020-05-27 Thread Nathan Chancellor
Hi all,

This series aims to clean up the code while addressing the majority of
clang warnings in this driver, some found by the 0day bot and others
found by me.

There are several enum conversion warnings that happen, which I do not
really know how to solve without understanding how exactly this driver
works. I would appreciate some guidance or a solution. Below are the
warnings, sorry for not wrapping them but they would be hard to read
otherwise.

../drivers/staging/media/atomisp/pci/atomisp_subdev.c:49:65: warning: implicit 
conversion from enumeration type 'enum ia_css_frame_format' to different 
enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
{ V4L2_MBUS_FMT_CUSTOM_NV21, 12, 12, CSS_FRAME_FORMAT_NV21, 0, 
CSS_FRAME_FORMAT_NV21 },
~  
^
../drivers/staging/media/atomisp//pci/atomisp_compat.h:101:32: note: expanded 
from macro 'CSS_FRAME_FORMAT_NV21'
#define CSS_FRAME_FORMAT_NV21   CSS_ID(CSS_FRAME_FORMAT_NV21)
^
../drivers/staging/media/atomisp//pci/atomisp_compat_css20.h:117:22: note: 
expanded from macro 'CSS_ID'
#define CSS_ID(val) (IA_ ## val)
 ^~
:69:1: note: expanded from here
IA_CSS_FRAME_FORMAT_NV21
^~~~
../drivers/staging/media/atomisp/pci/atomisp_subdev.c:49:39: warning: implicit 
conversion from enumeration type 'enum ia_css_frame_format' to different 
enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
{ V4L2_MBUS_FMT_CUSTOM_NV21, 12, 12, CSS_FRAME_FORMAT_NV21, 0, 
CSS_FRAME_FORMAT_NV21 },
~^
../drivers/staging/media/atomisp//pci/atomisp_compat.h:101:32: note: expanded 
from macro 'CSS_FRAME_FORMAT_NV21'
#define CSS_FRAME_FORMAT_NV21   CSS_ID(CSS_FRAME_FORMAT_NV21)
^
../drivers/staging/media/atomisp//pci/atomisp_compat_css20.h:117:22: note: 
expanded from macro 'CSS_ID'
#define CSS_ID(val) (IA_ ## val)
 ^~
:68:1: note: expanded from here
IA_CSS_FRAME_FORMAT_NV21
^~~~
../drivers/staging/media/atomisp/pci/atomisp_subdev.c:48:65: warning: implicit 
conversion from enumeration type 'enum ia_css_frame_format' to different 
enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
{ V4L2_MBUS_FMT_CUSTOM_NV12, 12, 12, CSS_FRAME_FORMAT_NV12, 0, 
CSS_FRAME_FORMAT_NV12 },
~  
^
../drivers/staging/media/atomisp//pci/atomisp_compat.h:99:32: note: expanded 
from macro 'CSS_FRAME_FORMAT_NV12'
#define CSS_FRAME_FORMAT_NV12   CSS_ID(CSS_FRAME_FORMAT_NV12)
^
../drivers/staging/media/atomisp//pci/atomisp_compat_css20.h:117:22: note: 
expanded from macro 'CSS_ID'
#define CSS_ID(val) (IA_ ## val)
 ^~
:67:1: note: expanded from here
IA_CSS_FRAME_FORMAT_NV12
^~~~
../drivers/staging/media/atomisp/pci/atomisp_subdev.c:48:39: warning: implicit 
conversion from enumeration type 'enum ia_css_frame_format' to different 
enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
{ V4L2_MBUS_FMT_CUSTOM_NV12, 12, 12, CSS_FRAME_FORMAT_NV12, 0, 
CSS_FRAME_FORMAT_NV12 },
~^
../drivers/staging/media/atomisp//pci/atomisp_compat.h:99:32: note: expanded 
from macro 'CSS_FRAME_FORMAT_NV12'
#define CSS_FRAME_FORMAT_NV12   CSS_ID(CSS_FRAME_FORMAT_NV12)
^
../drivers/staging/media/atomisp//pci/atomisp_compat_css20.h:117:22: note: 
expanded from macro 'CSS_ID'
#define CSS_ID(val) (IA_ ## val)
 ^~
:66:1: note: expanded from here
IA_CSS_FRAME_FORMAT_NV12
^~~~
../drivers/staging/media/atomisp/pci/atomisp_subdev.c:47:34: warning: implicit 
conversion from enumeration type 'enum ia_css_frame_format' to different 
enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
{ MEDIA_BUS_FMT_JPEG_1X8, 8, 8, CSS_FRAME_FORMAT_BINARY_8, 0, 
ATOMISP_INPUT_FORMAT_BINARY_8 },
~   ^
../drivers/staging/media/atomisp//pci/atomisp_compat.h:118:35: note: expanded 
from macro 'CSS_FRAME_FORMAT_BINARY_8'
#define CSS_FRAME_FORMAT_BINARY_8   CSS_ID(CSS_FRAME_FORMAT_BINARY_8)
^
../drivers/staging/media/atomisp//pci/atomisp_compat_css20.h:117:22: note: 
expanded from macro 'CSS_ID'
#define CSS_ID(val) (IA_ ## val)
 ^~
:65:1: note: expanded from here
IA_CSS_FRAME_FORMAT_BINARY_8
^~

[PATCH 2/7] media: atomisp: Remove second increment of count in atomisp_subdev_probe

2020-05-27 Thread Nathan Chancellor
Clang warns:

../drivers/staging/media/atomisp/pci/atomisp_v4l2.c:1097:3: warning:
variable 'count' is incremented both in the loop header and in the loop
body [-Wfor-loop-analysis]
count++;
^

This was probably unintentional, remove it.

Link: https://github.com/ClangBuiltLinux/linux/issues/1036
Reported-by: kbuild test robot 
Signed-off-by: Nathan Chancellor 
---
 drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c 
b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index 694268d133c0..c42999a55303 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -1094,7 +1094,6 @@ static int atomisp_subdev_probe(struct atomisp_device 
*isp)
if (camera_count)
break;
msleep(SUBDEV_WAIT_TIMEOUT);
-   count++;
}
/* Wait more time to give more time for subdev init code to finish */
msleep(5 * SUBDEV_WAIT_TIMEOUT);
-- 
2.27.0.rc0

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


[PATCH 4/7] media: atomisp: Remove unnecessary NULL checks in ia_css_pipe_load_extension

2020-05-27 Thread Nathan Chancellor
Clang warns:

../drivers/staging/media/atomisp/pci/sh_css.c:8537:14: warning: address
of 'pipe->output_stage' will always evaluate to 'true'
[-Wpointer-bool-conversion]
if (&pipe->output_stage)
~~   ~~^~~~
../drivers/staging/media/atomisp/pci/sh_css.c:8545:14: warning: address
of 'pipe->vf_stage' will always evaluate to 'true'
[-Wpointer-bool-conversion]
if (&pipe->vf_stage)
~~   ~~^~~~

output_stage and vf_stage are pointers in the middle of a struct, their
addresses cannot be NULL if pipe is not NULL and pipe is already checked
for NULL in this function. Simplify this if block.

Link: https://github.com/ClangBuiltLinux/linux/issues/1036
Signed-off-by: Nathan Chancellor 
---
 drivers/staging/media/atomisp/pci/sh_css.c | 19 +++
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/sh_css.c 
b/drivers/staging/media/atomisp/pci/sh_css.c
index d77432254a2c..b8626cdb2436 100644
--- a/drivers/staging/media/atomisp/pci/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/sh_css.c
@@ -8533,22 +8533,9 @@ ia_css_pipe_load_extension(struct ia_css_pipe *pipe,
}
 
if (firmware->info.isp.type == IA_CSS_ACC_OUTPUT)
-   {
-   if (&pipe->output_stage)
-   append_firmware(&pipe->output_stage, firmware);
-   else {
-   IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INTERNAL_ERROR);
-   return IA_CSS_ERR_INTERNAL_ERROR;
-   }
-   } else if (firmware->info.isp.type == IA_CSS_ACC_VIEWFINDER)
-   {
-   if (&pipe->vf_stage)
-   append_firmware(&pipe->vf_stage, firmware);
-   else {
-   IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INTERNAL_ERROR);
-   return IA_CSS_ERR_INTERNAL_ERROR;
-   }
-   }
+   append_firmware(&pipe->output_stage, firmware);
+   else if (firmware->info.isp.type == IA_CSS_ACC_VIEWFINDER)
+   append_firmware(&pipe->vf_stage, firmware);
err = acc_load_extension(firmware);
 
IA_CSS_LEAVE_ERR_PRIVATE(err);
-- 
2.27.0.rc0

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


[PATCH 3/7] media: atomisp: Add stub for atomisp_mrfld_power

2020-05-27 Thread Nathan Chancellor
Clang warns:

../drivers/staging/media/atomisp/pci/atomisp_v4l2.c:764:12: warning:
unused function 'atomisp_mrfld_power' [-Wunused-function]
static int atomisp_mrfld_power(struct atomisp_device *isp, bool enable)
   ^

Use an '#if 0' preprocessor define to hide the broken code, leaving the
FIXME comment intact, and creating an atomisp_mrfld_power stub function
that just returns 0.

Fixes: 95d1f398c4dc ("media: atomisp: keep the ISP powered on when setting it")
Link: https://github.com/ClangBuiltLinux/linux/issues/1036
Signed-off-by: Nathan Chancellor 
---
 drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c 
b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index c42999a55303..41aa6018d254 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -736,6 +736,8 @@ static int atomisp_mrfld_pre_power_down(struct 
atomisp_device *isp)
 * WA for DDR DVFS enable/disable
 * By default, ISP will force DDR DVFS 1600MHz before disable DVFS
 */
+/* FIXME: at least with ISP2401, the code below causes the driver to break */
+#if 0
 static void punit_ddr_dvfs_enable(bool enable)
 {
int door_bell = 1 << 8;
@@ -820,20 +822,23 @@ static int atomisp_mrfld_power(struct atomisp_device 
*isp, bool enable)
dev_err(isp->dev, "IUNIT power-%s timeout.\n", enable ? "on" : "off");
return -EBUSY;
 }
+#else
+static int atomisp_mrfld_power(struct atomisp_device *isp, bool enable)
+{
+   return 0;
+}
+#endif
 
 /* Workaround for pmu_nc_set_power_state not ready in MRFLD */
 int atomisp_mrfld_power_down(struct atomisp_device *isp)
 {
-   return 0;
-// FIXME: at least with ISP2401, the code below causes the driver to break
-// return atomisp_mrfld_power(isp, false);
+   return atomisp_mrfld_power(isp, false);
 }
 
 /* Workaround for pmu_nc_set_power_state not ready in MRFLD */
 int atomisp_mrfld_power_up(struct atomisp_device *isp)
 {
return 0;
-// FIXME: at least with ISP2401, the code below causes the driver to break
 // return atomisp_mrfld_power(isp, true);
 }
 
-- 
2.27.0.rc0

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


[PATCH 1/7] media: atomisp: Clean up if block in sh_css_sp_init_stage

2020-05-27 Thread Nathan Chancellor
Clang warns:

../drivers/staging/media/atomisp/pci/sh_css_sp.c:1039:23: warning:
address of 'binary->in_frame_info' will always evaluate to 'true'
[-Wpointer-bool-conversion]
} else if (&binary->in_frame_info) {
   ~~   ^

in_frame_info is not a pointer so if binary is not NULL, in_frame_info's
address cannot be NULL. Change this to an else since it will always be
evaluated as one.

While we are here, clean up this if block. The contents of both if
blocks are the same but a check against "stage == 0" is added when
ISP2401 is defined. USE_INPUT_SYSTEM_VERSION_2401 is only defined when
isp2401_system_global.h is included, which only happens when ISP2401. In
other words, USE_INPUT_SYSTEM_VERSION_2401 always requires ISP2401 to be
defined so the '#ifndef ISP2401' makes no sense. Remove that part of the
block to simplify everything.

Link: https://github.com/ClangBuiltLinux/linux/issues/1036
Reported-by: kbuild test robot 
Signed-off-by: Nathan Chancellor 
---
 drivers/staging/media/atomisp/pci/sh_css_sp.c | 27 +++
 1 file changed, 4 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.c 
b/drivers/staging/media/atomisp/pci/sh_css_sp.c
index e574396ad0f4..e242a539d3d8 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_sp.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_sp.c
@@ -1015,34 +1015,15 @@ sh_css_sp_init_stage(struct ia_css_binary *binary,
return err;
 
 #ifdef USE_INPUT_SYSTEM_VERSION_2401
-#ifndef ISP2401
-   if (args->in_frame)
-   {
-   pipe = 
find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num);
-   if (!pipe)
-   return IA_CSS_ERR_INTERNAL_ERROR;
-   ia_css_get_crop_offsets(pipe, &args->in_frame->info);
-   } else if (&binary->in_frame_info)
-   {
+   if (stage == 0) {
pipe = 
find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num);
if (!pipe)
return IA_CSS_ERR_INTERNAL_ERROR;
-   ia_css_get_crop_offsets(pipe, &binary->in_frame_info);
-#else
-   if (stage == 0)
-   {
-   if (args->in_frame) {
-   pipe = 
find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num);
-   if (!pipe)
-   return IA_CSS_ERR_INTERNAL_ERROR;
+
+   if (args->in_frame)
ia_css_get_crop_offsets(pipe, &args->in_frame->info);
-   } else if (&binary->in_frame_info) {
-   pipe = 
find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num);
-   if (!pipe)
-   return IA_CSS_ERR_INTERNAL_ERROR;
+   else
ia_css_get_crop_offsets(pipe, &binary->in_frame_info);
-   }
-#endif
}
 #else
(void)pipe; /*avoid build warning*/

base-commit: 938b29db3aa9c293c7c1366b16e55e308f1a1ddd
-- 
2.27.0.rc0

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


[PATCH 7/7] media: atomisp: Remove binary_supports_input_format

2020-05-27 Thread Nathan Chancellor
Clang warns:

drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c:1707:64:
warning: implicit conversion from enumeration type 'const enum
ia_css_frame_format' to different enumeration type 'enum
atomisp_input_format' [-Wenum-conversion]
binary_supports_input_format(xcandidate, req_in_info->format));
 ~^~

As it turns out, binary_supports_input_format only asserts that
xcandidate is not NULL and just returns true so this call is never
actually made.

There are other functions that are called that assert info is not NULL
so this function actually serves no purpose. Remove it. It can be
brought back if needed later.

Link: https://github.com/ClangBuiltLinux/linux/issues/1036
Signed-off-by: Nathan Chancellor 
---
 .../atomisp/pci/runtime/binary/src/binary.c   | 21 ---
 1 file changed, 21 deletions(-)

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 2a23b7c6aeeb..0be2331c66cd 100644
--- a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
+++ b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
@@ -857,18 +857,6 @@ binary_supports_output_format(const struct 
ia_css_binary_xinfo *info,
return false;
 }
 
-#ifdef ISP2401
-static bool
-binary_supports_input_format(const struct ia_css_binary_xinfo *info,
-enum atomisp_input_format format)
-{
-   assert(info);
-   (void)format;
-
-   return true;
-}
-#endif
-
 static bool
 binary_supports_vf_format(const struct ia_css_binary_xinfo *info,
  enum ia_css_frame_format format)
@@ -1699,15 +1687,6 @@ ia_css_binary_find(struct ia_css_binary_descr *descr,

binary_supports_output_format(xcandidate, req_bin_out_info->format));
continue;
}
-#ifdef ISP2401
-   if (!binary_supports_input_format(xcandidate, 
descr->stream_format)) {
-   ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
-   "ia_css_binary_find() [%d] 
continue: !%d\n",
-   __LINE__,
-   
binary_supports_input_format(xcandidate, req_in_info->format));
-   continue;
-   }
-#endif
if (xcandidate->num_output_pins > 1 &&
/* in case we have a second output pin, */
req_vf_info   && /* and we need vf output. 
*/
-- 
2.27.0.rc0

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


[PATCH 6/7] media: atomisp: Avoid overflow in compute_blending

2020-05-27 Thread Nathan Chancellor
Clang warns:

drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c:129:35:
warning: implicit conversion from 'unsigned long' to 'int32_t' (aka
'int') changes value from 18446744073709543424 to -8192
[-Wconstant-conversion]
return MAX(MIN(isp_strength, 0), -XNR_BLENDING_SCALE_FACTOR);
~~ ~~^~~

XNR_BLENDING_SCALE_FACTOR is BIT(13), or 8192, which will easily fit
into a signed 32-bit integer. However, it is an unsigned long, which
means that negating it is the same as subtracting that value from
ULONG_MAX + 1, which causes it to be larger than a signed 32-bit
integer so it gets implicitly converted.

We can avoid this by using the variable isp_scale, which holds the value
of XNR_BLENDING_SCALE_FACTOR already, where the implicit conversion from
unsigned long to s32 already happened. If that were to ever overflow,
clang would warn: https://godbolt.org/z/EeSxLG

Link: https://github.com/ClangBuiltLinux/linux/issues/1036
Signed-off-by: Nathan Chancellor 
---
 .../atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c 
b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c
index a9db6366d20b..629f07faf20a 100644
--- 
a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c
+++ 
b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c
@@ -126,7 +126,7 @@ compute_blending(int strength)
 * exactly as s0.11 fixed point, but -1.0 can.
 */
isp_strength = -(((strength * isp_scale) + offset) / host_scale);
-   return MAX(MIN(isp_strength, 0), -XNR_BLENDING_SCALE_FACTOR);
+   return MAX(MIN(isp_strength, 0), -isp_scale);
 }
 
 void
-- 
2.27.0.rc0

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


[PATCH 5/7] media: atomisp: Remove unnecessary NULL check in atomisp_param

2020-05-27 Thread Nathan Chancellor
Clang warns:

drivers/staging/media/atomisp/pci/atomisp_cmd.c:4278:17: warning:
address of 'config->info' will always evaluate to 'true'
[-Wpointer-bool-conversion]
if (!&config->info) {
~ ^~~~

config cannot be NULL because it comes from an ioctl, which ensures that
the user is not giving us an invalid pointer through copy_from_user. If
config is not NULL, info cannot be NULL. Remove this check.

Link: https://github.com/ClangBuiltLinux/linux/issues/1036
Signed-off-by: Nathan Chancellor 
---
 drivers/staging/media/atomisp/pci/atomisp_cmd.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c 
b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index 5be690f876c1..105c5aeb83ac 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -4264,7 +4264,6 @@ int atomisp_set_parameters(struct video_device *vdev,
 int atomisp_param(struct atomisp_sub_device *asd, int flag,
  struct atomisp_parm *config)
 {
-   struct atomisp_device *isp = asd->isp;
struct ia_css_pipe_config *vp_cfg =
&asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].
pipe_configs[IA_CSS_PIPE_ID_VIDEO];
@@ -4275,10 +4274,6 @@ int atomisp_param(struct atomisp_sub_device *asd, int 
flag,
atomisp_css_get_dvs_grid_info(
&asd->params.curr_grid_info);
 
-   if (!&config->info) {
-   dev_err(isp->dev, "ERROR: NULL pointer in grid_info\n");
-   return -EINVAL;
-   }
atomisp_curr_user_grid_info(asd, &config->info);
 
/* We always return the resolution and stride even if there is
-- 
2.27.0.rc0

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


Re: [PATCH] staging: rtl8712: Fix IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK

2020-05-27 Thread Greg Kroah-Hartman
On Sat, May 23, 2020 at 10:12:47PM +0100, Pascal Terjan wrote:
> The value in shared headers was fixed 9 years ago in commit 8d661f1e462d
> ("ieee80211: correct IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK macro") and
> while looking at using shared headers for other duplicated constants
> I noticed this driver uses the old value.
> 
> The macros are also defined twice in this file so I am deleting the
> second definition.
> 
> Signed-off-by: Pascal Terjan 
> Cc: stable 
> ---
>  drivers/staging/rtl8712/wifi.h | 9 +
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/wifi.h b/drivers/staging/rtl8712/wifi.h
> index be731f1a2209..91b65731fcaa 100644
> --- a/drivers/staging/rtl8712/wifi.h
> +++ b/drivers/staging/rtl8712/wifi.h
> @@ -440,7 +440,7 @@ static inline unsigned char *get_hdr_bssid(unsigned char 
> *pframe)
>  /* block-ack parameters */
>  #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
>  #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
> -#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
> +#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0
>  #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
>  #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800

I'll take this patch, but why can't this code be all deleted such that
the real in-kernel defines are used instead of these duplicated ones?

thanks,

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


Re: [PATCH] staging: rtl8723bs: Use shared header constants

2020-05-27 Thread Greg Kroah-Hartman
On Sat, May 23, 2020 at 10:29:19PM +0100, Pascal Terjan wrote:
> This is one of the 9 drivers redefining rfc1042_header.

I do not understand what this changelog is trying to say.  Can you fix
this up to be more explicit and detained and resend?

thanks,

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


Re: [PATCH 00/10] staging: wfx: introduce nl80211 vendor extensions

2020-05-27 Thread Greg Kroah-Hartman
On Tue, May 26, 2020 at 07:18:11PM +0200, Jerome Pouiller wrote:
> From: Jérôme Pouiller 
> 
> Hello,
> 
> This series introduces some nl80211 vendor extensions to the wfx driver.
> 
> This series may lead to some discussions:

I've applied the first 6 patches here, until you get some answers from
the wifi developers about what to do with the rest.  Once you do, please
fix up / change them to meet their requirements, and then resend.

thanks,

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


Re: [PATCH 0/7] media: atomisp: Address several clang warnings

2020-05-27 Thread Mauro Carvalho Chehab
Em Wed, 27 May 2020 00:11:43 -0700
Nathan Chancellor  escreveu:

> Hi all,
> 
> This series aims to clean up the code while addressing the majority of
> clang warnings in this driver, some found by the 0day bot and others
> found by me.
> 
> There are several enum conversion warnings that happen, which I do not
> really know how to solve without understanding how exactly this driver
> works. I would appreciate some guidance or a solution. Below are the
> warnings, sorry for not wrapping them but they would be hard to read
> otherwise.

... 
> ../drivers/staging/media/atomisp//pci/atomisp_compat_css20.h:117:22: note: 
> expanded from macro 'CSS_ID'
> #define CSS_ID(val) (IA_ ## val)
...

I actually wrote a patch getting rid of this ugly thing:


https://git.linuxtv.org/mchehab/experimental.git/commit/?h=atomisp_v3&id=cf6a15543ace1e99364911c0b7a2f6b8f2f43021

This one was already submitted upstream (not merged yet), but there
are also lots of other patches on my working tree.

I'll try to apply your patch series on it, once I'll be able to
fix a bug with mmap support.

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


[PATCH 1/2] staging: vt6656: vnt_tx_packet use skb_clone to preserve sk_buff.

2020-05-27 Thread Malcolm Priestley
The sk_buff needs to preserved for copying to various parts
of context and passing back to mac80211

clone sk_buff in context so to continue to writing to orginal
sk_buff data area to send in vnt_tx_context.

dev_kfree_skb the context on error or dev_kfree_skb the
orignal when done. The error handling continues as before.

Only one place in function needs to change from
ieee80211_get_hdrlen_from_skb to ieee80211_hdrlen(hdr) which
is already to pointing to correct position.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6656/rxtx.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index a1b16ef9b27f..05b9a9ee0e33 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -545,13 +545,18 @@ int vnt_tx_packet(struct vnt_private *priv, struct 
sk_buff *skb)
return -ENOMEM;
}
 
-   tx_context->skb = skb;
tx_context->pkt_type = pkt_type;
tx_context->frame_len = skb->len + 4;
tx_context->tx_rate =  rate->hw_value;
 
spin_unlock_irqrestore(&priv->lock, flags);
 
+   tx_context->skb = skb_clone(skb, GFP_ATOMIC);
+   if (!tx_context->skb) {
+   tx_context->in_use = false;
+   return -ENOMEM;
+   }
+
tx_header_size = vnt_get_hdr_size(info);
tx_bytes = tx_header_size + skb->len;
tx_header_size += sizeof(struct vnt_tx_usb_header);
@@ -565,12 +570,9 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
tx_buffer->usb.type = 0x00;
 
tx_context->type = CONTEXT_DATA_PACKET;
-   tx_context->tx_buffer = tx_buffer;
+   tx_context->tx_buffer = skb->data;
tx_context->buf_len = skb->len;
 
-   /* Return skb->data to mac80211 header */
-   skb_pull(skb, tx_header_size);
-
/*Set fifo controls */
if (pkt_type == PK_TYPE_11A)
tx_buffer_head->fifo_ctl = 0;
@@ -606,7 +608,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
tx_buffer_head->fifo_ctl |= cpu_to_le16(FIFOCTL_LHEAD);
 
tx_buffer_head->frag_ctl =
-   cpu_to_le16(ieee80211_get_hdrlen_from_skb(skb) << 10);
+   cpu_to_le16(ieee80211_hdrlen(hdr->frame_control) << 10);
 
if (info->control.hw_key)
tx_context->frame_len += info->control.hw_key->icv_len;
@@ -623,10 +625,13 @@ int vnt_tx_packet(struct vnt_private *priv, struct 
sk_buff *skb)
spin_lock_irqsave(&priv->lock, flags);
 
if (vnt_tx_context(priv, tx_context)) {
+   dev_kfree_skb(tx_context->skb);
spin_unlock_irqrestore(&priv->lock, flags);
return -EIO;
}
 
+   dev_kfree_skb(skb);
+
spin_unlock_irqrestore(&priv->lock, flags);
 
return 0;
-- 
2.27.0.rc0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


WARNING in binder_transaction_buffer_release (2)

2020-05-27 Thread syzbot
Hello,

syzbot found the following crash on:

HEAD commit:44456565 Merge tag 'io_uring-5.7-2020-05-22' of git://git...
git tree:   upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12990cba10
kernel config:  https://syzkaller.appspot.com/x/.config?x=b3368ce0cc5f5ace
dashboard link: https://syzkaller.appspot.com/bug?extid=e113a0b970b7b3f394ba
compiler:   gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=165b01e210
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1470601610

The bug was bisected to:

commit 44d8047f1d87adc2fd7eccc88533794f6d88c15e
Author: Todd Kjos 
Date:   Tue Aug 28 20:46:25 2018 +

binder: use standard functions to allocate fds

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=134e254a10
final crash:https://syzkaller.appspot.com/x/report.txt?x=10ce254a10
console output: https://syzkaller.appspot.com/x/log.txt?x=174e254a10

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+e113a0b970b7b3f39...@syzkaller.appspotmail.com
Fixes: 44d8047f1d87 ("binder: use standard functions to allocate fds")

[ cut here ]
WARNING: CPU: 1 PID: 7071 at drivers/android/binder.c:2348 
binder_transaction_buffer_release+0x601/0x8a0 drivers/android/binder.c:2348
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 7071 Comm: syz-executor142 Not tainted 5.7.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x188/0x20d lib/dump_stack.c:118
 panic+0x2e3/0x75c kernel/panic.c:221
 __warn.cold+0x2f/0x35 kernel/panic.c:582
 report_bug+0x27b/0x2f0 lib/bug.c:195
 fixup_bug arch/x86/kernel/traps.c:175 [inline]
 fixup_bug arch/x86/kernel/traps.c:170 [inline]
 do_error_trap+0x12b/0x220 arch/x86/kernel/traps.c:267
 do_invalid_op+0x32/0x40 arch/x86/kernel/traps.c:286
 invalid_op+0x23/0x30 arch/x86/entry/entry_64.S:1027
RIP: 0010:binder_transaction_buffer_release+0x601/0x8a0 
drivers/android/binder.c:2348
Code: bb fd 31 ff 41 89 c5 89 c6 e8 bb ff 81 fb 45 85 ed 0f 85 f9 4b 01 00 48 
8d 45 40 48 89 44 24 28 e9 fa fa ff ff e8 2f fe 81 fb <0f> 0b e9 87 fc ff ff e8 
23 fe 81 fb 4c 8b 44 24 20 48 89 d8 45 31
RSP: 0018:c900018e7620 EFLAGS: 00010293
RAX: 8880a12da5c0 RBX: 0058 RCX: 11101425b55b
RDX:  RSI: 85f136f1 RDI: 88809db1c048
RBP: 88809290a080 R08: 8880a12da5c0 R09: f5200031cee7
R10: c900018e7737 R11: f5200031cee6 R12: 88809187a040
R13: 0060 R14: 88809db1c000 R15: 0060
 binder_transaction+0x146d/0x6500 drivers/android/binder.c:3486
 binder_thread_write+0x818/0x2560 drivers/android/binder.c:3796
 binder_ioctl_write_read drivers/android/binder.c:4847 [inline]
 binder_ioctl+0x1008/0x1862 drivers/android/binder.c:5024
 vfs_ioctl fs/ioctl.c:47 [inline]
 ksys_ioctl+0x11a/0x180 fs/ioctl.c:771
 __do_sys_ioctl fs/ioctl.c:780 [inline]
 __se_sys_ioctl fs/ioctl.c:778 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:778
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3
RIP: 0033:0x44b749
Code: e8 5c d9 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 
89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 
bb d0 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:7f65c624dce8 EFLAGS: 0246 ORIG_RAX: 0010
RAX: ffda RBX: 006ddc48 RCX: 0044b749
RDX: 2540 RSI: c0306201 RDI: 0003
RBP: 006ddc40 R08:  R09: 
R10:  R11: 0246 R12: 006ddc4c
R13: 7ffd9783511f R14: 7f65c624e9c0 R15: 006ddc4c
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkal...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: vt6656: Move vnt_tx_usb_header to vnt_tx_context

2020-05-27 Thread Malcolm Priestley
Move the USB element out of vnt_tx_packet and vnt_beacon_xmit to
vnt_tx_context with sk_buff passed in parameters with the data now
between skb->data and skb->len.

The vnt_tx_usb header is moved from vnt_tx_buffer to usbpipe.h with the
size added to extra_tx_headroom the largest possible size.

The CONTEXT enums types are aligned with usb ones and CONTEXT_MGMT_PACKET
is removed and is never be used.

The skb_push in vnt_tx_packet is now only ever used with
vnt_get_hdr_size with variables tx_bytes and tx_header_size removed.

buf_len in vnt_usb_send_context is no longer used and replaced with
urb->actual_length in vnt_tx_context_complete.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6656/device.h   |  4 +---
 drivers/staging/vt6656/main_usb.c |  3 ++-
 drivers/staging/vt6656/rxtx.c | 30 +-
 drivers/staging/vt6656/rxtx.h |  7 ---
 drivers/staging/vt6656/usbpipe.c  | 21 +++--
 drivers/staging/vt6656/usbpipe.h  |  9 -
 6 files changed, 31 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index d89f564a13c4..947530fefe94 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -206,8 +206,7 @@ struct vnt_rsp_card_init {
  * Enum of context types for SendPacket
  */
 enum {
-   CONTEXT_DATA_PACKET = 1,
-   CONTEXT_MGMT_PACKET,
+   CONTEXT_DATA_PACKET = 0,
CONTEXT_BEACON_PACKET
 };
 
@@ -239,7 +238,6 @@ struct vnt_usb_send_context {
void *priv;
struct sk_buff *skb;
void *tx_buffer;
-   unsigned int buf_len;
u32 frame_len;
u16 tx_hdr_size;
u16 tx_rate;
diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index c0169e32621b..8bf851c53f4e 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -1043,7 +1043,8 @@ vt6656_probe(struct usb_interface *intf, const struct 
usb_device_id *id)
ieee80211_hw_set(priv->hw, SUPPORTS_PS);
ieee80211_hw_set(priv->hw, PS_NULLFUNC_STACK);
 
-   priv->hw->extra_tx_headroom = sizeof(struct vnt_tx_buffer);
+   priv->hw->extra_tx_headroom =
+   sizeof(struct vnt_tx_buffer) + sizeof(struct vnt_tx_usb_header);
priv->hw->max_signal = 100;
 
SET_IEEE80211_DEV(priv->hw, &intf->dev);
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 05b9a9ee0e33..5530c06ffd40 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -512,7 +512,6 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
struct vnt_tx_fifo_head *tx_buffer_head;
struct vnt_usb_send_context *tx_context;
unsigned long flags;
-   u16 tx_bytes, tx_header_size;
u8 pkt_type;
 
hdr = (struct ieee80211_hdr *)(skb->data);
@@ -557,21 +556,11 @@ int vnt_tx_packet(struct vnt_private *priv, struct 
sk_buff *skb)
return -ENOMEM;
}
 
-   tx_header_size = vnt_get_hdr_size(info);
-   tx_bytes = tx_header_size + skb->len;
-   tx_header_size += sizeof(struct vnt_tx_usb_header);
-
-   tx_buffer = skb_push(skb, tx_header_size);
+   tx_buffer = skb_push(skb, vnt_get_hdr_size(info));
+   tx_context->tx_buffer = tx_buffer;
tx_buffer_head = &tx_buffer->fifo_head;
 
-   /* Fill USB header */
-   tx_buffer->usb.tx_byte_count = cpu_to_le16(tx_bytes);
-   tx_buffer->usb.pkt_no = tx_context->pkt_no;
-   tx_buffer->usb.type = 0x00;
-
tx_context->type = CONTEXT_DATA_PACKET;
-   tx_context->tx_buffer = skb->data;
-   tx_context->buf_len = skb->len;
 
/*Set fifo controls */
if (pkt_type == PK_TYPE_11A)
@@ -624,7 +613,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
 
spin_lock_irqsave(&priv->lock, flags);
 
-   if (vnt_tx_context(priv, tx_context)) {
+   if (vnt_tx_context(priv, tx_context, skb)) {
dev_kfree_skb(tx_context->skb);
spin_unlock_irqrestore(&priv->lock, flags);
return -EIO;
@@ -639,14 +628,13 @@ int vnt_tx_packet(struct vnt_private *priv, struct 
sk_buff *skb)
 
 static int vnt_beacon_xmit(struct vnt_private *priv, struct sk_buff *skb)
 {
-   struct vnt_tx_usb_header *usb;
struct vnt_tx_short_buf_head *short_head;
struct ieee80211_tx_info *info;
struct vnt_usb_send_context *context;
struct ieee80211_mgmt *mgmt_hdr;
unsigned long flags;
u32 frame_size = skb->len + 4;
-   u16 current_rate, count;
+   u16 current_rate;
 
spin_lock_irqsave(&priv->lock, flags);
 
@@ -663,7 +651,6 @@ static int vnt_beacon_xmit(struct vnt_private *priv, struct 
sk_buff *skb)
 
mgmt_hdr = (struct ieee80211_mgmt *)skb->data;
short_head = skb_push(skb, sizeof(*short_head));
-   count = skb->len;
 
if (priv->bb_type == BB_TYPE_11A) {
 

[PATCH 00/10] staging: most: usb: fix code review findings

2020-05-27 Thread Christian Gromm
This series fixes the comments received from the mailing list.

Christian Gromm (10):
  staging: most: usb: change order of function parameters
  staging: most: usb: don't use expressions that might fail in a
declaration
  staging: most: usb: change return value of function drci_rd_reg
  staging: most: usb: return 0 instead of variable
  staging: most: usb: move allocation of URB out of critical section
  staging: most: usb: don't use error path to exit function on success
  staging: most: usb: replace code to calculate array index
  staging: most: usb: use correct error codes
  staging: most: usb: add missing put_device calls
  staging: most: usb: use function sysfs_streq

 drivers/staging/most/usb/usb.c | 83 --
 1 file changed, 47 insertions(+), 36 deletions(-)

-- 
2.7.4

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


[PATCH 02/10] staging: most: usb: don't use expressions that might fail in a declaration

2020-05-27 Thread Christian Gromm
This patch moves function calls that can fail out of the declararion block
of a function body. This is done to enhance readability.

Signed-off-by: Christian Gromm 
Reported-by: Dan Carpenter 
---
 drivers/staging/most/usb/usb.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 0e1264d..fd0d885 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -139,9 +139,10 @@ static void wq_netinfo(struct work_struct *wq_obj);
 static inline int drci_rd_reg(struct usb_device *dev, u16 reg, u16 *buf)
 {
int retval;
-   __le16 *dma_buf = kzalloc(sizeof(*dma_buf), GFP_KERNEL);
+   __le16 *dma_buf;
u8 req_type = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
 
+   dma_buf = kzalloc(sizeof(*dma_buf), GFP_KERNEL);
if (!dma_buf)
return -ENOMEM;
 
@@ -846,8 +847,9 @@ static ssize_t value_store(struct device *dev, struct 
device_attribute *attr,
const char *name = attr->attr.name;
struct most_dci_obj *dci_obj = to_dci_obj(dev);
struct usb_device *usb_dev = dci_obj->usb_device;
-   int err = kstrtou16(buf, 16, &val);
+   int err;
 
+   err = kstrtou16(buf, 16, &val);
if (err)
return err;
 
@@ -939,13 +941,14 @@ hdm_probe(struct usb_interface *interface, const struct 
usb_device_id *id)
struct usb_host_interface *usb_iface_desc = interface->cur_altsetting;
struct usb_device *usb_dev = interface_to_usbdev(interface);
struct device *dev = &usb_dev->dev;
-   struct most_dev *mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
+   struct most_dev *mdev;
unsigned int i;
unsigned int num_endpoints;
struct most_channel_capability *tmp_cap;
struct usb_endpoint_descriptor *ep_desc;
int ret = -ENOMEM;
 
+   mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
if (!mdev)
return -ENOMEM;
 
-- 
2.7.4

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


[PATCH 05/10] staging: most: usb: move allocation of URB out of critical section

2020-05-27 Thread Christian Gromm
This patch puts the call to usb_alloc_urb() before the critical
section starts that is protected with the io_mutex lock. This is
to make the section as short as possible and to use the regular
GFP_KERNEL flag.

Signed-off-by: Christian Gromm 
Reported-by: Dan Carpenter 
---
 drivers/staging/most/usb/usb.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index a605e0f..534825f 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -467,18 +467,16 @@ static int hdm_enqueue(struct most_interface *iface, int 
channel,
if (iface->num_channels <= channel || channel < 0)
return -ECHRNG;
 
+   urb = usb_alloc_urb(NO_ISOCHRONOUS_URB, GFP_KERNEL);
+   if (!urb)
+   return -ENOMEM;
+
conf = &mdev->conf[channel];
 
mutex_lock(&mdev->io_mutex);
if (!mdev->usb_device) {
retval = -ENODEV;
-   goto unlock_io_mutex;
-   }
-
-   urb = usb_alloc_urb(NO_ISOCHRONOUS_URB, GFP_ATOMIC);
-   if (!urb) {
-   retval = -ENOMEM;
-   goto unlock_io_mutex;
+   goto err_free_urb;
}
 
if ((conf->direction & MOST_CH_TX) && mdev->padding_active[channel] &&
-- 
2.7.4

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


[PATCH 04/10] staging: most: usb: return 0 instead of variable

2020-05-27 Thread Christian Gromm
This patch returns 0 instead of variable in case of invalid parameter
has been passed to function to increase readability.

Signed-off-by: Christian Gromm 
Reported-by: Dan Carpenter 
---
 drivers/staging/most/usb/usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 64005b6..a605e0f 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -192,12 +192,12 @@ static inline int start_sync_ep(struct usb_device 
*usb_dev, u16 ep)
 static unsigned int get_stream_frame_size(struct device *dev,
  struct most_channel_config *cfg)
 {
-   unsigned int frame_size = 0;
+   unsigned int frame_size;
unsigned int sub_size = cfg->subbuffer_size;
 
if (!sub_size) {
dev_warn(dev, "Misconfig: Subbuffer size zero.\n");
-   return frame_size;
+   return 0;
}
switch (cfg->data_type) {
case MOST_CH_ISOC:
-- 
2.7.4

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


[PATCH 09/10] staging: most: usb: add missing put_device calls

2020-05-27 Thread Christian Gromm
This patch adds the missing put_device() function calls to
properly free allocated resources and maintain reference counts.

Signed-off-by: Christian Gromm 
Reported-by: Dan Carpenter 
---
 drivers/staging/most/usb/usb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 3575a40..1c4bdb8 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -919,6 +919,7 @@ static void release_dci(struct device *dev)
 {
struct most_dci_obj *dci = to_dci_obj(dev);
 
+   put_device(dev->parent);
kfree(dci);
 }
 
@@ -1123,6 +1124,7 @@ static void hdm_disconnect(struct usb_interface 
*interface)
kfree(mdev->cap);
kfree(mdev->conf);
kfree(mdev->ep_address);
+   put_device(&mdev->dci->dev);
put_device(&mdev->dev);
 }
 
-- 
2.7.4

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


[PATCH 10/10] staging: most: usb: use function sysfs_streq

2020-05-27 Thread Christian Gromm
This patch replaces function strcmp() with sysfs_streq() to compare
strings provided via sysfs.

Signed-off-by: Christian Gromm 
Reported-by: Dan Carpenter 
---
 drivers/staging/most/usb/usb.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 1c4bdb8..df5876c 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -808,7 +808,7 @@ static int get_stat_reg_addr(const struct regs *regs, int 
size,
int i;
 
for (i = 0; i < size; i++) {
-   if (!strcmp(name, regs[i].name)) {
+   if (sysfs_streq(name, regs[i].name)) {
*reg_addr = regs[i].reg;
return 0;
}
@@ -828,10 +828,10 @@ static ssize_t value_show(struct device *dev, struct 
device_attribute *attr,
u16 reg_addr;
int err;
 
-   if (!strcmp(name, "arb_address"))
+   if (sysfs_streq(name, "arb_address"))
return snprintf(buf, PAGE_SIZE, "%04x\n", dci_obj->reg_addr);
 
-   if (!strcmp(name, "arb_value"))
+   if (sysfs_streq(name, "arb_value"))
reg_addr = dci_obj->reg_addr;
else if (get_static_reg_addr(ro_regs, name, ®_addr) &&
 get_static_reg_addr(rw_regs, name, ®_addr))
@@ -858,14 +858,14 @@ static ssize_t value_store(struct device *dev, struct 
device_attribute *attr,
if (err)
return err;
 
-   if (!strcmp(name, "arb_address")) {
+   if (sysfs_streq(name, "arb_address")) {
dci_obj->reg_addr = val;
return count;
}
 
-   if (!strcmp(name, "arb_value"))
+   if (sysfs_streq(name, "arb_value"))
err = drci_wr_reg(usb_dev, dci_obj->reg_addr, val);
-   else if (!strcmp(name, "sync_ep"))
+   else if (sysfs_streq(name, "sync_ep"))
err = start_sync_ep(usb_dev, val);
else if (!get_static_reg_addr(rw_regs, name, ®_addr))
err = drci_wr_reg(usb_dev, reg_addr, val);
-- 
2.7.4

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


[PATCH 03/10] staging: most: usb: change return value of function drci_rd_reg

2020-05-27 Thread Christian Gromm
This patch makes function drci_rd_reg return 0 in case of success
and a negative number else. As no caller is evaluating the number
of bytes transferred by function usb_control_msg this information is
being omitted.

Signed-off-by: Christian Gromm 
Reported-by: Dan Carpenter 
---
 drivers/staging/most/usb/usb.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index fd0d885..64005b6 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -153,7 +153,9 @@ static inline int drci_rd_reg(struct usb_device *dev, u16 
reg, u16 *buf)
*buf = le16_to_cpu(*dma_buf);
kfree(dma_buf);
 
-   return retval;
+   if (retval < 0)
+   return retval;
+   return 0;
 }
 
 /**
@@ -686,22 +688,22 @@ static void wq_netinfo(struct work_struct *wq_obj)
u16 hi, mi, lo, link;
u8 hw_addr[6];
 
-   if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_HI, &hi) < 0) {
+   if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_HI, &hi)) {
dev_err(dev, "Vendor request 'hw_addr_hi' failed\n");
return;
}
 
-   if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_MI, &mi) < 0) {
+   if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_MI, &mi)) {
dev_err(dev, "Vendor request 'hw_addr_mid' failed\n");
return;
}
 
-   if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_LO, &lo) < 0) {
+   if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_LO, &lo)) {
dev_err(dev, "Vendor request 'hw_addr_low' failed\n");
return;
}
 
-   if (drci_rd_reg(usb_device, DRCI_REG_NI_STATE, &link) < 0) {
+   if (drci_rd_reg(usb_device, DRCI_REG_NI_STATE, &link)) {
dev_err(dev, "Vendor request 'link status' failed\n");
return;
}
-- 
2.7.4

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


[PATCH 01/10] staging: most: usb: change order of function parameters

2020-05-27 Thread Christian Gromm
This patch swaps the arguments of function get_stream_frame_size to
have the struct device as first parameter.

Signed-off-by: Christian Gromm 
Reported-by: Dan Carpenter 
---
 drivers/staging/most/usb/usb.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 56b75e4..0e1264d 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -183,10 +183,11 @@ static inline int start_sync_ep(struct usb_device 
*usb_dev, u16 ep)
 
 /**
  * get_stream_frame_size - calculate frame size of current configuration
+ * @dev: device structure
  * @cfg: channel configuration
  */
-static unsigned int get_stream_frame_size(struct most_channel_config *cfg,
- struct device *dev)
+static unsigned int get_stream_frame_size(struct device *dev,
+ struct most_channel_config *cfg)
 {
unsigned int frame_size = 0;
unsigned int sub_size = cfg->subbuffer_size;
@@ -270,7 +271,7 @@ static int hdm_poison_channel(struct most_interface *iface, 
int channel)
 static int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
 {
struct most_channel_config *conf = &mdev->conf[channel];
-   unsigned int frame_size = get_stream_frame_size(conf, &mdev->dev);
+   unsigned int frame_size = get_stream_frame_size(&mdev->dev, conf);
unsigned int j, num_frames;
 
if (!frame_size)
@@ -304,7 +305,7 @@ static int hdm_remove_padding(struct most_dev *mdev, int 
channel,
  struct mbo *mbo)
 {
struct most_channel_config *const conf = &mdev->conf[channel];
-   unsigned int frame_size = get_stream_frame_size(conf, &mdev->dev);
+   unsigned int frame_size = get_stream_frame_size(&mdev->dev, conf);
unsigned int j, num_frames;
 
if (!frame_size)
@@ -600,7 +601,7 @@ static int hdm_configure_channel(struct most_interface 
*iface, int channel,
 
mdev->padding_active[channel] = true;
 
-   frame_size = get_stream_frame_size(conf, &mdev->dev);
+   frame_size = get_stream_frame_size(&mdev->dev, conf);
if (frame_size == 0 || frame_size > USB_MTU) {
dev_warn(dev, "Misconfig: frame size wrong\n");
return -EINVAL;
-- 
2.7.4

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


[PATCH 08/10] staging: most: usb: use correct error codes

2020-05-27 Thread Christian Gromm
This patch uses the -EINVAL return code where -EFAULT is wrongly being
used.

Signed-off-by: Christian Gromm 
Reported-by: Dan Carpenter 
---
 drivers/staging/most/usb/usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 468aabf..3575a40 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -813,7 +813,7 @@ static int get_stat_reg_addr(const struct regs *regs, int 
size,
return 0;
}
}
-   return -EFAULT;
+   return -EINVAL;
 }
 
 #define get_static_reg_addr(regs, name, reg_addr) \
@@ -835,7 +835,7 @@ static ssize_t value_show(struct device *dev, struct 
device_attribute *attr,
reg_addr = dci_obj->reg_addr;
else if (get_static_reg_addr(ro_regs, name, ®_addr) &&
 get_static_reg_addr(rw_regs, name, ®_addr))
-   return -EFAULT;
+   return -EINVAL;
 
err = drci_rd_reg(dci_obj->usb_device, reg_addr, &val);
if (err < 0)
@@ -870,7 +870,7 @@ static ssize_t value_store(struct device *dev, struct 
device_attribute *attr,
else if (!get_static_reg_addr(rw_regs, name, ®_addr))
err = drci_wr_reg(usb_dev, reg_addr, val);
else
-   return -EFAULT;
+   return -EINVAL;
 
if (err < 0)
return err;
-- 
2.7.4

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


[PATCH 06/10] staging: most: usb: don't use error path to exit function on success

2020-05-27 Thread Christian Gromm
This patch makes it transparent whether the function is exiting
with an error or successful.

Signed-off-by: Christian Gromm 
Reported-by: Dan Carpenter 
---
 drivers/staging/most/usb/usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 534825f..03318de 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -519,13 +519,13 @@ static int hdm_enqueue(struct most_interface *iface, int 
channel,
"URB submit failed with error %d.\n", retval);
goto err_unanchor_urb;
}
-   goto unlock_io_mutex;
+   mutex_unlock(&mdev->io_mutex);
+   return 0;
 
 err_unanchor_urb:
usb_unanchor_urb(urb);
 err_free_urb:
usb_free_urb(urb);
-unlock_io_mutex:
mutex_unlock(&mdev->io_mutex);
return retval;
 }
-- 
2.7.4

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


[PATCH 07/10] staging: most: usb: replace code to calculate array index

2020-05-27 Thread Christian Gromm
This patch removes the expression that makes use of a priori knowledge
about channel numbers to calculate an array index.
The expression 'peer = 1 - channel' utilizes the fact that an USB interface
that operates on the asynchronous data of the Network only has two
endpoints. Hence, channel being 0 or 1. The replacement is more simple and
less confusing when reading the code.

Signed-off-by: Christian Gromm 
Reported-by: Dan Carpenter 
---
 drivers/staging/most/usb/usb.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 03318de..468aabf 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -729,6 +729,8 @@ static void wq_clear_halt(struct work_struct *wq_obj)
struct most_dev *mdev = clear_work->mdev;
unsigned int channel = clear_work->channel;
int pipe = clear_work->pipe;
+   int snd_pipe;
+   int peer;
 
mutex_lock(&mdev->io_mutex);
most_stop_enqueue(&mdev->iface, channel);
@@ -746,9 +748,12 @@ static void wq_clear_halt(struct work_struct *wq_obj)
 */
if (mdev->conf[channel].data_type == MOST_CH_ASYNC &&
mdev->conf[channel].direction == MOST_CH_RX) {
-   int peer = 1 - channel;
-   int snd_pipe = usb_sndbulkpipe(mdev->usb_device,
-  mdev->ep_address[peer]);
+   if (channel == 0)
+   peer = 1;
+   else
+   peer = 0;
+   snd_pipe = usb_sndbulkpipe(mdev->usb_device,
+  mdev->ep_address[peer]);
usb_clear_halt(mdev->usb_device, snd_pipe);
}
mdev->is_channel_healthy[channel] = true;
-- 
2.7.4

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


[PATCH] staging: vt6656: Fix warning: unused variable vnt_frame_time

2020-05-27 Thread Malcolm Priestley
In commit 3436accadc3f
("staging: vt6656: Move vnt_get_frame_time and vnt_get_phy_field to rxtx")
not quite all of the code was removed.

Remove unused vnt_frame_time variable.

Reported-by: kbuild test robot 
Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6656/rxtx.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 5530c06ffd40..5dd6b4d2bf20 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -39,10 +39,6 @@ static const u16 vnt_time_stampoff[2][MAX_RATE] = {
 #define DATADUR_B   10
 #define DATADUR_A   11
 
-static const u16 vnt_frame_time[MAX_RATE] = {
-   10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216
-};
-
 static const u8 vnt_phy_signal[] = {
0x00,   /* RATE_1M  */
0x01,   /* RATE_2M  */
-- 
2.27.0.rc0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: vt6656: Fix warning: unused variable vnt_frame_time

2020-05-27 Thread Malcolm Priestley
In commit 61bb798767e4
("staging: vt6656: vnt_get_rtscts_rsvtime_le replace with rts/cts duration.")
not quite all of the code was removed.

Remove unused vnt_frame_time variable.

Reported-by: kbuild test robot 
Signed-off-by: Malcolm Priestley 
---
v2 corrected the commit 

 drivers/staging/vt6656/rxtx.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 5530c06ffd40..5dd6b4d2bf20 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -39,10 +39,6 @@ static const u16 vnt_time_stampoff[2][MAX_RATE] = {
 #define DATADUR_B   10
 #define DATADUR_A   11
 
-static const u16 vnt_frame_time[MAX_RATE] = {
-   10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216
-};
-
 static const u8 vnt_phy_signal[] = {
0x00,   /* RATE_1M  */
0x01,   /* RATE_2M  */
-- 
2.27.0.rc0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/11] media: atomisp: get rid of hmm_vm.c

2020-05-27 Thread kbuild test robot
Hi Mauro,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20200526]
[cannot apply to staging/staging-testing v5.7-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:
https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/Some-fixes-and-cleanups-for-atomisp-driver/20200525-150001
base:   git://linuxtv.org/media_tree.git master
config: x86_64-allmodconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 
3393cc4cebf9969db94dc424b7a2b6195589c33b)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> make[5]: *** No rule to make target 
>> 'drivers/staging/media/atomisp/pci/hmm/hmm_dynamic_pool.o', needed by 
>> 'drivers/staging/media/atomisp/atomisp.o'.
make[5]: Target '__build' not remade because of errors.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC 00/50] staging: vchiq: Getting rid of the vchi/vchiq split

2020-05-27 Thread Nicolas Saenz Julienne
vchi acts as a mid layer between vchiq and its kernel services, while
arguably providing little to no benefit: half of the functions exposed
are a 1:1 copy of vchiq's, and the rest provide some functionality which
can be easly integrated into vchiq without all the churn. Moreover it
has been found in the past as a blockage to further fixes in vchiq as
every change needed its vchi counterpart, if even possible.

Hence this series, which merges all vchi functionality into vchiq and
provies a simpler and more concise API to services.

I'm aware that kernel's vchi API tries to mimic its userspace
counterpart (or vice versa). Obviously this breaks the parity, but I
don't think it's a sane goal to have. There is little sense or gain from
it, and adds impossible constraints to upstreaming the driver.

Overall the series falls short of removing 1500 lines of code, which is
pretty neat on itself.

So far it has been tested trough bcm2835-camera, audio and vchiq-test. I
can't do much about vc-sm-cma for now, but the changes are done in a way
that shouldn't affect its behaviour.

Note that the series builds up on RPi/Laurent's camera support series[1]
and can't yet be merged. We'd have to coordinate here. We could either
wait for the vc_sm_cma rework (if it's not going to take months and
months to finish), or factor out all the vc-sm-cma stuff, merge that into
the downstream kernel and take the rest of the series on top of
Laurent's mmal-vchiq changes.

Regards,
Nicolas

[1] 
https://lwn.net/ml/linux-media/20200504092611.9798-1-laurent.pinch...@ideasonboard.com/

---

Nicolas Saenz Julienne (50):
  staging: vchi: Get rid of vchi_service_destroy()
  staging: vchi: Get rid of vchi_queue_user_message()
  staging: vchiq: Move copy callback handling into vchiq
  staging: vchi: Merge vchi_msg_queue() into vchi_queue_kernel_message()
  staging: vchi: Get rid of vchi_service_set_option()
  staging: vchi: Get rid of vchiq_status_to_vchi()
  staging: vchi: Get rid of not implemented function declarations
  staging: vchi: Get rid of C++ guards
  staging: vchiq: move vchiq_release_message() into vchiq
  staging: vchiq: Get rid of VCHIQ_SERVICE_OPENEND callback reason
  staging: vchi: Get rid of all useless callback reasons
  staging: vchi: Get rid of vchi_msg_peek()
  staging: vchi: Get rid of struct vchi_instance_handle
  staging: vchi: Unify struct shim_service and struct
vchi_service_handle
  staging: vc04_services: bcm2835-audio: Use vchi_msg_hold()
  staging: vchi: Get rid of vchi_msg_dequeue()
  staging: vchi_common: Get rid of all unused definitions
  staging: vc04_services: vc-sm-cma: Get rid of the multiple connections
option
  staging: vchi: Get rid of unnecessary defines
  staging: vc04_services: Get rid of vchi_cfg.h
  staging: vchi: Get rid of flags argument in vchi_msg_hold()
  staging: vchi: Use enum vchiq_bulk_mode instead of vchi's transmission
flags
  staging: vchi: Use vchiq's enum vchiq_reason
  staging: vchi: Get rid of effect less expression
  staging: vchiq: Introduce vchiq_validate_params()
  staging: vchiq: Move message queue into struct vchiq_service
  staging: vchiq: Get rid of vchiq_util.h
  staging: vchi: Expose struct vchi_service
  staging: vchiq: Export vchiq_get_service_userdata()
  staging: vchiq: Export vchiq_msg_queue_push
  staging: vchi: Get rid of vchiq_shim's message callback
  staging: vchiq: Don't use a typedef for vchiq_callback
  staging: vchi: Use struct vchiq_service_params
  staging: vchi: Get rid of struct vchi_service
  staging: vchiq: Pass vchiq's message when holding a message
  staging: vchi: Rework vchi_msg_hold() to match vchiq_msg_hold()
  staging: vchiq: Unify fourcc definition mechanisms
  staging: vchi: Get rid of struct vchiq_instance forward declaration
  staging: vchi: Don't include vchiq_core.h
  staging: vchiq: Get rid of unnecessary definitions in vchiq_if.h
  staging: vchiq: Make vchiq_add_service() local
  staging: vchiq: Move definitions only used by core into core header
  staging: vchi: Get rid of vchi_bulk_queue_receive()
  staging: vchi: Get rid of vchi_bulk_queue_transmit()
  staging: vchi: Move vchi_queue_kernel_message() into vchiq
  staging: vchiq: Get rid of vchi
  staging: vchiq: Move conditional barrier definition into vchiq_core.h
  staging: vchiq: Use vchiq.h as the main header file for services
  staging: vchiq: Move defines into core header
  staging: vchiq: Move vchiq.h into include directory

 drivers/staging/vc04_services/Makefile|   4 +-
 .../vc04_services/bcm2835-audio/Makefile  |   2 +-
 .../bcm2835-audio/bcm2835-vchiq.c | 100 ++-
 .../vc04_services/bcm2835-audio/bcm2835.h |   4 +-
 .../bcm2835-audio/vc_vchi_audioserv_defs.h|   5 +-
 .../linux/raspberrypi/vchiq.h}|  71 +-
 .../vc04_services/interface/{vchi => }/TODO   |   0
 .../vc04_services/interface/vchi/vchi.h   | 240 --
 .../vc04_services/interface/vchi/vchi_cfg.h   | 238 --
 .../interface/vchi/vchi_common.h 

[RFC 02/50] staging: vchi: Get rid of vchi_queue_user_message()

2020-05-27 Thread Nicolas Saenz Julienne
The function has no users.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchi/vchi.h   |  6 
 .../interface/vchiq_arm/vchiq_shim.c  | 34 ---
 2 files changed, 40 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 686cfc536012..62d9d3efa755 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -111,12 +111,6 @@ vchi_queue_kernel_message(struct vchi_service_handle 
*handle,
  void *data,
  unsigned int size);
 
-/* Routine to send a message from user memory across a service */
-extern int
-vchi_queue_user_message(struct vchi_service_handle *handle,
-   void __user *data,
-   unsigned int size);
-
 // Routine to receive a msg from a service
 // Dequeue is equivalent to hold, copy into client buffer, release
 extern int32_t vchi_msg_dequeue(struct vchi_service_handle *handle,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 9a040651bb9b..2c2bd7a9dc27 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -150,40 +150,6 @@ vchi_queue_kernel_message(struct vchi_service_handle 
*handle,
 }
 EXPORT_SYMBOL(vchi_queue_kernel_message);
 
-struct vchi_queue_user_message_context {
-   void __user *data;
-};
-
-static ssize_t
-vchi_queue_user_message_callback(void *context,
-void *dest,
-size_t offset,
-size_t maxsize)
-{
-   struct vchi_queue_user_message_context *copycontext = context;
-
-   if (copy_from_user(dest, copycontext->data + offset, maxsize))
-   return -EFAULT;
-
-   return maxsize;
-}
-
-int
-vchi_queue_user_message(struct vchi_service_handle *handle,
-   void __user *data,
-   unsigned int size)
-{
-   struct vchi_queue_user_message_context copycontext = {
-   .data = data
-   };
-
-   return vchi_msg_queue(handle,
- vchi_queue_user_message_callback,
- ©context,
- size);
-}
-EXPORT_SYMBOL(vchi_queue_user_message);
-
 /***
  * Name: vchi_bulk_queue_receive
  *
-- 
2.26.2

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


[RFC 01/50] staging: vchi: Get rid of vchi_service_destroy()

2020-05-27 Thread Nicolas Saenz Julienne
The function has no users.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchi/vchi.h   |  3 ---
 .../interface/vchiq_arm/vchiq_shim.c  | 19 ---
 2 files changed, 22 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index ff2b960d8cac..686cfc536012 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -83,9 +83,6 @@ extern uint32_t vchi_current_time(struct vchi_instance_handle 
*instance_handle);
 /**
  * Global service API
  */
-// Routine to destroy a service
-extern int32_t vchi_service_destroy(const struct vchi_service_handle *handle);
-
 // Routine to open a named service
 extern int32_t vchi_service_open(struct vchi_instance_handle *instance_handle,
 struct service_creation *setup,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index efdd3b1c7d85..9a040651bb9b 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -642,25 +642,6 @@ int32_t vchi_service_close(const struct 
vchi_service_handle *handle)
 }
 EXPORT_SYMBOL(vchi_service_close);
 
-int32_t vchi_service_destroy(const struct vchi_service_handle *handle)
-{
-   int32_t ret = -1;
-   struct shim_service *service = (struct shim_service *)handle;
-
-   if (service) {
-   enum vchiq_status status = 
vchiq_remove_service(service->handle);
-
-   if (status == VCHIQ_SUCCESS) {
-   service_free(service);
-   service = NULL;
-   }
-
-   ret = vchiq_status_to_vchi(status);
-   }
-   return ret;
-}
-EXPORT_SYMBOL(vchi_service_destroy);
-
 int32_t vchi_service_set_option(const struct vchi_service_handle *handle,
enum vchi_service_option option,
int value)
-- 
2.26.2

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


[RFC 06/50] staging: vchi: Get rid of vchiq_status_to_vchi()

2020-05-27 Thread Nicolas Saenz Julienne
vchiq functions return an enum and vchi's ints. Those are compatible, no
need to explicitly cast them.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../interface/vchiq_arm/vchiq_shim.c  | 25 ---
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 429b0c71e455..0fc5fa05c6c2 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -9,8 +9,6 @@
 
 #include "vchiq_util.h"
 
-#define vchiq_status_to_vchi(status) ((int32_t)status)
-
 struct shim_service {
unsigned int handle;
 
@@ -105,7 +103,7 @@ int vchi_queue_kernel_message(struct vchi_service_handle 
*handle, void *data,
msleep(1);
}
 
-   return vchiq_status_to_vchi(status);
+   return status;
 }
 EXPORT_SYMBOL(vchi_queue_kernel_message);
 
@@ -146,7 +144,7 @@ int32_t vchi_bulk_queue_receive(struct vchi_service_handle 
*handle, void *data_d
break;
default:
WARN(1, "unsupported message\n");
-   return vchiq_status_to_vchi(VCHIQ_ERROR);
+   return VCHIQ_ERROR;
}
 
while (1) {
@@ -163,7 +161,7 @@ int32_t vchi_bulk_queue_receive(struct vchi_service_handle 
*handle, void *data_d
msleep(1);
}
 
-   return vchiq_status_to_vchi(status);
+   return status;
 }
 EXPORT_SYMBOL(vchi_bulk_queue_receive);
 
@@ -207,7 +205,7 @@ int32_t vchi_bulk_queue_transmit(struct vchi_service_handle 
*handle,
break;
default:
WARN(1, "unsupported message\n");
-   return vchiq_status_to_vchi(VCHIQ_ERROR);
+   return VCHIQ_ERROR;
}
 
while (1) {
@@ -225,7 +223,7 @@ int32_t vchi_bulk_queue_transmit(struct vchi_service_handle 
*handle,
msleep(1);
}
 
-   return vchiq_status_to_vchi(status);
+   return status;
 }
 EXPORT_SYMBOL(vchi_bulk_queue_transmit);
 
@@ -372,7 +370,7 @@ int32_t vchi_initialise(struct vchi_instance_handle 
**instance_handle)
 
*instance_handle = (struct vchi_instance_handle *)instance;
 
-   return vchiq_status_to_vchi(status);
+   return status;
 }
 EXPORT_SYMBOL(vchi_initialise);
 
@@ -410,7 +408,7 @@ int32_t vchi_disconnect(struct vchi_instance_handle 
*instance_handle)
 {
struct vchiq_instance *instance = (struct vchiq_instance 
*)instance_handle;
 
-   return vchiq_status_to_vchi(vchiq_shutdown(instance));
+   return vchiq_shutdown(instance);
 }
 EXPORT_SYMBOL(vchi_disconnect);
 
@@ -561,7 +559,7 @@ int32_t vchi_service_close(const struct vchi_service_handle 
*handle)
if (status == VCHIQ_SUCCESS)
service_free(service);
 
-   ret = vchiq_status_to_vchi(status);
+   ret = status;
}
return ret;
 }
@@ -576,7 +574,7 @@ int32_t vchi_get_peer_version(const struct 
vchi_service_handle *handle, short *p
enum vchiq_status status;
 
status = vchiq_get_peer_version(service->handle, peer_version);
-   ret = vchiq_status_to_vchi(status);
+   ret = status;
}
return ret;
 }
@@ -598,7 +596,7 @@ int32_t vchi_service_use(const struct vchi_service_handle 
*handle)
 
struct shim_service *service = (struct shim_service *)handle;
if (service)
-   ret = vchiq_status_to_vchi(vchiq_use_service(service->handle));
+   ret = vchiq_use_service(service->handle);
return ret;
 }
 EXPORT_SYMBOL(vchi_service_use);
@@ -619,8 +617,7 @@ int32_t vchi_service_release(const struct 
vchi_service_handle *handle)
 
struct shim_service *service = (struct shim_service *)handle;
if (service)
-   ret = vchiq_status_to_vchi(
-   vchiq_release_service(service->handle));
+   ret = vchiq_release_service(service->handle);
return ret;
 }
 EXPORT_SYMBOL(vchi_service_release);
-- 
2.26.2

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


[RFC 05/50] staging: vchi: Get rid of vchi_service_set_option()

2020-05-27 Thread Nicolas Saenz Julienne
There are no users for that function.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchi/vchi.h   |  5 ---
 .../interface/vchiq_arm/vchiq_shim.c  | 31 ---
 2 files changed, 36 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 62d9d3efa755..1e8d17531e9d 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -100,11 +100,6 @@ extern int32_t vchi_service_use(const struct 
vchi_service_handle *handle);
 // Routine to decrement ref count on a named service
 extern int32_t vchi_service_release(const struct vchi_service_handle *handle);
 
-// Routine to set a control option for a named service
-extern int32_t vchi_service_set_option(const struct vchi_service_handle 
*handle,
-  enum vchi_service_option option,
-  int value);
-
 /* Routine to send a message from kernel memory across a service */
 extern int
 vchi_queue_kernel_message(struct vchi_service_handle *handle,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 081ab67ad6fd..429b0c71e455 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -567,37 +567,6 @@ int32_t vchi_service_close(const struct 
vchi_service_handle *handle)
 }
 EXPORT_SYMBOL(vchi_service_close);
 
-int32_t vchi_service_set_option(const struct vchi_service_handle *handle,
-   enum vchi_service_option option,
-   int value)
-{
-   int32_t ret = -1;
-   struct shim_service *service = (struct shim_service *)handle;
-   enum vchiq_service_option vchiq_option;
-
-   switch (option) {
-   case VCHI_SERVICE_OPTION_TRACE:
-   vchiq_option = VCHIQ_SERVICE_OPTION_TRACE;
-   break;
-   case VCHI_SERVICE_OPTION_SYNCHRONOUS:
-   vchiq_option = VCHIQ_SERVICE_OPTION_SYNCHRONOUS;
-   break;
-   default:
-   service = NULL;
-   break;
-   }
-   if (service) {
-   enum vchiq_status status =
-   vchiq_set_service_option(service->handle,
-   vchiq_option,
-   value);
-
-   ret = vchiq_status_to_vchi(status);
-   }
-   return ret;
-}
-EXPORT_SYMBOL(vchi_service_set_option);
-
 int32_t vchi_get_peer_version(const struct vchi_service_handle *handle, short 
*peer_version)
 {
int32_t ret = -1;
-- 
2.26.2

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


[RFC 12/50] staging: vchi: Get rid of vchi_msg_peek()

2020-05-27 Thread Nicolas Saenz Julienne
There already is a function that covers most of the functionality
vchi_msg_peek() provides: vchi_msg_hold(). The main difference being
that the later removes the message from vchu's queue while the other
does it later on, while releasing the message.

There are no users of this function that can't be trivially converted to
vchi_msg_hold(). So, for the sake of removing duplicate code, get rid of
vchi_msg_peek().

Note that the opposite change could be performed as well. But
vchi_msg_peek()'s implementation was deemed less robust as messages have
to be released in order.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchi/vchi.h   | 12 
 .../interface/vchiq_arm/vchiq_shim.c  | 64 ---
 .../interface/vchiq_arm/vchiq_util.c  | 12 
 .../interface/vchiq_arm/vchiq_util.h  |  1 -
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  |  7 +-
 5 files changed, 4 insertions(+), 92 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 1a981e98e82b..1daef5ad70f1 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -103,18 +103,6 @@ extern int32_t vchi_msg_dequeue(struct vchi_service_handle 
*handle,
uint32_t *actual_msg_size,
enum vchi_flags flags);
 
-// Routine to look at a message in place.
-// The message is not dequeued, so a subsequent call to peek or dequeue
-// will return the same message.
-extern int32_t vchi_msg_peek(struct vchi_service_handle *handle,
-void **data,
-uint32_t *msg_size,
-enum vchi_flags flags);
-
-// Routine to remove a message after it has been read in place with peek
-// The first message on the queue is dequeued.
-extern int32_t vchi_msg_remove(struct vchi_service_handle *handle);
-
 // Routine to look at a message in place.
 // The message is dequeued, so the caller is left holding it; the descriptor is
 // filled in and must be released when the user has finished with the message.
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 75d87b6992c4..54c2492b7c83 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -18,70 +18,6 @@ struct shim_service {
void *callback_param;
 };
 
-/***
- * Name: vchi_msg_peek
- *
- * Arguments:  struct vchi_service_handle *handle,
- * void **data,
- * uint32_t *msg_size,
-
- * enum vchi_flags flags
- *
- * Description: Routine to return a pointer to the current message (to allow in
- *  place processing). The message can be removed using
- *  vchi_msg_remove when you're finished
- *
- * Returns: int32_t - success == 0
- *
- ***/
-int32_t vchi_msg_peek(struct vchi_service_handle *handle,
- void **data,
- uint32_t *msg_size,
- enum vchi_flags flags)
-{
-   struct shim_service *service = (struct shim_service *)handle;
-   struct vchiq_header *header;
-
-   WARN_ON((flags != VCHI_FLAGS_NONE) &&
-   (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE));
-
-   if (flags == VCHI_FLAGS_NONE)
-   if (vchiu_queue_is_empty(&service->queue))
-   return -1;
-
-   header = vchiu_queue_peek(&service->queue);
-
-   *data = header->data;
-   *msg_size = header->size;
-
-   return 0;
-}
-EXPORT_SYMBOL(vchi_msg_peek);
-
-/***
- * Name: vchi_msg_remove
- *
- * Arguments:  struct vchi_service_handle *handle,
- *
- * Description: Routine to remove a message (after it has been read with
- *  vchi_msg_peek)
- *
- * Returns: int32_t - success == 0
- *
- ***/
-int32_t vchi_msg_remove(struct vchi_service_handle *handle)
-{
-   struct shim_service *service = (struct shim_service *)handle;
-   struct vchiq_header *header;
-
-   header = vchiu_queue_pop(&service->queue);
-
-   vchiq_release_message(service->handle, header);
-
-   return 0;
-}
-EXPORT_SYMBOL(vchi_msg_remove);
-
 int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data,
   unsigned int size)
 {
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c
index 644844d88fed..c1c81f9ab9e6 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c
+++ b/drivers/staging/vc04_service

[RFC 16/50] staging: vchi: Get rid of vchi_msg_dequeue()

2020-05-27 Thread Nicolas Saenz Julienne
Nobody uses it. Get rid of it.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchi/vchi.h   |  7 
 .../interface/vchiq_arm/vchiq_shim.c  | 39 ---
 2 files changed, 46 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index ff302e6b8b1b..a369feb3a448 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -93,13 +93,6 @@ extern int32_t vchi_service_release(struct vchi_service 
*service);
 extern int vchi_queue_kernel_message(struct vchi_service *service, void *data,
 unsigned int size);
 
-// Routine to receive a msg from a service
-// Dequeue is equivalent to hold, copy into client buffer, release
-extern int32_t vchi_msg_dequeue(struct vchi_service *service, void *data,
-   uint32_t max_data_size_to_read,
-   uint32_t *actual_msg_size,
-   enum vchi_flags flags);
-
 // Routine to look at a message in place.
 // The message is dequeued, so the caller is left holding it; the descriptor is
 // filled in and must be released when the user has finished with the message.
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 99eb7a5ccce6..0c3473861a8d 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -160,45 +160,6 @@ int32_t vchi_bulk_queue_transmit(struct vchi_service 
*service,
 }
 EXPORT_SYMBOL(vchi_bulk_queue_transmit);
 
-/***
- * Name: vchi_msg_dequeue
- *
- * Arguments:  struct vchi_service *service,
- * void *data,
- * uint32_t max_data_size_to_read,
- * uint32_t *actual_msg_size
- * enum vchi_flags flags
- *
- * Description: Routine to dequeue a message into the supplied buffer
- *
- * Returns: int32_t - success == 0
- *
- ***/
-int32_t vchi_msg_dequeue(struct vchi_service *service, void *data,
-uint32_t max_data_size_to_read,
-uint32_t *actual_msg_size, enum vchi_flags flags)
-{
-   struct vchiq_header *header;
-
-   WARN_ON((flags != VCHI_FLAGS_NONE) &&
-   (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE));
-
-   if (flags == VCHI_FLAGS_NONE)
-   if (vchiu_queue_is_empty(&service->queue))
-   return -1;
-
-   header = vchiu_queue_pop(&service->queue);
-
-   memcpy(data, header->data, header->size < max_data_size_to_read ?
-   header->size : max_data_size_to_read);
-
-   *actual_msg_size = header->size;
-
-   vchiq_release_message(service->handle, header);
-
-   return 0;
-}
-EXPORT_SYMBOL(vchi_msg_dequeue);
 
 /***
  * Name: vchi_held_msg_release
-- 
2.26.2

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


[RFC 10/50] staging: vchiq: Get rid of VCHIQ_SERVICE_OPENEND callback reason

2020-05-27 Thread Nicolas Saenz Julienne
Nobody uses it and it's routinely discarded in vchi.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchiq_arm/vchiq_core.c   | 9 -
 .../vc04_services/interface/vchiq_arm/vchiq_shim.c   | 4 
 2 files changed, 13 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index ef31e541c902..ae9183db44ee 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -1484,15 +1484,6 @@ parse_open(struct vchiq_state *state, struct 
vchiq_header *header)
: VCHIQ_SRVSTATE_OPEN);
}
 
-   service->remoteport = remoteport;
-   service->client_id = ((int *)header->data)[1];
-   if (make_service_callback(service, VCHIQ_SERVICE_OPENED,
-   NULL, NULL) == VCHIQ_RETRY) {
-   /* Bail out if not ready */
-   service->remoteport = VCHIQ_PORT_FREE;
-   goto bail_not_ready;
-   }
-
/* Success - the message has been dealt with */
unlock_service(service);
return 1;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 55f9e34ea50e..75d87b6992c4 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -461,10 +461,6 @@ static enum vchiq_status shim_callback(enum vchiq_reason 
reason,
  VCHI_CALLBACK_SERVICE_CLOSED, NULL);
break;
 
-   case VCHIQ_SERVICE_OPENED:
-   /* No equivalent VCHI reason */
-   break;
-
case VCHIQ_BULK_TRANSMIT_ABORTED:
service->callback(service->callback_param,
  VCHI_CALLBACK_BULK_TRANSMIT_ABORTED,
-- 
2.26.2

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


[RFC 08/50] staging: vchi: Get rid of C++ guards

2020-05-27 Thread Nicolas Saenz Julienne
This is an include only used by the Linux kernel, so no need to worry
about C++ compatibility.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/interface/vchi/vchi.h | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 2e41b5f7bdec..1a981e98e82b 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -60,10 +60,6 @@ struct vchi_service_handle;
  * (local / remote)
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 // Routine used to initialise the vchi on both local + remote connections
 extern int32_t vchi_initialise(struct vchi_instance_handle **instance_handle);
 
@@ -158,10 +154,6 @@ extern int32_t vchi_bulk_queue_transmit(struct 
vchi_service_handle *handle,
  * Configuration plumbing
  */
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* VCHI_H_ */
 
 /** End of file **/
-- 
2.26.2

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


[RFC 15/50] staging: vc04_services: bcm2835-audio: Use vchi_msg_hold()

2020-05-27 Thread Nicolas Saenz Julienne
vchi_msg_dequeue() provides the same functionality as vchi_msg_hold()
except it copies the message data as opposed to the later which provides
the data in place.

The copying is done on a local variable, so there is no need to keep the
message out the function's bounds, so use vchi_msg_hold() instead.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../bcm2835-audio/bcm2835-vchiq.c | 25 +++
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 62eef233275f..5018b5baa009 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -94,31 +94,34 @@ static void audio_vchi_callback(void *param,
void *msg_handle)
 {
struct bcm2835_audio_instance *instance = param;
-   struct vc_audio_msg m;
-   int msg_len;
+   struct vchi_held_msg handle;
+   struct vc_audio_msg *m;
+   unsigned size;
int status;
 
if (reason != VCHI_CALLBACK_MSG_AVAILABLE)
return;
 
-   status = vchi_msg_dequeue(instance->service,
- &m, sizeof(m), &msg_len, VCHI_FLAGS_NONE);
+   status = vchi_msg_hold(instance->service, (void **)&m, &size,
+  VCHI_FLAGS_NONE, &handle);
if (status)
return;
 
-   if (m.type == VC_AUDIO_MSG_TYPE_RESULT) {
-   instance->result = m.result.success;
+   if (m->type == VC_AUDIO_MSG_TYPE_RESULT) {
+   instance->result = m->result.success;
complete(&instance->msg_avail_comp);
-   } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) {
-   if (m.complete.cookie1 != VC_AUDIO_WRITE_COOKIE1 ||
-   m.complete.cookie2 != VC_AUDIO_WRITE_COOKIE2)
+   } else if (m->type == VC_AUDIO_MSG_TYPE_COMPLETE) {
+   if (m->complete.cookie1 != VC_AUDIO_WRITE_COOKIE1 ||
+   m->complete.cookie2 != VC_AUDIO_WRITE_COOKIE2)
dev_err(instance->dev, "invalid cookie\n");
else
bcm2835_playback_fifo(instance->alsa_stream,
- m.complete.count);
+ m->complete.count);
} else {
-   dev_err(instance->dev, "unexpected callback type=%d\n", m.type);
+   dev_err(instance->dev, "unexpected callback type=%d\n", 
m->type);
}
+
+   vchi_held_msg_release(&handle);
 }
 
 static int
-- 
2.26.2

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


[RFC 31/50] staging: vchi: Get rid of vchiq_shim's message callback

2020-05-27 Thread Nicolas Saenz Julienne
As vchiq_shim's callback does nothing aside from pushing messages into
the service's queue, let's bypass it and jump directly to the service's
callbacks, letting them choose whether to use the message queue.

It turns out most services don't need to use the message queue, which
makes for simpler code in the end.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../bcm2835-audio/bcm2835-vchiq.c | 20 ++---
 .../vc04_services/interface/vchi/vchi.h   |  9 +-
 .../interface/vchi/vchi_common.h  | 12 ---
 .../interface/vchiq_arm/vchiq_shim.c  | 42 ++
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  | 17 ++--
 .../vc04_services/vchiq-mmal/mmal-vchiq.c | 83 +--
 6 files changed, 69 insertions(+), 114 deletions(-)
 delete mode 100644 drivers/staging/vc04_services/interface/vchi/vchi_common.h

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 0f97eda4ec90..71750ef891dd 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -89,22 +89,17 @@ static int bcm2835_audio_send_simple(struct 
bcm2835_audio_instance *instance,
return bcm2835_audio_send_msg(instance, &m, wait);
 }
 
-static void audio_vchi_callback(void *param, const enum vchiq_reason reason,
-   void *msg_handle)
+static enum vchiq_status audio_vchi_callback(enum vchiq_reason reason,
+struct vchiq_header *header,
+unsigned handle, void *userdata)
 {
-   struct bcm2835_audio_instance *instance = param;
-   struct vchi_held_msg handle;
+   struct bcm2835_audio_instance *instance = 
vchiq_get_service_userdata(handle);
struct vc_audio_msg *m;
-   unsigned size;
-   int status;
 
if (reason != VCHIQ_MESSAGE_AVAILABLE)
-   return;
-
-   status = vchi_msg_hold(instance->service, (void **)&m, &size, &handle);
-   if (status)
-   return;
+   return VCHIQ_SUCCESS;
 
+   m = (void *)header->data;
if (m->type == VC_AUDIO_MSG_TYPE_RESULT) {
instance->result = m->result.success;
complete(&instance->msg_avail_comp);
@@ -119,7 +114,8 @@ static void audio_vchi_callback(void *param, const enum 
vchiq_reason reason,
dev_err(instance->dev, "unexpected callback type=%d\n", 
m->type);
}
 
-   vchi_held_msg_release(&handle);
+   vchiq_release_message(handle, header);
+   return VCHIQ_SUCCESS;
 }
 
 static int
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 789acb7999d1..fdc243f3f60a 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -4,8 +4,6 @@
 #ifndef VCHI_H_
 #define VCHI_H_
 
-#include "vchi_common.h"
-
 /**
  * Global defs
  */
@@ -31,16 +29,13 @@ struct vchi_held_msg {
 
 struct vchi_service {
unsigned int handle;
-
-   vchi_callback callback;
-   void *callback_param;
 };
 
 // structure used to provide the information needed to open a server or a 
client
 struct service_creation {
struct vchi_version version;
int32_t service_id;
-   vchi_callback callback;
+   vchiq_callback callback;
void *callback_param;
 };
 
@@ -88,7 +83,7 @@ extern int vchi_queue_kernel_message(struct vchi_service 
*service, void *data,
 // Routine to look at a message in place.
 // The message is dequeued, so the caller is left holding it; the descriptor is
 // filled in and must be released when the user has finished with the message.
-extern int32_t vchi_msg_hold(struct vchi_service *service,
+extern int32_t vchi_msg_hold(unsigned handle,
 void **data,// } may be NULL, as info can 
be
 uint32_t *msg_size, // } obtained from HELD_MSG_T
 struct vchi_held_msg *message_descriptor);
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h 
b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
deleted file mode 100644
index 24e8665e214a..
--- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
-/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
-
-#ifndef VCHI_COMMON_H_
-#define VCHI_COMMON_H_
-
-//Callback used by all services / bulk transfers
-typedef void (*vchi_callback)(void *callback_param, //my service local param
- enum vchiq_reason reason,
- void *handle); 

[RFC 26/50] staging: vchiq: Move message queue into struct vchiq_service

2020-05-27 Thread Nicolas Saenz Julienne
This has historically been handled by vchi, but there is no reason why
this couldn't be handled directly in vchiq.

The patch tries to avoid altering any behavior, with the exception of
the msg_queue size, which is now fixed to VCHIQ_MAX_SLOTS (it was set to
VCHIQ_MAX_SLOTS / 2). This is done to match vchiq's user_service message
queue, which could be merged with this one in the future.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/Makefile|  1 -
 .../interface/vchiq_arm/vchiq_core.c  | 46 
 .../interface/vchiq_arm/vchiq_core.h  |  6 ++
 .../interface/vchiq_arm/vchiq_if.h|  2 +
 .../interface/vchiq_arm/vchiq_shim.c  | 24 ++
 .../interface/vchiq_arm/vchiq_util.c  | 73 ---
 .../interface/vchiq_arm/vchiq_util.h  | 22 --
 7 files changed, 61 insertions(+), 113 deletions(-)
 delete mode 100644 
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c

diff --git a/drivers/staging/vc04_services/Makefile 
b/drivers/staging/vc04_services/Makefile
index 5fc3b65224a3..6a426572793b 100644
--- a/drivers/staging/vc04_services/Makefile
+++ b/drivers/staging/vc04_services/Makefile
@@ -7,7 +7,6 @@ vchiq-objs := \
interface/vchiq_arm/vchiq_2835_arm.o \
interface/vchiq_arm/vchiq_debugfs.o \
interface/vchiq_arm/vchiq_shim.o \
-   interface/vchiq_arm/vchiq_util.o \
interface/vchiq_arm/vchiq_connected.o \
 
 obj-$(CONFIG_SND_BCM2835)  += bcm2835-audio/
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 46b09b7154f8..0e9680904e68 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -2265,6 +2265,47 @@ vchiq_init_state(struct vchiq_state *state, struct 
vchiq_slot_zero *slot_zero)
return VCHIQ_ERROR;
 }
 
+void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header)
+{
+   struct vchiq_service *service = find_service_by_handle(handle);
+   int pos;
+
+   while (service->msg_queue_write == service->msg_queue_read +
+   VCHIQ_MAX_SLOTS) {
+   if (wait_for_completion_interruptible(&service->msg_queue_pop))
+   flush_signals(current);
+   }
+
+   pos = service->msg_queue_write++ & (VCHIQ_MAX_SLOTS - 1);
+   service->msg_queue[pos] = header;
+
+   complete(&service->msg_queue_push);
+}
+EXPORT_SYMBOL(vchiq_msg_queue_push);
+
+struct vchiq_header *vchiq_msg_hold(unsigned handle)
+{
+   struct vchiq_service *service = find_service_by_handle(handle);
+   struct vchiq_header *header;
+   int pos;
+
+   if (service->msg_queue_write == service->msg_queue_read)
+   return NULL;
+
+   while (service->msg_queue_write == service->msg_queue_read) {
+   if (wait_for_completion_interruptible(&service->msg_queue_push))
+   flush_signals(current);
+   }
+
+   pos = service->msg_queue_read++ & (VCHIQ_MAX_SLOTS - 1);
+   header = service->msg_queue[pos];
+
+   complete(&service->msg_queue_pop);
+
+   return header;
+}
+EXPORT_SYMBOL(vchiq_msg_hold);
+
 static int vchiq_validate_params(const struct vchiq_service_params *params)
 {
if (!params->callback || !params->fourcc) {
@@ -2319,12 +2360,17 @@ vchiq_add_service_internal(struct vchiq_state *state,
service->state = state;
service->instance  = instance;
service->service_use_count = 0;
+   service->msg_queue_read = 0;
+   service->msg_queue_write = 0;
init_bulk_queue(&service->bulk_tx);
init_bulk_queue(&service->bulk_rx);
init_completion(&service->remove_event);
init_completion(&service->bulk_remove_event);
+   init_completion(&service->msg_queue_pop);
+   init_completion(&service->msg_queue_push);
mutex_init(&service->bulk_mutex);
memset(&service->stats, 0, sizeof(service->stats));
+   memset(&service->msg_queue, 0, sizeof(service->msg_queue));
 
/* Although it is perfectly possible to use a spinlock
** to protect the creation of services, it is overkill as it
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 1fe6cd8b86c0..b97b661bea1c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -297,6 +297,12 @@ struct vchiq_service {
uint64_t bulk_tx_bytes;
uint64_t bulk_rx_bytes;
} stats;
+
+   int msg_queue_read;
+   int msg_queue_write;
+   struct completion msg_queue_pop;
+   struct completion msg_queue_push;
+   struct vchiq_header *msg_queue[VCHIQ_MAX_SLOTS];
 };
 
 /* The quota information is outside struct vc

[RFC 17/50] staging: vchi_common: Get rid of all unused definitions

2020-05-27 Thread Nicolas Saenz Julienne
There is a series of structures and enums defined but never used. Get
rid of them.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../interface/vchi/vchi_common.h  | 65 ---
 1 file changed, 65 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h 
b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
index 0f79bea4757d..e07376fe4dfd 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
@@ -10,23 +10,7 @@ enum vchi_flags {
VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE   = 0x1,   // waits for message to 
be received, or sent (NB. not the same as being seen on other side)
VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2,   // run a callback when 
message sent
VCHI_FLAGS_BLOCK_UNTIL_QUEUED= 0x4,   // return once the 
transfer is in a queue ready to go
-   VCHI_FLAGS_ALLOW_PARTIAL = 0x8,
VCHI_FLAGS_BLOCK_UNTIL_DATA_READ = 0x10,
-   VCHI_FLAGS_CALLBACK_WHEN_DATA_READ   = 0x20,
-
-   VCHI_FLAGS_ALIGN_SLOT= 0x80,  // internal use only
-   VCHI_FLAGS_BULK_AUX_QUEUED   = 0x01,  // internal use only
-   VCHI_FLAGS_BULK_AUX_COMPLETE = 0x02,  // internal use only
-   VCHI_FLAGS_BULK_DATA_QUEUED  = 0x04,  // internal use only
-   VCHI_FLAGS_BULK_DATA_COMPLETE= 0x08,  // internal use only
-   VCHI_FLAGS_INTERNAL  = 0xFF
-};
-
-// constants for vchi_crc_control()
-enum vchi_crc_control {
-   VCHI_CRC_NOTHING = -1,
-   VCHI_CRC_PER_SERVICE = 0,
-   VCHI_CRC_EVERYTHING = 1,
 };
 
 //callback reasons when an event occurs on a service
@@ -47,58 +31,9 @@ enum vchi_callback_reason {
VCHI_CALLBACK_BULK_RECEIVE_ABORTED,
 };
 
-// service control options
-enum vchi_service_option {
-   VCHI_SERVICE_OPTION_MIN,
-
-   VCHI_SERVICE_OPTION_TRACE,
-   VCHI_SERVICE_OPTION_SYNCHRONOUS,
-
-   VCHI_SERVICE_OPTION_MAX
-};
-
 //Callback used by all services / bulk transfers
 typedef void (*vchi_callback)(void *callback_param, //my service local param
  enum vchi_callback_reason reason,
  void *handle); //for transmitting msg's only
 
-/*
- * Define vector struct for scatter-gather (vector) operations
- * Vectors can be nested - if a vector element has negative length, then
- * the data pointer is treated as pointing to another vector array, with
- * '-vec_len' elements. Thus to append a header onto an existing vector,
- * you can do this:
- *
- * void foo(const struct vchi_msg_vector *v, int n)
- * {
- *struct vchi_msg_vector nv[2];
- *nv[0].vec_base = my_header;
- *nv[0].vec_len = sizeof my_header;
- *nv[1].vec_base = v;
- *nv[1].vec_len = -n;
- *...
- *
- */
-struct vchi_msg_vector {
-   const void *vec_base;
-   int32_t vec_len;
-};
-
-/*
- * Iterator structure for reading ahead through received message queue.
- * Allocated by client, initialised by vchi_msg_look_ahead. Fields are for
- * internal VCHI use only.
- * Iterates over messages in queue at the instant of the call to
- * vchi_msg_lookahead - will not proceed to messages received since.
- * Behaviour is undefined if an iterator is used again after messages for that
- * service are removed/dequeued by any means other than vchi_msg_iter_...
- * calls on the iterator itself.
- */
-struct vchi_msg_iter {
-   struct opaque_vchi_service_t *service;
-   void *last;
-   void *next;
-   void *remove;
-};
-
 #endif // VCHI_COMMON_H_
-- 
2.26.2

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


[RFC 13/50] staging: vchi: Get rid of struct vchi_instance_handle

2020-05-27 Thread Nicolas Saenz Julienne
The idea behind this was to create an opaque handle to struct
vchiq_instance. This can be achieved without creating a new type by
means of a forward declaration of struct vchiq_instance.

This saves us from a lot of useless casting and overall simplifies code.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../bcm2835-audio/bcm2835-vchiq.c | 20 ++---
 .../vc04_services/bcm2835-audio/bcm2835.h |  2 +-
 .../vc04_services/interface/vchi/vchi.h   | 12 
 .../interface/vchiq_arm/vchiq_shim.c  | 30 ++-
 .../staging/vc04_services/vc-sm-cma/vc_sm.c   |  8 ++---
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  |  4 +--
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.h  |  2 +-
 .../vc04_services/vchiq-mmal/mmal-vchiq.c |  8 ++---
 8 files changed, 37 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 73144f1ce45e..8c9390153a26 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -122,7 +122,7 @@ static void audio_vchi_callback(void *param,
 }
 
 static int
-vc_vchi_audio_init(struct vchi_instance_handle *vchi_instance,
+vc_vchi_audio_init(struct vchiq_instance *vchiq_instance,
   struct bcm2835_audio_instance *instance)
 {
struct service_creation params = {
@@ -134,7 +134,7 @@ vc_vchi_audio_init(struct vchi_instance_handle 
*vchi_instance,
int status;
 
/* Open the VCHI service connections */
-   status = vchi_service_open(vchi_instance, ¶ms,
+   status = vchi_service_open(vchiq_instance, ¶ms,
   &instance->vchi_handle);
 
if (status) {
@@ -173,20 +173,20 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct 
bcm2835_vchi_ctx *vchi_ctx)
int ret;
 
/* Initialize and create a VCHI connection */
-   ret = vchi_initialise(&vchi_ctx->vchi_instance);
+   ret = vchi_initialise(&vchi_ctx->instance);
if (ret) {
dev_err(dev, "failed to initialise VCHI instance (ret=%d)\n",
ret);
return -EIO;
}
 
-   ret = vchi_connect(vchi_ctx->vchi_instance);
+   ret = vchi_connect(vchi_ctx->instance);
if (ret) {
dev_dbg(dev, "failed to connect VCHI instance (ret=%d)\n",
ret);
 
-   kfree(vchi_ctx->vchi_instance);
-   vchi_ctx->vchi_instance = NULL;
+   kfree(vchi_ctx->instance);
+   vchi_ctx->instance = NULL;
 
return -EIO;
}
@@ -196,10 +196,10 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct 
bcm2835_vchi_ctx *vchi_ctx)
 
 void bcm2835_free_vchi_ctx(struct bcm2835_vchi_ctx *vchi_ctx)
 {
-   /* Close the VCHI connection - it will also free vchi_instance */
-   WARN_ON(vchi_disconnect(vchi_ctx->vchi_instance));
+   /* Close the VCHI connection - it will also free vchi_ctx->instance */
+   WARN_ON(vchi_disconnect(vchi_ctx->instance));
 
-   vchi_ctx->vchi_instance = NULL;
+   vchi_ctx->instance = NULL;
 }
 
 int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream)
@@ -217,7 +217,7 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream 
*alsa_stream)
instance->alsa_stream = alsa_stream;
alsa_stream->instance = instance;
 
-   err = vc_vchi_audio_init(vchi_ctx->vchi_instance,
+   err = vc_vchi_audio_init(vchi_ctx->instance,
 instance);
if (err < 0)
goto free_instance;
diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
index d2fe8d36ab7d..2a94e825194f 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
@@ -44,7 +44,7 @@ enum snd_bcm2835_ctrl {
 };
 
 struct bcm2835_vchi_ctx {
-   struct vchi_instance_handle *vchi_instance;
+   struct vchiq_instance *instance;
 };
 
 /* definition of the chip-specific record */
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 1daef5ad70f1..6b73d8fb394a 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -49,8 +49,8 @@ struct service_creation {
void *callback_param;
 };
 
-// Opaque handle for a VCHI instance
-struct vchi_instance_handle;
+// Opaque handle for a VCHIQ instance
+struct vchiq_instance;
 
 // Opaque handle for a server or client
 struct vchi_service_handle;
@@ -61,19 +61,19 @@ struct vchi_service_handle;
  */
 
 // Routine used to initialise the vchi on both local + remote connections
-extern int32_t vchi_initialise(struct vchi_instan

[RFC 19/50] staging: vchi: Get rid of unnecessary defines

2020-05-27 Thread Nicolas Saenz Julienne
Those defines aren't used by anyone. Get rid of them.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/interface/vchi/vchi.h   | 11 ---
 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c |  1 -
 2 files changed, 12 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index a369feb3a448..bf0c7a496f5a 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -11,21 +11,10 @@
  * Global defs
  */
 
-#define VCHI_BULK_ROUND_UP(x) unsigned long)(x)) + VCHI_BULK_ALIGN - 
1) & ~(VCHI_BULK_ALIGN - 1))
-#define VCHI_BULK_ROUND_DOWN(x)   (((unsigned long)(x)) & ~(VCHI_BULK_ALIGN - 
1))
-#define VCHI_BULK_ALIGN_NBYTES(x) (VCHI_BULK_ALIGNED(x) ? 0 : (VCHI_BULK_ALIGN 
- ((unsigned long)(x) & (VCHI_BULK_ALIGN - 1
-
-#ifdef USE_VCHIQ_ARM
-#define VCHI_BULK_ALIGNED(x)  1
-#else
-#define VCHI_BULK_ALIGNED(x)  (((unsigned long)(x) & (VCHI_BULK_ALIGN - 
1)) == 0)
-#endif
-
 struct vchi_version {
uint32_t version;
uint32_t version_min;
 };
-#define VCHI_VERSION(v_) { v_, v_ }
 #define VCHI_VERSION_EX(v_, m_) { v_, m_ }
 
 // Macros to manipulate 'FOURCC' values
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c 
b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
index a1995d1e5180..5183aff453eb 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
@@ -32,7 +32,6 @@
 
 #include "vc-sm-cma/vc_sm_knl.h"
 
-#define USE_VCHIQ_ARM
 #include "interface/vchi/vchi.h"
 
 /*
-- 
2.26.2

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


[RFC 38/50] staging: vchi: Get rid of struct vchiq_instance forward declaration

2020-05-27 Thread Nicolas Saenz Julienne
It's already forward declared in vchiq_if.h. So no need to insist

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/interface/vchi/vchi.h | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 7108c254a38a..d24e7027c08f 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -4,13 +4,6 @@
 #ifndef VCHI_H_
 #define VCHI_H_
 
-/**
- * Global defs
- */
-
-// Opaque handle for a VCHIQ instance
-struct vchiq_instance;
-
 /**
  * Global funcs - implementation is specific to which side you are on
  * (local / remote)
-- 
2.26.2

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


[RFC 39/50] staging: vchi: Don't include vchiq_core.h

2020-05-27 Thread Nicolas Saenz Julienne
This file is internal to vchiq.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index fc12b76617d1..52654123463d 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -8,7 +8,6 @@
 #include "vchiq_if.h"
 #include "../vchi/vchi.h"
 #include "vchiq.h"
-#include "vchiq_core.h"
 
 int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size)
 {
-- 
2.26.2

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


[RFC 03/50] staging: vchiq: Move copy callback handling into vchiq

2020-05-27 Thread Nicolas Saenz Julienne
All vchi users use the kernel variant of the copy callback. The only
user for the user space variant of the copy callback is in the ioctl
implementation. So move all this copying logic into vchiq, and expose a
new function that explicitly passes kernel messages.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../interface/vchiq_arm/vchiq_core.c  |  6 
 .../interface/vchiq_arm/vchiq_core.h  |  7 
 .../interface/vchiq_arm/vchiq_if.h|  8 ++---
 .../interface/vchiq_arm/vchiq_shim.c  | 34 ---
 4 files changed, 22 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index edcd97373809..67b2090c91db 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -3147,6 +3147,12 @@ vchiq_queue_message(unsigned int handle,
return status;
 }
 
+enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, void 
*context,
+ size_t size)
+{
+   return vchiq_queue_message(handle, memcpy_copy_callback, context, size);
+}
+
 void
 vchiq_release_message(unsigned int handle,
  struct vchiq_header *header)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index cedd8e721aae..1fe6cd8b86c0 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -587,6 +587,13 @@ lock_service(struct vchiq_service *service);
 extern void
 unlock_service(struct vchiq_service *service);
 
+extern enum vchiq_status
+vchiq_queue_message(unsigned int handle,
+   ssize_t (*copy_callback)(void *context, void *dest,
+size_t offset, size_t maxsize),
+   void *context,
+   size_t size);
+
 /* The following functions are called from vchiq_core, and external
 ** implementations must be provided. */
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index 39b77ea19210..b62fd6d6f1ac 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -105,12 +105,8 @@ extern enum vchiq_status vchiq_close_service(unsigned int 
service);
 extern enum vchiq_status vchiq_remove_service(unsigned int service);
 extern enum vchiq_status vchiq_use_service(unsigned int service);
 extern enum vchiq_status vchiq_release_service(unsigned int service);
-extern enum vchiq_status
-vchiq_queue_message(unsigned int handle,
-   ssize_t (*copy_callback)(void *context, void *dest,
-size_t offset, size_t maxsize),
-   void *context,
-   size_t size);
+extern enum vchiq_status vchiq_queue_kernel_message(unsigned int handle,
+   void *context, size_t size);
 extern void   vchiq_release_message(unsigned int service,
struct vchiq_header *header);
 extern enum vchiq_status vchiq_bulk_transmit(unsigned int service,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 2c2bd7a9dc27..1c5ddea8b076 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -99,20 +99,15 @@ EXPORT_SYMBOL(vchi_msg_remove);
  *
  ***/
 static
-int32_t vchi_msg_queue(struct vchi_service_handle *handle,
-   ssize_t (*copy_callback)(void *context, void *dest,
-size_t offset, size_t maxsize),
-   void *context,
-   uint32_t data_size)
+int32_t vchi_msg_queue(struct vchi_service_handle *handle, void *context,
+  uint32_t data_size)
 {
struct shim_service *service = (struct shim_service *)handle;
enum vchiq_status status;
 
while (1) {
-   status = vchiq_queue_message(service->handle,
-copy_callback,
-context,
-data_size);
+   status = vchiq_queue_kernel_message(service->handle, context,
+   data_size);
 
/*
 * vchiq_queue_message() may return VCHIQ_RETRY, so we need to
@@ -128,25 +123,10 @@ int32_t vchi_msg_queue(struct vchi_service_handle *handle,
return vchiq_status_to_vchi(status);
 }
 
-static ssize_t
-vchi_queue_kernel_message_callbac

[RFC 24/50] staging: vchi: Get rid of effect less expression

2020-05-27 Thread Nicolas Saenz Julienne
It was probably there to trick compilers into ignoring unused variables,
which isn't needed in Linux.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 649a65f02578..e09c595d6f9d 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -288,8 +288,6 @@ static struct vchi_service *service_alloc(struct 
vchiq_instance *instance,
 {
struct vchi_service *service = kzalloc(sizeof(struct vchi_service), 
GFP_KERNEL);
 
-   (void)instance;
-
if (service) {
if (!vchiu_queue_init(&service->queue, 64)) {
service->callback = setup->callback;
-- 
2.26.2

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


[RFC 32/50] staging: vchiq: Don't use a typedef for vchiq_callback

2020-05-27 Thread Nicolas Saenz Julienne
Linux coding style says to avoid typdefs.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../staging/vc04_services/interface/vchi/vchi.h|  5 -
 .../vc04_services/interface/vchiq_arm/vchiq_if.h   | 14 --
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index fdc243f3f60a..cb66ea1ffad2 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -35,7 +35,10 @@ struct vchi_service {
 struct service_creation {
struct vchi_version version;
int32_t service_id;
-   vchiq_callback callback;
+   enum vchiq_status (*callback)(enum vchiq_reason reason,
+ struct vchiq_header *header,
+ unsigned int handle,
+ void *bulk_userdata);
void *callback_param;
 };
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index c99caa3add57..b3d4c14536bd 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -60,19 +60,21 @@ struct vchiq_element {
unsigned int size;
 };
 
-typedef enum vchiq_status (*vchiq_callback)(enum vchiq_reason,
-   struct vchiq_header *,
-   unsigned int, void *);
-
 struct vchiq_service_base {
int fourcc;
-   vchiq_callback callback;
+   enum vchiq_status (*callback)(enum vchiq_reason reason,
+ struct vchiq_header *header,
+ unsigned int handle,
+ void *bulk_userdata);
void *userdata;
 };
 
 struct vchiq_service_params {
int fourcc;
-   vchiq_callback callback;
+   enum vchiq_status (*callback)(enum vchiq_reason reason,
+ struct vchiq_header *header,
+ unsigned int handle,
+ void *bulk_userdata);
void *userdata;
short version;   /* Increment for non-trivial changes */
short version_min;   /* Update for incompatible changes */
-- 
2.26.2

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


[RFC 28/50] staging: vchi: Expose struct vchi_service

2020-05-27 Thread Nicolas Saenz Julienne
This will make further changes easier. The struct will ultimately
disappear.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/interface/vchi/vchi.h| 10 +++---
 .../vc04_services/interface/vchiq_arm/vchiq_shim.c |  7 ---
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 9a74ca4e1062..789acb7999d1 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -29,6 +29,13 @@ struct vchi_held_msg {
void *message;
 };
 
+struct vchi_service {
+   unsigned int handle;
+
+   vchi_callback callback;
+   void *callback_param;
+};
+
 // structure used to provide the information needed to open a server or a 
client
 struct service_creation {
struct vchi_version version;
@@ -40,9 +47,6 @@ struct service_creation {
 // Opaque handle for a VCHIQ instance
 struct vchiq_instance;
 
-// Opaque handle for a server or client
-struct vchi_service;
-
 /**
  * Global funcs - implementation is specific to which side you are on
  * (local / remote)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 9728667adbd9..843ee978928f 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -10,13 +10,6 @@
 #include "vchiq.h"
 #include "vchiq_core.h"
 
-struct vchi_service {
-   unsigned int handle;
-
-   vchi_callback callback;
-   void *callback_param;
-};
-
 int vchi_queue_kernel_message(struct vchi_service *service, void *data,
  unsigned int size)
 {
-- 
2.26.2

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


[RFC 22/50] staging: vchi: Use enum vchiq_bulk_mode instead of vchi's transmission flags

2020-05-27 Thread Nicolas Saenz Julienne
vchi has a set of transfer flags which almost map 1:1 to vchiq's own
transfer modes. For the sake of simplicity let's use the later and
delete vchi's.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../bcm2835-audio/bcm2835-vchiq.c |  2 +-
 .../vc04_services/bcm2835-audio/bcm2835.h |  1 +
 .../vc04_services/interface/vchi/vchi.h   |  4 +-
 .../interface/vchi/vchi_common.h  |  9 
 .../interface/vchiq_arm/vchiq_shim.c  | 44 ++-
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  |  1 +
 .../vc04_services/vchiq-mmal/mmal-vchiq.c |  4 +-
 7 files changed, 10 insertions(+), 55 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 68119246f10b..565853ec1e7a 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -348,7 +348,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream 
*alsa_stream,
/* Send the message to the videocore */
status = vchi_bulk_queue_transmit(instance->service,
  src, count,
- 
VCHI_FLAGS_BLOCK_UNTIL_DATA_READ,
+ VCHIQ_BULK_MODE_BLOCKING,
  NULL);
} else {
while (count > 0) {
diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
index 2a94e825194f..7a0e4ab50fc7 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include "interface/vchiq_arm/vchiq_if.h"
 #include "interface/vchi/vchi.h"
 
 #define MAX_SUBSTREAMS   (8)
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 92ce811fc28d..9a74ca4e1062 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -105,14 +105,14 @@ extern int32_t vchi_held_msg_release(struct vchi_held_msg 
*message);
 extern int32_t vchi_bulk_queue_receive(struct vchi_service *service,
   void *data_dst,
   uint32_t data_size,
-  enum vchi_flags flags,
+  enum vchiq_bulk_mode mode,
   void *transfer_handle);
 
 // Routine to queue up data ready for transfer to the other (once they have 
signalled they are ready)
 extern int32_t vchi_bulk_queue_transmit(struct vchi_service *service,
const void *data_src,
uint32_t data_size,
-   enum vchi_flags flags,
+   enum vchiq_bulk_mode mode,
void *transfer_handle);
 
 /**
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h 
b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
index e07376fe4dfd..52b447c19445 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
@@ -4,15 +4,6 @@
 #ifndef VCHI_COMMON_H_
 #define VCHI_COMMON_H_
 
-//flags used when sending messages (must be bitmapped)
-enum vchi_flags {
-   VCHI_FLAGS_NONE  = 0x0,
-   VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE   = 0x1,   // waits for message to 
be received, or sent (NB. not the same as being seen on other side)
-   VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2,   // run a callback when 
message sent
-   VCHI_FLAGS_BLOCK_UNTIL_QUEUED= 0x4,   // return once the 
transfer is in a queue ready to go
-   VCHI_FLAGS_BLOCK_UNTIL_DATA_READ = 0x10,
-};
-
 //callback reasons when an event occurs on a service
 enum vchi_callback_reason {
/*
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 0466512cfe3c..3a5545e0db6b 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -3,6 +3,7 @@
 #include 
 #include 
 
+#include "vchiq_if.h"
 #include "../vchi/vchi.h"
 #include "vchiq.h"
 #include "vchiq_core.h"
@@ -57,30 +58,11 @@ EXPORT_SYMBOL(vchi_queue_kernel_message);
  *
  ***/
 int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst,
-   uint32_t data_size, enum vchi_flags flags,

[RFC 11/50] staging: vchi: Get rid of all useless callback reasons

2020-05-27 Thread Nicolas Saenz Julienne
They are neither produced nor expected, so just delete them.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../interface/vchi/vchi_common.h  | 40 ++-
 1 file changed, 3 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h 
b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
index 7fc04e38936d..0f79bea4757d 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
@@ -31,8 +31,6 @@ enum vchi_crc_control {
 
 //callback reasons when an event occurs on a service
 enum vchi_callback_reason {
-   VCHI_CALLBACK_REASON_MIN,
-
/*
 * This indicates that there is data available handle is the msg id that
 * was transmitted with the data
@@ -41,44 +39,12 @@ enum vchi_callback_reason {
 * Tasks get kicked by the callback, reset their event and try and read
 * from the fifo until it fails
 */
+   VCHI_CALLBACK_SERVICE_CLOSED,
VCHI_CALLBACK_MSG_AVAILABLE,
-   VCHI_CALLBACK_MSG_SENT,
-   VCHI_CALLBACK_MSG_SPACE_AVAILABLE, // XXX not yet implemented
-
-   // This indicates that a transfer from the other side has completed
-   VCHI_CALLBACK_BULK_RECEIVED,
-   //This indicates that data queued up to be sent has now gone
-   //handle is the msg id that was used when sending the data
VCHI_CALLBACK_BULK_SENT,
-   VCHI_CALLBACK_BULK_RX_SPACE_AVAILABLE, // XXX not yet implemented
-   VCHI_CALLBACK_BULK_TX_SPACE_AVAILABLE, // XXX not yet implemented
-
-   VCHI_CALLBACK_SERVICE_CLOSED,
-
-   /*
-* this side has sent XOFF to peer due to lack of data consumption by
-* service (suggests the service may need to take some recovery action
-* if it has been deliberately holding off consuming data)
-*/
-   VCHI_CALLBACK_SENT_XOFF,
-   VCHI_CALLBACK_SENT_XON,
-
-   // indicates that a bulk transfer has finished reading the source buffer
-   VCHI_CALLBACK_BULK_DATA_READ,
-
-   // power notification events (currently host side only)
-   VCHI_CALLBACK_PEER_OFF,
-   VCHI_CALLBACK_PEER_SUSPENDED,
-   VCHI_CALLBACK_PEER_ON,
-   VCHI_CALLBACK_PEER_RESUMED,
-   VCHI_CALLBACK_FORCED_POWER_OFF,
-
-   // some extra notifications provided by vchiq_arm
-   VCHI_CALLBACK_SERVICE_OPENED,
-   VCHI_CALLBACK_BULK_RECEIVE_ABORTED,
+   VCHI_CALLBACK_BULK_RECEIVED,
VCHI_CALLBACK_BULK_TRANSMIT_ABORTED,
-
-   VCHI_CALLBACK_REASON_MAX
+   VCHI_CALLBACK_BULK_RECEIVE_ABORTED,
 };
 
 // service control options
-- 
2.26.2

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


[RFC 20/50] staging: vc04_services: Get rid of vchi_cfg.h

2020-05-27 Thread Nicolas Saenz Julienne
Nothing in it is being used.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchi/vchi.h   |   1 -
 .../vc04_services/interface/vchi/vchi_cfg.h   | 238 --
 2 files changed, 239 deletions(-)
 delete mode 100644 drivers/staging/vc04_services/interface/vchi/vchi_cfg.h

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index bf0c7a496f5a..55e51e5a1fdc 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -4,7 +4,6 @@
 #ifndef VCHI_H_
 #define VCHI_H_
 
-#include "vchi_cfg.h"
 #include "vchi_common.h"
 
 /**
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_cfg.h 
b/drivers/staging/vc04_services/interface/vchi/vchi_cfg.h
deleted file mode 100644
index 138c36151a22..
--- a/drivers/staging/vc04_services/interface/vchi/vchi_cfg.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
-/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
-
-#ifndef VCHI_CFG_H_
-#define VCHI_CFG_H_
-
-/***
- * Defines in this first section are part of the VCHI API and may be examined 
by
- * VCHI services.
- 
**/
-
-/*
- * Required alignment of base addresses for bulk transfer, if unaligned
- * transfers are not enabled
- * Really determined by the message driver, and should be available from
- * a run-time call.
- */
-#ifndef VCHI_BULK_ALIGN
-#   if __VCCOREVER__ >= 0x0400
-#   define VCHI_BULK_ALIGN 32 // Allows for the need to do cache cleans
-#   else
-#   define VCHI_BULK_ALIGN 16
-#   endif
-#endif
-
-/*
- * Required length multiple for bulk transfers, if unaligned transfers are
- * not enabled
- * May be less than or greater than VCHI_BULK_ALIGN
- * Really determined by the message driver, and should be available from
- * a run-time call.
- */
-#ifndef VCHI_BULK_GRANULARITY
-#   if __VCCOREVER__ >= 0x0400
-#   define VCHI_BULK_GRANULARITY 32 // Allows for the need to do cache 
cleans
-#   else
-#   define VCHI_BULK_GRANULARITY 16
-#   endif
-#endif
-
-/* The largest possible message to be queued with vchi_msg_queue. */
-#ifndef VCHI_MAX_MSG_SIZE
-#   if defined VCHI_LOCAL_HOST_PORT
-#   define VCHI_MAX_MSG_SIZE 16384 // makes file transfers 
fast, but should they be using bulk?
-#   else
-#   define VCHI_MAX_MSG_SIZE  4096 // NOTE: THIS MUST BE LARGER THAN 
OR EQUAL TO THE SIZE OF THE KHRONOS MERGE BUFFER!!
-#   endif
-#endif
-
-/**
- * Defines below are system configuration options, and should not be used by
- * VCHI services.
- 
**/
-
-/*
- * How many connections can we support? A localhost implementation uses
- * 2 connections, 1 for host-app, 1 for VMCS, and these are hooked together
- * by a loopback MPHI VCFW  driver.
- */
-#ifndef VCHI_MAX_NUM_CONNECTIONS
-#   define VCHI_MAX_NUM_CONNECTIONS 3
-#endif
-
-/*
- * How many services can we open per connection? Extending this doesn't cost
- * processing time, just a small amount of static memory.
- */
-#ifndef VCHI_MAX_SERVICES_PER_CONNECTION
-#  define VCHI_MAX_SERVICES_PER_CONNECTION 36
-#endif
-
-/* Adjust if using a message driver that supports more logical TX channels */
-#ifndef VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION
-#   define VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION 9 // 1 MPHI + 8 CCP2 
logical channels
-#endif
-
-/* Adjust if using a message driver that supports more logical RX channels */
-#ifndef VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION
-#   define VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION 1 // 1 MPHI
-#endif
-
-/*
- * How many receive slots do we use. This times VCHI_MAX_MSG_SIZE gives the
- * effective receive queue space, less message headers.
- */
-#ifndef VCHI_NUM_READ_SLOTS
-#  if defined(VCHI_LOCAL_HOST_PORT)
-# define VCHI_NUM_READ_SLOTS 4
-#  else
-# define VCHI_NUM_READ_SLOTS 48
-#  endif
-#endif
-
-/*
- * Do we utilise overrun facility for receive message slots? Can aid peer
- * transmit performance. Only define on VideoCore end, talking to host.
- */
-//#define VCHI_MSG_RX_OVERRUN
-
-/*
- * How many transmit slots do we use. Generally don't need many,
- * as the hardware driver underneath VCHI will usually have its own buffering.
- */
-#ifndef VCHI_NUM_WRITE_SLOTS
-#  define VCHI_NUM_WRITE_SLOTS 4
-#endif
-
-/*
- * If a service has held or queued received messages in VCHI_XOFF_THRESHOLD or
- * more slots, then it's taking up too much buffer space,
- * and the peer service will be told to stop transmitting with an XOFF message.
- * For this to be effective, the VCHI_NUM_REA

[RFC 04/50] staging: vchi: Merge vchi_msg_queue() into vchi_queue_kernel_message()

2020-05-27 Thread Nicolas Saenz Julienne
There are no gains from that extra indirection level. Also, get rid of
the function description, the whole file will disappear soon.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../interface/vchiq_arm/vchiq_shim.c  | 29 +++
 1 file changed, 4 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 1c5ddea8b076..081ab67ad6fd 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -84,30 +84,15 @@ int32_t vchi_msg_remove(struct vchi_service_handle *handle)
 }
 EXPORT_SYMBOL(vchi_msg_remove);
 
-/***
- * Name: vchi_msg_queue
- *
- * Arguments:  struct vchi_service_handle *handle,
- * ssize_t (*copy_callback)(void *context, void *dest,
- * size_t offset, size_t maxsize),
- *void *context,
- * uint32_t data_size
- *
- * Description: Thin wrapper to queue a message onto a connection
- *
- * Returns: int32_t - success == 0
- *
- ***/
-static
-int32_t vchi_msg_queue(struct vchi_service_handle *handle, void *context,
-  uint32_t data_size)
+int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data,
+  unsigned int size)
 {
struct shim_service *service = (struct shim_service *)handle;
enum vchiq_status status;
 
while (1) {
-   status = vchiq_queue_kernel_message(service->handle, context,
-   data_size);
+   status = vchiq_queue_kernel_message(service->handle, data,
+   size);
 
/*
 * vchiq_queue_message() may return VCHIQ_RETRY, so we need to
@@ -122,12 +107,6 @@ int32_t vchi_msg_queue(struct vchi_service_handle *handle, 
void *context,
 
return vchiq_status_to_vchi(status);
 }
-
-int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data,
- unsigned int size)
-{
-   return vchi_msg_queue(handle, data, size);
-}
 EXPORT_SYMBOL(vchi_queue_kernel_message);
 
 /***
-- 
2.26.2

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


[RFC 30/50] staging: vchiq: Export vchiq_msg_queue_push

2020-05-27 Thread Nicolas Saenz Julienne
vchiq consumer drivers may need to use this function in order to get the
benefits of vchiq's per service message queueing mechanism.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index 8fd51d885a18..c99caa3add57 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -107,6 +107,7 @@ extern enum vchiq_status vchiq_use_service(unsigned int 
service);
 extern enum vchiq_status vchiq_release_service(unsigned int service);
 extern enum vchiq_status vchiq_queue_kernel_message(unsigned int handle,
void *context, size_t size);
+extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header);
 extern void   vchiq_release_message(unsigned int service,
struct vchiq_header *header);
 extern enum vchiq_status vchiq_bulk_transmit(unsigned int service,
-- 
2.26.2

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


[RFC 23/50] staging: vchi: Use vchiq's enum vchiq_reason

2020-05-27 Thread Nicolas Saenz Julienne
enum vchi_callback_reason maps 1:1 to enum vchiq_reason, in an effort to
simplify things, let's use the later, and get rid of the extra
indirection.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../bcm2835-audio/bcm2835-vchiq.c |  5 +--
 .../interface/vchi/vchi_common.h  | 20 +-
 .../interface/vchiq_arm/vchiq_shim.c  | 40 +--
 .../staging/vc04_services/vc-sm-cma/vc_sm.c   |  1 +
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  |  7 ++--
 .../vc04_services/vchiq-mmal/mmal-vchiq.c | 11 +++--
 6 files changed, 14 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 565853ec1e7a..0f97eda4ec90 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -89,8 +89,7 @@ static int bcm2835_audio_send_simple(struct 
bcm2835_audio_instance *instance,
return bcm2835_audio_send_msg(instance, &m, wait);
 }
 
-static void audio_vchi_callback(void *param,
-   const enum vchi_callback_reason reason,
+static void audio_vchi_callback(void *param, const enum vchiq_reason reason,
void *msg_handle)
 {
struct bcm2835_audio_instance *instance = param;
@@ -99,7 +98,7 @@ static void audio_vchi_callback(void *param,
unsigned size;
int status;
 
-   if (reason != VCHI_CALLBACK_MSG_AVAILABLE)
+   if (reason != VCHIQ_MESSAGE_AVAILABLE)
return;
 
status = vchi_msg_hold(instance->service, (void **)&m, &size, &handle);
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h 
b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
index 52b447c19445..24e8665e214a 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
@@ -4,27 +4,9 @@
 #ifndef VCHI_COMMON_H_
 #define VCHI_COMMON_H_
 
-//callback reasons when an event occurs on a service
-enum vchi_callback_reason {
-   /*
-* This indicates that there is data available handle is the msg id that
-* was transmitted with the data
-* When a message is received and there was no FULL message available
-* previously, send callback
-* Tasks get kicked by the callback, reset their event and try and read
-* from the fifo until it fails
-*/
-   VCHI_CALLBACK_SERVICE_CLOSED,
-   VCHI_CALLBACK_MSG_AVAILABLE,
-   VCHI_CALLBACK_BULK_SENT,
-   VCHI_CALLBACK_BULK_RECEIVED,
-   VCHI_CALLBACK_BULK_TRANSMIT_ABORTED,
-   VCHI_CALLBACK_BULK_RECEIVE_ABORTED,
-};
-
 //Callback used by all services / bulk transfers
 typedef void (*vchi_callback)(void *callback_param, //my service local param
- enum vchi_callback_reason reason,
+ enum vchiq_reason reason,
  void *handle); //for transmitting msg's only
 
 #endif // VCHI_COMMON_H_
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 3a5545e0db6b..649a65f02578 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -274,46 +274,10 @@ static enum vchiq_status shim_callback(enum vchiq_reason 
reason,
if (!service->callback)
goto release;
 
-   switch (reason) {
-   case VCHIQ_MESSAGE_AVAILABLE:
+   if (reason == VCHIQ_MESSAGE_AVAILABLE)
vchiu_queue_push(&service->queue, header);
 
-   service->callback(service->callback_param,
- VCHI_CALLBACK_MSG_AVAILABLE, NULL);
-
-   break;
-
-   case VCHIQ_BULK_TRANSMIT_DONE:
-   service->callback(service->callback_param,
- VCHI_CALLBACK_BULK_SENT, bulk_user);
-   break;
-
-   case VCHIQ_BULK_RECEIVE_DONE:
-   service->callback(service->callback_param,
- VCHI_CALLBACK_BULK_RECEIVED, bulk_user);
-   break;
-
-   case VCHIQ_SERVICE_CLOSED:
-   service->callback(service->callback_param,
- VCHI_CALLBACK_SERVICE_CLOSED, NULL);
-   break;
-
-   case VCHIQ_BULK_TRANSMIT_ABORTED:
-   service->callback(service->callback_param,
- VCHI_CALLBACK_BULK_TRANSMIT_ABORTED,
- bulk_user);
-   break;
-
-   case VCHIQ_BULK_RECEIVE_ABORTED:
-   service->callback(service->callback_param,
- VCHI_CALLBACK_BULK_RECEIVE_ABORTED,
- bulk_user);
-   break;
-
-   default:

[RFC 18/50] staging: vc04_services: vc-sm-cma: Get rid of the multiple connections option

2020-05-27 Thread Nicolas Saenz Julienne
Multiple connections are not handled by the IO thread, so it's not
really necessary to handle them on initialization.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../staging/vc04_services/vc-sm-cma/vc_sm.c   |  3 +-
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  | 67 ++-
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.h  |  1 -
 3 files changed, 23 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c 
b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
index 3f95ea90c08a..e660f546a7e4 100644
--- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
+++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
@@ -1532,8 +1532,7 @@ static void vc_sm_connected_init(void)
}
 
/* Initialize an instance of the shared memory service. */
-   sm_state->sm_handle = vc_sm_cma_vchi_init(instance, 1,
- vc_sm_vpu_event);
+   sm_state->sm_handle = vc_sm_cma_vchi_init(instance, vc_sm_vpu_event);
if (!sm_state->sm_handle) {
pr_err("[%s]: failed to initialize shared memory service\n",
   __func__);
diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c 
b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
index 32706eb2838b..72b09685db31 100644
--- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
+++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
@@ -46,8 +46,7 @@ struct sm_cmd_rsp_blk {
 };
 
 struct sm_instance {
-   u32 num_connections;
-   struct vchi_service *service[VCHI_MAX_NUM_CONNECTIONS];
+   struct vchi_service *service;
struct task_struct *io_thread;
struct completion io_cmplt;
 
@@ -187,13 +186,13 @@ static int vc_sm_cma_vchi_videocore_io(void *arg)
 
while (1) {
if (svc_use)
-   vchi_service_release(instance->service[0]);
+   vchi_service_release(instance->service);
svc_use = 0;
 
if (wait_for_completion_interruptible(&instance->io_cmplt))
continue;
 
-   vchi_service_use(instance->service[0]);
+   vchi_service_use(instance->service);
svc_use = 1;
 
do {
@@ -214,7 +213,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg)
 
/* Send the command */
status =
-   bcm2835_vchi_msg_queue(instance->service[0],
+   bcm2835_vchi_msg_queue(instance->service,
   cmd->msg, cmd->length);
if (status) {
pr_err("%s: failed to queue message (%d)",
@@ -237,7 +236,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg)
 
} while (1);
 
-   while (!vchi_msg_hold(instance->service[0], (void **)&reply,
+   while (!vchi_msg_hold(instance->service, (void **)&reply,
   &reply_len, VCHI_FLAGS_NONE, &msg)) {
if (reply->trans_id & 0x8000) {
/* Async event or cmd from the VPU */
@@ -286,21 +285,20 @@ static void vc_sm_cma_vchi_callback(void *param,
 }
 
 struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance,
-   unsigned int num_connections,
vpu_event_cb vpu_event)
 {
-   u32 i;
+   struct service_creation params = {
+   .version = VCHI_VERSION_EX(VC_SM_VER, VC_SM_MIN_VER),
+   .service_id = VC_SM_SERVER_NAME,
+   .callback = vc_sm_cma_vchi_callback,
+   .callback_param = NULL,
+   };
struct sm_instance *instance;
int status;
+   int i;
 
pr_debug("%s: start", __func__);
 
-   if (num_connections > VCHI_MAX_NUM_CONNECTIONS) {
-   pr_err("%s: unsupported number of connections %u (max=%u)",
-  __func__, num_connections, VCHI_MAX_NUM_CONNECTIONS);
-
-   goto err_null;
-   }
/* Allocate memory for this instance */
instance = kzalloc(sizeof(*instance), GFP_KERNEL);
 
@@ -317,25 +315,15 @@ struct sm_instance *vc_sm_cma_vchi_init(struct 
vchiq_instance *vchiq_instance,
init_completion(&instance->free_blk[i].cmplt);
list_add(&instance->free_blk[i].head, &instance->free_list);
}
+   params.callback_param = instance;
 
/* Open the VCHI service connections */
-   instance->num_connections = num_connections;
-   for (i = 0; i < num_connections; i++) {
-   struct service_creation params = {
-   .version = VCHI_VERSION_EX(VC_SM_VER, VC_SM_MIN_VER),
-   .service_id = VC_SM_SERVER_NAME,
-   .callback = vc_sm_cma_vchi_callback,
- 

[RFC 21/50] staging: vchi: Get rid of flags argument in vchi_msg_hold()

2020-05-27 Thread Nicolas Saenz Julienne
All users are ignoring the flags argument. So for the sake of
simplicity delete it.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/bcm2835-audio/bcm2835-vchiq.c  |  3 +--
 drivers/staging/vc04_services/interface/vchi/vchi.h  |  1 -
 .../vc04_services/interface/vchiq_arm/vchiq_shim.c   | 12 +++-
 .../staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c |  2 +-
 .../staging/vc04_services/vchiq-mmal/mmal-vchiq.c|  2 +-
 5 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 5018b5baa009..68119246f10b 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -102,8 +102,7 @@ static void audio_vchi_callback(void *param,
if (reason != VCHI_CALLBACK_MSG_AVAILABLE)
return;
 
-   status = vchi_msg_hold(instance->service, (void **)&m, &size,
-  VCHI_FLAGS_NONE, &handle);
+   status = vchi_msg_hold(instance->service, (void **)&m, &size, &handle);
if (status)
return;
 
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 55e51e5a1fdc..92ce811fc28d 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -87,7 +87,6 @@ extern int vchi_queue_kernel_message(struct vchi_service 
*service, void *data,
 extern int32_t vchi_msg_hold(struct vchi_service *service,
 void **data,// } may be NULL, as info can 
be
 uint32_t *msg_size, // } obtained from HELD_MSG_T
-enum vchi_flags flags,
 struct vchi_held_msg *message_descriptor);
 
 
/***
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 0c3473861a8d..0466512cfe3c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -195,7 +195,6 @@ EXPORT_SYMBOL(vchi_held_msg_release);
  * Arguments:  struct vchi_service *service,
  * void **data,
  * uint32_t *msg_size,
- * enum vchi_flags flags,
  * struct vchi_held_msg *message_handle
  *
  * Description: Routine to return a pointer to the current message (to allow
@@ -207,17 +206,12 @@ EXPORT_SYMBOL(vchi_held_msg_release);
  *
  ***/
 int32_t vchi_msg_hold(struct vchi_service *service, void **data,
- uint32_t *msg_size, enum vchi_flags flags,
- struct vchi_held_msg *message_handle)
+ uint32_t *msg_size, struct vchi_held_msg *message_handle)
 {
struct vchiq_header *header;
 
-   WARN_ON((flags != VCHI_FLAGS_NONE) &&
-   (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE));
-
-   if (flags == VCHI_FLAGS_NONE)
-   if (vchiu_queue_is_empty(&service->queue))
-   return -1;
+   if (vchiu_queue_is_empty(&service->queue))
+   return -1;
 
header = vchiu_queue_pop(&service->queue);
 
diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c 
b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
index 72b09685db31..826cac7922d2 100644
--- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
+++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
@@ -237,7 +237,7 @@ static int vc_sm_cma_vchi_videocore_io(void *arg)
} while (1);
 
while (!vchi_msg_hold(instance->service, (void **)&reply,
-  &reply_len, VCHI_FLAGS_NONE, &msg)) {
+ &reply_len, &msg)) {
if (reply->trans_id & 0x8000) {
/* Async event or cmd from the VPU */
if (instance->vpu_event)
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c 
b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
index 5183aff453eb..9f905f529d91 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
@@ -693,7 +693,7 @@ static void service_callback(void *param,
switch (reason) {
case VCHI_CALLBACK_MSG_AVAILABLE:
status = vchi_msg_hold(instance->service, (void **)&msg,
-  &msg_len, VCHI_FLAGS_NONE, &msg_handle);
+  &msg_len, &msg_handle);
if (status) {
pr_err("Unable to dequeue a mess

[RFC 33/50] staging: vchi: Use struct vchiq_service_params

2020-05-27 Thread Nicolas Saenz Julienne
For initialization, vchi has its own params structure, which is then
translated to vchiq's params structure. They are essentially the same,
so lets directly use vchiq's.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../bcm2835-audio/bcm2835-vchiq.c |  9 +
 .../vc04_services/interface/vchi/vchi.h   | 19 +--
 .../interface/vchiq_arm/vchiq_shim.c  | 12 ++--
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  | 11 ++-
 .../vc04_services/vchiq-mmal/mmal-vchiq.c | 11 ++-
 5 files changed, 20 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 71750ef891dd..c1537a41a2fe 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -122,11 +122,12 @@ static int
 vc_vchi_audio_init(struct vchiq_instance *vchiq_instance,
   struct bcm2835_audio_instance *instance)
 {
-   struct service_creation params = {
-   .version= VCHI_VERSION_EX(VC_AUDIOSERV_VER, 
VC_AUDIOSERV_MIN_VER),
-   .service_id = VC_AUDIO_SERVER_NAME,
+   struct vchiq_service_params params = {
+   .version= VC_AUDIOSERV_VER,
+   .version_min= VC_AUDIOSERV_MIN_VER,
+   .fourcc = VC_AUDIO_SERVER_NAME,
.callback   = audio_vchi_callback,
-   .callback_param = instance,
+   .userdata   = instance,
};
int status;
 
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index cb66ea1ffad2..4afa6e9f57c4 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -8,12 +8,6 @@
  * Global defs
  */
 
-struct vchi_version {
-   uint32_t version;
-   uint32_t version_min;
-};
-#define VCHI_VERSION_EX(v_, m_) { v_, m_ }
-
 // Macros to manipulate 'FOURCC' values
 #define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | 
x[3]))
 
@@ -31,17 +25,6 @@ struct vchi_service {
unsigned int handle;
 };
 
-// structure used to provide the information needed to open a server or a 
client
-struct service_creation {
-   struct vchi_version version;
-   int32_t service_id;
-   enum vchiq_status (*callback)(enum vchiq_reason reason,
- struct vchiq_header *header,
- unsigned int handle,
- void *bulk_userdata);
-   void *callback_param;
-};
-
 // Opaque handle for a VCHIQ instance
 struct vchiq_instance;
 
@@ -64,7 +47,7 @@ extern int32_t vchi_disconnect(struct vchiq_instance 
*instance);
  */
 // Routine to open a named service
 extern int32_t vchi_service_open(struct vchiq_instance *instance,
-struct service_creation *setup,
+struct vchiq_service_params *setup,
 struct vchi_service **service);
 
 extern int32_t vchi_get_peer_version(struct vchi_service *service,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index e6773cd51b44..e76399e083f6 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -265,23 +265,15 @@ static void service_free(struct vchi_service *service)
 }
 
 int32_t vchi_service_open(struct vchiq_instance *instance,
-   struct service_creation *setup,
+   struct vchiq_service_params *params,
struct vchi_service **service)
 {
 
*service = service_alloc();
if (service) {
-   struct vchiq_service_params params;
enum vchiq_status status;
 
-   memset(¶ms, 0, sizeof(params));
-   params.fourcc = setup->service_id;
-   params.callback = setup->callback;
-   params.userdata = setup->callback_param;
-   params.version = setup->version.version;
-   params.version_min = setup->version.version_min;
-
-   status = vchiq_open_service(instance, ¶ms,
+   status = vchiq_open_service(instance, params,
&((*service)->handle));
if (status != VCHIQ_SUCCESS) {
service_free(*service);
diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c 
b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
index 5088f72f57c9..a37607d07335 100644

[RFC 27/50] staging: vchiq: Get rid of vchiq_util.h

2020-05-27 Thread Nicolas Saenz Julienne
The header file only provides other includes. Move the relevant includes
to their respective C files and delete it for good.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchiq_arm/vchiq.h |  1 -
 .../interface/vchiq_arm/vchiq_2835_arm.c  |  1 +
 .../interface/vchiq_arm/vchiq_arm.c   |  1 +
 .../interface/vchiq_arm/vchiq_core.c  |  9 +++
 .../interface/vchiq_arm/vchiq_shim.c  |  4 +--
 .../interface/vchiq_arm/vchiq_util.h  | 27 ---
 6 files changed, 13 insertions(+), 30 deletions(-)
 delete mode 100644 
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
index 25af99a0f394..211b20705e36 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
@@ -5,7 +5,6 @@
 #define VCHIQ_VCHIQ_H
 
 #include "vchiq_if.h"
-#include "vchiq_util.h"
 
 /* Do this so that we can test-build the code on non-rpi systems */
 #if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index ecec84ad4345..d80c5f9b5cd8 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index abc30e593b67..4230f33ac38a 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "vchiq_core.h"
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 0e9680904e68..5b55d32e62a0 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -1,8 +1,17 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
+#include 
 
 #include "vchiq_core.h"
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 85d79d0033bf..9728667adbd9 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -2,14 +2,14 @@
 /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
 #include 
 #include 
+#include 
+#include 
 
 #include "vchiq_if.h"
 #include "../vchi/vchi.h"
 #include "vchiq.h"
 #include "vchiq_core.h"
 
-#include "vchiq_util.h"
-
 struct vchi_service {
unsigned int handle;
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h
deleted file mode 100644
index dcf081079c39..
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
-/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
-
-#ifndef VCHIQ_UTIL_H
-#define VCHIQ_UTIL_H
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include   /* for time_t */
-#include 
-
-#include "vchiq_if.h"
-
-#endif
-- 
2.26.2

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


[RFC 07/50] staging: vchi: Get rid of not implemented function declarations

2020-05-27 Thread Nicolas Saenz Julienne
They don't exist, they have no users, get rid of them.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchi/vchi.h   | 59 ---
 1 file changed, 59 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 1e8d17531e9d..2e41b5f7bdec 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -67,19 +67,12 @@ extern "C" {
 // Routine used to initialise the vchi on both local + remote connections
 extern int32_t vchi_initialise(struct vchi_instance_handle **instance_handle);
 
-extern int32_t vchi_exit(void);
-
 extern int32_t vchi_connect(struct vchi_instance_handle *instance_handle);
 
 //When this is called, ensure that all services have no data pending.
 //Bulk transfers can remain 'queued'
 extern int32_t vchi_disconnect(struct vchi_instance_handle *instance_handle);
 
-// helper functions
-extern void *vchi_allocate_buffer(struct vchi_service_handle *handle, uint32_t 
*length);
-extern void vchi_free_buffer(struct vchi_service_handle *handle, void 
*address);
-extern uint32_t vchi_current_time(struct vchi_instance_handle 
*instance_handle);
-
 /**
  * Global service API
  */
@@ -135,54 +128,14 @@ extern int32_t vchi_msg_hold(struct vchi_service_handle 
*handle,
 enum vchi_flags flags,
 struct vchi_held_msg *message_descriptor);
 
-// Initialise an iterator to look through messages in place
-extern int32_t vchi_msg_look_ahead(struct vchi_service_handle *handle,
-  struct vchi_msg_iter *iter,
-  enum vchi_flags flags);
-
 
/***
  * Global service support API - operations on held messages
  * and message iterators
  
**/
 
-// Routine to get the address of a held message
-extern void *vchi_held_msg_ptr(const struct vchi_held_msg *message);
-
-// Routine to get the size of a held message
-extern int32_t vchi_held_msg_size(const struct vchi_held_msg *message);
-
-// Routine to get the transmit timestamp as written into the header by the peer
-extern uint32_t vchi_held_msg_tx_timestamp(const struct vchi_held_msg 
*message);
-
-// Routine to get the reception timestamp, written as we parsed the header
-extern uint32_t vchi_held_msg_rx_timestamp(const struct vchi_held_msg 
*message);
-
 // Routine to release a held message after it has been processed
 extern int32_t vchi_held_msg_release(struct vchi_held_msg *message);
 
-// Indicates whether the iterator has a next message.
-extern int32_t vchi_msg_iter_has_next(const struct vchi_msg_iter *iter);
-
-// Return the pointer and length for the next message and advance the iterator.
-extern int32_t vchi_msg_iter_next(struct vchi_msg_iter *iter,
- void **data,
- uint32_t *msg_size);
-
-// Remove the last message returned by vchi_msg_iter_next.
-// Can only be called once after each call to vchi_msg_iter_next.
-extern int32_t vchi_msg_iter_remove(struct vchi_msg_iter *iter);
-
-// Hold the last message returned by vchi_msg_iter_next.
-// Can only be called once after each call to vchi_msg_iter_next.
-extern int32_t vchi_msg_iter_hold(struct vchi_msg_iter *iter,
- struct vchi_held_msg *message);
-
-// Return information for the next message, and hold it, advancing the 
iterator.
-extern int32_t vchi_msg_iter_hold_next(struct vchi_msg_iter *iter,
-  void **data,// } may be NULL
-  uint32_t *msg_size, // }
-  struct vchi_held_msg *message);
-
 /**
  * Global bulk API
  */
@@ -194,13 +147,6 @@ extern int32_t vchi_bulk_queue_receive(struct 
vchi_service_handle *handle,
   enum vchi_flags flags,
   void *transfer_handle);
 
-// Prepare interface for a transfer from the other side into relocatable 
memory.
-int32_t vchi_bulk_queue_receive_reloc(const struct vchi_service_handle *handle,
- uint32_t offset,
- uint32_t data_size,
- const enum vchi_flags flags,
- void * const bulk_handle);
-
 // Routine to queue up data ready for transfer to the other (once they have 
signalled they are ready)
 extern int3

[RFC 09/50] staging: vchiq: move vchiq_release_message() into vchiq

2020-05-27 Thread Nicolas Saenz Julienne
For messages with a reason different from VCHIQ_MESSAGE_AVAILABLE the
responsibility for releasing them is kept in vchi, in other words,
services don't need to worry about it. As we're trying to unify vchi and
vchiq, move the release code into vchiq.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c| 4 
 .../staging/vc04_services/interface/vchiq_arm/vchiq_shim.c| 4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 67b2090c91db..ef31e541c902 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -372,6 +372,10 @@ make_service_callback(struct vchiq_service *service, enum 
vchiq_reason reason,
service->state->id, service->handle);
status = VCHIQ_SUCCESS;
}
+
+   if (reason != VCHIQ_MESSAGE_AVAILABLE)
+   vchiq_release_message(service->handle, header);
+
return status;
 }
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 0fc5fa05c6c2..55f9e34ea50e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -444,7 +444,7 @@ static enum vchiq_status shim_callback(enum vchiq_reason 
reason,
service->callback(service->callback_param,
  VCHI_CALLBACK_MSG_AVAILABLE, NULL);
 
-   goto done;
+   break;
 
case VCHIQ_BULK_TRANSMIT_DONE:
service->callback(service->callback_param,
@@ -483,8 +483,6 @@ static enum vchiq_status shim_callback(enum vchiq_reason 
reason,
}
 
 release:
-   vchiq_release_message(service->handle, header);
-done:
return VCHIQ_SUCCESS;
 }
 
-- 
2.26.2

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


[RFC 25/50] staging: vchiq: Introduce vchiq_validate_params()

2020-05-27 Thread Nicolas Saenz Julienne
When adding a new service validate the configuration parameters
provided, and remove unnecessary checks in vchi, now that we have
validated service's config.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../interface/vchiq_arm/vchiq_core.c  | 15 +++
 .../interface/vchiq_arm/vchiq_shim.c  |  4 
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index ae9183db44ee..46b09b7154f8 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -2265,6 +2265,16 @@ vchiq_init_state(struct vchiq_state *state, struct 
vchiq_slot_zero *slot_zero)
return VCHIQ_ERROR;
 }
 
+static int vchiq_validate_params(const struct vchiq_service_params *params)
+{
+   if (!params->callback || !params->fourcc) {
+   vchiq_loud_error("Can't add service, invalid params\n");
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
 /* Called from application thread when a client or server service is created. 
*/
 struct vchiq_service *
 vchiq_add_service_internal(struct vchiq_state *state,
@@ -2275,8 +2285,13 @@ vchiq_add_service_internal(struct vchiq_state *state,
struct vchiq_service *service;
struct vchiq_service __rcu **pservice = NULL;
struct vchiq_service_quota *service_quota;
+   int ret;
int i;
 
+   ret = vchiq_validate_params(params);
+   if (ret)
+   return NULL;
+
service = kmalloc(sizeof(*service), GFP_KERNEL);
if (!service)
return service;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index e09c595d6f9d..dcf8776834b1 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -271,15 +271,11 @@ static enum vchiq_status shim_callback(enum vchiq_reason 
reason,
struct vchi_service *service =
(struct vchi_service *)VCHIQ_GET_SERVICE_USERDATA(handle);
 
-   if (!service->callback)
-   goto release;
-
if (reason == VCHIQ_MESSAGE_AVAILABLE)
vchiu_queue_push(&service->queue, header);
 
service->callback(service->callback_param, reason, bulk_user);
 
-release:
return VCHIQ_SUCCESS;
 }
 
-- 
2.26.2

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


[RFC 14/50] staging: vchi: Unify struct shim_service and struct vchi_service_handle

2020-05-27 Thread Nicolas Saenz Julienne
The idea behind struct vchi_service_handle is to create an opaque handle
to struct shim_service. This can be achieved by doing a forward
declaration of struct shim_service, which will avoid unwarranted casts
and pointer play.

Ultimately as a rename is due all over the vchi user space, rename
struct shim_service into struvt vchi_service, which is more consistent
with the rest of the exposed API.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../bcm2835-audio/bcm2835-vchiq.c | 24 +++
 .../vc04_services/interface/vchi/vchi.h   | 27 
 .../interface/vchiq_arm/vchiq_shim.c  | 68 ---
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  | 24 +++
 .../vc04_services/vchiq-mmal/mmal-vchiq.c | 34 +-
 5 files changed, 81 insertions(+), 96 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 8c9390153a26..62eef233275f 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -9,7 +9,7 @@
 
 struct bcm2835_audio_instance {
struct device *dev;
-   struct vchi_service_handle *vchi_handle;
+   struct vchi_service *service;
struct completion msg_avail_comp;
struct mutex vchi_mutex;
struct bcm2835_alsa_stream *alsa_stream;
@@ -25,12 +25,12 @@ MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for 
audio");
 static void bcm2835_audio_lock(struct bcm2835_audio_instance *instance)
 {
mutex_lock(&instance->vchi_mutex);
-   vchi_service_use(instance->vchi_handle);
+   vchi_service_use(instance->service);
 }
 
 static void bcm2835_audio_unlock(struct bcm2835_audio_instance *instance)
 {
-   vchi_service_release(instance->vchi_handle);
+   vchi_service_release(instance->service);
mutex_unlock(&instance->vchi_mutex);
 }
 
@@ -44,7 +44,7 @@ static int bcm2835_audio_send_msg_locked(struct 
bcm2835_audio_instance *instance
init_completion(&instance->msg_avail_comp);
}
 
-   status = vchi_queue_kernel_message(instance->vchi_handle,
+   status = vchi_queue_kernel_message(instance->service,
   m, sizeof(*m));
if (status) {
dev_err(instance->dev,
@@ -101,7 +101,7 @@ static void audio_vchi_callback(void *param,
if (reason != VCHI_CALLBACK_MSG_AVAILABLE)
return;
 
-   status = vchi_msg_dequeue(instance->vchi_handle,
+   status = vchi_msg_dequeue(instance->service,
  &m, sizeof(m), &msg_len, VCHI_FLAGS_NONE);
if (status)
return;
@@ -135,7 +135,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance,
 
/* Open the VCHI service connections */
status = vchi_service_open(vchiq_instance, ¶ms,
-  &instance->vchi_handle);
+  &instance->service);
 
if (status) {
dev_err(instance->dev,
@@ -145,7 +145,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance,
}
 
/* Finished with the service for now */
-   vchi_service_release(instance->vchi_handle);
+   vchi_service_release(instance->service);
 
return 0;
 }
@@ -155,10 +155,10 @@ static void vc_vchi_audio_deinit(struct 
bcm2835_audio_instance *instance)
int status;
 
mutex_lock(&instance->vchi_mutex);
-   vchi_service_use(instance->vchi_handle);
+   vchi_service_use(instance->service);
 
/* Close all VCHI service connections */
-   status = vchi_service_close(instance->vchi_handle);
+   status = vchi_service_close(instance->service);
if (status) {
dev_err(instance->dev,
"failed to close VCHI service connection (status=%d)\n",
@@ -228,7 +228,7 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream 
*alsa_stream)
goto deinit;
 
bcm2835_audio_lock(instance);
-   vchi_get_peer_version(instance->vchi_handle, &instance->peer_version);
+   vchi_get_peer_version(instance->service, &instance->peer_version);
bcm2835_audio_unlock(instance);
if (instance->peer_version < 2 || force_bulk)
instance->max_packet = 0; /* bulk transfer */
@@ -344,7 +344,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream 
*alsa_stream,
count = size;
if (!instance->max_packet) {
/* Send the message to the videocore */
-   status = vchi_bulk_queue_transmit(instance->vchi_handle,
+   status = vchi_bulk_queue_transmit(instance->service,
  src, count,
  
VCHI_FLAGS_BLOCK_UNTIL_DATA_READ,
  NULL);
@@ -352,7 +352,7 @@ int bcm2835_audio_write(struct bcm2835

[RFC 29/50] staging: vchiq: Export vchiq_get_service_userdata()

2020-05-27 Thread Nicolas Saenz Julienne
This is for service's callbacks to get their private data.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 5b55d32e62a0..01a9331dbff4 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -332,6 +332,7 @@ vchiq_get_service_userdata(unsigned int handle)
rcu_read_unlock();
return userdata;
 }
+EXPORT_SYMBOL(vchiq_get_service_userdata);
 
 static void
 mark_service_closing_internal(struct vchiq_service *service, int sh_thread)
-- 
2.26.2

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


[RFC 36/50] staging: vchi: Rework vchi_msg_hold() to match vchiq_msg_hold()

2020-05-27 Thread Nicolas Saenz Julienne
The services have access to struct vchiq_header's internals, so we can
let them get the data pointer. This pretty much makes both functions
exactly the same, which will allow us to make a switch to
vchiq_msg_hold() further down the road.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../staging/vc04_services/interface/vchi/vchi.h   |  5 +
 .../interface/vchiq_arm/vchiq_shim.c  | 15 ++-
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  |  9 +++--
 3 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 72771fdee9d6..59559d4cd5f1 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -54,10 +54,7 @@ extern int vchi_queue_kernel_message(unsigned handle, void 
*data,
 // Routine to look at a message in place.
 // The message is dequeued, so the caller is left holding it; the descriptor is
 // filled in and must be released when the user has finished with the message.
-extern int32_t vchi_msg_hold(unsigned handle,
-void **data,// } may be NULL, as info can 
be
-uint32_t *msg_size, // } obtained from HELD_MSG_T
-struct vchiq_header **message);
+struct vchiq_header *vchi_msg_hold(unsigned handle);
 
 
/***
  * Global service support API - operations on held messages
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 6eb9a9878641..fc12b76617d1 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -154,20 +154,9 @@ EXPORT_SYMBOL(vchi_held_msg_release);
  * Returns: int32_t - success == 0
  *
  ***/
-int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size,
- struct vchiq_header **message)
+struct vchiq_header *vchi_msg_hold(unsigned handle)
 {
-   struct vchiq_header *header;
-
-   header = vchiq_msg_hold(handle);
-   if (!header)
-   return -ENOENT;
-
-   *data = header->data;
-   *msg_size = header->size;
-   *message = header;
-
-   return 0;
+   return vchiq_msg_hold(handle);
 }
 EXPORT_SYMBOL(vchi_msg_hold);
 
diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c 
b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
index 08979502f551..2de67ce18be2 100644
--- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
+++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
@@ -233,8 +233,13 @@ static int vc_sm_cma_vchi_videocore_io(void *arg)
 
} while (1);
 
-   while (!vchi_msg_hold(instance->service_handle,
- (void **)&reply, &reply_len, &message)) {
+   while (1) {
+   message = vchi_msg_hold(instance->service_handle);
+   if (!message)
+   break;
+   reply = (struct vc_sm_result_t *)message->data;
+   reply_len = message->size;
+
if (reply->trans_id & 0x8000) {
/* Async event or cmd from the VPU */
if (instance->vpu_event)
-- 
2.26.2

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


[RFC 37/50] staging: vchiq: Unify fourcc definition mechanisms

2020-05-27 Thread Nicolas Saenz Julienne
There is already enough duplication with regard to fourcc generation in
the kernel. Let's at least use the same macro all over the vchiq
ecosystem.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c  | 2 +-
 .../vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h | 5 ++---
 drivers/staging/vc04_services/interface/vchi/vchi.h  | 3 ---
 drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 2 +-
 drivers/staging/vc04_services/vc-sm-cma/vc_sm_defs.h | 3 ---
 drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h  | 1 -
 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c| 2 +-
 7 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 18309578e9a2..55f1e684eef1 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -125,7 +125,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance,
struct vchiq_service_params params = {
.version= VC_AUDIOSERV_VER,
.version_min= VC_AUDIOSERV_MIN_VER,
-   .fourcc = VC_AUDIO_SERVER_NAME,
+   .fourcc = VCHIQ_MAKE_FOURCC('A', 'U', 'D', 'S'),
.callback   = audio_vchi_callback,
.userdata   = instance,
};
diff --git 
a/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h 
b/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h
index d6401e914ac9..b4fa239c5ebe 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h
+++ b/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h
@@ -8,9 +8,8 @@
 #define VC_AUDIOSERV_VER 2
 
 /* FourCC codes used for VCHI communication */
-#define VC_AUDIO_SERVER_NAME  MAKE_FOURCC("AUDS")
-#define VC_AUDIO_WRITE_COOKIE1 MAKE_FOURCC("BCMA")
-#define VC_AUDIO_WRITE_COOKIE2 MAKE_FOURCC("DATA")
+#define VC_AUDIO_WRITE_COOKIE1 VCHIQ_MAKE_FOURCC('B', 'C', 'M', 'A')
+#define VC_AUDIO_WRITE_COOKIE2 VCHIQ_MAKE_FOURCC('D', 'A', 'T', 'A')
 
 /*
  *  List of screens that are currently supported
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 59559d4cd5f1..7108c254a38a 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -8,9 +8,6 @@
  * Global defs
  */
 
-// Macros to manipulate 'FOURCC' values
-#define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | 
x[3]))
-
 // Opaque handle for a VCHIQ instance
 struct vchiq_instance;
 
diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c 
b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
index 2de67ce18be2..0b1a510d6bab 100644
--- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
+++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c
@@ -294,7 +294,7 @@ struct sm_instance *vc_sm_cma_vchi_init(struct 
vchiq_instance *vchiq_instance,
struct vchiq_service_params params = {
.version = VC_SM_VER,
.version_min = VC_SM_MIN_VER,
-   .fourcc = VC_SM_SERVER_NAME,
+   .fourcc = VCHIQ_MAKE_FOURCC('S', 'M', 'E', 'M'),
.callback = vc_sm_cma_vchi_callback,
.userdata = NULL,
};
diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_defs.h 
b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_defs.h
index 8a0d1f6dbfe8..4e6354000dfd 100644
--- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_defs.h
+++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_defs.h
@@ -15,9 +15,6 @@
 #ifndef __VC_SM_DEFS_H__INCLUDED__
 #define __VC_SM_DEFS_H__INCLUDED__
 
-/* FourCC code used for VCHI connection */
-#define VC_SM_SERVER_NAME MAKE_FOURCC("SMEM")
-
 /* Maximum message length */
 #define VC_SM_MAX_MSG_LEN (sizeof(union vc_sm_msg_union_t) + \
sizeof(struct vc_sm_msg_hdr_t))
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h 
b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h
index bd83159403e5..ab63835ce01c 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h
@@ -28,7 +28,6 @@
 
 #define VC_MMAL_VER 15
 #define VC_MMAL_MIN_VER 10
-#define VC_MMAL_SERVER_NAME  MAKE_FOURCC("mmal")
 
 /* max total message size is 512 bytes */
 #define MMAL_MSG_MAX_SIZE 512
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c 
b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
index 3707212d8e7e..d35d2b50991b 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_servi

[RFC 35/50] staging: vchiq: Pass vchiq's message when holding a message

2020-05-27 Thread Nicolas Saenz Julienne
vchi created an opaque structure to be held by services while they
process callback messages. The contents of this opaque structure are the
service handle, which all services already maintain, and a pointer to
vchiq's message structure, struct vchiq_header.

Let's get rid of this opaque structure and directly pass struct
vchiq_header, which is what ultimately vchiq consumes when handling
callback messages.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchi/vchi.h   | 14 ++-
 .../interface/vchiq_arm/vchiq_shim.c  | 25 ++-
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  |  6 ++---
 3 files changed, 12 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 74fd169e079a..72771fdee9d6 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -11,16 +11,6 @@
 // Macros to manipulate 'FOURCC' values
 #define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | 
x[3]))
 
-// Opaque service information
-struct opaque_vchi_service_t;
-
-// Descriptor for a held message. Allocated by client, initialised by 
vchi_msg_hold,
-// vchi_msg_iter_hold or vchi_msg_iter_hold_next. Fields are for internal VCHI 
use only.
-struct vchi_held_msg {
-   struct opaque_vchi_service_t *service;
-   void *message;
-};
-
 // Opaque handle for a VCHIQ instance
 struct vchiq_instance;
 
@@ -67,7 +57,7 @@ extern int vchi_queue_kernel_message(unsigned handle, void 
*data,
 extern int32_t vchi_msg_hold(unsigned handle,
 void **data,// } may be NULL, as info can 
be
 uint32_t *msg_size, // } obtained from HELD_MSG_T
-struct vchi_held_msg *message_descriptor);
+struct vchiq_header **message);
 
 
/***
  * Global service support API - operations on held messages
@@ -75,7 +65,7 @@ extern int32_t vchi_msg_hold(unsigned handle,
  
**/
 
 // Routine to release a held message after it has been processed
-extern int32_t vchi_held_msg_release(struct vchi_held_msg *message);
+extern int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header 
*message);
 
 /**
  * Global bulk API
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 578346965da6..6eb9a9878641 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -113,7 +113,8 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit);
 /***
  * Name: vchi_held_msg_release
  *
- * Arguments:  struct vchi_held_msg *message
+ * Arguments:  unsgined handle
+ *struct vchiq_header *message
  *
  * Description: Routine to release a held message (after it has been read with
  *  vchi_msg_hold)
@@ -121,7 +122,7 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit);
  * Returns: int32_t - success == 0
  *
  ***/
-int32_t vchi_held_msg_release(struct vchi_held_msg *message)
+int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message)
 {
/*
 * Convert the service field pointer back to an
@@ -131,8 +132,7 @@ int32_t vchi_held_msg_release(struct vchi_held_msg *message)
 * to a pointer.
 */
 
-   vchiq_release_message((unsigned int)(long)message->service,
- (struct vchiq_header *)message->message);
+   vchiq_release_message(handle, message);
 
return 0;
 }
@@ -144,7 +144,7 @@ EXPORT_SYMBOL(vchi_held_msg_release);
  * Arguments:  struct vchi_service *service,
  * void **data,
  * uint32_t *msg_size,
- * struct vchi_held_msg *message_handle
+ * struct vchiq_header **message
  *
  * Description: Routine to return a pointer to the current message (to allow
  *  in place processing). The message is dequeued - don't forget
@@ -155,7 +155,7 @@ EXPORT_SYMBOL(vchi_held_msg_release);
  *
  ***/
 int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size,
- struct vchi_held_msg *message_handle)
+ struct vchiq_header **message)
 {
struct vchiq_header *header;
 
@@ -165,18 +165,7 @@ int32_t vchi_msg_hold(unsigned handle, void **data, 
uint32_t *msg_size,
 
*data = header->data;
*msg_size = header->size;
-
-   /*
-* upcast the unsigned int which i

[RFC 34/50] staging: vchi: Get rid of struct vchi_service

2020-05-27 Thread Nicolas Saenz Julienne
The structure only contains a single parameter, which is the underlying
vchiq handle. Get rid of the struct and directly pass the handle around.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../bcm2835-audio/bcm2835-vchiq.c | 23 ++---
 .../vc04_services/interface/vchi/vchi.h   | 25 ++---
 .../interface/vchiq_arm/vchiq_shim.c  | 99 +--
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  | 26 +++--
 .../vc04_services/vchiq-mmal/mmal-vchiq.c | 55 ++-
 5 files changed, 84 insertions(+), 144 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index c1537a41a2fe..18309578e9a2 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -9,7 +9,7 @@
 
 struct bcm2835_audio_instance {
struct device *dev;
-   struct vchi_service *service;
+   unsigned service_handle;
struct completion msg_avail_comp;
struct mutex vchi_mutex;
struct bcm2835_alsa_stream *alsa_stream;
@@ -25,12 +25,12 @@ MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for 
audio");
 static void bcm2835_audio_lock(struct bcm2835_audio_instance *instance)
 {
mutex_lock(&instance->vchi_mutex);
-   vchi_service_use(instance->service);
+   vchi_service_use(instance->service_handle);
 }
 
 static void bcm2835_audio_unlock(struct bcm2835_audio_instance *instance)
 {
-   vchi_service_release(instance->service);
+   vchi_service_release(instance->service_handle);
mutex_unlock(&instance->vchi_mutex);
 }
 
@@ -44,7 +44,7 @@ static int bcm2835_audio_send_msg_locked(struct 
bcm2835_audio_instance *instance
init_completion(&instance->msg_avail_comp);
}
 
-   status = vchi_queue_kernel_message(instance->service,
+   status = vchi_queue_kernel_message(instance->service_handle,
   m, sizeof(*m));
if (status) {
dev_err(instance->dev,
@@ -133,7 +133,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance,
 
/* Open the VCHI service connections */
status = vchi_service_open(vchiq_instance, ¶ms,
-  &instance->service);
+  &instance->service_handle);
 
if (status) {
dev_err(instance->dev,
@@ -143,7 +143,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance,
}
 
/* Finished with the service for now */
-   vchi_service_release(instance->service);
+   vchi_service_release(instance->service_handle);
 
return 0;
 }
@@ -153,10 +153,10 @@ static void vc_vchi_audio_deinit(struct 
bcm2835_audio_instance *instance)
int status;
 
mutex_lock(&instance->vchi_mutex);
-   vchi_service_use(instance->service);
+   vchi_service_use(instance->service_handle);
 
/* Close all VCHI service connections */
-   status = vchi_service_close(instance->service);
+   status = vchi_service_close(instance->service_handle);
if (status) {
dev_err(instance->dev,
"failed to close VCHI service connection (status=%d)\n",
@@ -226,7 +226,8 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream 
*alsa_stream)
goto deinit;
 
bcm2835_audio_lock(instance);
-   vchi_get_peer_version(instance->service, &instance->peer_version);
+   vchi_get_peer_version(instance->service_handle,
+ &instance->peer_version);
bcm2835_audio_unlock(instance);
if (instance->peer_version < 2 || force_bulk)
instance->max_packet = 0; /* bulk transfer */
@@ -342,7 +343,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream 
*alsa_stream,
count = size;
if (!instance->max_packet) {
/* Send the message to the videocore */
-   status = vchi_bulk_queue_transmit(instance->service,
+   status = vchi_bulk_queue_transmit(instance->service_handle,
  src, count,
  VCHIQ_BULK_MODE_BLOCKING,
  NULL);
@@ -350,7 +351,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream 
*alsa_stream,
while (count > 0) {
int bytes = min(instance->max_packet, count);
 
-   status = vchi_queue_kernel_message(instance->service,
+   status = 
vchi_queue_kernel_message(instance->service_handle,
   src, bytes);
src += bytes;
count -= bytes;
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 4afa6e9f57c4..74fd169e07

Re: [RFC 00/50] staging: vchiq: Getting rid of the vchi/vchiq split

2020-05-27 Thread Greg KH
On Wed, May 27, 2020 at 01:53:05PM +0200, Nicolas Saenz Julienne wrote:
> vchi acts as a mid layer between vchiq and its kernel services, while
> arguably providing little to no benefit: half of the functions exposed
> are a 1:1 copy of vchiq's, and the rest provide some functionality which
> can be easly integrated into vchiq without all the churn. Moreover it
> has been found in the past as a blockage to further fixes in vchiq as
> every change needed its vchi counterpart, if even possible.
> 
> Hence this series, which merges all vchi functionality into vchiq and
> provies a simpler and more concise API to services.
> 
> I'm aware that kernel's vchi API tries to mimic its userspace
> counterpart (or vice versa). Obviously this breaks the parity, but I
> don't think it's a sane goal to have. There is little sense or gain from
> it, and adds impossible constraints to upstreaming the driver.
> 
> Overall the series falls short of removing 1500 lines of code, which is
> pretty neat on itself.
> 
> So far it has been tested trough bcm2835-camera, audio and vchiq-test. I
> can't do much about vc-sm-cma for now, but the changes are done in a way
> that shouldn't affect its behaviour.
> 
> Note that the series builds up on RPi/Laurent's camera support series[1]
> and can't yet be merged. We'd have to coordinate here. We could either
> wait for the vc_sm_cma rework (if it's not going to take months and
> months to finish), or factor out all the vc-sm-cma stuff, merge that into
> the downstream kernel and take the rest of the series on top of
> Laurent's mmal-vchiq changes.

These look great, but due to the dependancy, I can't take them all.

But I can take the first 10, so I did that, they are now queued up,
thanks!

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


[RFC 47/50] staging: vchiq: Move conditional barrier definition into vchiq_core.h

2020-05-27 Thread Nicolas Saenz Julienne
The barrier is only used by core code. So keep the barrier definition in
the core header.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchiq_arm/vchiq.h| 11 ---
 .../vc04_services/interface/vchiq_arm/vchiq_core.h   | 12 
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
index 211b20705e36..57fe7d5e9a85 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
@@ -6,15 +6,4 @@
 
 #include "vchiq_if.h"
 
-/* Do this so that we can test-build the code on non-rpi systems */
-#if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE)
-
-#else
-
-#ifndef dsb
-#define dsb(a)
-#endif
-
-#endif /* IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) */
-
 #endif
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index ff91c04ba6b9..15e9867f78f4 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -15,6 +15,18 @@
 
 #include "vchiq.h"
 
+/* Do this so that we can test-build the code on non-rpi systems */
+#if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE)
+
+#else
+
+#ifndef dsb
+#define dsb(a)
+#endif
+
+#endif /* IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) */
+
+
 /* Run time control of log level, based on KERN_XXX level. */
 #define VCHIQ_LOG_DEFAULT  4
 #define VCHIQ_LOG_ERROR3
-- 
2.26.2

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


[RFC 46/50] staging: vchiq: Get rid of vchi

2020-05-27 Thread Nicolas Saenz Julienne
All the functions that vchi currently provides are a 1:1 mapping to its
vchiq counterparts. Get rid of vchi altogether and use vchiq's on all
services.

In the process also get rid of the vchi directory, as the only remaining
file was a TODO file, which now lives in the parent directory.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/Makefile|   1 -
 .../bcm2835-audio/bcm2835-vchiq.c |  24 +--
 .../vc04_services/bcm2835-audio/bcm2835.h |   1 -
 .../vc04_services/interface/{vchi => }/TODO   |   0
 .../vc04_services/interface/vchi/vchi.h   |  59 --
 .../interface/vchiq_arm/vchiq_arm.c   |   2 +
 .../interface/vchiq_arm/vchiq_core.c  |   3 +
 .../interface/vchiq_arm/vchiq_shim.c  | 179 --
 .../staging/vc04_services/vc-sm-cma/vc_sm.c   |   4 +-
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  |  17 +-
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.h  |   2 -
 .../vc04_services/vchiq-mmal/mmal-vchiq.c |  29 ++-
 12 files changed, 42 insertions(+), 279 deletions(-)
 rename drivers/staging/vc04_services/interface/{vchi => }/TODO (100%)
 delete mode 100644 drivers/staging/vc04_services/interface/vchi/vchi.h
 delete mode 100644 
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c

diff --git a/drivers/staging/vc04_services/Makefile 
b/drivers/staging/vc04_services/Makefile
index 6a426572793b..e32c0744e7fc 100644
--- a/drivers/staging/vc04_services/Makefile
+++ b/drivers/staging/vc04_services/Makefile
@@ -6,7 +6,6 @@ vchiq-objs := \
interface/vchiq_arm/vchiq_arm.o \
interface/vchiq_arm/vchiq_2835_arm.o \
interface/vchiq_arm/vchiq_debugfs.o \
-   interface/vchiq_arm/vchiq_shim.o \
interface/vchiq_arm/vchiq_connected.o \
 
 obj-$(CONFIG_SND_BCM2835)  += bcm2835-audio/
diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index efaa2ae11f52..8c9ddd86fbbd 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -25,12 +25,12 @@ MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for 
audio");
 static void bcm2835_audio_lock(struct bcm2835_audio_instance *instance)
 {
mutex_lock(&instance->vchi_mutex);
-   vchi_service_use(instance->service_handle);
+   vchiq_use_service(instance->service_handle);
 }
 
 static void bcm2835_audio_unlock(struct bcm2835_audio_instance *instance)
 {
-   vchi_service_release(instance->service_handle);
+   vchiq_release_service(instance->service_handle);
mutex_unlock(&instance->vchi_mutex);
 }
 
@@ -132,8 +132,8 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance,
int status;
 
/* Open the VCHI service connections */
-   status = vchi_service_open(vchiq_instance, ¶ms,
-  &instance->service_handle);
+   status = vchiq_open_service(vchiq_instance, ¶ms,
+   &instance->service_handle);
 
if (status) {
dev_err(instance->dev,
@@ -143,7 +143,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance,
}
 
/* Finished with the service for now */
-   vchi_service_release(instance->service_handle);
+   vchiq_release_service(instance->service_handle);
 
return 0;
 }
@@ -153,10 +153,10 @@ static void vc_vchi_audio_deinit(struct 
bcm2835_audio_instance *instance)
int status;
 
mutex_lock(&instance->vchi_mutex);
-   vchi_service_use(instance->service_handle);
+   vchiq_use_service(instance->service_handle);
 
/* Close all VCHI service connections */
-   status = vchi_service_close(instance->service_handle);
+   status = vchiq_close_service(instance->service_handle);
if (status) {
dev_err(instance->dev,
"failed to close VCHI service connection (status=%d)\n",
@@ -171,14 +171,14 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct 
bcm2835_vchi_ctx *vchi_ctx)
int ret;
 
/* Initialize and create a VCHI connection */
-   ret = vchi_initialise(&vchi_ctx->instance);
+   ret = vchiq_initialise(&vchi_ctx->instance);
if (ret) {
dev_err(dev, "failed to initialise VCHI instance (ret=%d)\n",
ret);
return -EIO;
}
 
-   ret = vchi_connect(vchi_ctx->instance);
+   ret = vchiq_connect(vchi_ctx->instance);
if (ret) {
dev_dbg(dev, "failed to connect VCHI instance (ret=%d)\n",
ret);
@@ -195,7 +195,7 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct 
bcm2835_vchi_ctx *vchi_ctx)
 void bcm2835_free_vchi_ctx(struct bcm2835_vchi_ctx *vchi_ctx)
 {
/* Close the VCHI connection - it will also free vchi_ctx->instance */
-   WARN_ON(vchi_disconnect(vchi_ctx->instance));
+   WARN_ON(vchiq_shutdo

[RFC 44/50] staging: vchi: Get rid of vchi_bulk_queue_transmit()

2020-05-27 Thread Nicolas Saenz Julienne
Its vchiq counterpart, vchiq_bulk_transmit() is only used by vchi. We
can then merge both functions by moving vchi_bulk_queue_transmit()'s
retry mechanism into vchiq_bulk_transmit() and let services call the
later.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../bcm2835-audio/bcm2835-vchiq.c |  7 +-
 .../vc04_services/interface/vchi/vchi.h   | 11 
 .../interface/vchiq_arm/vchiq_arm.c   | 38 +++
 .../interface/vchiq_arm/vchiq_shim.c  | 66 ---
 4 files changed, 41 insertions(+), 81 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 55f1e684eef1..28d64bc895cd 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -343,10 +343,9 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream 
*alsa_stream,
count = size;
if (!instance->max_packet) {
/* Send the message to the videocore */
-   status = vchi_bulk_queue_transmit(instance->service_handle,
- src, count,
- VCHIQ_BULK_MODE_BLOCKING,
- NULL);
+   status = vchiq_bulk_transmit(instance->service_handle, src,
+count, NULL,
+VCHIQ_BULK_MODE_BLOCKING);
} else {
while (count > 0) {
int bytes = min(instance->max_packet, count);
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index ca20b99122f2..c800796f9986 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -54,17 +54,6 @@ struct vchiq_header *vchi_msg_hold(unsigned handle);
 // Routine to release a held message after it has been processed
 extern int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header 
*message);
 
-/**
- * Global bulk API
- */
-
-// Routine to queue up data ready for transfer to the other (once they have 
signalled they are ready)
-extern int32_t vchi_bulk_queue_transmit(unsigned handle,
-   const void *data_src,
-   uint32_t data_size,
-   enum vchiq_bulk_mode mode,
-   void *transfer_handle);
-
 /**
  * Configuration plumbing
  */
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 084e98b4ca61..524128225766 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -361,19 +361,31 @@ vchiq_bulk_transmit(unsigned int handle, const void *data,
 {
enum vchiq_status status;
 
-   switch (mode) {
-   case VCHIQ_BULK_MODE_NOCALLBACK:
-   case VCHIQ_BULK_MODE_CALLBACK:
-   status = vchiq_bulk_transfer(handle, (void *)data, size,
-userdata, mode,
-VCHIQ_BULK_TRANSMIT);
-   break;
-   case VCHIQ_BULK_MODE_BLOCKING:
-   status = vchiq_blocking_bulk_transfer(handle,
-   (void *)data, size, VCHIQ_BULK_TRANSMIT);
-   break;
-   default:
-   return VCHIQ_ERROR;
+   while (1) {
+   switch (mode) {
+   case VCHIQ_BULK_MODE_NOCALLBACK:
+   case VCHIQ_BULK_MODE_CALLBACK:
+   status = vchiq_bulk_transfer(handle, (void *)data, size,
+userdata, mode,
+VCHIQ_BULK_TRANSMIT);
+   break;
+   case VCHIQ_BULK_MODE_BLOCKING:
+   status = vchiq_blocking_bulk_transfer(handle,
+   (void *)data, size, VCHIQ_BULK_TRANSMIT);
+   break;
+   default:
+   return VCHIQ_ERROR;
+   }
+
+   /*
+* vchiq_*_bulk_transfer() may return VCHIQ_RETRY, so we need
+* to implement a retry mechanism since this function is
+* supposed to block until queued
+*/
+   if (status != VCHIQ_RETRY)
+   break;

[RFC 50/50] staging: vchiq: Move vchiq.h into include directory

2020-05-27 Thread Nicolas Saenz Julienne
To make the separation clear between vchiq's header files and vchiq.h,
which is to be used by services and is the 'public' API, move it into a
dedicated includes directory.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/Makefile | 2 +-
 drivers/staging/vc04_services/bcm2835-audio/Makefile   | 2 +-
 drivers/staging/vc04_services/bcm2835-audio/bcm2835.h  | 2 +-
 .../{interface/vchiq_arm => include/linux/raspberrypi}/vchiq.h | 0
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h | 2 +-
 .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h| 2 +-
 drivers/staging/vc04_services/vc-sm-cma/Makefile   | 1 -
 drivers/staging/vc04_services/vc-sm-cma/vc_sm.c| 2 +-
 drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c   | 2 +-
 drivers/staging/vc04_services/vchiq-mmal/Makefile  | 1 +
 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c  | 3 +--
 11 files changed, 9 insertions(+), 10 deletions(-)
 rename drivers/staging/vc04_services/{interface/vchiq_arm => 
include/linux/raspberrypi}/vchiq.h (100%)

diff --git a/drivers/staging/vc04_services/Makefile 
b/drivers/staging/vc04_services/Makefile
index e32c0744e7fc..e1de39303ffe 100644
--- a/drivers/staging/vc04_services/Makefile
+++ b/drivers/staging/vc04_services/Makefile
@@ -14,5 +14,5 @@ obj-$(CONFIG_VIDEO_ISP_BCM2835)   += bcm2835-isp/
 obj-$(CONFIG_BCM_VC_SM_CMA)+= vc-sm-cma/
 obj-$(CONFIG_BCM2835_VCHIQ_MMAL)   += vchiq-mmal/
 
-ccflags-y += -D__VCCOREVER__=0x0400
+ccflags-y += -I $(srctree)/$(src)/include  -D__VCCOREVER__=0x0400
 
diff --git a/drivers/staging/vc04_services/bcm2835-audio/Makefile 
b/drivers/staging/vc04_services/bcm2835-audio/Makefile
index 13fa6d7d9745..d59fe4dde615 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/Makefile
+++ b/drivers/staging/vc04_services/bcm2835-audio/Makefile
@@ -2,4 +2,4 @@
 obj-$(CONFIG_SND_BCM2835)  += snd-bcm2835.o
 snd-bcm2835-objs   := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o 
bcm2835-vchiq.o
 
-ccflags-y += -I $(srctree)/$(src)/.. -D__VCCOREVER__=0x0400
+ccflags-y += -I $(srctree)/$(src)/../include -D__VCCOREVER__=0x0400
diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
index ca220f5230ec..1b36475872d6 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
@@ -6,10 +6,10 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include "interface/vchiq_arm/vchiq.h"
 
 #define MAX_SUBSTREAMS   (8)
 #define AVAIL_SUBSTREAMS_MASK  (0xff)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h 
b/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
similarity index 100%
rename from drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
rename to drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 8a27f3d7217e..e67692879249 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -10,10 +10,10 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "vchiq_cfg.h"
 
-#include "vchiq.h"
 
 /* Do this so that we can test-build the code on non-rpi systems */
 #if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index f285d754ad28..3653fd99d8a1 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -5,7 +5,7 @@
 #define VCHIQ_IOCTLS_H
 
 #include 
-#include "vchiq.h"
+#include 
 
 #define VCHIQ_IOC_MAGIC 0xc4
 #define VCHIQ_INVALID_HANDLE (~0)
diff --git a/drivers/staging/vc04_services/vc-sm-cma/Makefile 
b/drivers/staging/vc04_services/vc-sm-cma/Makefile
index 77d173694fbf..c92a5775c62e 100644
--- a/drivers/staging/vc04_services/vc-sm-cma/Makefile
+++ b/drivers/staging/vc04_services/vc-sm-cma/Makefile
@@ -1,6 +1,5 @@
 ccflags-y += \
-I$(srctree)/$(src)/../ \
-   -I$(srctree)/$(src)/../interface/vchi \
-I$(srctree)/$(src)/../interface/vchiq_arm\
-I$(srctree)/$(src)/../include
 
diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c 
b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
index e4f7bdeef66d..cc69ce932317 100644
--- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
+++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
@@ -46,9 +46,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
-#include "vchiq.h"
 #include "vchiq_connected.h"
 #include "vc_sm_cma_vchi.h"
 
diff --git a/drivers/staging/vc04_services/vc-sm

[RFC 48/50] staging: vchiq: Use vchiq.h as the main header file for services

2020-05-27 Thread Nicolas Saenz Julienne
This used to be vchiq_if.h but vchiq.h is more concise for an include
file that will hopefully be in the future in the includes directory.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/bcm2835-audio/bcm2835.h |   2 +-
 .../vc04_services/interface/vchiq_arm/vchiq.h | 107 -
 .../interface/vchiq_arm/vchiq_if.h| 109 --
 .../interface/vchiq_arm/vchiq_ioctl.h |   2 +-
 .../staging/vc04_services/vc-sm-cma/vc_sm.c   |   2 +-
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  |   2 +-
 .../vc04_services/vchiq-mmal/mmal-vchiq.c |   2 +-
 7 files changed, 108 insertions(+), 118 deletions(-)
 delete mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
index a15f251033ac..ca220f5230ec 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
@@ -9,7 +9,7 @@
 #include 
 #include 
 #include 
-#include "interface/vchiq_arm/vchiq_if.h"
+#include "interface/vchiq_arm/vchiq.h"
 
 #define MAX_SUBSTREAMS   (8)
 #define AVAIL_SUBSTREAMS_MASK  (0xff)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
index 57fe7d5e9a85..04b7ff41a025 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
@@ -1,9 +1,108 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
 
-#ifndef VCHIQ_VCHIQ_H
-#define VCHIQ_VCHIQ_H
+#ifndef VCHIQ_H
+#define VCHIQ_H
 
-#include "vchiq_if.h"
+#define VCHIQ_SERVICE_HANDLE_INVALID 0
 
-#endif
+#define VCHIQ_SLOT_SIZE 4096
+#define VCHIQ_MAX_MSG_SIZE  (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header))
+
+#define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \
+   (((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3))
+
+enum vchiq_reason {
+   VCHIQ_SERVICE_OPENED, /* service, -, - */
+   VCHIQ_SERVICE_CLOSED, /* service, -, - */
+   VCHIQ_MESSAGE_AVAILABLE,  /* service, header, -*/
+   VCHIQ_BULK_TRANSMIT_DONE, /* service, -, bulk_userdata */
+   VCHIQ_BULK_RECEIVE_DONE,  /* service, -, bulk_userdata */
+   VCHIQ_BULK_TRANSMIT_ABORTED,  /* service, -, bulk_userdata */
+   VCHIQ_BULK_RECEIVE_ABORTED/* service, -, bulk_userdata */
+};
+
+enum vchiq_status {
+   VCHIQ_ERROR   = -1,
+   VCHIQ_SUCCESS = 0,
+   VCHIQ_RETRY   = 1
+};
+
+enum vchiq_bulk_mode {
+   VCHIQ_BULK_MODE_CALLBACK,
+   VCHIQ_BULK_MODE_BLOCKING,
+   VCHIQ_BULK_MODE_NOCALLBACK,
+   VCHIQ_BULK_MODE_WAITING /* Reserved for internal use */
+};
+
+enum vchiq_service_option {
+   VCHIQ_SERVICE_OPTION_AUTOCLOSE,
+   VCHIQ_SERVICE_OPTION_SLOT_QUOTA,
+   VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA,
+   VCHIQ_SERVICE_OPTION_SYNCHRONOUS,
+   VCHIQ_SERVICE_OPTION_TRACE
+};
+
+struct vchiq_header {
+   /* The message identifier - opaque to applications. */
+   int msgid;
+
+   /* Size of message data. */
+   unsigned int size;
+
+   char data[0];   /* message */
+};
+
+struct vchiq_element {
+   const void __user *data;
+   unsigned int size;
+};
+
+struct vchiq_service_base {
+   int fourcc;
+   enum vchiq_status (*callback)(enum vchiq_reason reason,
+ struct vchiq_header *header,
+ unsigned int handle,
+ void *bulk_userdata);
+   void *userdata;
+};
+
+struct vchiq_service_params {
+   int fourcc;
+   enum vchiq_status (*callback)(enum vchiq_reason reason,
+ struct vchiq_header *header,
+ unsigned int handle,
+ void *bulk_userdata);
+   void *userdata;
+   short version;   /* Increment for non-trivial changes */
+   short version_min;   /* Update for incompatible changes */
+};
+
+struct vchiq_instance;
+
+extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance);
+extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance);
+extern enum vchiq_status vchiq_connect(struct vchiq_instance *instance);
+extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance,
+   const struct vchiq_service_params *params,
+   unsigned int *pservice);
+extern enum vchiq_status vchiq_close_service(unsigned int service);
+extern enum vchiq_status vchiq_use_service(unsigned int service);
+extern enum vchiq_status vchiq_release_service(unsigned int service);
+extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header);
+extern void   vchiq_release_message(unsigned int se

[RFC 43/50] staging: vchi: Get rid of vchi_bulk_queue_receive()

2020-05-27 Thread Nicolas Saenz Julienne
Its vchiq counterpart, vchiq_bulk_receive() is only used by vchi. We can
then merge both functions by moving vchi_bulk_queue_receive()'s retry
mechanism into vchiq_bulk_receive() and let services call the later.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../vc04_services/interface/vchi/vchi.h   |  7 
 .../interface/vchiq_arm/vchiq_arm.c   | 42 ---
 .../interface/vchiq_arm/vchiq_shim.c  | 38 -
 .../vc04_services/vchiq-mmal/mmal-vchiq.c | 20 -
 4 files changed, 37 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index d24e7027c08f..ca20b99122f2 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -58,13 +58,6 @@ extern int32_t vchi_held_msg_release(unsigned handle, struct 
vchiq_header *messa
  * Global bulk API
  */
 
-// Routine to prepare interface for a transfer from the other side
-extern int32_t vchi_bulk_queue_receive(unsigned handle,
-  void *data_dst,
-  uint32_t data_size,
-  enum vchiq_bulk_mode mode,
-  void *transfer_handle);
-
 // Routine to queue up data ready for transfer to the other (once they have 
signalled they are ready)
 extern int32_t vchi_bulk_queue_transmit(unsigned handle,
const void *data_src,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 4d98d4d3ee8a..084e98b4ca61 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -380,24 +380,36 @@ vchiq_bulk_transmit(unsigned int handle, const void *data,
 }
 EXPORT_SYMBOL(vchiq_bulk_transmit);
 
-enum vchiq_status
-vchiq_bulk_receive(unsigned int handle, void *data,
-   unsigned int size, void *userdata, enum vchiq_bulk_mode mode)
+enum vchiq_status vchiq_bulk_receive(unsigned int handle, void *data,
+unsigned int size, void *userdata,
+enum vchiq_bulk_mode mode)
 {
enum vchiq_status status;
 
-   switch (mode) {
-   case VCHIQ_BULK_MODE_NOCALLBACK:
-   case VCHIQ_BULK_MODE_CALLBACK:
-   status = vchiq_bulk_transfer(handle, data, size, userdata,
-mode, VCHIQ_BULK_RECEIVE);
-   break;
-   case VCHIQ_BULK_MODE_BLOCKING:
-   status = vchiq_blocking_bulk_transfer(handle,
-   (void *)data, size, VCHIQ_BULK_RECEIVE);
-   break;
-   default:
-   return VCHIQ_ERROR;
+   while (1) {
+   switch (mode) {
+   case VCHIQ_BULK_MODE_NOCALLBACK:
+   case VCHIQ_BULK_MODE_CALLBACK:
+   status = vchiq_bulk_transfer(handle, data, size, 
userdata,
+mode, VCHIQ_BULK_RECEIVE);
+   break;
+   case VCHIQ_BULK_MODE_BLOCKING:
+   status = vchiq_blocking_bulk_transfer(handle,
+   (void *)data, size, VCHIQ_BULK_RECEIVE);
+   break;
+   default:
+   return VCHIQ_ERROR;
+   }
+
+   /*
+* vchiq_*_bulk_transfer() may return VCHIQ_RETRY, so we need
+* to implement a retry mechanism since this function is
+* supposed to block until queued
+*/
+   if (status != VCHIQ_RETRY)
+   break;
+
+   msleep(1);
}
 
return status;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 52654123463d..f69936a9eb29 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -31,44 +31,6 @@ int vchi_queue_kernel_message(unsigned handle, void *data, 
unsigned int size)
 }
 EXPORT_SYMBOL(vchi_queue_kernel_message);
 
-/***
- * Name: vchi_bulk_queue_receive
- *
- * Arguments:  VCHI_BULK_HANDLE_T handle,
- * void *data_dst,
- * const uint32_t data_size,
- * enum vchi_flags flags
- * void *bulk_handle
- *
- * Description: Routine to setup a rcv buffer
- *
- * Returns: int32_t - success == 0
- *
- ***/
-int32_t vchi_bulk_queue_receive(unsigned handle, void *data_dst,
- 

[RFC 41/50] staging: vchiq: Make vchiq_add_service() local

2020-05-27 Thread Nicolas Saenz Julienne
The function is being exported although there is no use for it outside
of vchiq's core code. Keep it local then.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +--
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h  | 3 ---
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 4230f33ac38a..4d98d4d3ee8a 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -277,7 +277,7 @@ enum vchiq_status vchiq_connect(struct vchiq_instance 
*instance)
 }
 EXPORT_SYMBOL(vchiq_connect);
 
-enum vchiq_status vchiq_add_service(
+static enum vchiq_status vchiq_add_service(
struct vchiq_instance *instance,
const struct vchiq_service_params *params,
unsigned int   *phandle)
@@ -314,7 +314,6 @@ enum vchiq_status vchiq_add_service(
 
return status;
 }
-EXPORT_SYMBOL(vchiq_add_service);
 
 enum vchiq_status vchiq_open_service(
struct vchiq_instance *instance,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index 407e7dc31108..b852980447dc 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -94,9 +94,6 @@ struct vchiq_instance;
 extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance);
 extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance);
 extern enum vchiq_status vchiq_connect(struct vchiq_instance *instance);
-extern enum vchiq_status vchiq_add_service(struct vchiq_instance *instance,
-   const struct vchiq_service_params *params,
-   unsigned int *pservice);
 extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance,
const struct vchiq_service_params *params,
unsigned int *pservice);
-- 
2.26.2

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


[RFC 42/50] staging: vchiq: Move definitions only used by core into core header

2020-05-27 Thread Nicolas Saenz Julienne
vchiq_if.h is used by service consumers and only the exported API should
be present. Move the rest of definitions, which were not exported by the
way, to vchiq_core.h where they belong.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../interface/vchiq_arm/vchiq_core.h  | 22 +++
 .../interface/vchiq_arm/vchiq_if.h| 16 --
 2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index b97b661bea1c..ff91c04ba6b9 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -486,6 +486,18 @@ struct bulk_waiter {
int actual;
 };
 
+struct vchiq_config {
+   unsigned int max_msg_size;
+   unsigned int bulk_threshold; /* The message size above which it
+   is better to use a bulk transfer
+   (<= max_msg_size) */
+   unsigned int max_outstanding_bulks;
+   unsigned int max_services;
+   short version;  /* The version of VCHIQ */
+   short version_min;  /* The minimum compatible version of VCHIQ */
+};
+
+
 extern spinlock_t bulk_waiter_spinlock;
 
 extern int vchiq_core_log_level;
@@ -665,4 +677,14 @@ extern void
 vchiq_log_dump_mem(const char *label, uint32_t addr, const void *voidMem,
size_t numBytes);
 
+extern enum vchiq_status vchiq_remove_service(unsigned int service);
+
+extern int vchiq_get_client_id(unsigned int service);
+
+extern void vchiq_get_config(struct vchiq_config *config);
+
+extern enum vchiq_status
+vchiq_set_service_option(unsigned int service, enum vchiq_service_option 
option,
+int value);
+
 #endif
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index b852980447dc..931debcd6492 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -78,17 +78,6 @@ struct vchiq_service_params {
short version_min;   /* Update for incompatible changes */
 };
 
-struct vchiq_config {
-   unsigned int max_msg_size;
-   unsigned int bulk_threshold; /* The message size above which it
-   is better to use a bulk transfer
-   (<= max_msg_size) */
-   unsigned int max_outstanding_bulks;
-   unsigned int max_services;
-   short version;  /* The version of VCHIQ */
-   short version_min;  /* The minimum compatible version of VCHIQ */
-};
-
 struct vchiq_instance;
 
 extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance);
@@ -98,7 +87,6 @@ extern enum vchiq_status vchiq_open_service(struct 
vchiq_instance *instance,
const struct vchiq_service_params *params,
unsigned int *pservice);
 extern enum vchiq_status vchiq_close_service(unsigned int service);
-extern enum vchiq_status vchiq_remove_service(unsigned int service);
 extern enum vchiq_status vchiq_use_service(unsigned int service);
 extern enum vchiq_status vchiq_release_service(unsigned int service);
 extern enum vchiq_status vchiq_queue_kernel_message(unsigned int handle,
@@ -112,11 +100,7 @@ extern enum vchiq_status vchiq_bulk_transmit(unsigned int 
service,
 extern enum vchiq_status vchiq_bulk_receive(unsigned int service,
void *data, unsigned int size, void *userdata,
enum vchiq_bulk_mode mode);
-extern int   vchiq_get_client_id(unsigned int service);
 extern void *vchiq_get_service_userdata(unsigned int service);
-extern void vchiq_get_config(struct vchiq_config *config);
-extern enum vchiq_status vchiq_set_service_option(unsigned int service,
-   enum vchiq_service_option option, int value);
 extern enum vchiq_status vchiq_get_peer_version(unsigned int handle,
   short *peer_version);
 extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header);
-- 
2.26.2

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


[RFC 40/50] staging: vchiq: Get rid of unnecessary definitions in vchiq_if.h

2020-05-27 Thread Nicolas Saenz Julienne
Those functions don't actually exist, nor have any use, nor the macros.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../interface/vchiq_arm/vchiq_if.h  | 17 -
 1 file changed, 17 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index b3d4c14536bd..407e7dc31108 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -8,11 +8,9 @@
 
 #define VCHIQ_SLOT_SIZE 4096
 #define VCHIQ_MAX_MSG_SIZE  (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header))
-#define VCHIQ_CHANNEL_SIZE  VCHIQ_MAX_MSG_SIZE /* For backwards compatibility 
*/
 
 #define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \
(((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3))
-#define VCHIQ_GET_SERVICE_USERDATA(service) vchiq_get_service_userdata(service)
 
 enum vchiq_reason {
VCHIQ_SERVICE_OPENED, /* service, -, - */
@@ -92,7 +90,6 @@ struct vchiq_config {
 };
 
 struct vchiq_instance;
-typedef void (*vchiq_remote_callback)(void *cb_arg);
 
 extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance);
 extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance);
@@ -118,25 +115,11 @@ extern enum vchiq_status vchiq_bulk_transmit(unsigned int 
service,
 extern enum vchiq_status vchiq_bulk_receive(unsigned int service,
void *data, unsigned int size, void *userdata,
enum vchiq_bulk_mode mode);
-extern enum vchiq_status vchiq_bulk_transmit_handle(unsigned int service,
-   const void *offset, unsigned int size,
-   void *userdata, enum vchiq_bulk_mode mode);
-extern enum vchiq_status vchiq_bulk_receive_handle(unsigned int service,
-   void *offset, unsigned int size, void *userdata,
-   enum vchiq_bulk_mode mode);
 extern int   vchiq_get_client_id(unsigned int service);
 extern void *vchiq_get_service_userdata(unsigned int service);
 extern void vchiq_get_config(struct vchiq_config *config);
 extern enum vchiq_status vchiq_set_service_option(unsigned int service,
enum vchiq_service_option option, int value);
-
-extern enum vchiq_status vchiq_remote_use(struct vchiq_instance *instance,
-   vchiq_remote_callback callback, void *cb_arg);
-extern enum vchiq_status vchiq_remote_release(struct vchiq_instance *instance);
-
-extern enum vchiq_status vchiq_dump_phys_mem(unsigned int service,
-   void *ptr, size_t num_bytes);
-
 extern enum vchiq_status vchiq_get_peer_version(unsigned int handle,
   short *peer_version);
 extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header);
-- 
2.26.2

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


[RFC 45/50] staging: vchi: Move vchi_queue_kernel_message() into vchiq

2020-05-27 Thread Nicolas Saenz Julienne
We can't really merge it with vchiq_queue_message() as it has internal
users that will not benefit from the retry mechanism
vchiq_queue_kernel_message() uses. So, for the sake of getting rid of
vchi, move it into vchiq.

Signed-off-by: Nicolas Saenz Julienne 
---
 .../bcm2835-audio/bcm2835-vchiq.c |  8 +++
 .../vc04_services/interface/vchi/vchi.h   |  4 
 .../interface/vchiq_arm/vchiq_core.c  | 23 ---
 .../interface/vchiq_arm/vchiq_if.h|  4 ++--
 .../interface/vchiq_arm/vchiq_shim.c  | 22 --
 .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c  |  2 +-
 .../vc04_services/vchiq-mmal/mmal-vchiq.c | 14 +--
 7 files changed, 33 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 28d64bc895cd..efaa2ae11f52 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -44,8 +44,8 @@ static int bcm2835_audio_send_msg_locked(struct 
bcm2835_audio_instance *instance
init_completion(&instance->msg_avail_comp);
}
 
-   status = vchi_queue_kernel_message(instance->service_handle,
-  m, sizeof(*m));
+   status = vchiq_queue_kernel_message(instance->service_handle,
+   m, sizeof(*m));
if (status) {
dev_err(instance->dev,
"vchi message queue failed: %d, msg=%d\n",
@@ -350,8 +350,8 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream 
*alsa_stream,
while (count > 0) {
int bytes = min(instance->max_packet, count);
 
-   status = 
vchi_queue_kernel_message(instance->service_handle,
-  src, bytes);
+   status = 
vchiq_queue_kernel_message(instance->service_handle,
+   src, bytes);
src += bytes;
count -= bytes;
}
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index c800796f9986..6de5df43cc29 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -37,10 +37,6 @@ extern int32_t vchi_service_use(unsigned handle);
 // Routine to decrement ref count on a named service
 extern int32_t vchi_service_release(unsigned handle);
 
-/* Routine to send a message from kernel memory across a service */
-extern int vchi_queue_kernel_message(unsigned handle, void *data,
-unsigned int size);
-
 // Routine to look at a message in place.
 // The message is dequeued, so the caller is left holding it; the descriptor is
 // filled in and must be released when the user has finished with the message.
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 01a9331dbff4..ee11707b7476 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -3213,11 +3213,28 @@ vchiq_queue_message(unsigned int handle,
return status;
 }
 
-enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, void 
*context,
- size_t size)
+int vchiq_queue_kernel_message(unsigned handle, void *data, unsigned size)
 {
-   return vchiq_queue_message(handle, memcpy_copy_callback, context, size);
+   enum vchiq_status status;
+
+   while (1) {
+   status = vchiq_queue_message(handle, memcpy_copy_callback,
+data, size);
+
+   /*
+* vchiq_queue_message() may return VCHIQ_RETRY, so we need to
+* implement a retry mechanism since this function is supposed
+* to block until queued
+*/
+   if (status != VCHIQ_RETRY)
+   break;
+
+   msleep(1);
+   }
+
+   return status;
 }
+EXPORT_SYMBOL(vchiq_queue_kernel_message);
 
 void
 vchiq_release_message(unsigned int handle,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index 931debcd6492..6374eda4ea0c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -89,8 +89,8 @@ extern enum vchiq_status vchiq_open_service(struct 
vchiq_instance *instance,
 extern enum vchiq_status vchiq_close_service(unsigned int service);
 extern enum vchiq_status vchiq_use_service(unsigned int service);

[RFC 49/50] staging: vchiq: Move defines into core header

2020-05-27 Thread Nicolas Saenz Julienne
Those are only used in the core vchiq code, while present in vchiq's
'public' API header. Move them into the right place.

Signed-off-by: Nicolas Saenz Julienne 
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h| 5 -
 .../staging/vc04_services/interface/vchiq_arm/vchiq_core.h   | 4 
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
index 04b7ff41a025..cb9ef9a4150b 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h
@@ -4,11 +4,6 @@
 #ifndef VCHIQ_H
 #define VCHIQ_H
 
-#define VCHIQ_SERVICE_HANDLE_INVALID 0
-
-#define VCHIQ_SLOT_SIZE 4096
-#define VCHIQ_MAX_MSG_SIZE  (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header))
-
 #define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \
(((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3))
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 15e9867f78f4..8a27f3d7217e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -26,6 +26,10 @@
 
 #endif /* IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) */
 
+#define VCHIQ_SERVICE_HANDLE_INVALID 0
+
+#define VCHIQ_SLOT_SIZE 4096
+#define VCHIQ_MAX_MSG_SIZE  (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header))
 
 /* Run time control of log level, based on KERN_XXX level. */
 #define VCHIQ_LOG_DEFAULT  4
-- 
2.26.2

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


Re: [PATCH 00/10] staging: wfx: introduce nl80211 vendor extensions

2020-05-27 Thread Kalle Valo
Jerome Pouiller  writes:

> This series introduces some nl80211 vendor extensions to the wfx driver.
>
> This series may lead to some discussions:
>
>   1. Patch 7 allows to change the dynamic PS timeout. I have found
>  an API in wext (cfg80211_wext_siwpower()) that do more or less the
>  same thing. However, I have not found any equivalent in nl80211. Is it
>  expected or this API should be ported to nl80211?

struct wireless_dev::ps_timeout doesn't work for you?

>
>   2. The device The device allows to do Packet Traffic Arbitration (PTA or
>  also Coex). This feature allows the device to communicate with another
>  RF device in order to share the access to the RF. The patch 9 provides
>  a way to configure that. However, I think that this chip is not the
>  only one to provide this feature. Maybe a standard way to change
>  these parameters should be provided?
>
>   3. For these vendor extensions, I have used the new policy introduced by
>  the commit 901bb989185516 ("nl80211: require and validate vendor
>  command policy"). However, it seems that my version of 'iw' is not
>  able to follow this new policy (it does not pack the netlink
>  attributes into a NLA_NESTED). I could develop a tool specifically for
>  that API, but it is not very handy. So, in patch 10, I have also
>  introduced an API for compatibility with iw. Any comments about this?

If you want the driver out of staging I recommend not adding any vendor
commands until the driver is moved to drivers/net/wireless. Also do note
that we have special rules for nl80211 vendor commands:

https://wireless.wiki.kernel.org/en/developers/documentation/nl80211#vendor-specific_api

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/10] staging: wfx: introduce nl80211 vendor extensions

2020-05-27 Thread Jérôme Pouiller
On Wednesday 27 May 2020 14:34:37 CEST Kalle Valo wrote:
> Jerome Pouiller  writes:
> 
> > This series introduces some nl80211 vendor extensions to the wfx driver.
> >
> > This series may lead to some discussions:
> >
> >   1. Patch 7 allows to change the dynamic PS timeout. I have found
> >  an API in wext (cfg80211_wext_siwpower()) that do more or less the
> >  same thing. However, I have not found any equivalent in nl80211. Is it
> >  expected or this API should be ported to nl80211?
> 
> struct wireless_dev::ps_timeout doesn't work for you?

Indeed, cfg80211_wext_siwpower() modify wireless_dev::ps_timeout, but
there is no equivalent in nl80211, no?

Else, I choose to not directly change wireless_dev::ps_timeout because I
worried about interactions with other parts of cfg80211/mac80211.


> >
> >   2. The device The device allows to do Packet Traffic Arbitration (PTA or
> >  also Coex). This feature allows the device to communicate with another
> >  RF device in order to share the access to the RF. The patch 9 provides
> >  a way to configure that. However, I think that this chip is not the
> >  only one to provide this feature. Maybe a standard way to change
> >  these parameters should be provided?
> >
> >   3. For these vendor extensions, I have used the new policy introduced by
> >  the commit 901bb989185516 ("nl80211: require and validate vendor
> >  command policy"). However, it seems that my version of 'iw' is not
> >  able to follow this new policy (it does not pack the netlink
> >  attributes into a NLA_NESTED). I could develop a tool specifically for
> >  that API, but it is not very handy. So, in patch 10, I have also
> >  introduced an API for compatibility with iw. Any comments about this?
> 
> If you want the driver out of staging I recommend not adding any vendor
> commands until the driver is moved to drivers/net/wireless. Also do note
> that we have special rules for nl80211 vendor commands:
> 
> https://wireless.wiki.kernel.org/en/developers/documentation/nl80211#vendor-specific_api

I hoped to suggest the move of this driver outside of staging in some
weeks (the last items in TODO list are either non-essential or easy to
fix). So, you suggest me to resend these patches after that change?

-- 
Jérôme Pouiller


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


Spende

2020-05-27 Thread Mrs.Judith Rice
Attn:

Es tut uns leid, dass wir Sie aufgrund eines Mismanagent of Beneficaries-Fonds 
von unseren ernannten Zonal Managern verspätet kontaktiert haben. Bitte 
beachten Sie, dass Sie qualifiziert sind, die Zahlung von 900.000,00 USD an der 
ATM-Karte mit neunhunderttausend Dollar zu erhalten.

Als Entschädigung von WORLD BANK / IWF (Internationaler 
Währungsfonds) für die automatisch über einen 
E-Mail-Wahlautomaten gezogenen, die in der Vergangenheit noch nicht 
abgeschlossene Transaktionen hatten.

Für weitere Informationen kontaktieren Sie bitte Rev.EVANS JONES ( 
jonesevan...@gmail.com )

Bitte senden Sie ihm Ihre persönlichen Daten wie:

Vollständiger Name:
Wohnanschrift:
Telefonnummer:
Herkunftsland:

Grüße,
Mrs. Judith Rice

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


Spende

2020-05-27 Thread Mrs.Judith Rice
Attn:

Es tut uns leid, dass wir Sie aufgrund eines Mismanagent of Beneficaries-Fonds 
von unseren ernannten Zonal Managern verspätet kontaktiert haben. Bitte 
beachten Sie, dass Sie qualifiziert sind, die Zahlung von 900.000,00 USD an der 
ATM-Karte mit neunhunderttausend Dollar zu erhalten.

Als Entschädigung von WORLD BANK / IWF (Internationaler 
Währungsfonds) für die automatisch über einen 
E-Mail-Wahlautomaten gezogenen, die in der Vergangenheit noch nicht 
abgeschlossene Transaktionen hatten.

Für weitere Informationen kontaktieren Sie bitte Rev.EVANS JONES ( 
jonesevan...@gmail.com )

Bitte senden Sie ihm Ihre persönlichen Daten wie:

Vollständiger Name:
Wohnanschrift:
Telefonnummer:
Herkunftsland:

Grüße,
Mrs. Judith Rice

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


[PATCH v4] drivers: most: add USB adapter driver

2020-05-27 Thread Christian Gromm
This patch adds the usb driver source file most_usb.c and
modifies the Makefile and Kconfig accordingly.

Signed-off-by: Christian Gromm 
---
v2:
Reported-by: Greg Kroah-Hartman 
- don't remove usb driver from staging area
- don't touch staging/most/Kconfig
- remove subdirectory for USB driver and put source file into
  drivers/most
v3:
- submitted fixes found during code audit to staging version
  first to be able to resend single patch that adds the driver
v4:
Reported-by: Dan Carpenter 

submitted patch set that fixes issues found during code audit
to staging version first to be able to resend single patch that
adds the driver. The patch series included:

- use function sysfs_streq
- add missing put_device calls
- use correct error codes
- replace code to calculate array index
- don't use error path to exit function on success
- move allocation of URB out of critical section
- return 0 instead of variable
- change return value of function drci_rd_reg
- don't use expressions that might fail in a declaration
- change order of function parameters

 drivers/most/Kconfig|   12 +
 drivers/most/Makefile   |2 +
 drivers/most/most_usb.c | 1169 +++
 3 files changed, 1183 insertions(+)
 create mode 100644 drivers/most/most_usb.c

diff --git a/drivers/most/Kconfig b/drivers/most/Kconfig
index 58d7999..7b65320 100644
--- a/drivers/most/Kconfig
+++ b/drivers/most/Kconfig
@@ -13,3 +13,15 @@ menuconfig MOST
  module will be called most_core.
 
  If in doubt, say N here.
+
+if MOST
+config MOST_USB_HDM
+   tristate "USB"
+   depends on USB && NET
+   help
+ Say Y here if you want to connect via USB to network transceiver.
+ This device driver depends on the networking AIM.
+
+ To compile this driver as a module, choose M here: the
+ module will be called most_usb.
+endif
diff --git a/drivers/most/Makefile b/drivers/most/Makefile
index e810cd3..6a3cb90 100644
--- a/drivers/most/Makefile
+++ b/drivers/most/Makefile
@@ -2,3 +2,5 @@
 obj-$(CONFIG_MOST) += most_core.o
 most_core-y := core.o \
configfs.o
+
+obj-$(CONFIG_MOST_USB_HDM) += most_usb.o
diff --git a/drivers/most/most_usb.c b/drivers/most/most_usb.c
new file mode 100644
index 000..df5876c
--- /dev/null
+++ b/drivers/most/most_usb.c
@@ -0,0 +1,1169 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * usb.c - Hardware dependent module for USB
+ *
+ * Copyright (C) 2013-2015 Microchip Technology Germany II GmbH & Co. KG
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USB_MTU512
+#define NO_ISOCHRONOUS_URB 0
+#define AV_PACKETS_PER_XACT2
+#define BUF_CHAIN_SIZE 0x
+#define MAX_NUM_ENDPOINTS  30
+#define MAX_SUFFIX_LEN 10
+#define MAX_STRING_LEN 80
+#define MAX_BUF_SIZE   0x
+
+#define USB_VENDOR_ID_SMSC 0x0424  /* VID: SMSC */
+#define USB_DEV_ID_BRDG0xC001  /* PID: USB Bridge */
+#define USB_DEV_ID_OS81118 0xCF18  /* PID: USB OS81118 */
+#define USB_DEV_ID_OS81119 0xCF19  /* PID: USB OS81119 */
+#define USB_DEV_ID_OS81210 0xCF30  /* PID: USB OS81210 */
+/* DRCI Addresses */
+#define DRCI_REG_NI_STATE  0x0100
+#define DRCI_REG_PACKET_BW 0x0101
+#define DRCI_REG_NODE_ADDR 0x0102
+#define DRCI_REG_NODE_POS  0x0103
+#define DRCI_REG_MEP_FILTER0x0140
+#define DRCI_REG_HASH_TBL0 0x0141
+#define DRCI_REG_HASH_TBL1 0x0142
+#define DRCI_REG_HASH_TBL2 0x0143
+#define DRCI_REG_HASH_TBL3 0x0144
+#define DRCI_REG_HW_ADDR_HI0x0145
+#define DRCI_REG_HW_ADDR_MI0x0146
+#define DRCI_REG_HW_ADDR_LO0x0147
+#define DRCI_REG_BASE  0x1100
+#define DRCI_COMMAND   0x02
+#define DRCI_READ_REQ  0xA0
+#define DRCI_WRITE_REQ 0xA1
+
+/**
+ * struct most_dci_obj - Direct Communication Interface
+ * @kobj:position in sysfs
+ * @usb_device: pointer to the usb device
+ * @reg_addr: register address for arbitrary DCI access
+ */
+struct most_dci_obj {
+   struct device dev;
+   struct usb_device *usb_device;
+   u16 reg_addr;
+};
+
+#define to_dci_obj(p) container_of(p, struct most_dci_obj, dev)
+
+struct most_dev;
+
+struct clear_hold_work {
+   struct work_struct ws;
+   struct most_dev *mdev;
+   unsigned int channel;
+   int pipe;
+};
+
+#define to_clear_hold_work(w) container_of(w, struct clear_hold_work, ws)
+
+/**
+ * struct most_dev - holds all usb interface specific stuff
+ * @usb_device: pointer to usb device
+ * @iface: hardware interface
+ * @cap: channel capabilities
+ * @conf: channel configuration
+ * @dci: direct communication in

Re: [PATCH v4] drivers: most: add USB adapter driver

2020-05-27 Thread Dan Carpenter
On Wed, May 27, 2020 at 03:14:28PM +0200, Christian Gromm wrote:
> This patch adds the usb driver source file most_usb.c and
> modifies the Makefile and Kconfig accordingly.
> 
> Signed-off-by: Christian Gromm 
> ---
> v2:
> Reported-by: Greg Kroah-Hartman 
> - don't remove usb driver from staging area
> - don't touch staging/most/Kconfig
> - remove subdirectory for USB driver and put source file into
>   drivers/most
> v3:
> - submitted fixes found during code audit to staging version
>   first to be able to resend single patch that adds the driver
> v4:
> Reported-by: Dan Carpenter 
>   
> submitted patch set that fixes issues found during code audit
>   to staging version first to be able to resend single patch that
>   adds the driver. The patch series included:
> 
>   - use function sysfs_streq
>   - add missing put_device calls
>   - use correct error codes
>   - replace code to calculate array index
>   - don't use error path to exit function on success
>   - move allocation of URB out of critical section
>   - return 0 instead of variable
>   - change return value of function drci_rd_reg
>   - don't use expressions that might fail in a declaration
>   - change order of function parameters

Thanks for doing this.  I'm sorry that I am behind on reviewing code so
I hadn't gotten to that patchset yet.

> +static unsigned int get_stream_frame_size(struct device *dev,
> +   struct most_channel_config *cfg)
> +{
> + unsigned int frame_size;
> + unsigned int sub_size = cfg->subbuffer_size;
> +
> + if (!sub_size) {
> + dev_warn(dev, "Misconfig: Subbuffer size zero.\n");
> + return 0;
> + }
> + switch (cfg->data_type) {
> + case MOST_CH_ISOC:
> + frame_size = AV_PACKETS_PER_XACT * sub_size;
> + break;
> + case MOST_CH_SYNC:
> + if (cfg->packets_per_xact == 0) {
> + dev_warn(dev, "Misconfig: Packets per XACT zero\n");
> + frame_size = 0;
> + } else if (cfg->packets_per_xact == 0xFF) {
> + frame_size = (USB_MTU / sub_size) * sub_size;
> + } else {
> + frame_size = cfg->packets_per_xact * sub_size;
> + }
> + break;
> + default:
> + dev_warn(dev, "Query frame size of non-streaming channel\n");
> + break;

frame_size isn't initialized on this path.

> + }
> + return frame_size;
> +}

regards,
dan carpenter

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


Spende

2020-05-27 Thread Mrs.Judith Rice
Attn:

Es tut uns leid, dass wir Sie aufgrund eines Mismanagent of Beneficaries-Fonds 
von unseren ernannten Zonal Managern verspätet kontaktiert haben. Bitte 
beachten Sie, dass Sie qualifiziert sind, die Zahlung von 900.000,00 USD an der 
ATM-Karte mit neunhunderttausend Dollar zu erhalten.

Als Entschädigung von WORLD BANK / IWF (Internationaler 
Währungsfonds) für die automatisch über einen 
E-Mail-Wahlautomaten gezogenen, die in der Vergangenheit noch nicht 
abgeschlossene Transaktionen hatten.

Für weitere Informationen kontaktieren Sie bitte Rev.EVANS JONES ( 
jonesevan...@gmail.com )

Bitte senden Sie ihm Ihre persönlichen Daten wie:

Vollständiger Name:
Wohnanschrift:
Telefonnummer:
Herkunftsland:

Grüße,
Mrs. Judith Rice

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


PLEASE I NEED YOUR HELP.

2020-05-27 Thread Irene Zakari
你好  ..

你那边怎么样我希望你一切都好吗?
我叫艾琳女士。 (28岁),我是妻子冈比亚的寡妇
的后期工程。伯纳德·巴卡里·扎卡里亚(Bernard Bakary Zakaria)。 Bajam Enterprise主管
(冈比亚的建筑公司)也是Bernard的首席执行官
进出口(GAMBIA)。

事实上,我丈夫为此死于冠状病毒19
他前往法国正式旅行之后的日期为2019年12月5日
见面后,他带着我2岁零6个月的女儿离开了我,
在我丈夫因冠状病毒19死亡后,他的兄弟(
我已故的购销销售经理
丈夫公司(詹姆斯·托昆博·奥里亚德·扎卡里亚先生)想要
将我已故丈夫的所有财产和资源转换成他的
帐户,由于这个原因,我确实有一个与我吵架的男孩
他,这使他对我发火
雇用刺客杀死我的程度,但我要荣耀归我
前往另一个名为布基纳法索的国家成功
我们住在教堂里过着我们亲爱的生活。
老实说,即使在布基纳法索,我们的确过着令人恐惧的生活,因为
那些刺客追击我们。

实际上,我想与您讨论的是关于我的个人问题
关注我已故丈夫存入我以外银行的资金
国家伦敦以我的名义成为价值450万美元的近亲
美国美元,
我需要您的帮助,以帮助我将这些钱转入您的
帐户,并将这些资金投资到您的国家/地区,因为我想要这些
汇入国外的钱
我已经通过邮件通知银行我的死亡
丈夫和我的目标是将这些资金转入另一个帐户
他们为他的死感到惊讶,他们向我证实了我的
丈夫是他们的好顾客,他们也向我证实
有一个我名字的亲戚账户,他们告诉我
介绍一个代表我作为我的受托人和我的受托人的人
他们将这些资金转入我的任何帐户的合作伙伴
选择,

请让我帮助您成为我的受托人和我的合伙人
银行会将这些资金转入您的帐户,以便我们
可以来贵国重获自由,请不要
想要任何会伤害到我的人

请帮助我,我对你很真诚,我想成为你的一员
如果您不介意接受我们并带领我们走向更好的家庭
贵国的未来。

因此,我将给您银行联系方式和其他必要的
如果您只答应我将在我的下一封电子邮件中提供信息,
不/从未背叛我或出于安全目的向任何人透露此事
因为这些钱是我生存的唯一希望
自从我失去丈夫以来,我和女儿一起来到了地球。

此外,在我向您发送银行和帐户详细信息之前,我需要
您可以在下面向我发送您的数据,以便我完全确定自己是
不信任错误的人。
而且,这也使我能够为您发送银行联系方式
与他们沟通以进行更多验证并让您确认
从银行那里获得有关这笔资金的信息。和
更好地了解您,我将给您总数的25%
转移后的钱作为补偿


1.全名:
2.地址:..
3.国籍:...性别
4.年龄:.出生日期:.
5.职业:..。
.
6.电话:.传真:.
7.原产国:...国家:..
8.职业:..。

9.婚姻状况...电子邮件地址:
10.扫描您的身份证或驾驶执照/照片的副本:
宣言:

同时,您可以通过我的牧师与我联系,他的名字叫保罗牧师。
每当您打电话时,告诉他您想和我说话,因为
现在我住在布基纳法索的教堂里,我不
想要再呆在这里,他的电话是这个(+226 75213646)

我将在这里停止,我将等待您的回复,随时可以
询问任何您想知道的关于我的信息,并将您的数据作为我发送给我
要求,以便我可以向您发送带有该帐户的银行信息
详细信息,以便您向银行确认,

请帮助我,我将不胜感激
祝你有美好的一天。
从艾琳


Hello  ..

How do you do over there? I hope you are doing well?
My name is Madam Irene. (28 years old ), i am a widow from Gambia, the wife
of late Eng. Bernard Bakary Zakaria. the Director of Bajam Enterprise
(Building Construction Company in Gambia) also the CEO of Bernard
Import and Export (GAMBIA).

As a matter of fact my husband died due to the Coronal virus19 on this
date 5th of December 2019 after he traveled to France for an official
meeting and he left me with our 2years and 6 months daughter,
After the death of my husband  as a result of Coronal-virus 19, his brother (My
Husband brother ) who is the purchasing and marketing sale manager of my late
Husbands company named (Mr. James Tokunbo Oriade Zakaria) wanted to
convert all the properties and resources of my late Husband into his
account and due to that i did have a male child which i quarreled with
him and it made him to lay his anger on me to
the extent of hiring an assassins to kill me but to God be the glory i
succeeded by making my way to another country called  Burkina faso
where we are living in a church  for our dear life.
Honestly we do live a fearful life even here in Burkina faso because
of those Assassins coming after us .

Actually what I want to discuss with you is about my personal issue
concern the  fund that  my late Husband deposited in a bank outside my
country London on my name as the next of kins worth $4.5 Million
united state dollars ,
I need your assistance to help me to transfer these money into your
account and to invest these funds in your country as i want these
money to be transferred into foreign country
I  have already  notified  the bank on mail about the death of my
Husband and my aim to transfer these fund into another account which
they were  surprise for his death and they confirmed to me that my
Husband  was their good customer and they also confirmed to me that
there is an account on my name as the next of kins and they told me to
present someone who will stand on my behalf as my  trustee and my
partner for them to transfer these money into any account of my
choice,

Please i want you to help me to stand as my trustee and my partner so
that the bank will transfer these money into your account so that we
can come over to your country  to regain our freedom please i dont
want anything that will harm this my duaghter

Please help me, I am sincere to you and I want to be member of your
family as well if you wouldn't mind to accept us and lead us  to a  better
future in your country.

Therefore, I shall give you the bank contact and other necessary
information in my next email if you will only promise me that you will
not/never betray me  or disclosed this matter to anybody for security
reason becuase  these money is the only hope i have for survival on
earth with my daughter since I have lost my Husband.

Moreover before i send you the bank and account details i will like
you to send me your data below so that i will be fully sure that i am
not trusting the wrong person.
and it will also give me the mind to send you the bank contact for you
to communicate with them for more verification and for you to confirm
from the bank about this fund. and
to know you more better and i shall give you 25 percent of the total
money after the the transfer as as a compensation


1. Full Name: 
2. Address: 

Re: [PATCH 0/7] media: atomisp: Address several clang warnings

2020-05-27 Thread Nathan Chancellor
On Wed, May 27, 2020 at 10:45:25AM +0200, Mauro Carvalho Chehab wrote:
> Em Wed, 27 May 2020 00:11:43 -0700
> Nathan Chancellor  escreveu:
> 
> > Hi all,
> > 
> > This series aims to clean up the code while addressing the majority of
> > clang warnings in this driver, some found by the 0day bot and others
> > found by me.
> > 
> > There are several enum conversion warnings that happen, which I do not
> > really know how to solve without understanding how exactly this driver
> > works. I would appreciate some guidance or a solution. Below are the
> > warnings, sorry for not wrapping them but they would be hard to read
> > otherwise.
> 
> ... 
> > ../drivers/staging/media/atomisp//pci/atomisp_compat_css20.h:117:22: note: 
> > expanded from macro 'CSS_ID'
> > #define CSS_ID(val) (IA_ ## val)
> ...
> 
> I actually wrote a patch getting rid of this ugly thing:
> 
>   
> https://git.linuxtv.org/mchehab/experimental.git/commit/?h=atomisp_v3&id=cf6a15543ace1e99364911c0b7a2f6b8f2f43021
> 
> This one was already submitted upstream (not merged yet), but there
> are also lots of other patches on my working tree.

Ah excellent, that makes the warnings a lot more readable. I am still
not sure how to reconcile the differences, it might be easier to just
change the types in the struct to int.

../drivers/staging/media/atomisp/pci/atomisp_subdev.c:49:68: warning: implicit 
conversion from enumeration type 'enum ia_css_frame_format' to different 
enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
{ V4L2_MBUS_FMT_CUSTOM_NV21, 12, 12, IA_CSS_FRAME_FORMAT_NV21, 0, 
IA_CSS_FRAME_FORMAT_NV21 },
~ 
^~~~
../drivers/staging/media/atomisp/pci/atomisp_subdev.c:49:39: warning: implicit 
conversion from enumeration type 'enum ia_css_frame_format' to different 
enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
{ V4L2_MBUS_FMT_CUSTOM_NV21, 12, 12, IA_CSS_FRAME_FORMAT_NV21, 0, 
IA_CSS_FRAME_FORMAT_NV21 },
~^~~~
../drivers/staging/media/atomisp/pci/atomisp_subdev.c:48:68: warning: implicit 
conversion from enumeration type 'enum ia_css_frame_format' to different 
enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
{ V4L2_MBUS_FMT_CUSTOM_NV12, 12, 12, IA_CSS_FRAME_FORMAT_NV12, 0, 
IA_CSS_FRAME_FORMAT_NV12 },
~ 
^~~~
../drivers/staging/media/atomisp/pci/atomisp_subdev.c:48:39: warning: implicit 
conversion from enumeration type 'enum ia_css_frame_format' to different 
enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
{ V4L2_MBUS_FMT_CUSTOM_NV12, 12, 12, IA_CSS_FRAME_FORMAT_NV12, 0, 
IA_CSS_FRAME_FORMAT_NV12 },
~^~~~
../drivers/staging/media/atomisp/pci/atomisp_subdev.c:47:34: warning: implicit 
conversion from enumeration type 'enum ia_css_frame_format' to different 
enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
{ MEDIA_BUS_FMT_JPEG_1X8, 8, 8, IA_CSS_FRAME_FORMAT_BINARY_8, 0, 
ATOMISP_INPUT_FORMAT_BINARY_8 },
~   ^~~~
5 warnings generated.

> I'll try to apply your patch series on it, once I'll be able to
> fix a bug with mmap support.

It looks like all of them apply to your experimental branch aside from
patch 3, which you handled in a different way.

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


Re: [PATCH 0/7] media: atomisp: Address several clang warnings

2020-05-27 Thread Mauro Carvalho Chehab
Em Wed, 27 May 2020 09:45:21 -0700
Nathan Chancellor  escreveu:

> On Wed, May 27, 2020 at 10:45:25AM +0200, Mauro Carvalho Chehab wrote:
> > Em Wed, 27 May 2020 00:11:43 -0700
> > Nathan Chancellor  escreveu:
> >   
> > > Hi all,
> > > 
> > > This series aims to clean up the code while addressing the majority of
> > > clang warnings in this driver, some found by the 0day bot and others
> > > found by me.
> > > 
> > > There are several enum conversion warnings that happen, which I do not
> > > really know how to solve without understanding how exactly this driver
> > > works. I would appreciate some guidance or a solution. Below are the
> > > warnings, sorry for not wrapping them but they would be hard to read
> > > otherwise.  
> > 
> > ...   
> > > ../drivers/staging/media/atomisp//pci/atomisp_compat_css20.h:117:22: 
> > > note: expanded from macro 'CSS_ID'
> > > #define CSS_ID(val) (IA_ ## val)  
> > ...
> > 
> > I actually wrote a patch getting rid of this ugly thing:
> > 
> > 
> > https://git.linuxtv.org/mchehab/experimental.git/commit/?h=atomisp_v3&id=cf6a15543ace1e99364911c0b7a2f6b8f2f43021
> > 
> > This one was already submitted upstream (not merged yet), but there
> > are also lots of other patches on my working tree.  
> 
> Ah excellent, that makes the warnings a lot more readable. I am still
> not sure how to reconcile the differences, it might be easier to just
> change the types in the struct to int.
> 
> ../drivers/staging/media/atomisp/pci/atomisp_subdev.c:49:68: warning: 
> implicit conversion from enumeration type 'enum ia_css_frame_format' to 
> different enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
> { V4L2_MBUS_FMT_CUSTOM_NV21, 12, 12, IA_CSS_FRAME_FORMAT_NV21, 0, 
> IA_CSS_FRAME_FORMAT_NV21 },
> ~ 
> ^~~~
> ../drivers/staging/media/atomisp/pci/atomisp_subdev.c:49:39: warning: 
> implicit conversion from enumeration type 'enum ia_css_frame_format' to 
> different enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
> { V4L2_MBUS_FMT_CUSTOM_NV21, 12, 12, IA_CSS_FRAME_FORMAT_NV21, 0, 
> IA_CSS_FRAME_FORMAT_NV21 },
> ~^~~~
> ../drivers/staging/media/atomisp/pci/atomisp_subdev.c:48:68: warning: 
> implicit conversion from enumeration type 'enum ia_css_frame_format' to 
> different enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
> { V4L2_MBUS_FMT_CUSTOM_NV12, 12, 12, IA_CSS_FRAME_FORMAT_NV12, 0, 
> IA_CSS_FRAME_FORMAT_NV12 },
> ~ 
> ^~~~
> ../drivers/staging/media/atomisp/pci/atomisp_subdev.c:48:39: warning: 
> implicit conversion from enumeration type 'enum ia_css_frame_format' to 
> different enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
> { V4L2_MBUS_FMT_CUSTOM_NV12, 12, 12, IA_CSS_FRAME_FORMAT_NV12, 0, 
> IA_CSS_FRAME_FORMAT_NV12 },
> ~^~~~
> ../drivers/staging/media/atomisp/pci/atomisp_subdev.c:47:34: warning: 
> implicit conversion from enumeration type 'enum ia_css_frame_format' to 
> different enumeration type 'enum atomisp_input_format' [-Wenum-conversion]
> { MEDIA_BUS_FMT_JPEG_1X8, 8, 8, IA_CSS_FRAME_FORMAT_BINARY_8, 0, 
> ATOMISP_INPUT_FORMAT_BINARY_8 },
> ~   ^~~~
> 5 warnings generated.

Well, I guess we should just get rid of the duplication there,

> 
> > I'll try to apply your patch series on it, once I'll be able to
> > fix a bug with mmap support.  
> 
> It looks like all of them apply to your experimental branch aside from
> patch 3, which you handled in a different way.

Ok. I'll apply your patch series on my tree.

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


Re: [PATCH] staging: rtl8723bs: Use shared header constants

2020-05-27 Thread Dan Carpenter
On Sat, May 23, 2020 at 10:29:19PM +0100, Pascal Terjan wrote:
> This is one of the 9 drivers redefining rfc1042_header.
> 

This is how the patch looks like in my email client:

https://marc.info/?l=linux-driver-devel&m=159026973821890&w=2

Do you see how the subject is far away from the body of the commit
message?  I normally only read the subject or the body when I'm
reviewing patches so it's good if the body is clear on its own.  Maybe
write something like:

"This driver creates a local definitions of "rtw_rfc1042_header" and
"rtw_bridge_tunnel_header" but it should just use the standard definitions
from cfg80211.h."

>  void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
> @@ -1625,11 +1622,11 @@ sint wlanhdr_to_ethhdr(union recv_frame *precvframe)
>   psnap_type = ptr+pattrib->hdrlen + pattrib->iv_len+SNAP_SIZE;
>   /* convert hdr + possible LLC headers into Ethernet header */
>   /* eth_type = (psnap_type[0] << 8) | psnap_type[1]; */
> - if ((!memcmp(psnap, rtw_rfc1042_header, SNAP_SIZE) &&
> - (memcmp(psnap_type, SNAP_ETH_TYPE_IPX, 2)) &&
> - (memcmp(psnap_type, SNAP_ETH_TYPE_APPLETALK_AARP, 2))) ||
> - /* eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) || */
> -  !memcmp(psnap, rtw_bridge_tunnel_header, SNAP_SIZE)) {
> + if ((!memcmp(psnap, rfc1042_header, SNAP_SIZE) &&
> +  memcmp(psnap_type, SNAP_ETH_TYPE_IPX, 2) &&
> +  memcmp(psnap_type, SNAP_ETH_TYPE_APPLETALK_AARP, 2)) ||
> + /* eth_type != ETH_P_AARP && eth_type != ETH_P_IPX) || */
> + !memcmp(psnap, bridge_tunnel_header, SNAP_SIZE)) {
>   /* remove RFC1042 or Bridge-Tunnel encapsulation and replace 
> EtherType */
>   bsnaphdr = true;

Your indenting is correct, but I would probably do that in a separate
patch.  It makes it harder to review.  Also probably delete the
commented out code.  Do you see how if we don't touch the indenting then
it doesn't raise the question about if we should delete the comments as
well?

regards,
dan carpenter

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


[driver-core:readfile] BUILD SUCCESS 7a5125bbbabf1d3655640e59db556fb2aefaec6a

2020-05-27 Thread kbuild test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git  readfile
branch HEAD: 7a5125bbbabf1d3655640e59db556fb2aefaec6a  readfile: add 
test_readfile

elapsed time: 1188m

configs tested: 102
configs skipped: 1

The following configs have been built successfully.
More configs may be tested in the coming days.

arm defconfig
arm   allnoconfig
arm  allyesconfig
arm  allmodconfig
arm64allyesconfig
arm64   defconfig
arm64allmodconfig
arm64 allnoconfig
mipsmalta_kvm_guest_defconfig
arm socfpga_defconfig
nds32 allnoconfig
mips  malta_defconfig
arc  alldefconfig
arm orion5x_defconfig
i386  allnoconfig
i386 allyesconfig
i386defconfig
i386  debian-10.3
ia64defconfig
ia64  allnoconfig
ia64 allmodconfig
ia64 allyesconfig
m68k allmodconfig
m68k  allnoconfig
m68k   sun3_defconfig
m68kdefconfig
m68k allyesconfig
nios2   defconfig
nios2allyesconfig
openriscdefconfig
c6x  allyesconfig
c6x   allnoconfig
nds32   defconfig
csky allyesconfig
cskydefconfig
alpha   defconfig
alphaallyesconfig
xtensa  defconfig
xtensa   allyesconfig
h8300allyesconfig
h8300allmodconfig
arc defconfig
arc  allyesconfig
sh   allmodconfig
shallnoconfig
microblazeallnoconfig
openrisc allyesconfig
mips allyesconfig
mips  allnoconfig
mips allmodconfig
pariscallnoconfig
parisc  defconfig
parisc   allyesconfig
parisc   allmodconfig
powerpc  allyesconfig
powerpc  rhel-kconfig
powerpc  allmodconfig
powerpc   allnoconfig
powerpc defconfig
x86_64   randconfig-a006-20200527
x86_64   randconfig-a002-20200527
x86_64   randconfig-a005-20200527
x86_64   randconfig-a003-20200527
x86_64   randconfig-a004-20200527
x86_64   randconfig-a001-20200527
i386 randconfig-a001-20200527
i386 randconfig-a004-20200527
i386 randconfig-a003-20200527
i386 randconfig-a006-20200527
i386 randconfig-a002-20200527
i386 randconfig-a005-20200527
i386 randconfig-a013-20200527
i386 randconfig-a015-20200527
i386 randconfig-a012-20200527
i386 randconfig-a011-20200527
i386 randconfig-a016-20200527
i386 randconfig-a014-20200527
riscvallyesconfig
riscv allnoconfig
riscv   defconfig
riscvallmodconfig
s390  allnoconfig
s390defconfig
s390 allyesconfig
s390 allmodconfig
sparcallyesconfig
sparc   defconfig
sparc64 defconfig
sparc64   allnoconfig
sparc64  allyesconfig
sparc64  allmodconfig
umallnoconfig
um  defconfig
um   allyesconfig
um   allmodconfig
x86_64   rhel-7.6
x86_64rhel-7.6-kselftests
x86_64   rhel
x86_64 rhel-7.2-clear
x86_64lkp
x86_64  fedora-25
x86_64

[PATCH] staging: gasket: Convert get_user_pages*() --> pin_user_pages*()

2020-05-27 Thread Souptick Joarder
This code was using get_user_pages_fast(), in a "Case 2" scenario
(DMA/RDMA), using the categorization from [1]. That means that it's
time to convert the get_user_pages_fast() + put_page() calls to
pin_user_pages_fast() + unpin_user_page() calls.

There is some helpful background in [2]: basically, this is a small
part of fixing a long-standing disconnect between pinning pages, and
file systems' use of those pages.

[1] Documentation/core-api/pin_user_pages.rst

[2] "Explicit pinning of user-space pages":
https://lwn.net/Articles/807108/

Signed-off-by: Souptick Joarder 
Cc: John Hubbard 

Hi,

I'm compile tested this, but unable to run-time test, so any testing
help is much appriciated.
---
 drivers/staging/gasket/gasket_page_table.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c 
b/drivers/staging/gasket/gasket_page_table.c
index f6d7157..d712ad4 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -449,7 +449,7 @@ static bool gasket_release_page(struct page *page)
 
if (!PageReserved(page))
SetPageDirty(page);
-   put_page(page);
+   unpin_user_page(page);
 
return true;
 }
@@ -486,12 +486,12 @@ static int gasket_perform_mapping(struct 
gasket_page_table *pg_tbl,
ptes[i].dma_addr = pg_tbl->coherent_pages[0].paddr +
   off + i * PAGE_SIZE;
} else {
-   ret = get_user_pages_fast(page_addr - offset, 1,
+   ret = pin_user_pages_fast(page_addr - offset, 1,
  FOLL_WRITE, &page);
 
if (ret <= 0) {
dev_err(pg_tbl->device,
-   "get user pages failed for addr=0x%lx, 
offset=0x%lx [ret=%d]\n",
+   "pin user pages failed for addr=0x%lx, 
offset=0x%lx [ret=%d]\n",
page_addr, offset, ret);
return ret ? ret : -ENOMEM;
}
-- 
1.9.1

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


PLEASE CONFIRM

2020-05-27 Thread Wade KAHN
I need you as a partner to invest US$27.5Million. 
You will invest and manage it based on terms of agreement
We shall do the needful to position and make you the beneficiary. 
Please confirm your full names, contact address, phone, numbers, age, sex, 
occupation. 
I will supply you all necessary information once I hear from you. 
This transaction is a deal and MUST be kept a SECRET. Feel free to ask 
questions. 
I await your immediate response.
 
Regards,
Mr. Wade KAHN.
Email: wadekahn...@yahoo.co.jp


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


[PATCH] staging: tegra-video: fix V4L2 dependency

2020-05-27 Thread Arnd Bergmann
Rather than using a dependency on VIDEO_V4L2, this driver uses
"select", which fails when other dependencies are missing:

WARNING: unmet direct dependencies detected for VIDEO_V4L2
  Depends on [n]: MEDIA_SUPPORT [=y] && (I2C [=y] || I2C [=y]=n) && VIDEO_DEV 
[=n]
  Selected by [y]:
  - VIDEO_TEGRA [=y] && STAGING [=y] && STAGING_MEDIA [=y] && MEDIA_SUPPORT 
[=y] && TEGRA_HOST1X [=y]
(plus an endless stream of link errors for other drivers that
depend on VIDEO_V4L2 but are now lacking their dependencies)

Fixes: 3d8a97eabef0 ("media: tegra-video: Add Tegra210 Video input driver")
Signed-off-by: Arnd Bergmann 
---
 drivers/staging/media/tegra-video/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/tegra-video/Kconfig 
b/drivers/staging/media/tegra-video/Kconfig
index 3f03b5b39e6c..f6c61ec74386 100644
--- a/drivers/staging/media/tegra-video/Kconfig
+++ b/drivers/staging/media/tegra-video/Kconfig
@@ -2,7 +2,7 @@
 config VIDEO_TEGRA
tristate "NVIDIA Tegra VI driver"
depends on TEGRA_HOST1X
-   select VIDEO_V4L2
+   depends on VIDEO_V4L2
select MEDIA_CONTROLLER
select VIDEOBUF2_DMA_CONTIG
help
-- 
2.26.2

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


Cursos Bonificables JUNIO 2020 (Empleados activos y en ERTE)

2020-05-27 Thread foesco14
Cursos Bonificables JUNIO 2020 (Empleados activos y en ERTE)


Buenos días



Se encuentra abierto el plazo de inscripción de Cursos Bonificables para 
empleados en activo y en situación de ERTE (JUNIO 2020)


Todos los cursos son totalmente Bonificables con cargo al Crédito de Formación 
2020 que dispone vuestra empresa.

Se realizan en modalidad individual E-learning a través de la plataforma web y 
con total flexibilidad horaria.


Deseáis que os mandemos la información?


Saludos cordiales.


Alex Pons
Director departamento formación.

FOESCO Formación Estatal Continua.
Entidad Organizadora: B171823AP
www.foesco.com

e-mail: cur...@foesco.net
Tel: 910 323 794


(Horario de 9h a 15h y de 17h a 20h de Lunes a Viernes)


FOESCO ofrece formación a empresas y trabajadores en activo a través de cursos 
bonificados por la Fundación Estatal para la Formación en el Empleo (antiguo 
FORCEM) que gestiona las acciones formativas de FORMACIÓN CONTINUA para 
trabajadores y se rige por la ley 30/2015 de 9 de Septiembre.

Si no desea recibir mas información de FOESCO responda a este correo con la 
palabra BAJA en el asunto.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[driver-core:driver-core-next] BUILD SUCCESS 46d26819a5056f4831649c5887ad5c71a16d86f7

2020-05-27 Thread kbuild test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git  
driver-core-next
branch HEAD: 46d26819a5056f4831649c5887ad5c71a16d86f7  software node: implement 
software_node_unregister()

elapsed time: 1524m

configs tested: 90
configs skipped: 2

The following configs have been built successfully.
More configs may be tested in the coming days.

arm defconfig
arm  allmodconfig
arm   allnoconfig
arm64allyesconfig
arm64   defconfig
arm64allmodconfig
arm64 allnoconfig
arm  allyesconfig
sh   se7724_defconfig
armmmp2_defconfig
mipsmaltaup_defconfig
armrealview_defconfig
arm  footbridge_defconfig
arm  jornada720_defconfig
mips loongson1c_defconfig
mipsmaltaup_xpa_defconfig
arm   tegra_defconfig
mipse55_defconfig
arc nsimosci_hs_defconfig
i386  allnoconfig
i386 allyesconfig
i386defconfig
i386  debian-10.3
ia64 allmodconfig
ia64defconfig
ia64  allnoconfig
ia64 allyesconfig
m68k allmodconfig
m68k  allnoconfig
m68k   sun3_defconfig
m68kdefconfig
m68k allyesconfig
nds32   defconfig
nds32 allnoconfig
csky allyesconfig
cskydefconfig
alpha   defconfig
alphaallyesconfig
xtensa  defconfig
xtensa   allyesconfig
h8300allyesconfig
h8300allmodconfig
arc defconfig
sh   allmodconfig
shallnoconfig
microblazeallnoconfig
arc  allyesconfig
nios2   defconfig
nios2allyesconfig
openriscdefconfig
c6x  allyesconfig
c6x   allnoconfig
openrisc allyesconfig
mips allyesconfig
mips  allnoconfig
mips allmodconfig
pariscallnoconfig
parisc  defconfig
parisc   allyesconfig
parisc   allmodconfig
powerpc  allyesconfig
powerpc  rhel-kconfig
powerpc  allmodconfig
powerpc   allnoconfig
powerpc defconfig
riscvallyesconfig
riscv allnoconfig
riscv   defconfig
riscvallmodconfig
s390  allnoconfig
s390defconfig
s390 allyesconfig
s390 allmodconfig
sparcallyesconfig
sparc   defconfig
sparc64 defconfig
sparc64   allnoconfig
sparc64  allyesconfig
sparc64  allmodconfig
umallnoconfig
um   allmodconfig
um   allyesconfig
um  defconfig
x86_64   rhel
x86_64   rhel-7.6
x86_64rhel-7.6-kselftests
x86_64 rhel-7.2-clear
x86_64lkp
x86_64  fedora-25
x86_64  kexec

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[staging:staging-testing 391/415] drivers/staging/wfx/sta.c:203:5: warning: no previous prototype for function 'wfx_get_ps_timeout'

2020-05-27 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-testing
head:   36cf583eaff3458abbfac144c5e4d417a23fa1a1
commit: 398999dabc8cfc51c7274639cb87e2a316138859 [391/415] staging: wfx: split 
wfx_get_ps_timeout() from wfx_update_pm()
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 
3393cc4cebf9969db94dc424b7a2b6195589c33b)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout 398999dabc8cfc51c7274639cb87e2a316138859
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot 

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/staging/wfx/sta.c:203:5: warning: no previous prototype for function 
>> 'wfx_get_ps_timeout' [-Wmissing-prototypes]
int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps)
^
drivers/staging/wfx/sta.c:203:1: note: declare 'static' if the function is not 
intended to be used outside of this translation unit
int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps)
^
static
>> drivers/staging/wfx/sta.c:233:5: warning: no previous prototype for function 
>> 'wfx_update_pm' [-Wmissing-prototypes]
int wfx_update_pm(struct wfx_vif *wvif)
^
drivers/staging/wfx/sta.c:233:1: note: declare 'static' if the function is not 
intended to be used outside of this translation unit
int wfx_update_pm(struct wfx_vif *wvif)
^
static
2 warnings generated.

vim +/wfx_get_ps_timeout +203 drivers/staging/wfx/sta.c

   202  
 > 203  int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps)
   204  {
   205  struct ieee80211_channel *chan0 = NULL, *chan1 = NULL;
   206  struct ieee80211_conf *conf = &wvif->wdev->hw->conf;
   207  
   208  WARN(!wvif->vif->bss_conf.assoc && enable_ps,
   209   "enable_ps is reliable only if associated");
   210  if (wdev_to_wvif(wvif->wdev, 0))
   211  chan0 = wdev_to_wvif(wvif->wdev, 
0)->vif->bss_conf.chandef.chan;
   212  if (wdev_to_wvif(wvif->wdev, 1))
   213  chan1 = wdev_to_wvif(wvif->wdev, 
1)->vif->bss_conf.chandef.chan;
   214  if (chan0 && chan1 && chan0->hw_value != chan1->hw_value &&
   215  wvif->vif->type != NL80211_IFTYPE_AP) {
   216  // It is necessary to enable powersave if channels
   217  // are differents.
   218  if (enable_ps)
   219  *enable_ps = true;
   220  if (wvif->bss_not_support_ps_poll)
   221  return 30;
   222  else
   223  return 0;
   224  }
   225  if (enable_ps)
   226  *enable_ps = wvif->vif->bss_conf.ps;
   227  if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps)
   228  return conf->dynamic_ps_timeout;
   229  else
   230  return -1;
   231  }
   232  
 > 233  int wfx_update_pm(struct wfx_vif *wvif)
   234  {
   235  int ps_timeout;
   236  bool ps;
   237  
   238  if (!wvif->vif->bss_conf.assoc)
   239  return 0;
   240  ps_timeout = wfx_get_ps_timeout(wvif, &ps);
   241  if (!ps)
   242  ps_timeout = 0;
   243  WARN_ON(ps_timeout < 0);
   244  if (wvif->uapsd_mask)
   245  ps_timeout = 0;
   246  
   247  if (!wait_for_completion_timeout(&wvif->set_pm_mode_complete,
   248   TU_TO_JIFFIES(512)))
   249  dev_warn(wvif->wdev->dev,
   250   "timeout while waiting of 
set_pm_mode_complete\n");
   251  return hif_set_pm(wvif, ps, ps_timeout);
   252  }
   253  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/20] media: atomisp: go one step further to drop ia_css_memory_access.c

2020-05-27 Thread Mauro Carvalho Chehab
Move the attrs handling into hmm, simplifying even further
what the ia_css_memory_access.c file does.

Yet, the returned type for ia_css_memory_access.c is an
integer, instead of a pointer.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../staging/media/atomisp/include/hmm/hmm.h   |  3 ++-
 .../media/atomisp/include/linux/atomisp.h |  2 ++
 .../memory_access/memory_access.h |  3 ---
 drivers/staging/media/atomisp/pci/hmm/hmm.c   | 11 --
 .../media/atomisp/pci/ia_css_memory_access.c  | 21 +--
 .../atomisp/pci/runtime/frame/src/frame.c |  4 ++--
 .../staging/media/atomisp/pci/sh_css_params.c |  8 +++
 7 files changed, 20 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/media/atomisp/include/hmm/hmm.h 
b/drivers/staging/media/atomisp/include/hmm/hmm.h
index e2149b16c9fd..a661c039a2cc 100644
--- a/drivers/staging/media/atomisp/include/hmm/hmm.h
+++ b/drivers/staging/media/atomisp/include/hmm/hmm.h
@@ -35,7 +35,8 @@ int hmm_init(void);
 void hmm_cleanup(void);
 
 ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
-int from_highmem, const void __user *userptr, bool cached);
+int from_highmem, const void __user *userptr,
+const uint16_t attrs);
 void hmm_free(ia_css_ptr ptr);
 int hmm_load(ia_css_ptr virt, void *data, unsigned int bytes);
 int hmm_store(ia_css_ptr virt, const void *data, unsigned int bytes);
diff --git a/drivers/staging/media/atomisp/include/linux/atomisp.h 
b/drivers/staging/media/atomisp/include/linux/atomisp.h
index e9670749bae0..fc2e76694613 100644
--- a/drivers/staging/media/atomisp/include/linux/atomisp.h
+++ b/drivers/staging/media/atomisp/include/linux/atomisp.h
@@ -917,6 +917,8 @@ struct atomisp_acc_map {
 
 #define ATOMISP_MAP_FLAG_NOFLUSH   0x0001  /* Do not flush cache */
 #define ATOMISP_MAP_FLAG_CACHED0x0002  /* Enable cache */
+#define ATOMISP_MAP_FLAG_CONTIGUOUS0x0004
+#define ATOMISP_MAP_FLAG_CLEARED   0x0008
 
 struct atomisp_acc_state {
__u32 flags;/* Flags, see list below */
diff --git 
a/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h
 
b/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h
index c8a41e5d8dab..19b9083995a4 100644
--- 
a/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h
+++ 
b/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h
@@ -76,9 +76,6 @@
  * within the allocation referencable from the
  * returned pointer/address.
  */
-#define MMGR_ATTRIBUTE_CACHED  0x0001
-#define MMGR_ATTRIBUTE_CONTIGUOUS  0x0002
-#define MMGR_ATTRIBUTE_CLEARED 0x0008
 
 #define mmgr_NULL  ((hrt_vaddress)0)
 #define mmgr_EXCEPTION ((hrt_vaddress)-1)
diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c 
b/drivers/staging/media/atomisp/pci/hmm/hmm.c
index 975749d67131..68dab2393767 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
@@ -193,7 +193,7 @@ int hmm_init(void)
 * at the beginning, to avoid hmm_alloc return 0 in the
 * further allocation.
 */
-   dummy_ptr = hmm_alloc(1, HMM_BO_PRIVATE, 0, NULL, false);
+   dummy_ptr = hmm_alloc(1, HMM_BO_PRIVATE, 0, NULL, 0);
 
if (!ret) {
ret = sysfs_create_group(&atomisp_dev->kobj,
@@ -219,12 +219,16 @@ void hmm_cleanup(void)
 }
 
 ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
-int from_highmem, const void __user *userptr, bool cached)
+int from_highmem, const void __user *userptr,
+const uint16_t attrs)
 {
unsigned int pgnr;
struct hmm_buffer_object *bo;
+   bool cached = attrs & ATOMISP_MAP_FLAG_CACHED;
int ret;
 
+   WARN_ON(attrs & ATOMISP_MAP_FLAG_CONTIGUOUS);
+
/*
 * Check if we are initialized. In the ideal world we wouldn't need
 * this but we can tackle it once the driver is a lot cleaner
@@ -258,6 +262,9 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
 
hmm_mem_stat.tol_cnt += pgnr;
 
+   if (attrs & ATOMISP_MAP_FLAG_CLEARED)
+   hmm_set(bo->start, 0, bytes);
+
return bo->start;
 
 bind_err:
diff --git a/drivers/staging/media/atomisp/pci/ia_css_memory_access.c 
b/drivers/staging/media/atomisp/pci/ia_css_memory_access.c
index d11843a717e0..e19b98fe7201 100644
--- a/drivers/staging/media/atomisp/pci/ia_css_memory_access.c
+++ b/drivers/staging/media/atomisp/pci/ia_css_memory_access.c
@@ -12,30 +12,11 @@
  * more details.
  */
 
-#include 
-#include 
-#include 
 #include 
-#include 
-
-#include "atomisp_internal.h"
 
 hrt_vaddress mmgr_alloc_attr(const size_t size, const uint16_t attrs)
 {
-   ia_css_ptr data;
-
-   WARN_ON(attrs & MMGR_ATTRIBUTE_CONTIGUOUS);
-
-   data = hmm_alloc(size

  1   2   >