Re: [PATCH] staging: rtl8712: switch to common ieee80211 headers

2020-06-02 Thread Dan Carpenter
On Tue, Jun 02, 2020 at 04:58:46PM +0100, Pascal Terjan wrote:
> On Tue, 2 Jun 2020 at 15:57, Larry Finger  wrote:
> >
> > On 6/1/20 3:24 PM, Pascal Terjan wrote:
> > > This patch switches to  and  and
> > > deletes a lot of duplicate definitions plus many unused ones.
> > >
> > > Non obvious changes:
> > > - struct ieee80211_ht_cap is different enough that I preferred to keep
> > >(and rename) it for now.
> > > - mcs_rate in translate_scan was not read after being set, so I deleted
> > >that part rather than using the renamed struct
> > > - WLAN_CAPABILITY_BSS is replaced with WLAN_CAPABILITY_ESS which is the
> > >corresponding one with same value
> > >
> > > Signed-off-by: Pascal Terjan 
> >
> > This patch does not apply to the staging repo, current mainline, or
> > wireless-drivers-next. Where did you intend it to go? Staging is the 
> > correct tree.
> 
> It was against staging-testing as there is a (trivial) merge conflict
> in there with 
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?h=staging-testing=2aaeaaff1ae21b2817256435c7fc0095eeda61ae
> which is also in staging-next
> What is the best practice in such case?

It has to apply against staging-next so that's fine.

> 
> Thanks to kbuild test robot I found that it is failing to build there
> because I forgot to add a dependency on CFG80211 in Kconfig, so I will
> need to send a v2.

Yup.

regards,
dan carpenter

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


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

2020-06-02 Thread Souptick Joarder
In 2019, we introduced pin_user_pages*() and now we are converting
get_user_pages*() to the new API as appropriate. [1] & [2] could
be referred for more information.

[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.

 .../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c   | 16 +---
 1 file changed, 5 insertions(+), 11 deletions(-)

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 38a13e4..4616013 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
@@ -287,12 +287,8 @@ int vchiq_dump_platform_state(void *dump_context)
 pagelistinfo->num_pages, pagelistinfo->dma_dir);
}
 
-   if (pagelistinfo->pages_need_release) {
-   unsigned int i;
-
-   for (i = 0; i < pagelistinfo->num_pages; i++)
-   put_page(pagelistinfo->pages[i]);
-   }
+   if (pagelistinfo->pages_need_release)
+   unpin_user_pages(pagelistinfo->pages, pagelistinfo->num_pages);
 
dma_free_coherent(g_dev, pagelistinfo->pagelist_buffer_size,
  pagelistinfo->pagelist, pagelistinfo->dma_addr);
@@ -395,7 +391,7 @@ int vchiq_dump_platform_state(void *dump_context)
}
/* do not try and release vmalloc pages */
} else {
-   actual_pages = get_user_pages_fast(
+   actual_pages = pin_user_pages_fast(
  (unsigned long)buf & PAGE_MASK,
  num_pages,
  type == PAGELIST_READ,
@@ -407,10 +403,8 @@ int vchiq_dump_platform_state(void *dump_context)
   __func__, actual_pages, num_pages);
 
/* This is probably due to the process being killed */
-   while (actual_pages > 0) {
-   actual_pages--;
-   put_page(pages[actual_pages]);
-   }
+   if (actual_pages > 0)
+   unpin_user_pages(pages, actual_pages);
cleanup_pagelistinfo(pagelistinfo);
return NULL;
}
-- 
1.9.1

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


Re: [PATCH] staging: rtl8712: switch to common ieee80211 headers

2020-06-02 Thread kbuild test robot
Hi Pascal,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on next-20200602]
[cannot apply to v5.7]
[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/Pascal-Terjan/staging-rtl8712-switch-to-common-ieee80211-headers/20200602-042517
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
77f55d1305c11fb729b88f2c3f7881ba0831fa6f
config: i386-randconfig-a011-20200602 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce (this is a W=1 build):
# save the attached .config to linux build tree
make W=1 ARCH=i386 

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 <<):

ld: drivers/staging/rtl8712/rtl8712_recv.o: in function `amsdu_to_msdu':
>> drivers/staging/rtl8712/rtl8712_recv.c:377: undefined reference to 
>> `bridge_tunnel_header'
>> ld: drivers/staging/rtl8712/rtl8712_recv.c:375: undefined reference to 
>> `rfc1042_header'
>> ld: drivers/staging/rtl8712/rtl8712_recv.c:377: undefined reference to 
>> `bridge_tunnel_header'
>> ld: drivers/staging/rtl8712/rtl8712_recv.c:375: undefined reference to 
>> `rfc1042_header'
ld: drivers/staging/rtl8712/rtl871x_recv.o: in function 
`r8712_wlanhdr_to_ethhdr':
>> drivers/staging/rtl8712/rtl871x_recv.c:603: undefined reference to 
>> `rfc1042_header'
>> ld: drivers/staging/rtl8712/rtl871x_recv.c:606: undefined reference to 
>> `bridge_tunnel_header'
>> ld: drivers/staging/rtl8712/rtl871x_recv.c:603: undefined reference to 
>> `rfc1042_header'
>> ld: drivers/staging/rtl8712/rtl871x_recv.c:606: undefined reference to 
>> `bridge_tunnel_header'

vim +377 drivers/staging/rtl8712/rtl8712_recv.c

2865d42c78a912 Larry Finger2010-08-20  314  
fc898688aa37c0 Nishka Dasgupta 2019-08-08  315  static void 
amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
2865d42c78a912 Larry Finger2010-08-20  316  {
2865d42c78a912 Larry Finger2010-08-20  317  int a_len, 
padding_len;
2865d42c78a912 Larry Finger2010-08-20  318  u16 eth_type, 
nSubframe_Length;
2865d42c78a912 Larry Finger2010-08-20  319  u8  nr_subframes, i;
b952f4dff27512 yuan linyu  2017-06-18  320  unsigned char *pdata;
2865d42c78a912 Larry Finger2010-08-20  321  struct rx_pkt_attrib 
*pattrib;
2865d42c78a912 Larry Finger2010-08-20  322  _pkt *sub_skb, 
*subframes[MAX_SUBFRAME_COUNT];
2865d42c78a912 Larry Finger2010-08-20  323  struct recv_priv 
*precvpriv = >recvpriv;
2865d42c78a912 Larry Finger2010-08-20  324  struct  __queue 
*pfree_recv_queue = &(precvpriv->free_recv_queue);
2865d42c78a912 Larry Finger2010-08-20  325  
2865d42c78a912 Larry Finger2010-08-20  326  nr_subframes = 0;
2865d42c78a912 Larry Finger2010-08-20  327  pattrib = 
>u.hdr.attrib;
2865d42c78a912 Larry Finger2010-08-20  328  recvframe_pull(prframe, 
prframe->u.hdr.attrib.hdrlen);
2865d42c78a912 Larry Finger2010-08-20  329  if 
(prframe->u.hdr.attrib.iv_len > 0)
2865d42c78a912 Larry Finger2010-08-20  330  
recvframe_pull(prframe, prframe->u.hdr.attrib.iv_len);
2865d42c78a912 Larry Finger2010-08-20  331  a_len = 
prframe->u.hdr.len;
2865d42c78a912 Larry Finger2010-08-20  332  pdata = 
prframe->u.hdr.rx_data;
2865d42c78a912 Larry Finger2010-08-20  333  while (a_len > 
ETH_HLEN) {
2865d42c78a912 Larry Finger2010-08-20  334  /* Offset 12 
denote 2 mac address */
2865d42c78a912 Larry Finger2010-08-20  335  
nSubframe_Length = *((u16 *)(pdata + 12));
2865d42c78a912 Larry Finger2010-08-20  336  /*==m==>change 
the length order*/
2865d42c78a912 Larry Finger2010-08-20  337  
nSubframe_Length = (nSubframe_Length >> 8) +
2865d42c78a912 Larry Finger2010-08-20  338  
   (nSubframe_Length << 8);
2865d42c78a912 Larry Finger2010-08-20  339  if (a_len < 
(ETHERNET_HEADER_SIZE + nSubframe_Length)) {
87a573ada017b4 Przemo Firszt   2012-12-10  340  
netdev_warn(padapter->pnetdev, "r8712u: nRemain_Length is %d and 
nSubframe_Length is: %d\n",
2865d42c78a912 Larry Finger2010-08-20  341  
a_len, nSubframe_Length);
2865d42c78a912 Larry Finger2010-08-20  342  goto 
ex

Re: [PATCH] staging: rtl8712: switch to common ieee80211 headers

2020-06-02 Thread Larry Finger

On 6/1/20 3:24 PM, Pascal Terjan wrote:

This patch switches to  and  and
deletes a lot of duplicate definitions plus many unused ones.

Non obvious changes:
- struct ieee80211_ht_cap is different enough that I preferred to keep
   (and rename) it for now.
- mcs_rate in translate_scan was not read after being set, so I deleted
   that part rather than using the renamed struct
- WLAN_CAPABILITY_BSS is replaced with WLAN_CAPABILITY_ESS which is the
   corresponding one with same value

Signed-off-by: Pascal Terjan 


This patch does not apply to the staging repo, current mainline, or 
wireless-drivers-next. Where did you intend it to go? Staging is the correct tree.


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


Re: [RESEND PATCH v1 6/6] staging: greybus: audio: Enable GB codec, audio module compilation.

2020-06-02 Thread Dan Carpenter
On Tue, Jun 02, 2020 at 10:51:15AM +0530, Vaibhav Agarwal wrote:
> Currently, GB codec and audio module is conditionally compiled based on
> GREYBUS_AUDIO_MSM8994. However, audio module is not dependent on MSM8994
> platform and can be used generically with any platform that follows
> GB Audio class specification.
> 
> Also, GB codec driver corresponds to dummy codec represented by I2S port
> available on Toshiba AP Bridge. Added config option for the same in
> kconfig file and accordingly updated Makefile.
> 

This commit message was a bit confusing to me.  Just say:

"Currently you can't enable the Grey Bus Audio Codec because there is no
entry for it in the Kconfig file.  Originally the config name was going
to be AUDIO_MSM8994 but that's not correct because other types of
hardware are supported now.  I have chosen the name AUDIO_APB_CODEC
instead.  Also I had to update the dependencies for GREYBUS_AUDIO to
make the compile work."

Otherwise this looks fine.

regards,
dan carpenter

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


Re: [RESEND PATCH v1 5/6] staging: greybus: audio: Add helper APIs for dynamic audio modules

2020-06-02 Thread Dan Carpenter
On Tue, Jun 02, 2020 at 10:51:14AM +0530, Vaibhav Agarwal wrote:
> +static int gbaudio_remove_controls(struct snd_card *card, struct device *dev,
> +const struct snd_kcontrol_new *controls,
> +int num_controls, const char *prefix)
> +{
> + int i, err;
> +
> + for (i = 0; i < num_controls; i++) {
> + const struct snd_kcontrol_new *control = [i];
> + struct snd_ctl_elem_id id;
> + struct snd_kcontrol *kctl;
> +
> + if (prefix)
> + snprintf(id.name, sizeof(id.name), "%s %s", prefix,
> +  control->name);
> + else
> + strlcpy(id.name, control->name, sizeof(id.name));
> + id.numid = 0;
> + id.iface = control->iface;
> + id.device = control->device;
> + id.subdevice = control->subdevice;
> + id.index = control->index;
> + kctl = snd_ctl_find_id(card, );
> + if (!kctl) {
> + dev_err(dev, "%d: Failed to find %s\n", err,
> + control->name);
> + return -ENOENT;

I feel like this should be a continue instead of a return.

> + }
> + err = snd_ctl_remove(card, kctl);
> + if (err < 0) {
> + dev_err(dev, "%d: Failed to remove %s\n", err,
> + control->name);
> + return err;

Probably here as well.  The caller doesn't actually check for errors.

> + }
> + }
> + return 0;
> +}

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


Re: [RESEND PATCH v1 4/6] staging: greybus: audio: Resolve compilation error in topology parser

2020-06-02 Thread Dan Carpenter
On Tue, Jun 02, 2020 at 10:51:13AM +0530, Vaibhav Agarwal wrote:
> Fix compilation errors for GB Audio topology parser code with recent
> kernel versions.
> 
> Signed-off-by: Vaibhav Agarwal 
> ---
>  drivers/staging/greybus/audio_topology.c | 130 +++
>  1 file changed, 61 insertions(+), 69 deletions(-)
> 
> diff --git a/drivers/staging/greybus/audio_topology.c 
> b/drivers/staging/greybus/audio_topology.c
> index 4ac30accf226..7d5e87341a5c 100644
> --- a/drivers/staging/greybus/audio_topology.c
> +++ b/drivers/staging/greybus/audio_topology.c
> @@ -5,8 +5,8 @@
>   * Copyright 2015-2016 Linaro Ltd.
>   */
>  
> +#include 
>  #include "audio_codec.h"
> -#include "greybus_protocols.h"
>  
>  #define GBAUDIO_INVALID_ID   0xFF
>  
> @@ -165,15 +165,15 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol 
> *kcontrol,
>   struct gbaudio_ctl_pvt *data;
>   struct gb_audio_ctl_elem_info *info;
>   struct gbaudio_module_info *module;
> - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
> - struct gbaudio_codec_info *gbcodec = snd_soc_codec_get_drvdata(codec);
> + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
> + struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp);

Please rename "gbcodec" in a different patch.  It's not related to
fixing the compile.

Otherwise it seems okay.

regards,
dan carpenter

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


Re: [RESEND PATCH v1 3/6] staging: greybus: audio: Resolve compilation errors for GB codec module

2020-06-02 Thread Dan Carpenter
On Tue, Jun 02, 2020 at 10:51:12AM +0530, Vaibhav Agarwal wrote:
> Due to dependencies on ASoC framework changes, GB dummy codec module
> compilation is currently disabled. This patch updates codec driver as
> per the latest ASoC APIs.
> 
> Signed-off-by: Vaibhav Agarwal 
> ---
>  drivers/staging/greybus/audio_codec.c | 87 +--
>  drivers/staging/greybus/audio_codec.h |  2 +-
>  2 files changed, 44 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/staging/greybus/audio_codec.c 
> b/drivers/staging/greybus/audio_codec.c
> index a2ee587e5a79..bbd072acda5c 100644
> --- a/drivers/staging/greybus/audio_codec.c
> +++ b/drivers/staging/greybus/audio_codec.c
> @@ -832,7 +832,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info 
> *module,
>  int gbaudio_register_module(struct gbaudio_module_info *module)
>  {
>   int ret;
> - struct snd_soc_codec *codec;
> + struct snd_soc_component *component;

I quite like the "component" pointer because it's assigned once at the
start of the function and used consistently throughout.  The other
pointers I complained about were just temporary pointers which meant
different things depending on which line you were on.  They made the
code harder to read.

My only quible is that in the next patch it's called "comp" and here
it's called "component".  Let's just use "comp" for all the local
variables.


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


Re: [RESEND PATCH v1 2/6] staging: greybus: audio: Maintain jack list within GB Audio module

2020-06-02 Thread Dan Carpenter
On Tue, Jun 02, 2020 at 10:51:11AM +0530, Vaibhav Agarwal wrote:
> As per the current implementation for GB codec driver, a jack list is
> maintained for each module. And it expects the list to be populated by
> the snd_soc_jack structure which would require modifications in
> mainstream code.
> 
> However, this is not a necessary requirement and the list can be easily
> maintained within gbaudio_module_info as well. This patch provides the
> relevant changes for the same.
> 
> Signed-off-by: Vaibhav Agarwal 
> ---
>  drivers/staging/greybus/audio_codec.c  | 76 ++
>  drivers/staging/greybus/audio_codec.h  | 10 +++-
>  drivers/staging/greybus/audio_module.c | 20 ---
>  3 files changed, 60 insertions(+), 46 deletions(-)
> 
> diff --git a/drivers/staging/greybus/audio_codec.c 
> b/drivers/staging/greybus/audio_codec.c
> index ebf8484f0ae7..a2ee587e5a79 100644
> --- a/drivers/staging/greybus/audio_codec.c
> +++ b/drivers/staging/greybus/audio_codec.c
> @@ -712,7 +712,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info 
> *module,
>struct snd_soc_card *card)
>  {
>   int ret;
> -
> + struct gbaudio_jack *gba_jack, *n;
>   struct snd_soc_jack *jack;

Because we got rid of the jack pointer then we can re-use the name here.

struct gbaudio_jack *jack, *n;

We still don't want the "struct snd_soc_jack *jack;" pointer.

>   struct snd_soc_jack_pin *headset, *button;
>  
> @@ -728,7 +728,8 @@ static int gbaudio_init_jack(struct gbaudio_module_info 
> *module,
>  
>   headset->pin = module->jack_name;
>   headset->mask = module->jack_mask;
> - jack = >headset_jack;
> + gba_jack = >headset;
> + jack = _jack->jack;

Use module->headset.jack directly.

>  
>   ret = snd_soc_card_jack_new(card, module->jack_name, module->jack_mask,
>   jack, headset, 1);
> @@ -737,6 +738,9 @@ static int gbaudio_init_jack(struct gbaudio_module_info 
> *module,
>   return ret;
>   }
>  
> + /* Add to module's jack list */
> + list_add(_jack->list, >jack_list);


Here as well.

> +
>   if (!module->button_mask)
>   return 0;
>  
> @@ -745,20 +749,24 @@ static int gbaudio_init_jack(struct gbaudio_module_info 
> *module,
>   button = devm_kzalloc(module->dev, sizeof(*headset), GFP_KERNEL);
>   if (!button) {
>   ret = -ENOMEM;
> - goto free_headset;
> + goto free_jack;

Let's call the label "free_jacks" (plural).

>   }
>  
>   button->pin = module->button_name;
>   button->mask = module->button_mask;
> - jack = >button_jack;
> + gba_jack = >button;
> + jack = _jack->jack;
>  
>   ret = snd_soc_card_jack_new(card, module->button_name,
>   module->button_mask, jack, button, 1);
>   if (ret) {
>   dev_err(module->dev, "Failed to create button jack\n");
> - goto free_headset;
> + goto free_jack;
>   }
>  
> + /* Add to module's jack list */
> + list_add(_jack->list, >jack_list);
> +
>   /*
>* Currently, max 4 buttons are supported with following key mapping
>* BTN_0 = KEY_MEDIA
> @@ -768,58 +776,55 @@ static int gbaudio_init_jack(struct gbaudio_module_info 
> *module,
>*/
>  
>   if (module->button_mask & SND_JACK_BTN_0) {
> - ret = snd_jack_set_key(module->button_jack.jack, SND_JACK_BTN_0,
> + ret = snd_jack_set_key(jack->jack, SND_JACK_BTN_0,
>  KEY_MEDIA);
>   if (ret) {
>   dev_err(module->dev, "Failed to set BTN_0\n");
> - goto free_button;
> + goto free_jack;
>   }
>   }
>  
>   if (module->button_mask & SND_JACK_BTN_1) {
> - ret = snd_jack_set_key(module->button_jack.jack, SND_JACK_BTN_1,
> + ret = snd_jack_set_key(jack->jack, SND_JACK_BTN_1,
>  KEY_VOICECOMMAND);
>   if (ret) {
>   dev_err(module->dev, "Failed to set BTN_1\n");
> - goto free_button;
> + goto free_jack;
>   }
>   }
>  
>   if (module->button_mask & SND_JACK_BTN_2) {
> - ret = snd_jack_set_key(module->button_jack.jack, SND_JACK_BTN_2,
> + ret = snd_jack_set_key(jack->jack, SND_JACK_BTN_2,
>  KEY_VOLUMEUP);
>   if (ret) {
>   dev_err(module->dev, "Failed to set BTN_2\n");
> - goto free_button;
> + goto free_jack;
>   }
>   }
>  
>   if (module->button_mask & SND_JACK_BTN_3) {
> - ret = snd_jack_set_key(module->button_jack.jack, SND_JACK_BTN_3,
> + ret = snd_jack_set_key(jack->jack, SND_JACK_BTN_3,
>  

Re: [RESEND PATCH v1 1/6] staging: greybus: audio: Update snd_jack FW usage as per new APIs

2020-06-02 Thread Dan Carpenter
On Tue, Jun 02, 2020 at 10:51:10AM +0530, Vaibhav Agarwal wrote:
> diff --git a/drivers/staging/greybus/audio_codec.c 
> b/drivers/staging/greybus/audio_codec.c
> index 08746c85dea6..ebf8484f0ae7 100644
> --- a/drivers/staging/greybus/audio_codec.c
> +++ b/drivers/staging/greybus/audio_codec.c
> @@ -709,17 +709,29 @@ static struct snd_soc_dai_driver gbaudio_dai[] = {
>  };
>  
>  static int gbaudio_init_jack(struct gbaudio_module_info *module,
> -  struct snd_soc_codec *codec)
> +  struct snd_soc_card *card)
>  {
>   int ret;
>  

No blank line please.

> + struct snd_soc_jack *jack;

This code would be nicer without the "jack" pointer.  Just use
"module->headset_jack" directly so that it's easier to use grep on the
code.

> + struct snd_soc_jack_pin *headset, *button;
> +
>   if (!module->jack_mask)
>   return 0;
>  
>   snprintf(module->jack_name, NAME_SIZE, "GB %d Headset Jack",
>module->dev_id);
> - ret = snd_soc_jack_new(codec, module->jack_name, module->jack_mask,
> ->headset_jack);
> +
> + headset = devm_kzalloc(module->dev, sizeof(*headset), GFP_KERNEL);
> + if (!headset)
> + return -ENOMEM;
> +
> + headset->pin = module->jack_name;
> + headset->mask = module->jack_mask;
> + jack = >headset_jack;
> +
> + ret = snd_soc_card_jack_new(card, module->jack_name, module->jack_mask,
> + jack, headset, 1);
>   if (ret) {
>   dev_err(module->dev, "Failed to create new jack\n");
>   return ret;
> @@ -730,11 +742,21 @@ static int gbaudio_init_jack(struct gbaudio_module_info 
> *module,
>  
>   snprintf(module->button_name, NAME_SIZE, "GB %d Button Jack",
>module->dev_id);
> - ret = snd_soc_jack_new(codec, module->button_name, module->button_mask,
> ->button_jack);
> + button = devm_kzalloc(module->dev, sizeof(*headset), GFP_KERNEL);
   
Use "sizeof(*button)".  It's the same size so it doesn't affect runtime.


> + if (!button) {
> + ret = -ENOMEM;
> + goto free_headset;
> + }

regards,
dan carpenter

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


Re: [PATCH] media: staging: tegra-vde: add missing pm_runtime_put_autosuspend

2020-06-02 Thread Markus Elfring
> Call to pm_runtime_get_sync increments counter even in case of
> failure leading to incorrect ref count.
> Call pm_runtime_put_autosuspend if pm_runtime_get_sync fails.

How do you think about a wording variant like the following?

   Change description:
   The PM runtime reference counter is generally incremented by a call of
   the function “pm_runtime_get_sync”.
   Thus call the function “pm_runtime_put_autosuspend” also in one error case
   to keep the reference counting consistent.


Would you like to add the tag “Fixes” to the commit message?

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


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

2020-06-02 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

v5:
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:

- init return value in default path of switch/case expression

 drivers/most/Kconfig|   12 +
 drivers/most/Makefile   |2 +
 drivers/most/most_usb.c | 1170 +++
 3 files changed, 1184 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..2640c5b
--- /dev/null
+++ b/drivers/most/most_usb.c
@@ -0,0 +1,1170 @@
+// 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;
+};
+

[PATCH] staging: rtl8192e: Using comparison to false is error prone

2020-06-02 Thread John Oldman
clear below issues reported by checkpatch.pl:

CHECK: Using comparison to false is error prone

Signed-off-by: John Oldman 
---
 drivers/staging/rtl8192e/rtl819x_HTProc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c 
b/drivers/staging/rtl8192e/rtl819x_HTProc.c
index d83d72594312..8abc921ecb3e 100644
--- a/drivers/staging/rtl8192e/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c
@@ -371,7 +371,7 @@ void HTConstructInfoElement(struct rtllib_device *ieee, u8 
*posHTInfo,
if ((ieee->iw_mode == IW_MODE_ADHOC) ||
(ieee->iw_mode == IW_MODE_MASTER)) {
pHTInfoEle->ControlChl  = ieee->current_network.channel;
-   pHTInfoEle->ExtChlOffset = ((pHT->bRegBW40MHz == false) ?
+   pHTInfoEle->ExtChlOffset = ((!pHT->bRegBW40MHz) ?
HT_EXTCHNL_OFFSET_NO_EXT :
(ieee->current_network.channel <= 6)
? HT_EXTCHNL_OFFSET_UPPER :
@@ -526,7 +526,7 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};
 
-   if (pHTInfo->bCurrentHTSupport == false) {
+   if (!pHTInfo->bCurrentHTSupport) {
netdev_warn(ieee->dev, "%s(): HT_DISABLE\n", __func__);
return;
}
@@ -873,7 +873,7 @@ void HTSetConnectBwMode(struct rtllib_device *ieee,
 {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
 
-   if (pHTInfo->bRegBW40MHz == false)
+   if (!pHTInfo->bRegBW40MHz)
return;
 
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
-- 
2.17.1

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