Re: [PATCH v1] media: staging: tegra-vde: Use devm_platform_ioremap_resource_byname()

2020-03-02 Thread Dan Carpenter
On Thu, Feb 27, 2020 at 09:09:15PM +0300, Dmitry Osipenko wrote:
> This helps to make code cleaner a tad.

Please don't start the commit message in the middle of a sentence.
It looks like this for some of us:

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

I generally read the subject or the full commit message but seldom
both.

Otherwise the patch looks very good.

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


Re: [PATCH v3 00/18] wilc1000: move out of staging

2020-03-02 Thread Dan Carpenter
There are a few static checker warnings from Friday's linux-next.  Only
the first one is important.  (Not all these Smatch warnings have been
published).

drivers/staging/wilc1000/hif.c:804 wilc_hif_pack_sta_param() warn: 
'¶ms->ht_capa' sometimes too small '8' size = 29

drivers/staging/wilc1000/hif.c
   787  static void wilc_hif_pack_sta_param(u8 *cur_byte, const u8 *mac,
   788  struct station_parameters *params)
   789  {
   790  ether_addr_copy(cur_byte, mac);
   791  cur_byte += ETH_ALEN;
   792  
   793  put_unaligned_le16(params->aid, cur_byte);
   794  cur_byte += 2;
   795  
   796  *cur_byte++ = params->supported_rates_len;
   797  if (params->supported_rates_len > 0)
   798  memcpy(cur_byte, params->supported_rates,
   799 params->supported_rates_len);
   800  cur_byte += params->supported_rates_len;
   801  
   802  if (params->ht_capa) {
   803  *cur_byte++ = true;
   804  memcpy(cur_byte, ¶ms->ht_capa,
 
This is copying the wrong data.  The "&" is wrong.

   805 sizeof(struct ieee80211_ht_cap));
   806  } else {
   807  *cur_byte++ = false;
   808  }
   809  cur_byte += sizeof(struct ieee80211_ht_cap);
   810  
   811  put_unaligned_le16(params->sta_flags_mask, cur_byte);
   812  cur_byte += 2;
   813  put_unaligned_le16(params->sta_flags_set, cur_byte);
   814  }


drivers/staging/wilc1000/cfg80211.c:904 del_pmksa() warn: 'i < 
priv->pmkid_list.numpmkid' 'true' implies 'priv->pmkid_list.numpmkid > 0' is 
'true'

drivers/staging/wilc1000/cfg80211.c
   887  static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
   888   struct cfg80211_pmksa *pmksa)
   889  {
   890  u32 i;
   891  int ret = 0;
   892  struct wilc_vif *vif = netdev_priv(netdev);
   893  struct wilc_priv *priv = &vif->priv;
   894  
   895  for (i = 0; i < priv->pmkid_list.numpmkid; i++) {
   896  if (!memcmp(pmksa->bssid, 
priv->pmkid_list.pmkidlist[i].bssid,
   897  ETH_ALEN)) {
   898  memset(&priv->pmkid_list.pmkidlist[i], 0,
   899 sizeof(struct wilc_pmkid));
   900  break;
   901  }
   902  }
   903  
   904  if (i < priv->pmkid_list.numpmkid && priv->pmkid_list.numpmkid 
> 0) {
 
^
This part of the condition is a given (must be true).  Delete it.  It's
better to reverse the test and say:

if (i == priv->pmkid_list.numpmkid)
return -EINVAL;

   905  for (; i < (priv->pmkid_list.numpmkid - 1); i++) {
   906  memcpy(priv->pmkid_list.pmkidlist[i].bssid,
   907 priv->pmkid_list.pmkidlist[i + 1].bssid,
   908 ETH_ALEN);
   909  memcpy(priv->pmkid_list.pmkidlist[i].pmkid,
   910 priv->pmkid_list.pmkidlist[i + 1].pmkid,
   911 WLAN_PMKID_LEN);
   912  }
   913  priv->pmkid_list.numpmkid--;
   914  } else {
   915  ret = -EINVAL;
   916  }
   917  
   918  return ret;
   919  }


drivers/staging/wilc1000/wlan.c:706 wilc_wlan_handle_rx_buff() warn: 'pkt_len' 
'true' implies 'pkt_len > 0' is 'true'

drivers/staging/wilc1000/wlan.c
   686  int is_cfg_packet;
   687  u8 *buff_ptr;
   688  
   689  do {
   690  buff_ptr = buffer + offset;
   691  header = get_unaligned_le32(buff_ptr);
   692  
   693  is_cfg_packet = FIELD_GET(WILC_PKT_HDR_CONFIG_FIELD, 
header);
   694  pkt_offset = FIELD_GET(WILC_PKT_HDR_OFFSET_FIELD, 
header);
   695  tp_len = FIELD_GET(WILC_PKT_HDR_TOTAL_LEN_FIELD, 
header);
   696  pkt_len = FIELD_GET(WILC_PKT_HDR_LEN_FIELD, header);
   697  
   698  if (pkt_len == 0 || tp_len == 0)


   699  break;
   700  
   701  if (pkt_offset & IS_MANAGMEMENT) {
   702  buff_ptr += HOST_HDR_OFFSET;
   703  wilc_wfi_mgmt_rx(wilc, buff_ptr, pkt_len);
   704  } else {
   705  if (!is_cfg_packet) {
   706  if (pkt_len > 0) {
^^^
Delete.

   707  wilc_frmw_to_host(wilc, 
buff_ptr,
   708  

[PATCH 2/2] staging: exfat: remove redundant if statements

2020-03-02 Thread Tetsuhiro Kohada
If statement does not affect results when updating directory entry in
ffsMapCluster().

Signed-off-by: Tetsuhiro Kohada 
---
 drivers/staging/exfat/exfat_super.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/exfat/exfat_super.c 
b/drivers/staging/exfat/exfat_super.c
index 708398265828..75813d0fe7a7 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -1361,11 +1361,8 @@ static int ffsMapCluster(struct inode *inode, s32 
clu_offset, u32 *clu)
 
/* (3) update directory entry */
if (modified) {
-   if (exfat_get_entry_flag(ep) != fid->flags)
-   exfat_set_entry_flag(ep, fid->flags);
-
-   if (exfat_get_entry_clu0(ep) != fid->start_clu)
-   exfat_set_entry_clu0(ep, fid->start_clu);
+   exfat_set_entry_flag(ep, fid->flags);
+   exfat_set_entry_clu0(ep, fid->start_clu);
}
 
update_dir_checksum_with_entry_set(sb, es);
-- 
2.25.1

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


[PATCH 1/2] staging: exfat: clean up d_entry rebuilding.

2020-03-02 Thread Tetsuhiro Kohada
Clean up d_entry rebuilding in exfat_rename_file() and move_file().

-Replace memcpy of d_entry with structure copy.
-Change to use the value already stored in fid.

Signed-off-by: Tetsuhiro Kohada 
---
 drivers/staging/exfat/exfat_core.c | 25 ++---
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/exfat/exfat_core.c 
b/drivers/staging/exfat/exfat_core.c
index ceaea1ba1a83..374a4fe183f5 100644
--- a/drivers/staging/exfat/exfat_core.c
+++ b/drivers/staging/exfat/exfat_core.c
@@ -2285,12 +2285,10 @@ s32 exfat_rename_file(struct inode *inode, struct 
chain_t *p_dir, s32 oldentry,
return -ENOENT;
}
 
-   memcpy((void *)epnew, (void *)epold, DENTRY_SIZE);
-   if (exfat_get_entry_type(epnew) == TYPE_FILE) {
-   exfat_set_entry_attr(epnew,
-exfat_get_entry_attr(epnew) |
-ATTR_ARCHIVE);
+   *epnew = *epold;
+   if (fid->type == TYPE_FILE) {
fid->attr |= ATTR_ARCHIVE;
+   exfat_set_entry_attr(epnew, fid->attr);
}
exfat_buf_modify(sb, sector_new);
exfat_buf_unlock(sb, sector_old);
@@ -2306,7 +2304,7 @@ s32 exfat_rename_file(struct inode *inode, struct chain_t 
*p_dir, s32 oldentry,
return -ENOENT;
}
 
-   memcpy((void *)epnew, (void *)epold, DENTRY_SIZE);
+   *epnew = *epold;
exfat_buf_modify(sb, sector_new);
exfat_buf_unlock(sb, sector_old);
 
@@ -2319,11 +2317,9 @@ s32 exfat_rename_file(struct inode *inode, struct 
chain_t *p_dir, s32 oldentry,
   num_old_entries);
fid->entry = newentry;
} else {
-   if (exfat_get_entry_type(epold) == TYPE_FILE) {
-   exfat_set_entry_attr(epold,
-exfat_get_entry_attr(epold) |
-ATTR_ARCHIVE);
+   if (fid->type == TYPE_FILE) {
fid->attr |= ATTR_ARCHIVE;
+   exfat_set_entry_attr(epold, fid->attr);
}
exfat_buf_modify(sb, sector_old);
exfat_buf_unlock(sb, sector_old);
@@ -2387,11 +2383,10 @@ s32 move_file(struct inode *inode, struct chain_t 
*p_olddir, s32 oldentry,
return -ENOENT;
}
 
-   memcpy((void *)epnew, (void *)epmov, DENTRY_SIZE);
-   if (exfat_get_entry_type(epnew) == TYPE_FILE) {
-   exfat_set_entry_attr(epnew, exfat_get_entry_attr(epnew) |
-ATTR_ARCHIVE);
+   *epnew = *epmov;
+   if (fid->type == TYPE_FILE) {
fid->attr |= ATTR_ARCHIVE;
+   exfat_set_entry_attr(epnew, fid->attr);
}
exfat_buf_modify(sb, sector_new);
exfat_buf_unlock(sb, sector_mov);
@@ -2406,7 +2401,7 @@ s32 move_file(struct inode *inode, struct chain_t 
*p_olddir, s32 oldentry,
return -ENOENT;
}
 
-   memcpy((void *)epnew, (void *)epmov, DENTRY_SIZE);
+   *epnew = *epmov;
exfat_buf_modify(sb, sector_new);
exfat_buf_unlock(sb, sector_mov);
 
-- 
2.25.1

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


Re: [PATCH 1/2] staging: exfat: clean up d_entry rebuilding.

2020-03-02 Thread Valdis Klētnieks
On Mon, 02 Mar 2020 18:57:15 +0900, Tetsuhiro Kohada said:
> Clean up d_entry rebuilding in exfat_rename_file() and move_file().
>
> -Replace memcpy of d_entry with structure copy.

Those look OK.

> -Change to use the value already stored in fid.

> - if (exfat_get_entry_type(epnew) == TYPE_FILE) {

> + if (fid->type == TYPE_FILE) {

Are you sure this is OK to do? exfat_get_entry_type() does a lot of
mapping between values, using a file_dentry_t->type, while
fid->type is a file_id_t->type. and at first read it's not obvious to me whether
fid->type is guaranteed to have the correct value already.

(The abundant use of 0xNN constants in exfat_get_entry_type()  doesn't
inspire confidence that it's looking at what you think it's looking at...)




pgpygxokVp9vb.pgp
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 8/8] arm64: dts: renesas: salvator: add a connection from adv748x codec (HDMI input) to the R-Car SoC

2020-03-02 Thread Geert Uytterhoeven
Hi Alex,

Thanks for your patch!

On Mon, Jan 13, 2020 at 3:24 PM Alex Riesen
 wrote:
> Not sure if all variants of the Salvator board have the HDMI decoder
> chip (the ADV7482) connected to the SSI4 on R-Car SoC, as it is on
> Salvator-X ES1, so the the ADV7482 endpoint and connection definitions
> are placed in the board file.

Both Salvator-X and Salvator-XS have SSI4 wired to the ADV7482.

> I do assume though that all Salvator variants have the CLK_C clock line
> hard-wired to the ADV7482 HDMI decoder, and remove it from the list of
> clocks provided by the R-Car sound system.

Yes, both Salvator-X and Salvator-XS have it wired that way.  But please
see below.

> The I2C wiring is also likely to persist across the variants (similar
> to ak4613, connected to the same interface), so that is in the common
> file.
>
> Signed-off-by: Alexander Riesen 

Below are my comments w.r.t. the board-specific wiring.
I'll defer to the multimedia people for commenting on the audio parts.

BTW, what is the status of the other patches in this series?

> --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> @@ -322,6 +322,10 @@
> clock-frequency = <22579200>;
>  };
>
> +&audio_clk_c {
> +   clock-frequency = <12288000>;
> +};

Does the ADV7482 always generate a 12.288 MHz clock signal?
Or is this programmable?

> +
>  &avb {
> pinctrl-0 = <&avb_pins>;
> pinctrl-names = "default";
> @@ -471,12 +475,14 @@
>
> #address-cells = <1>;
> #size-cells = <0>;
> +   #sound-dai-cells = <0>;
>
> interrupt-parent = <&gpio6>;
> interrupt-names = "intrq1", "intrq2";
> interrupts = <30 IRQ_TYPE_LEVEL_LOW>,
>  <31 IRQ_TYPE_LEVEL_LOW>;
> -
> +   clocks = <&rcar_sound 3>, <&audio_clk_c>;
> +   clock-names = "clk-hdmi-video", "clk-hdmi-i2s-mclk";

The above declares the Audio CLK C to be a clock input of the ADV7482, while
it is an output.
Furthermore, the DT bindings do not document that clocks can be specified.

> port@7 {
> reg = <7>;
>
> @@ -512,6 +518,14 @@
> remote-endpoint = <&csi20_in>;
> };
> };
> +
> +   port@c {
> +   reg = <12>;
> +
> +   adv7482_i2s: endpoint {
> +   /* remote-endpoint defined in the board file 
> */
> +   };
> +   };
> };
>
> csa_vdd: adc@7c {
> @@ -686,7 +700,8 @@
> };
>
> sound_pins: sound {
> -   groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
> +   groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a",
> +"ssi4_data";

Missing "ss4_ctrl", for the SCK4 and WS4 pins.

> function = "ssi";
> };
>
> @@ -735,8 +750,8 @@
> pinctrl-0 = <&sound_pins &sound_clk_pins>;
> pinctrl-names = "default";
>
> -   /* Single DAI */
> -   #sound-dai-cells = <0>;
> +   /* multi DAI */
> +   #sound-dai-cells = <1>;
>
> /* audio_clkout0/1/2/3 */
> #clock-cells = <1>;
> @@ -760,8 +775,18 @@
>  <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
>  <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
>  <&audio_clk_a>, <&cs2000>,
> -<&audio_clk_c>,

Why remove it? This is the list of clock inputs, not outputs.

>  <&cpg CPG_CORE CPG_AUDIO_CLK_I>;
> +   clock-names = "ssi-all",
> + "ssi.9", "ssi.8", "ssi.7", "ssi.6",
> + "ssi.5", "ssi.4", "ssi.3", "ssi.2",
> + "ssi.1", "ssi.0",
> + "src.9", "src.8", "src.7", "src.6",
> + "src.5", "src.4", "src.3", "src.2",
> + "src.1", "src.0",
> + "mix.1", "mix.0",
> + "ctu.1", "ctu.0",
> + "dvc.0", "dvc.1",
> + "clk_a", "clk_b", "clk_i";
>
> ports {
> #address-cells = <1>;
> --
> 2.24.1.508.g91d2dafee0

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Att. Administración

2020-03-02 Thread FOESCO
Buenos días



Os informamos que se encuentra abierto el plazo de inscripción para la presente 
Convocatoria de Cursos Bonificables para empleados (Marzo 2020)

Todos los cursos son totalmente Bonificables con cargo al Crédito de Formación 
2020 que disponen las empresas.


Deseáis que os mandemos la información?


Saludos.


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


Re: [PATCH v2 2/3] binder: do not initialize locals passed to copy_from_user()

2020-03-02 Thread Joe Perches
On Mon, 2020-03-02 at 14:04 +0100, gli...@google.com wrote:
> Certain copy_from_user() invocations in binder.c are known to
> unconditionally initialize locals before their first use, like e.g. in
> the following case:
[]
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
[]
> @@ -3788,7 +3788,7 @@ static int binder_thread_write(struct binder_proc *proc,
>  
>   case BC_TRANSACTION_SG:
>   case BC_REPLY_SG: {
> - struct binder_transaction_data_sg tr;
> + struct binder_transaction_data_sg tr __no_initialize;
>  
>   if (copy_from_user(&tr, ptr, sizeof(tr)))

I fail to see any value in marking tr with __no_initialize
when it's immediately written to by copy_from_user.

>   return -EFAULT;
> @@ -3799,7 +3799,7 @@ static int binder_thread_write(struct binder_proc *proc,
>   }
>   case BC_TRANSACTION:
>   case BC_REPLY: {
> - struct binder_transaction_data tr;
> + struct binder_transaction_data tr __no_initialize;
>  
>   if (copy_from_user(&tr, ptr, sizeof(tr)))

etc...


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


Re: [PATCH 8/8] arm64: dts: renesas: salvator: add a connection from adv748x codec (HDMI input) to the R-Car SoC

2020-03-02 Thread Alex Riesen
Geert Uytterhoeven, Mon, Mar 02, 2020 13:28:13 +0100:
> Hi Alex,
> 
> Thanks for your patch!
> 
> On Mon, Jan 13, 2020 at 3:24 PM Alex Riesen
>  wrote:
> > Not sure if all variants of the Salvator board have the HDMI decoder
> > chip (the ADV7482) connected to the SSI4 on R-Car SoC, as it is on
> > Salvator-X ES1, so the the ADV7482 endpoint and connection definitions
> > are placed in the board file.
> 
> Both Salvator-X and Salvator-XS have SSI4 wired to the ADV7482.
> 
> > I do assume though that all Salvator variants have the CLK_C clock line
> > hard-wired to the ADV7482 HDMI decoder, and remove it from the list of
> > clocks provided by the R-Car sound system.
> 
> Yes, both Salvator-X and Salvator-XS have it wired that way.

Ok, seems like I can move that part into the common file as well.
Integrations of ADV7482 and R-Car which use salvator-common.dts can still
redefine the endpoint settings in their board files, right?

> But please see below.

...

> > The I2C wiring is also likely to persist across the variants (similar
> > to ak4613, connected to the same interface), so that is in the common
> > file.
> >
> > Signed-off-by: Alexander Riesen 
> 
> Below are my comments w.r.t. the board-specific wiring.
> I'll defer to the multimedia people for commenting on the audio parts.
> 
> BTW, what is the status of the other patches in this series?

"Submitted", at the moment. Besides you and Rob Herring no one said anything
yet (either that or I missed the replies).

> > --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > @@ -322,6 +322,10 @@
> > clock-frequency = <22579200>;
> >  };
> >
> > +&audio_clk_c {
> > +   clock-frequency = <12288000>;
> > +};
> 
> Does the ADV7482 always generate a 12.288 MHz clock signal?
> Or is this programmable?

Oops. It looks like it is and the value is derived from the sampling rate
(48kHz) and the master clock multiplier. Both hard-coded in the board file.

> > video-receiver@70 {
> > compatible = "adi,adv7482";
> > ...
> > +   clocks = <&rcar_sound 3>, <&audio_clk_c>;
> > +   clock-names = "clk-hdmi-video", "clk-hdmi-i2s-mclk";
> 
> The above declares the Audio CLK C to be a clock input of the ADV7482, while
> it is an output.

I would gladly give it right direction if I *really* understood what I was
doing...

> Furthermore, the DT bindings do not document that clocks can be specified.

Should the DT bindings document that the clock cannot be specified than?

> > @@ -686,7 +700,8 @@
> > };
> >
> > sound_pins: sound {
> > -   groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
> > +   groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a",
> > +"ssi4_data";
> 
> Missing "ss4_ctrl", for the SCK4 and WS4 pins.

I'll add them.
As the device seems to function even without thoes, does this mean the pins in
the group are used "on demand" by whatever needs them?

> > @@ -760,8 +775,18 @@
> >  <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
> >  <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
> >  <&audio_clk_a>, <&cs2000>,
> > -<&audio_clk_c>,
> 
> Why remove it? This is the list of clock inputs, not outputs.

...probably because I was thinking the specification was exactly the other way
around.

Does a "clocks = ..." statement always mean input clocks?

I shall correct that and re-test (might take a while, I don't have the
hardware anymore).

Thanks for looking!
Regards,
Alex
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 8/8] arm64: dts: renesas: salvator: add a connection from adv748x codec (HDMI input) to the R-Car SoC

2020-03-02 Thread Geert Uytterhoeven
Hi Alex,

On Mon, Mar 2, 2020 at 2:40 PM Alex Riesen  wrote:
> Geert Uytterhoeven, Mon, Mar 02, 2020 13:28:13 +0100:
> > On Mon, Jan 13, 2020 at 3:24 PM Alex Riesen
> >  wrote:
> > > Not sure if all variants of the Salvator board have the HDMI decoder
> > > chip (the ADV7482) connected to the SSI4 on R-Car SoC, as it is on
> > > Salvator-X ES1, so the the ADV7482 endpoint and connection definitions
> > > are placed in the board file.
> >
> > Both Salvator-X and Salvator-XS have SSI4 wired to the ADV7482.
> >
> > > I do assume though that all Salvator variants have the CLK_C clock line
> > > hard-wired to the ADV7482 HDMI decoder, and remove it from the list of
> > > clocks provided by the R-Car sound system.
> >
> > Yes, both Salvator-X and Salvator-XS have it wired that way.
>
> Ok, seems like I can move that part into the common file as well.
> Integrations of ADV7482 and R-Car which use salvator-common.dts can still
> redefine the endpoint settings in their board files, right?

Indeed.

> > > --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > @@ -322,6 +322,10 @@
> > > clock-frequency = <22579200>;
> > >  };
> > >
> > > +&audio_clk_c {
> > > +   clock-frequency = <12288000>;
> > > +};
> >
> > Does the ADV7482 always generate a 12.288 MHz clock signal?
> > Or is this programmable?
>
> Oops. It looks like it is and the value is derived from the sampling rate
> (48kHz) and the master clock multiplier. Both hard-coded in the board file.

Where are these hardcoded in the board file?
Even if they are, technically this is a clock output of the ADC7482.

> > > video-receiver@70 {
> > > compatible = "adi,adv7482";
> > > ...
> > > +   clocks = <&rcar_sound 3>, <&audio_clk_c>;
> > > +   clock-names = "clk-hdmi-video", "clk-hdmi-i2s-mclk";
> >
> > The above declares the Audio CLK C to be a clock input of the ADV7482, while
> > it is an output.
>
> I would gladly give it right direction if I *really* understood what I was
> doing...

:-)

> > Furthermore, the DT bindings do not document that clocks can be specified.
>
> Should the DT bindings document that the clock cannot be specified than?

It currently does say so, as it doesn't list "clocks" in its properties section.

> > > @@ -686,7 +700,8 @@
> > > };
> > >
> > > sound_pins: sound {
> > > -   groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
> > > +   groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a",
> > > +"ssi4_data";
> >
> > Missing "ss4_ctrl", for the SCK4 and WS4 pins.
>
> I'll add them.
> As the device seems to function even without thoes, does this mean the pins in
> the group are used "on demand" by whatever needs them?

Probably the SCK4/WS4 functions are the reset-state defaults.

> > > @@ -760,8 +775,18 @@
> > >  <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
> > >  <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
> > >  <&audio_clk_a>, <&cs2000>,
> > > -<&audio_clk_c>,
> >
> > Why remove it? This is the list of clock inputs, not outputs.
>
> ...probably because I was thinking the specification was exactly the other way
> around.
>
> Does a "clocks = ..." statement always mean input clocks?

Yes it does.
If a device has clock outputs and is thus a clock provider, it should
have a #clock-cells property, and this should be documented in the bindings.

A clock consumer will refer to clocks of a provider using the "clocks"
property, specifying a clock specifier (phandle and zero or more indices)
for each clock referenced.

> I shall correct that and re-test (might take a while, I don't have the
> hardware anymore).

Oops.

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 2/3] binder: do not initialize locals passed to copy_from_user()

2020-03-02 Thread Dan Carpenter
On Mon, Mar 02, 2020 at 02:25:51PM +0100, Alexander Potapenko wrote:
> On Mon, Mar 2, 2020 at 2:11 PM Joe Perches  wrote:
> >
> > On Mon, 2020-03-02 at 14:04 +0100, gli...@google.com wrote:
> > > Certain copy_from_user() invocations in binder.c are known to
> > > unconditionally initialize locals before their first use, like e.g. in
> > > the following case:
> > []
> > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> > []
> > > @@ -3788,7 +3788,7 @@ static int binder_thread_write(struct binder_proc 
> > > *proc,
> > >
> > >   case BC_TRANSACTION_SG:
> > >   case BC_REPLY_SG: {
> > > - struct binder_transaction_data_sg tr;
> > > + struct binder_transaction_data_sg tr 
> > > __no_initialize;
> > >
> > >   if (copy_from_user(&tr, ptr, sizeof(tr)))
> >
> > I fail to see any value in marking tr with __no_initialize
> > when it's immediately written to by copy_from_user.
> 
> This is being done exactly because it's immediately written to by 
> copy_to_user()
> Clang is currently unable to figure out that copy_to_user() initializes 
> memory.
^^
typo s/to/from/.

It feels more useful to annotate copy_from_user().  That would be useful
for Smatch as well.

regards,
dan carpenter

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


Re: [PATCH v2 2/3] binder: do not initialize locals passed to copy_from_user()

2020-03-02 Thread Joe Perches
On Mon, 2020-03-02 at 14:25 +0100, Alexander Potapenko wrote:
> On Mon, Mar 2, 2020 at 2:11 PM Joe Perches  wrote:
> > On Mon, 2020-03-02 at 14:04 +0100, gli...@google.com wrote:
> > > Certain copy_from_user() invocations in binder.c are known to
> > > unconditionally initialize locals before their first use, like e.g. in
> > > the following case:
> > []
> > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> > []
> > > @@ -3788,7 +3788,7 @@ static int binder_thread_write(struct binder_proc 
> > > *proc,
> > > 
> > >   case BC_TRANSACTION_SG:
> > >   case BC_REPLY_SG: {
> > > - struct binder_transaction_data_sg tr;
> > > + struct binder_transaction_data_sg tr 
> > > __no_initialize;
> > > 
> > >   if (copy_from_user(&tr, ptr, sizeof(tr)))
> > 
> > I fail to see any value in marking tr with __no_initialize
> > when it's immediately written to by copy_from_user.
> 
> This is being done exactly because it's immediately written to by 
> copy_to_user()
> Clang is currently unable to figure out that copy_to_user() initializes 
> memory.
> So building the kernel with CONFIG_INIT_STACK_ALL=y basically leads to
> the following code:
> 
>   struct binder_transaction_data_sg tr;
>   memset(&tr, 0xAA, sizeof(tr));
>   if (copy_from_user(&tr, ptr, sizeof(tr))) {...}
> 
> This unnecessarily slows the code down, so we add __no_initialize to
> prevent the compiler from emitting the redundant initialization.

So?  CONFIG_INIT_STACK_ALL by design slows down code.

This marking would likely need to be done for nearly all
3000+ copy_from_user entries.

Why not try to get something done on the compiler side
to mark the function itself rather than the uses?



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


Re: [PATCH v1] media: staging: tegra-vde: Use devm_platform_ioremap_resource_byname()

2020-03-02 Thread Dmitry Osipenko
02.03.2020 11:04, Dan Carpenter пишет:
> On Thu, Feb 27, 2020 at 09:09:15PM +0300, Dmitry Osipenko wrote:
>> This helps to make code cleaner a tad.
> 
> Please don't start the commit message in the middle of a sentence.

Could you please clarify what do you mean by the "middle of a sentence"?
The commit's message doesn't sound "middle" to me at all.

> It looks like this for some of us:
> 
> https://marc.info/?l=linux-driver-devel&m=158282701430176&w=2

This link points to this patch, I don't quite understand what you're
trying to convey here.

> I generally read the subject or the full commit message but seldom
> both.

The commit's title describes the change briefly, while the message gives
a rational for the change. Usually reviewer should consult the code
changes themselves for more details.

Do you have some kind of a email filter that shows only the commit's
message? Otherwise I'm not sure what's the problem.

> Otherwise the patch looks very good.

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


Re: [PATCH 8/8] arm64: dts: renesas: salvator: add a connection from adv748x codec (HDMI input) to the R-Car SoC

2020-03-02 Thread Alex Riesen
Geert Uytterhoeven, Mon, Mar 02, 2020 14:47:46 +0100:
> On Mon, Mar 2, 2020 at 2:40 PM Alex Riesen  
> wrote:
> > > > --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > > +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > > @@ -322,6 +322,10 @@
> > > > clock-frequency = <22579200>;
> > > >  };
> > > >
> > > > +&audio_clk_c {
> > > > +   clock-frequency = <12288000>;
> > > > +};
> > >
> > > Does the ADV7482 always generate a 12.288 MHz clock signal?
> > > Or is this programmable?
> >
> > Oops. It looks like it is and the value is derived from the sampling rate
> > (48kHz) and the master clock multiplier. Both hard-coded in the board file.
> 
> Where are these hardcoded in the board file?

In the endpoint definition, 
arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts

So the frequency can be set at the run-time, perhaps even derived from
endpoint connected to the output. In this case, rsnd_endpoint3,
which has the "mclk-fs" setting. Not sure if the sampling rate
can be set to something else for the HDMI, though.

> Even if they are, technically this is a clock output of the ADV7482.

... which I hope to correct as soon as I steal the hardware from whoever stole
it from me...

> > > > video-receiver@70 {
> > > > compatible = "adi,adv7482";
> > > > ...
> > > > +   clocks = <&rcar_sound 3>, <&audio_clk_c>;
> > > > +   clock-names = "clk-hdmi-video", "clk-hdmi-i2s-mclk";
> > >
> > > The above declares the Audio CLK C to be a clock input of the ADV7482, 
> > > while
> > > it is an output.
> >
> > I would gladly give it right direction if I *really* understood what I was
> > doing...
> 
> :-)
> 
> > > Furthermore, the DT bindings do not document that clocks can be specified.
> >
> > Should the DT bindings document that the clock cannot be specified than?
> 
> It currently does say so, as it doesn't list "clocks" in its properties 
> section.

The bindings documentation file, which we're talking about here and which does
not list the specifiable input clocks in its properties, is it the

Documentation/devicetree/bindings/media/i2c/adv748x.txt

?

And this absence of documentation also means that whatever clocks (both input
in "clocks=" and output in "#clock-cells") listed in a specific .dts are just
an integration detail?

Does this below makes more sense, than?

video-receiver@70 {
compatible = "adi,adv7482";
clocks = <&rcar_sound 3>;
clock-names = "clk-hdmi-video";
adv748x_mclk: mclk {
compatible = "fixed-clock";
#clock-cells =  <0>;
/* frequency hard-coded for illustration */
clock-frequency = <12288000>;
clock-output-names = "clk-hdmi-i2s-mclk";
};
};

Now I'm a bit hazy on how to declare that the MCLK output of the
video-receiver@70 is connected to the Audio Clock C of the SoC...
Probably remove use of "audio_clk_c" completely?

> > > > @@ -686,7 +700,8 @@
> > > > };
> > > >
> > > > sound_pins: sound {
> > > > -   groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
> > > > +   groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a",
> > > > +"ssi4_data";
> > >
> > > Missing "ss4_ctrl", for the SCK4 and WS4 pins.
> >
> > I'll add them.
> > As the device seems to function even without thoes, does this mean the
> > pins in the group are used "on demand" by whatever needs them?
> 
> Probably the SCK4/WS4 functions are the reset-state defaults.

That ... might require some trial and testing: when I add them to the group,
the reset defaults will be overridden by the platform initialization, which is
not necessarily the reset default. Will see.

> >
> > Does a "clocks = ..." statement always mean input clocks?
> 
> Yes it does.
> If a device has clock outputs and is thus a clock provider, it should
> have a #clock-cells property, and this should be documented in the bindings.
> 
> A clock consumer will refer to clocks of a provider using the "clocks"
> property, specifying a clock specifier (phandle and zero or more indices)
> for each clock referenced.

Something like this?

&rcar_sound {
clocks = ...,
 <&adv748x_mclk>,
 <&cpg CPG_CORE CPG_AUDIO_CLK_I>;
clock-names = ...,
  "clk_c",
  "clk_i";
};

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


Re: [PATCH v1] media: staging: tegra-vde: Use devm_platform_ioremap_resource_byname()

2020-03-02 Thread Dan Carpenter
On Mon, Mar 02, 2020 at 06:04:20PM +0300, Dmitry Osipenko wrote:
> 02.03.2020 11:04, Dan Carpenter пишет:
> > On Thu, Feb 27, 2020 at 09:09:15PM +0300, Dmitry Osipenko wrote:
> >> This helps to make code cleaner a tad.
> > 
> > Please don't start the commit message in the middle of a sentence.
> 
> Could you please clarify what do you mean by the "middle of a sentence"?
> The commit's message doesn't sound "middle" to me at all.
> 
> > It looks like this for some of us:
> > 
> > https://marc.info/?l=linux-driver-devel&m=158282701430176&w=2
> 
> This link points to this patch, I don't quite understand what you're
> trying to convey here.
> 
> > I generally read the subject or the full commit message but seldom
> > both.
> 
> The commit's title describes the change briefly, while the message gives
> a rational for the change. Usually reviewer should consult the code
> changes themselves for more details.
> 
> Do you have some kind of a email filter that shows only the commit's
> message? Otherwise I'm not sure what's the problem.


The commit message just says "This helps to make code cleaner a tad."
but it doesn't mention devm_platform_ioremap_resource_byname().  That
information is there in the subject but not in the commit message itself.
Take a look at the link I sent you and try to find the subject.  It's
far away from the commit message.

regards,
dan carpenter

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


Re: [PATCH 8/8] arm64: dts: renesas: salvator: add a connection from adv748x codec (HDMI input) to the R-Car SoC

2020-03-02 Thread Geert Uytterhoeven
Hi Alex,

On Mon, Mar 2, 2020 at 4:07 PM Alex Riesen  wrote:
> Geert Uytterhoeven, Mon, Mar 02, 2020 14:47:46 +0100:
> > On Mon, Mar 2, 2020 at 2:40 PM Alex Riesen  
> > wrote:
> > > > > --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > > > +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > > > @@ -322,6 +322,10 @@
> > > > > clock-frequency = <22579200>;
> > > > >  };
> > > > >
> > > > > +&audio_clk_c {
> > > > > +   clock-frequency = <12288000>;
> > > > > +};
> > > >
> > > > Does the ADV7482 always generate a 12.288 MHz clock signal?
> > > > Or is this programmable?
> > >
> > > Oops. It looks like it is and the value is derived from the sampling rate
> > > (48kHz) and the master clock multiplier. Both hard-coded in the board 
> > > file.
> >
> > Where are these hardcoded in the board file?
>
> In the endpoint definition, 
> arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
>
> So the frequency can be set at the run-time, perhaps even derived from
> endpoint connected to the output. In this case, rsnd_endpoint3,
> which has the "mclk-fs" setting. Not sure if the sampling rate
> can be set to something else for the HDMI, though.
>
> > Even if they are, technically this is a clock output of the ADV7482.
>
> ... which I hope to correct as soon as I steal the hardware from whoever stole
> it from me...
>
> > > > > video-receiver@70 {
> > > > > compatible = "adi,adv7482";
> > > > > ...
> > > > > +   clocks = <&rcar_sound 3>, <&audio_clk_c>;
> > > > > +   clock-names = "clk-hdmi-video", "clk-hdmi-i2s-mclk";
> > > >
> > > > The above declares the Audio CLK C to be a clock input of the ADV7482, 
> > > > while
> > > > it is an output.
> > >
> > > I would gladly give it right direction if I *really* understood what I was
> > > doing...
> >
> > :-)
> >
> > > > Furthermore, the DT bindings do not document that clocks can be 
> > > > specified.
> > >
> > > Should the DT bindings document that the clock cannot be specified than?
> >
> > It currently does say so, as it doesn't list "clocks" in its properties 
> > section.
>
> The bindings documentation file, which we're talking about here and which does
> not list the specifiable input clocks in its properties, is it the
>
> Documentation/devicetree/bindings/media/i2c/adv748x.txt
>
> ?

Yes.

>
> And this absence of documentation also means that whatever clocks (both input
> in "clocks=" and output in "#clock-cells") listed in a specific .dts are just
> an integration detail?

No, the absence probably means that any clock-related properties in a .dts
file will just be ignored.

Looking at the driver source, it indeed has no support related to clocks at all.

> Does this below makes more sense, than?
>
> video-receiver@70 {
> compatible = "adi,adv7482";
> clocks = <&rcar_sound 3>;
> clock-names = "clk-hdmi-video";
> adv748x_mclk: mclk {
> compatible = "fixed-clock";
> #clock-cells =  <0>;
> /* frequency hard-coded for illustration */
> clock-frequency = <12288000>;
> clock-output-names = "clk-hdmi-i2s-mclk";
> };
> };

The #clock-cells should be in the main video-receiver node.
Probably there is more than one clock output, so #clock-cells may be 1?
There is no need for a fixed-clock compatible, nor for clock-frequency
and clock-output-names.

But most important: this should be documented in the adv748x DT bindings,
and implemented in the adv748x driver.

> Now I'm a bit hazy on how to declare that the MCLK output of the
> video-receiver@70 is connected to the Audio Clock C of the SoC...
> Probably remove use of "audio_clk_c" completely?

Yes, the current audio_clk_c definition in the DTS assumes a fixed
crystal.

> > > > > @@ -686,7 +700,8 @@
> > > > > };
> > > > >
> > > > > sound_pins: sound {
> > > > > -   groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
> > > > > +   groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a",
> > > > > +"ssi4_data";
> > > >
> > > > Missing "ss4_ctrl", for the SCK4 and WS4 pins.
> > >
> > > I'll add them.
> > > As the device seems to function even without thoes, does this mean the
> > > pins in the group are used "on demand" by whatever needs them?
> >
> > Probably the SCK4/WS4 functions are the reset-state defaults.
>
> That ... might require some trial and testing: when I add them to the group,
> the reset defaults will be overridden by the platform initialization, which is
> not necessarily the reset default. Will see.

Or by the boot loader.  Anyway, you need to specify these in the DTS.

> > > Does a "clocks = ..." statement always mean input clocks?
> >
> > Yes it does.
> > If a device has clock outputs and is thus a clock provider, it should
> > have a #clock-cells property, and this should be documented in the bindings.
> >
> > A clock consumer will refer to clocks of a provider using the "clocks"
> > property, spec

Re: [PATCH] staging: vt6656: Declare a few variables as __read_mostly

2020-03-02 Thread Quentin Deslandes
On Sun, Mar 01, 2020 at 12:26:20PM +0100, Oscar Carter wrote:
> These include module parameters.
> 
> Signed-off-by: Oscar Carter 
> ---
>  drivers/staging/vt6656/main_usb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/main_usb.c 
> b/drivers/staging/vt6656/main_usb.c
> index 5e48b3ddb94c..701300202b21 100644
> --- a/drivers/staging/vt6656/main_usb.c
> +++ b/drivers/staging/vt6656/main_usb.c
> @@ -49,12 +49,12 @@ MODULE_LICENSE("GPL");
>  MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM);
> 
>  #define RX_DESC_DEF0 64
> -static int vnt_rx_buffers = RX_DESC_DEF0;
> +static int __read_mostly vnt_rx_buffers = RX_DESC_DEF0;
>  module_param_named(rx_buffers, vnt_rx_buffers, int, 0644);
>  MODULE_PARM_DESC(rx_buffers, "Number of receive usb rx buffers");
> 
>  #define TX_DESC_DEF0 64
> -static int vnt_tx_buffers = TX_DESC_DEF0;
> +static int __read_mostly vnt_tx_buffers = TX_DESC_DEF0;
>  module_param_named(tx_buffers, vnt_tx_buffers, int, 0644);
>  MODULE_PARM_DESC(tx_buffers, "Number of receive usb tx buffers");
> 
> --
> 2.20.1
> 

Looks good to me.

Reviewed-by: Quentin Deslandes 

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


Re: [PATCH] staging: vt6656: Remove unnecessary local variables initialization

2020-03-02 Thread Quentin Deslandes
On Sun, Mar 01, 2020 at 02:50:28PM +0100, Oscar Carter wrote:
> Don't initialize variables that are then set a few lines later.
> 
> Signed-off-by: Oscar Carter 
> ---
>  drivers/staging/vt6656/main_usb.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/main_usb.c 
> b/drivers/staging/vt6656/main_usb.c
> index 701300202b21..bfeb5df896fe 100644
> --- a/drivers/staging/vt6656/main_usb.c
> +++ b/drivers/staging/vt6656/main_usb.c
> @@ -109,7 +109,7 @@ static void vnt_set_options(struct vnt_private *priv)
>   */
>  static int vnt_init_registers(struct vnt_private *priv)
>  {
> - int ret = 0;
> + int ret;
>   struct vnt_cmd_card_init *init_cmd = &priv->init_command;
>   struct vnt_rsp_card_init *init_rsp = &priv->init_response;
>   u8 antenna;
> @@ -435,7 +435,7 @@ static void vnt_free_int_bufs(struct vnt_private *priv)
> 
>  static int vnt_alloc_bufs(struct vnt_private *priv)
>  {
> - int ret = 0;
> + int ret;
>   struct vnt_usb_send_context *tx_context;
>   struct vnt_rcb *rcb;
>   int ii;
> @@ -528,7 +528,7 @@ static void vnt_tx_80211(struct ieee80211_hw *hw,
> 
>  static int vnt_start(struct ieee80211_hw *hw)
>  {
> - int ret = 0;
> + int ret;
>   struct vnt_private *priv = hw->priv;
> 
>   priv->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS;
> @@ -798,7 +798,7 @@ static u64 vnt_prepare_multicast(struct ieee80211_hw *hw,
>   struct vnt_private *priv = hw->priv;
>   struct netdev_hw_addr *ha;
>   u64 mc_filter = 0;
> - u32 bit_nr = 0;
> + u32 bit_nr;
> 
>   netdev_hw_addr_list_for_each(ha, mc_list) {
>   bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
> @@ -973,7 +973,7 @@ vt6656_probe(struct usb_interface *intf, const struct 
> usb_device_id *id)
>   struct vnt_private *priv;
>   struct ieee80211_hw *hw;
>   struct wiphy *wiphy;
> - int rc = 0;
> + int rc;
> 
>   udev = usb_get_dev(interface_to_usbdev(intf));
> 
> --
> 2.20.1
> 

Looks good.

Reviewed-by: Quentin Deslandes 

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


Re: [PATCH 8/8] arm64: dts: renesas: salvator: add a connection from adv748x codec (HDMI input) to the R-Car SoC

2020-03-02 Thread Alex Riesen
Hi Geert,

Geert Uytterhoeven, Mon, Mar 02, 2020 16:32:32 +0100:
> > And this absence of documentation also means that whatever clocks (both 
> > input
> > in "clocks=" and output in "#clock-cells") listed in a specific .dts are 
> > just
> > an integration detail?
> 
> No, the absence probably means that any clock-related properties in a .dts
> file will just be ignored.
> 
> Looking at the driver source, it indeed has no support related to clocks at 
> all.

...

> > Does this below makes more sense, than?
> >
> > video-receiver@70 {
> > compatible = "adi,adv7482";
> > clocks = <&rcar_sound 3>;
> > clock-names = "clk-hdmi-video";
> > adv748x_mclk: mclk {
> > compatible = "fixed-clock";
> > #clock-cells =  <0>;
> > /* frequency hard-coded for illustration */
> > clock-frequency = <12288000>;
> > clock-output-names = "clk-hdmi-i2s-mclk";
> > };
> > };
> 
> The #clock-cells should be in the main video-receiver node.
> Probably there is more than one clock output, so #clock-cells may be 1?

AFAICS, the device can provide only this one clock line (audio master clock
for I2S output)... I shall re-check, just in case.

> There is no need for a fixed-clock compatible, nor for clock-frequency
> and clock-output-names.
> 
> But most important: this should be documented in the adv748x DT bindings,
> and implemented in the adv748x driver.

So if the driver is to export that clock for the kernel (like in this case),
it must implement its support?

> > > > Does a "clocks = ..." statement always mean input clocks?
> > >
> > > Yes it does.
> > > If a device has clock outputs and is thus a clock provider, it should
> > > have a #clock-cells property, and this should be documented in the 
> > > bindings.
> > >
> > > A clock consumer will refer to clocks of a provider using the "clocks"
> > > property, specifying a clock specifier (phandle and zero or more indices)
> > > for each clock referenced.
> >
> > Something like this?
> >
> > &rcar_sound {
> > clocks = ...,
> >  <&adv748x_mclk>,
> >  <&cpg CPG_CORE CPG_AUDIO_CLK_I>;
> > clock-names = ...,
> >   "clk_c",
> >   "clk_i";
> > };
> 
> More or less.
> 
> Might become
> 
> find_a_better_label_choice: video-receiver@70 {
> ...
> };
> 
> &rcar_sound {
> clock = ...,
> <&find_a_better_label_choice 0>,
> ...
> };
> 
> as there may be multiple clock outputs on the ADV7482.

I see. Working on it.

Thanks a lot!

Regards,
Alex

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


Re: [PATCH 8/8] arm64: dts: renesas: salvator: add a connection from adv748x codec (HDMI input) to the R-Car SoC

2020-03-02 Thread Geert Uytterhoeven
Hi Alex,

On Mon, Mar 2, 2020 at 5:09 PM Alex Riesen  wrote:
> Geert Uytterhoeven, Mon, Mar 02, 2020 16:32:32 +0100:
> > > And this absence of documentation also means that whatever clocks (both 
> > > input
> > > in "clocks=" and output in "#clock-cells") listed in a specific .dts are 
> > > just
> > > an integration detail?
> >
> > No, the absence probably means that any clock-related properties in a .dts
> > file will just be ignored.
> >
> > Looking at the driver source, it indeed has no support related to clocks at 
> > all.
>
> ...
>
> > > Does this below makes more sense, than?
> > >
> > > video-receiver@70 {
> > > compatible = "adi,adv7482";
> > > clocks = <&rcar_sound 3>;
> > > clock-names = "clk-hdmi-video";
> > > adv748x_mclk: mclk {
> > > compatible = "fixed-clock";
> > > #clock-cells =  <0>;
> > > /* frequency hard-coded for illustration */
> > > clock-frequency = <12288000>;
> > > clock-output-names = "clk-hdmi-i2s-mclk";
> > > };
> > > };
> >
> > The #clock-cells should be in the main video-receiver node.
> > Probably there is more than one clock output, so #clock-cells may be 1?
>
> AFAICS, the device can provide only this one clock line (audio master clock
> for I2S output)... I shall re-check, just in case.
>
> > There is no need for a fixed-clock compatible, nor for clock-frequency
> > and clock-output-names.
> >
> > But most important: this should be documented in the adv748x DT bindings,
> > and implemented in the adv748x driver.
>
> So if the driver is to export that clock for the kernel (like in this case),
> it must implement its support?

Exactly.  Unless that pin is hardcoded to output a fixed clock, in which case
you can just override the existing audio_clk_c rate.

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/3] staging: wilc1000: use flexible-array member instead of zero-length array

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Use flexible-array member introduced in C99 instead of zero-length
array. Most of zero-length array was already taken care in previous
patch [1]. Now modified few more cases which were not handled earlier.

[1]. https://patchwork.kernel.org/patch/11394197/

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/spi.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/spi.c b/drivers/staging/wilc1000/spi.c
index 11653ac118cd..dfd25df75780 100644
--- a/drivers/staging/wilc1000/spi.c
+++ b/drivers/staging/wilc1000/spi.c
@@ -109,27 +109,27 @@ struct wilc_spi_cmd {
union {
struct {
u8 addr[3];
-   u8 crc[0];
+   u8 crc[];
} __packed simple_cmd;
struct {
u8 addr[3];
u8 size[2];
-   u8 crc[0];
+   u8 crc[];
} __packed dma_cmd;
struct {
u8 addr[3];
u8 size[3];
-   u8 crc[0];
+   u8 crc[];
} __packed dma_cmd_ext;
struct {
u8 addr[2];
__be32 data;
-   u8 crc[0];
+   u8 crc[];
} __packed internal_w_cmd;
struct {
u8 addr[3];
__be32 data;
-   u8 crc[0];
+   u8 crc[];
} __packed w_cmd;
} u;
 } __packed;
-- 
2.24.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: wilc1000: use correct data for memcpy in wilc_hif_pack_sta_param()

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Use correct data for memcpy in wilc_hif_pack_sta_param(). Its
reported by Smatch static code analyser tool as discussed in [1].

[1]. https://lore.kernel.org/linux-wireless/20200302092346.GA24308@kadam/

Suggested-by: Dan Carpenter 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/hif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/hif.c b/drivers/staging/wilc1000/hif.c
index c8c41c2df4ec..6c7de2f8d3f2 100644
--- a/drivers/staging/wilc1000/hif.c
+++ b/drivers/staging/wilc1000/hif.c
@@ -801,7 +801,7 @@ static void wilc_hif_pack_sta_param(u8 *cur_byte, const u8 
*mac,
 
if (params->ht_capa) {
*cur_byte++ = true;
-   memcpy(cur_byte, ¶ms->ht_capa,
+   memcpy(cur_byte, params->ht_capa,
   sizeof(struct ieee80211_ht_cap));
} else {
*cur_byte++ = false;
-- 
2.24.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] staging: wilc1000: remove unnecessary always true 'if' conditions

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Remove the unnecessary always true 'if' conditions and simiplifed the
logic as suggested in [1].

[1]. https://lore.kernel.org/linux-wireless/20200302092346.GA24308@kadam/

Suggested-by: Dan Carpenter 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/cfg80211.c | 26 --
 drivers/staging/wilc1000/wlan.c |  6 ++
 2 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/wilc1000/cfg80211.c 
b/drivers/staging/wilc1000/cfg80211.c
index 5d8faa01337d..54e02807cebf 100644
--- a/drivers/staging/wilc1000/cfg80211.c
+++ b/drivers/staging/wilc1000/cfg80211.c
@@ -888,7 +888,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device 
*netdev,
 struct cfg80211_pmksa *pmksa)
 {
u32 i;
-   int ret = 0;
struct wilc_vif *vif = netdev_priv(netdev);
struct wilc_priv *priv = &vif->priv;
 
@@ -901,21 +900,20 @@ static int del_pmksa(struct wiphy *wiphy, struct 
net_device *netdev,
}
}
 
-   if (i < priv->pmkid_list.numpmkid && priv->pmkid_list.numpmkid > 0) {
-   for (; i < (priv->pmkid_list.numpmkid - 1); i++) {
-   memcpy(priv->pmkid_list.pmkidlist[i].bssid,
-  priv->pmkid_list.pmkidlist[i + 1].bssid,
-  ETH_ALEN);
-   memcpy(priv->pmkid_list.pmkidlist[i].pmkid,
-  priv->pmkid_list.pmkidlist[i + 1].pmkid,
-  WLAN_PMKID_LEN);
-   }
-   priv->pmkid_list.numpmkid--;
-   } else {
-   ret = -EINVAL;
+   if (i == priv->pmkid_list.numpmkid)
+   return -EINVAL;
+
+   for (; i < (priv->pmkid_list.numpmkid - 1); i++) {
+   memcpy(priv->pmkid_list.pmkidlist[i].bssid,
+  priv->pmkid_list.pmkidlist[i + 1].bssid,
+  ETH_ALEN);
+   memcpy(priv->pmkid_list.pmkidlist[i].pmkid,
+  priv->pmkid_list.pmkidlist[i + 1].pmkid,
+  WLAN_PMKID_LEN);
}
+   priv->pmkid_list.numpmkid--;
 
-   return ret;
+   return 0;
 }
 
 static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
diff --git a/drivers/staging/wilc1000/wlan.c b/drivers/staging/wilc1000/wlan.c
index 3aeca882f431..6a82fb2f283e 100644
--- a/drivers/staging/wilc1000/wlan.c
+++ b/drivers/staging/wilc1000/wlan.c
@@ -703,10 +703,8 @@ static void wilc_wlan_handle_rx_buff(struct wilc *wilc, u8 
*buffer, int size)
wilc_wfi_mgmt_rx(wilc, buff_ptr, pkt_len);
} else {
if (!is_cfg_packet) {
-   if (pkt_len > 0) {
-   wilc_frmw_to_host(wilc, buff_ptr,
- pkt_len, pkt_offset);
-   }
+   wilc_frmw_to_host(wilc, buff_ptr, pkt_len,
+ pkt_offset);
} else {
struct wilc_cfg_rsp rsp;
 
-- 
2.24.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/3] staging: wilc1000: correct Smatch warnings & use flexible-array member

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

This patch series contains changes to address few Smatch static checker
reported warnings. Also added one patch to make use of flexible-array
member instead of zero-length array for few cases which were missed
earlier.

Ajay Singh (3):
  staging: wilc1000: use correct data for memcpy in
wilc_hif_pack_sta_param()
  staging: wilc1000: remove unnecessary always true 'if' conditions
  staging: wilc1000: use flexible-array member instead of zero-length
array

 drivers/staging/wilc1000/cfg80211.c | 26 --
 drivers/staging/wilc1000/hif.c  |  2 +-
 drivers/staging/wilc1000/spi.c  | 10 +-
 drivers/staging/wilc1000/wlan.c |  6 ++
 4 files changed, 20 insertions(+), 24 deletions(-)

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


[PATCH v4 07/18] wilc1000: add cfg80211.h

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/cfg80211.h' to
'drivers/net/wireless/microchip/wilc1000/cfg80211.h'.

Signed-off-by: Ajay Singh 
---
 .../wireless/microchip/wilc1000/cfg80211.h| 29 +++
 1 file changed, 29 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/cfg80211.h

diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.h 
b/drivers/net/wireless/microchip/wilc1000/cfg80211.h
new file mode 100644
index ..5e5d63f70df2
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#ifndef WILC_CFG80211_H
+#define WILC_CFG80211_H
+#include "netdev.h"
+
+struct wiphy *wilc_cfg_alloc(void);
+int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
+  const struct wilc_hif_func *ops);
+struct wilc *wilc_create_wiphy(struct device *dev);
+void wilc_deinit_host_int(struct net_device *net);
+int wilc_init_host_int(struct net_device *net);
+void wilc_wfi_monitor_rx(struct net_device *mon_dev, u8 *buff, u32 size);
+struct wilc_vif *wilc_netdev_interface(struct wilc *wl, const char *name,
+  enum nl80211_iftype type);
+void wilc_wfi_deinit_mon_interface(struct wilc *wl, bool rtnl_locked);
+struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl,
+  const char *name,
+  struct net_device *real_dev);
+void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
+ u16 frame_type, bool reg);
+struct wilc_vif *wilc_get_interface(struct wilc *wl);
+struct wilc_vif *wilc_get_wl_to_vif(struct wilc *wl);
+void wlan_deinit_locks(struct wilc *wilc);
+#endif
-- 
2.24.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 10/18] wilc1000: add mon.c

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/mon.c' to
'drivers/net/wireless/microchip/wilc1000/mon.c'.

Signed-off-by: Ajay Singh 
---
 drivers/net/wireless/microchip/wilc1000/mon.c | 260 ++
 1 file changed, 260 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/mon.c

diff --git a/drivers/net/wireless/microchip/wilc1000/mon.c 
b/drivers/net/wireless/microchip/wilc1000/mon.c
new file mode 100644
index ..60331417bd98
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/mon.c
@@ -0,0 +1,260 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#include "cfg80211.h"
+
+struct wilc_wfi_radiotap_hdr {
+   struct ieee80211_radiotap_header hdr;
+   u8 rate;
+} __packed;
+
+struct wilc_wfi_radiotap_cb_hdr {
+   struct ieee80211_radiotap_header hdr;
+   u8 rate;
+   u8 dump;
+   u16 tx_flags;
+} __packed;
+
+#define TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_RATE) |  \
+(1 << IEEE80211_RADIOTAP_TX_FLAGS))
+
+void wilc_wfi_monitor_rx(struct net_device *mon_dev, u8 *buff, u32 size)
+{
+   u32 header, pkt_offset;
+   struct sk_buff *skb = NULL;
+   struct wilc_wfi_radiotap_hdr *hdr;
+   struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
+
+   if (!mon_dev)
+   return;
+
+   if (!netif_running(mon_dev))
+   return;
+
+   /* Get WILC header */
+   header = get_unaligned_le32(buff - HOST_HDR_OFFSET);
+   /*
+* The packet offset field contain info about what type of management
+* the frame we are dealing with and ack status
+*/
+   pkt_offset = FIELD_GET(WILC_PKT_HDR_OFFSET_FIELD, header);
+
+   if (pkt_offset & IS_MANAGMEMENT_CALLBACK) {
+   /* hostapd callback mgmt frame */
+
+   skb = dev_alloc_skb(size + sizeof(*cb_hdr));
+   if (!skb)
+   return;
+
+   skb_put_data(skb, buff, size);
+
+   cb_hdr = skb_push(skb, sizeof(*cb_hdr));
+   memset(cb_hdr, 0, sizeof(*cb_hdr));
+
+   cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
+
+   cb_hdr->hdr.it_len = cpu_to_le16(sizeof(*cb_hdr));
+
+   cb_hdr->hdr.it_present = cpu_to_le32(TX_RADIOTAP_PRESENT);
+
+   cb_hdr->rate = 5;
+
+   if (pkt_offset & IS_MGMT_STATUS_SUCCES) {
+   /* success */
+   cb_hdr->tx_flags = IEEE80211_RADIOTAP_F_TX_RTS;
+   } else {
+   cb_hdr->tx_flags = IEEE80211_RADIOTAP_F_TX_FAIL;
+   }
+
+   } else {
+   skb = dev_alloc_skb(size + sizeof(*hdr));
+
+   if (!skb)
+   return;
+
+   skb_put_data(skb, buff, size);
+   hdr = skb_push(skb, sizeof(*hdr));
+   memset(hdr, 0, sizeof(struct wilc_wfi_radiotap_hdr));
+   hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
+   hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr));
+   hdr->hdr.it_present = cpu_to_le32
+   (1 << IEEE80211_RADIOTAP_RATE);
+   hdr->rate = 5;
+   }
+
+   skb->dev = mon_dev;
+   skb_reset_mac_header(skb);
+   skb->ip_summed = CHECKSUM_UNNECESSARY;
+   skb->pkt_type = PACKET_OTHERHOST;
+   skb->protocol = htons(ETH_P_802_2);
+   memset(skb->cb, 0, sizeof(skb->cb));
+
+   netif_rx(skb);
+}
+
+struct tx_complete_mon_data {
+   int size;
+   void *buff;
+};
+
+static void mgmt_tx_complete(void *priv, int status)
+{
+   struct tx_complete_mon_data *pv_data = priv;
+   /*
+* in case of fully hosting mode, the freeing will be done
+* in response to the cfg packet
+*/
+   kfree(pv_data->buff);
+
+   kfree(pv_data);
+}
+
+static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
+{
+   struct tx_complete_mon_data *mgmt_tx = NULL;
+
+   if (!dev)
+   return -EFAULT;
+
+   netif_stop_queue(dev);
+   mgmt_tx = kmalloc(sizeof(*mgmt_tx), GFP_ATOMIC);
+   if (!mgmt_tx)
+   return -ENOMEM;
+
+   mgmt_tx->buff = kmemdup(buf, len, GFP_ATOMIC);
+   if (!mgmt_tx->buff) {
+   kfree(mgmt_tx);
+   return -ENOMEM;
+   }
+
+   mgmt_tx->size = len;
+
+   wilc_wlan_txq_add_mgmt_pkt(dev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size,
+  mgmt_tx_complete);
+
+   netif_wake_queue(dev);
+   return 0;
+}
+
+static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
+struct net_device *dev)
+{
+   u32 rtap_len, ret = 0;
+   struct wilc_wfi_mon_priv  *mon_priv;
+   struct sk_buff *skb2;
+   struct wilc_wfi_radiotap_cb_hdr *cb_hdr;
+   u8 srcadd[ETH_ALEN];
+   

[PATCH v4 02/18] wilc1000: add hif.c

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/hif.c' to
'drivers/net/wireless/microchip/wilc1000/hif.c'.

Signed-off-by: Ajay Singh 
---
 drivers/net/wireless/microchip/wilc1000/hif.c | 1959 +
 1 file changed, 1959 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/hif.c

diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c 
b/drivers/net/wireless/microchip/wilc1000/hif.c
new file mode 100644
index ..6c7de2f8d3f2
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/hif.c
@@ -0,0 +1,1959 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#include "netdev.h"
+
+#define WILC_HIF_SCAN_TIMEOUT_MS5000
+#define WILC_HIF_CONNECT_TIMEOUT_MS 9500
+
+#define WILC_FALSE_FRMWR_CHANNEL   100
+
+struct wilc_rcvd_mac_info {
+   u8 status;
+};
+
+struct wilc_set_multicast {
+   u32 enabled;
+   u32 cnt;
+   u8 *mc_list;
+};
+
+struct wilc_del_all_sta {
+   u8 assoc_sta;
+   u8 mac[WILC_MAX_NUM_STA][ETH_ALEN];
+};
+
+union wilc_message_body {
+   struct wilc_rcvd_net_info net_info;
+   struct wilc_rcvd_mac_info mac_info;
+   struct wilc_set_multicast mc_info;
+   struct wilc_remain_ch remain_on_ch;
+   char *data;
+};
+
+struct host_if_msg {
+   union wilc_message_body body;
+   struct wilc_vif *vif;
+   struct work_struct work;
+   void (*fn)(struct work_struct *ws);
+   struct completion work_comp;
+   bool is_sync;
+};
+
+/* 'msg' should be free by the caller for syc */
+static struct host_if_msg*
+wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct work_struct *),
+   bool is_sync)
+{
+   struct host_if_msg *msg;
+
+   if (!work_fun)
+   return ERR_PTR(-EINVAL);
+
+   msg = kzalloc(sizeof(*msg), GFP_ATOMIC);
+   if (!msg)
+   return ERR_PTR(-ENOMEM);
+   msg->fn = work_fun;
+   msg->vif = vif;
+   msg->is_sync = is_sync;
+   if (is_sync)
+   init_completion(&msg->work_comp);
+
+   return msg;
+}
+
+static int wilc_enqueue_work(struct host_if_msg *msg)
+{
+   INIT_WORK(&msg->work, msg->fn);
+
+   if (!msg->vif || !msg->vif->wilc || !msg->vif->wilc->hif_workqueue)
+   return -EINVAL;
+
+   if (!queue_work(msg->vif->wilc->hif_workqueue, &msg->work))
+   return -EINVAL;
+
+   return 0;
+}
+
+/* The idx starts from 0 to (NUM_CONCURRENT_IFC - 1), but 0 index used as
+ * special purpose in wilc device, so we add 1 to the index to starts from 1.
+ * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
+ */
+int wilc_get_vif_idx(struct wilc_vif *vif)
+{
+   return vif->idx + 1;
+}
+
+/* We need to minus 1 from idx which is from wilc device to get real index
+ * of wilc->vif[], because we add 1 when pass to wilc device in the function
+ * wilc_get_vif_idx.
+ * As a result, the index should be between 0 and (NUM_CONCURRENT_IFC - 1).
+ */
+static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx)
+{
+   int index = idx - 1;
+   struct wilc_vif *vif;
+
+   if (index < 0 || index >= WILC_NUM_CONCURRENT_IFC)
+   return NULL;
+
+   list_for_each_entry_rcu(vif, &wilc->vif_list, list) {
+   if (vif->idx == index)
+   return vif;
+   }
+
+   return NULL;
+}
+
+static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
+{
+   int result = 0;
+   u8 abort_running_scan;
+   struct wid wid;
+   struct host_if_drv *hif_drv = vif->hif_drv;
+   struct wilc_user_scan_req *scan_req;
+
+   if (evt == SCAN_EVENT_ABORTED) {
+   abort_running_scan = 1;
+   wid.id = WID_ABORT_RUNNING_SCAN;
+   wid.type = WID_CHAR;
+   wid.val = (s8 *)&abort_running_scan;
+   wid.size = sizeof(char);
+
+   result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
+   if (result) {
+   netdev_err(vif->ndev, "Failed to set abort running\n");
+   result = -EFAULT;
+   }
+   }
+
+   if (!hif_drv) {
+   netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__);
+   return result;
+   }
+
+   scan_req = &hif_drv->usr_scan_req;
+   if (scan_req->scan_result) {
+   scan_req->scan_result(evt, NULL, scan_req->arg);
+   scan_req->scan_result = NULL;
+   }
+
+   return result;
+}
+
+int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
+ u8 *ch_freq_list, u8 ch_list_len,
+ void (*scan_result_fn)(enum scan_event,
+struct wilc_rcvd_net_info *, void *),
+ void *user_arg, struct cfg80211_scan_request *request)
+{
+   int result = 0;
+   struct

[PATCH v4 00/18] wilc1000: move out of staging

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

This patch series is to review and move wilc1000 driver out of staging.
Most of the review comments received in [1] & [2] are addressed in the
latest code. Please review and provide your inputs.

[1]. 
https://lore.kernel.org/linux-wireless/1537957525-11467-1-git-send-email-ajay.kat...@microchip.com/
[2]. 
https://lore.kernel.org/linux-wireless/1562896697-8002-1-git-send-email-ajay.kat...@microchip.com/

Changes since v3:
  - handle few Smatch static checker reported issues.
  - use flexible-array member instead of zero-length array.

Changes since v2:
  - use 'struct' to extract FW info from received commands.
  - make use of C style comments instead of C++.
  - remove use of bool type for firmware struct.
  - deleted unused code related to interrupt handling.
  - make use of RCU list to maintain interfaces list.
  - remove 'wilc_' prefix from file name.
  - added 'WILC_' prefix for header guard macro.
  - remove use of infinite loops(i.e. while(1)).
  - move firmware realted struct to a separate file.
  - refactor SPI command handling by using 'struct'.
  - use different functions to handle different SPI commands.
  - cleanup spi.c and sdio.c by removing unused code.
  - remove use of vendor specific IE for p2p handling.
  - refactor p2p related code to avoid use of buf pointer operation.
  - make use of FIELD_GET/PREP macro.
  - use #define instead of magic values.
  - use YAML schemes for DT binding documentation.
  - deleted unused code from spi.c and sdio.c.
  - added changes for few issues reported by smatch static code analyzer.

Changes since v1:
  - remove use of shadow buffer to keep scan result.
  - remove internal messaging flow to handle cfg80211_ops.
  - make use of cfg80211 provide API.
  - use 'struct' for packing firmware commands.
  - make use of kernel API's and Macro.
  - remove unnecessary log messages
  - supported dynamically add/remove interfaces.
  - cleanup and deleted around 3.3k lines of code.

Ajay Singh (18):
  wilc1000: add hif.h
  wilc1000: add hif.c
  wilc1000: add wlan_if.h
  wilc1000: add wlan_cfg.h
  wilc1000: add wlan_cfg.c
  wilc1000: add cfg80211.c
  wilc1000: add cfg80211.h
  wilc1000: add netdev.h
  wilc1000: add netdev.c
  wilc1000: add mon.c
  wilc1000: add spi.c
  wilc1000: add wlan.h
  wilc1000: add wlan.c
  wilc1000: add sdio.c
  wilc1000: add fw.h
  dt: bindings: net: add microchip,wilc1000,sdio.yaml
  dt: bindings: net: add microchip,wilc1000,spi.yaml
  wilc1000: add Makefile and Kconfig files for wilc1000 compilation

 .../net/wireless/microchip,wilc1000,sdio.yaml |   68 +
 .../net/wireless/microchip,wilc1000,spi.yaml  |   61 +
 drivers/net/wireless/Kconfig  |1 +
 drivers/net/wireless/Makefile |1 +
 drivers/net/wireless/microchip/Kconfig|   15 +
 drivers/net/wireless/microchip/Makefile   |2 +
 .../net/wireless/microchip/wilc1000/Kconfig   |   42 +
 .../net/wireless/microchip/wilc1000/Makefile  |   14 +
 .../wireless/microchip/wilc1000/cfg80211.c| 1850 
 .../wireless/microchip/wilc1000/cfg80211.h|   29 +
 drivers/net/wireless/microchip/wilc1000/fw.h  |  119 +
 drivers/net/wireless/microchip/wilc1000/hif.c | 1959 +
 drivers/net/wireless/microchip/wilc1000/hif.h |  214 ++
 drivers/net/wireless/microchip/wilc1000/mon.c |  260 +++
 .../net/wireless/microchip/wilc1000/netdev.c  |  940 
 .../net/wireless/microchip/wilc1000/netdev.h  |  295 +++
 .../net/wireless/microchip/wilc1000/sdio.c| 1030 +
 drivers/net/wireless/microchip/wilc1000/spi.c | 1001 +
 .../net/wireless/microchip/wilc1000/wlan.c| 1238 +++
 .../net/wireless/microchip/wilc1000/wlan.h|  398 
 .../wireless/microchip/wilc1000/wlan_cfg.c|  413 
 .../wireless/microchip/wilc1000/wlan_cfg.h|   54 +
 .../net/wireless/microchip/wilc1000/wlan_if.h |  803 +++
 drivers/staging/Kconfig   |2 -
 drivers/staging/Makefile  |1 -
 25 files changed, 10807 insertions(+), 3 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml
 create mode 100644 drivers/net/wireless/microchip/Kconfig
 create mode 100644 drivers/net/wireless/microchip/Makefile
 create mode 100644 drivers/net/wireless/microchip/wilc1000/Kconfig
 create mode 100644 drivers/net/wireless/microchip/wilc1000/Makefile
 create mode 100644 drivers/net/wireless/microchip/wilc1000/cfg80211.c
 create mode 100644 drivers/net/wireless/microchip/wilc1000/cfg80211.h
 create mode 100644 drivers/net/wireless/microchip/wilc1000/fw.h
 create mode 100644 drivers/net/wireless/microchip/wilc1000/hif.c
 create mode 100644 drivers/net/wireless/microchip/wilc1000/hif.h
 create mode 100644 drivers/net/wireless/microchip/wilc1000/mon.c
 create mode 100644 drivers/net/wireless/microchip/wilc1000/netdev.c
 create m

[PATCH v4 03/18] wilc1000: add wlan_if.h

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/wlan_if.h' to
'drivers/net/wireless/microchip/wilc1000/wlan_if.h'.

Signed-off-by: Ajay Singh 
---
 .../net/wireless/microchip/wilc1000/wlan_if.h | 803 ++
 1 file changed, 803 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/wlan_if.h

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan_if.h 
b/drivers/net/wireless/microchip/wilc1000/wlan_if.h
new file mode 100644
index ..f85fd575136d
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/wlan_if.h
@@ -0,0 +1,803 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#ifndef WILC_WLAN_IF_H
+#define WILC_WLAN_IF_H
+
+#include 
+#include "fw.h"
+
+/
+ *
+ *  Wlan Configuration ID
+ *
+ /
+
+enum bss_types {
+   WILC_FW_BSS_TYPE_INFRA = 0,
+   WILC_FW_BSS_TYPE_INDEPENDENT,
+   WILC_FW_BSS_TYPE_AP,
+};
+
+enum {
+   WILC_FW_OPER_MODE_B_ONLY = 0,/* 1, 2 M, otherwise 5, 11 M */
+   WILC_FW_OPER_MODE_G_ONLY,/* 6,12,24 otherwise 9,18,36,48,54 */
+   WILC_FW_OPER_MODE_G_MIXED_11B_1, /* 1,2,5.5,11 otherwise all on */
+   WILC_FW_OPER_MODE_G_MIXED_11B_2, /* 1,2,5,11,6,12,24 otherwise all on */
+};
+
+enum {
+   WILC_FW_PREAMBLE_SHORT = 0, /* Short Preamble */
+   WILC_FW_PREAMBLE_LONG = 1,  /* Long Preamble */
+   WILC_FW_PREAMBLE_AUTO = 2,  /* Auto Preamble Selection */
+};
+
+enum {
+   WILC_FW_PASSIVE_SCAN = 0,
+   WILC_FW_ACTIVE_SCAN = 1,
+};
+
+enum {
+   WILC_FW_NO_POWERSAVE = 0,
+   WILC_FW_MIN_FAST_PS = 1,
+   WILC_FW_MAX_FAST_PS = 2,
+   WILC_FW_MIN_PSPOLL_PS = 3,
+   WILC_FW_MAX_PSPOLL_PS = 4
+};
+
+enum chip_ps_states {
+   WILC_CHIP_WAKEDUP = 0,
+   WILC_CHIP_SLEEPING_AUTO = 1,
+   WILC_CHIP_SLEEPING_MANUAL = 2
+};
+
+enum bus_acquire {
+   WILC_BUS_ACQUIRE_ONLY = 0,
+   WILC_BUS_ACQUIRE_AND_WAKEUP = 1,
+};
+
+enum bus_release {
+   WILC_BUS_RELEASE_ONLY = 0,
+   WILC_BUS_RELEASE_ALLOW_SLEEP = 1,
+};
+
+enum {
+   WILC_FW_NO_ENCRYPT = 0,
+   WILC_FW_ENCRYPT_ENABLED = BIT(0),
+   WILC_FW_WEP = BIT(1),
+   WILC_FW_WEP_EXTENDED = BIT(2),
+   WILC_FW_WPA = BIT(3),
+   WILC_FW_WPA2 = BIT(4),
+   WILC_FW_AES = BIT(5),
+   WILC_FW_TKIP = BIT(6)
+};
+
+enum {
+   WILC_FW_SEC_NO = WILC_FW_NO_ENCRYPT,
+   WILC_FW_SEC_WEP = WILC_FW_WEP | WILC_FW_ENCRYPT_ENABLED,
+   WILC_FW_SEC_WEP_EXTENDED = WILC_FW_WEP_EXTENDED | WILC_FW_SEC_WEP,
+   WILC_FW_SEC_WPA = WILC_FW_WPA | WILC_FW_ENCRYPT_ENABLED,
+   WILC_FW_SEC_WPA_AES = WILC_FW_AES | WILC_FW_SEC_WPA,
+   WILC_FW_SEC_WPA_TKIP = WILC_FW_TKIP | WILC_FW_SEC_WPA,
+   WILC_FW_SEC_WPA2 = WILC_FW_WPA2 | WILC_FW_ENCRYPT_ENABLED,
+   WILC_FW_SEC_WPA2_AES = WILC_FW_AES | WILC_FW_SEC_WPA2,
+   WILC_FW_SEC_WPA2_TKIP = WILC_FW_TKIP | WILC_FW_SEC_WPA2
+};
+
+enum authtype {
+   WILC_FW_AUTH_OPEN_SYSTEM = 1,
+   WILC_FW_AUTH_SHARED_KEY = 2,
+   WILC_FW_AUTH_ANY = 3,
+   WILC_FW_AUTH_IEEE8021 = 5
+};
+
+enum site_survey {
+   WILC_FW_SITE_SURVEY_1CH = 0,
+   WILC_FW_SITE_SURVEY_ALL_CH = 1,
+   WILC_FW_SITE_SURVEY_OFF = 2
+};
+
+enum {
+   WILC_FW_ACK_POLICY_NORMAL = 0,
+   WILC_FW_ACK_NO_POLICY,
+};
+
+enum {
+   WILC_FW_REKEY_POLICY_DISABLE = 1,
+   WILC_FW_REKEY_POLICY_TIME_BASE,
+   WILC_FW_REKEY_POLICY_PKT_BASE,
+   WILC_FW_REKEY_POLICY_TIME_PKT_BASE
+};
+
+enum {
+   WILC_FW_FILTER_NO = 0x00,
+   WILC_FW_FILTER_AP_ONLY = 0x01,
+   WILC_FW_FILTER_STA_ONLY = 0x02
+};
+
+enum {
+   WILC_FW_11N_PROT_AUTO = 0,  /* Auto */
+   WILC_FW_11N_NO_PROT,/* Do not use any protection */
+   WILC_FW_11N_PROT_ERP,   /* Protect all ERP frame exchanges */
+   WILC_FW_11N_PROT_HT,/* Protect all HT frame exchanges  */
+   WILC_FW_11N_PROT_GF /* Protect all GF frame exchanges  */
+};
+
+enum {
+   WILC_FW_ERP_PROT_SELF_CTS,
+   WILC_FW_ERP_PROT_RTS_CTS,
+};
+
+enum {
+   WILC_FW_11N_OP_MODE_HT_MIXED = 1,
+   WILC_FW_11N_OP_MODE_HT_ONLY_20MHZ,
+   WILC_FW_11N_OP_MODE_HT_ONLY_20_40MHZ,
+};
+
+enum {
+   WILC_FW_OBBS_NONHT_NO_DETECT = 0,
+   WILC_FW_OBBS_NONHT_DETECT_ONLY = 1,
+   WILC_FW_OBBS_NONHT_DETECT_PROTECT = 2,
+   WILC_FW_OBBS_NONHT_DETECT_PROTECT_REPORT = 3,
+};
+
+enum {
+   WILC_FW_HT_PROT_RTS_CTS_NONHT = 0,  /* RTS-CTS at non-HT rate */
+   WILC_FW_HT_PROT_FIRST_FRAME_NONHT,  /* First frame at non-HT rate */
+   WILC_FW_HT_PROT_LSIG_TXOP,  /* LSIG TXOP Protection */
+   WILC_FW_HT_PROT_FIRST_FRAME_MIXED,  /* First frame at Mixed format */
+};
+
+enum {
+   WILC_FW_SMPS_MODE_STATIC = 1,
+   WILC_FW_SMPS_MODE_DYNAMIC = 2,
+   WILC_FW_SMPS_MODE_MIMO = 3,  

[PATCH v4 15/18] wilc1000: add fw.h

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/fw.h' to
'drivers/net/wireless/microchip/wilc1000/fw.h'.

Signed-off-by: Ajay Singh 
---
 drivers/net/wireless/microchip/wilc1000/fw.h | 119 +++
 1 file changed, 119 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/fw.h

diff --git a/drivers/net/wireless/microchip/wilc1000/fw.h 
b/drivers/net/wireless/microchip/wilc1000/fw.h
new file mode 100644
index ..a76e1dea4345
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/fw.h
@@ -0,0 +1,119 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#ifndef WILC_FW_H
+#define WILC_FW_H
+
+#include 
+
+#define WILC_MAX_NUM_STA   9
+#define WILC_MAX_RATES_SUPPORTED   12
+#define WILC_MAX_NUM_PMKIDS16
+#define WILC_MAX_NUM_SCANNED_CH14
+
+struct wilc_assoc_resp {
+   __le16 capab_info;
+   __le16 status_code;
+   __le16 aid;
+} __packed;
+
+struct wilc_pmkid {
+   u8 bssid[ETH_ALEN];
+   u8 pmkid[WLAN_PMKID_LEN];
+} __packed;
+
+struct wilc_pmkid_attr {
+   u8 numpmkid;
+   struct wilc_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
+} __packed;
+
+struct wilc_reg_frame {
+   u8 reg;
+   u8 reg_id;
+   __le16 frame_type;
+} __packed;
+
+struct wilc_drv_handler {
+   __le32 handler;
+   u8 mode;
+} __packed;
+
+struct wilc_wep_key {
+   u8 index;
+   u8 key_len;
+   u8 key[0];
+} __packed;
+
+struct wilc_sta_wpa_ptk {
+   u8 mac_addr[ETH_ALEN];
+   u8 key_len;
+   u8 key[0];
+} __packed;
+
+struct wilc_ap_wpa_ptk {
+   u8 mac_addr[ETH_ALEN];
+   u8 index;
+   u8 key_len;
+   u8 key[0];
+} __packed;
+
+struct wilc_gtk_key {
+   u8 mac_addr[ETH_ALEN];
+   u8 rsc[8];
+   u8 index;
+   u8 key_len;
+   u8 key[0];
+} __packed;
+
+struct wilc_op_mode {
+   __le32 mode;
+} __packed;
+
+struct wilc_noa_opp_enable {
+   u8 ct_window;
+   u8 cnt;
+   __le32 duration;
+   __le32 interval;
+   __le32 start_time;
+} __packed;
+
+struct wilc_noa_opp_disable {
+   u8 cnt;
+   __le32 duration;
+   __le32 interval;
+   __le32 start_time;
+} __packed;
+
+struct wilc_join_bss_param {
+   char ssid[IEEE80211_MAX_SSID_LEN];
+   u8 ssid_terminator;
+   u8 bss_type;
+   u8 ch;
+   __le16 cap_info;
+   u8 sa[ETH_ALEN];
+   u8 bssid[ETH_ALEN];
+   __le16 beacon_period;
+   u8 dtim_period;
+   u8 supp_rates[WILC_MAX_RATES_SUPPORTED + 1];
+   u8 wmm_cap;
+   u8 uapsd_cap;
+   u8 ht_capable;
+   u8 rsn_found;
+   u8 rsn_grp_policy;
+   u8 mode_802_11i;
+   u8 p_suites[3];
+   u8 akm_suites[3];
+   u8 rsn_cap[2];
+   u8 noa_enabled;
+   __le32 tsf_lo;
+   u8 idx;
+   u8 opp_enabled;
+   union {
+   struct wilc_noa_opp_disable opp_dis;
+   struct wilc_noa_opp_enable opp_en;
+   };
+} __packed;
+#endif
-- 
2.24.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 05/18] wilc1000: add wlan_cfg.c

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/wlan_cfg.c' to
'drivers/net/wireless/microchip/wilc1000/wlan_cfg.c'.

Signed-off-by: Ajay Singh 
---
 .../wireless/microchip/wilc1000/wlan_cfg.c| 413 ++
 1 file changed, 413 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/wlan_cfg.c

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c 
b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c
new file mode 100644
index ..fe2a7ed8e5cd
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c
@@ -0,0 +1,413 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#include 
+#include "wlan_if.h"
+#include "wlan.h"
+#include "wlan_cfg.h"
+#include "netdev.h"
+
+enum cfg_cmd_type {
+   CFG_BYTE_CMD= 0,
+   CFG_HWORD_CMD   = 1,
+   CFG_WORD_CMD= 2,
+   CFG_STR_CMD = 3,
+   CFG_BIN_CMD = 4
+};
+
+static const struct wilc_cfg_byte g_cfg_byte[] = {
+   {WID_STATUS, 0},
+   {WID_RSSI, 0},
+   {WID_LINKSPEED, 0},
+   {WID_NIL, 0}
+};
+
+static const struct wilc_cfg_hword g_cfg_hword[] = {
+   {WID_NIL, 0}
+};
+
+static const struct wilc_cfg_word g_cfg_word[] = {
+   {WID_FAILED_COUNT, 0},
+   {WID_RECEIVED_FRAGMENT_COUNT, 0},
+   {WID_SUCCESS_FRAME_COUNT, 0},
+   {WID_GET_INACTIVE_TIME, 0},
+   {WID_NIL, 0}
+
+};
+
+static const struct wilc_cfg_str g_cfg_str[] = {
+   {WID_FIRMWARE_VERSION, NULL},
+   {WID_MAC_ADDR, NULL},
+   {WID_ASSOC_RES_INFO, NULL},
+   {WID_NIL, NULL}
+};
+
+#define WILC_RESP_MSG_TYPE_CONFIG_REPLY'R'
+#define WILC_RESP_MSG_TYPE_STATUS_INFO 'I'
+#define WILC_RESP_MSG_TYPE_NETWORK_INFO'N'
+#define WILC_RESP_MSG_TYPE_SCAN_COMPLETE   'S'
+
+/
+ *
+ *  Configuration Functions
+ *
+ /
+
+static int wilc_wlan_cfg_set_byte(u8 *frame, u32 offset, u16 id, u8 val8)
+{
+   if ((offset + 4) >= WILC_MAX_CFG_FRAME_SIZE)
+   return 0;
+
+   put_unaligned_le16(id, &frame[offset]);
+   put_unaligned_le16(1, &frame[offset + 2]);
+   frame[offset + 4] = val8;
+   return 5;
+}
+
+static int wilc_wlan_cfg_set_hword(u8 *frame, u32 offset, u16 id, u16 val16)
+{
+   if ((offset + 5) >= WILC_MAX_CFG_FRAME_SIZE)
+   return 0;
+
+   put_unaligned_le16(id, &frame[offset]);
+   put_unaligned_le16(2, &frame[offset + 2]);
+   put_unaligned_le16(val16, &frame[offset + 4]);
+
+   return 6;
+}
+
+static int wilc_wlan_cfg_set_word(u8 *frame, u32 offset, u16 id, u32 val32)
+{
+   if ((offset + 7) >= WILC_MAX_CFG_FRAME_SIZE)
+   return 0;
+
+   put_unaligned_le16(id, &frame[offset]);
+   put_unaligned_le16(4, &frame[offset + 2]);
+   put_unaligned_le32(val32, &frame[offset + 4]);
+
+   return 8;
+}
+
+static int wilc_wlan_cfg_set_str(u8 *frame, u32 offset, u16 id, u8 *str,
+u32 size)
+{
+   if ((offset + size + 4) >= WILC_MAX_CFG_FRAME_SIZE)
+   return 0;
+
+   put_unaligned_le16(id, &frame[offset]);
+   put_unaligned_le16(size, &frame[offset + 2]);
+   if (str && size != 0)
+   memcpy(&frame[offset + 4], str, size);
+
+   return (size + 4);
+}
+
+static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, u16 id, u8 *b, u32 
size)
+{
+   u32 i;
+   u8 checksum = 0;
+
+   if ((offset + size + 5) >= WILC_MAX_CFG_FRAME_SIZE)
+   return 0;
+
+   put_unaligned_le16(id, &frame[offset]);
+   put_unaligned_le16(size, &frame[offset + 2]);
+
+   if ((b) && size != 0) {
+   memcpy(&frame[offset + 4], b, size);
+   for (i = 0; i < size; i++)
+   checksum += frame[offset + i + 4];
+   }
+
+   frame[offset + size + 4] = checksum;
+
+   return (size + 5);
+}
+
+/
+ *
+ *  Configuration Response Functions
+ *
+ /
+
+static void wilc_wlan_parse_response_frame(struct wilc *wl, u8 *info, int size)
+{
+   u16 wid;
+   u32 len = 0, i = 0;
+   struct wilc_cfg *cfg = &wl->cfg;
+
+   while (size > 0) {
+   i = 0;
+   wid = get_unaligned_le16(info);
+
+   switch (FIELD_GET(WILC_WID_TYPE, wid)) {
+   case WID_CHAR:
+   while (cfg->b[i].id != WID_NIL && cfg->b[i].id != wid)
+   i++;
+
+   if (cfg->b[i].id == wid)
+   cfg->b[i].val = info[4];
+
+   len = 3;
+   break;
+
+   case WID_SHORT:
+   while (cfg->hw[i].id != WID_NIL && cfg->hw[i].id != wid)
+   i++;
+

[PATCH v4 16/18] dt: bindings: net: add microchip,wilc1000,sdio.yaml

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved '/drivers/staging/wilc1000/microchip,wilc1000,sdio.yaml' to
'Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml'.

Signed-off-by: Ajay Singh 
---
 .../net/wireless/microchip,wilc1000,sdio.yaml | 68 +++
 1 file changed, 68 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml

diff --git 
a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml 
b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml
new file mode 100644
index ..b338f569f7e2
--- /dev/null
+++ 
b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/wireless/microchip,wilc1000,sdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip WILC wireless SDIO devicetree bindings
+
+maintainers:
+  - Adham Abozaeid 
+  - Ajay Singh 
+
+description:
+  The wilc1000 chips can be connected via SDIO. The node is used to
+  specify child node to the SDIO controller that connects the device
+  to the system.
+
+properties:
+  compatible:
+const: microchip,wilc1000-sdio
+
+  irq-gpios:
+description: The GPIO phandle connect to a host IRQ.
+maxItems: 1
+
+  reg:
+description: Slot ID used in the controller.
+maxItems: 1
+
+  clocks:
+description: phandle to the clock connected on rtc clock line.
+maxItems: 1
+
+  bus-width:
+description: The number of data lines wired up the slot.
+allOf:
+  - $ref: /schemas/types.yaml#/definitions/uint32
+  - enum: [1, 4, 8]
+  - default: 1
+
+required:
+  - compatible
+  - irq-gpios
+  - reg
+
+examples:
+  - |
+mmc1: mmc@fc00 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+  pinctrl-names = "default";
+  pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3>;
+  non-removable;
+  vmmc-supply = <&vcc_mmc1_reg>;
+  vqmmc-supply = <&vcc_3v3_reg>;
+  status = "okay";
+  wilc_sdio@0 {
+compatible = "microchip,wilc1000-sdio";
+  irq-gpios = <&pioC 27 0>;
+  reg = <0>;
+  clocks = <&pck1>;
+  clock-names = "rtc_clk";
+  assigned-clocks = <&pck1>;
+  assigned-clock-rates = <32768>;
+  status = "okay";
+  bus-width = <4>;
+};
+};
-- 
2.24.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 01/18] wilc1000: add hif.h

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/hif.h' to
'drivers/net/wireless/microchip/wilc1000/hif.h'.

Signed-off-by: Ajay Singh 
---
 drivers/net/wireless/microchip/wilc1000/hif.h | 214 ++
 1 file changed, 214 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/hif.h

diff --git a/drivers/net/wireless/microchip/wilc1000/hif.h 
b/drivers/net/wireless/microchip/wilc1000/hif.h
new file mode 100644
index ..db9179171f05
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/hif.h
@@ -0,0 +1,214 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries
+ * All rights reserved.
+ */
+
+#ifndef WILC_HIF_H
+#define WILC_HIF_H
+#include 
+#include "wlan_if.h"
+
+enum {
+   WILC_IDLE_MODE = 0x0,
+   WILC_AP_MODE = 0x1,
+   WILC_STATION_MODE = 0x2,
+   WILC_GO_MODE = 0x3,
+   WILC_CLIENT_MODE = 0x4
+};
+
+#define WILC_MAX_NUM_PROBED_SSID   10
+
+#define WILC_TX_MIC_KEY_LEN8
+#define WILC_RX_MIC_KEY_LEN8
+
+#define WILC_ADD_STA_LENGTH40
+#define WILC_NUM_CONCURRENT_IFC2
+
+enum {
+   WILC_SET_CFG = 0,
+   WILC_GET_CFG
+};
+
+#define WILC_MAX_ASSOC_RESP_FRAME_SIZE   256
+
+struct rf_info {
+   u8 link_speed;
+   s8 rssi;
+   u32 tx_cnt;
+   u32 rx_cnt;
+   u32 tx_fail_cnt;
+};
+
+enum host_if_state {
+   HOST_IF_IDLE= 0,
+   HOST_IF_SCANNING= 1,
+   HOST_IF_CONNECTING  = 2,
+   HOST_IF_WAITING_CONN_RESP   = 3,
+   HOST_IF_CONNECTED   = 4,
+   HOST_IF_P2P_LISTEN  = 5,
+   HOST_IF_FORCE_32BIT = 0x
+};
+
+struct cfg_param_attr {
+   u32 flag;
+   u16 short_retry_limit;
+   u16 long_retry_limit;
+   u16 frag_threshold;
+   u16 rts_threshold;
+};
+
+enum cfg_param {
+   WILC_CFG_PARAM_RETRY_SHORT = BIT(0),
+   WILC_CFG_PARAM_RETRY_LONG = BIT(1),
+   WILC_CFG_PARAM_FRAG_THRESHOLD = BIT(2),
+   WILC_CFG_PARAM_RTS_THRESHOLD = BIT(3)
+};
+
+enum scan_event {
+   SCAN_EVENT_NETWORK_FOUND= 0,
+   SCAN_EVENT_DONE = 1,
+   SCAN_EVENT_ABORTED  = 2,
+   SCAN_EVENT_FORCE_32BIT  = 0x
+};
+
+enum conn_event {
+   CONN_DISCONN_EVENT_CONN_RESP= 0,
+   CONN_DISCONN_EVENT_DISCONN_NOTIF= 1,
+   CONN_DISCONN_EVENT_FORCE_32BIT  = 0x
+};
+
+enum {
+   WILC_HIF_SDIO = 0,
+   WILC_HIF_SPI = BIT(0)
+};
+
+enum {
+   WILC_MAC_STATUS_INIT = -1,
+   WILC_MAC_STATUS_DISCONNECTED = 0,
+   WILC_MAC_STATUS_CONNECTED = 1
+};
+
+struct wilc_rcvd_net_info {
+   s8 rssi;
+   u8 ch;
+   u16 frame_len;
+   struct ieee80211_mgmt *mgmt;
+};
+
+struct wilc_user_scan_req {
+   void (*scan_result)(enum scan_event evt,
+   struct wilc_rcvd_net_info *info, void *priv);
+   void *arg;
+   u32 ch_cnt;
+};
+
+struct wilc_conn_info {
+   u8 bssid[ETH_ALEN];
+   u8 security;
+   enum authtype auth_type;
+   u8 ch;
+   u8 *req_ies;
+   size_t req_ies_len;
+   u8 *resp_ies;
+   u16 resp_ies_len;
+   u16 status;
+   void (*conn_result)(enum conn_event evt, u8 status, void *priv_data);
+   void *arg;
+   void *param;
+};
+
+struct wilc_remain_ch {
+   u16 ch;
+   u32 duration;
+   void (*expired)(void *priv, u64 cookie);
+   void *arg;
+   u32 cookie;
+};
+
+struct wilc;
+struct host_if_drv {
+   struct wilc_user_scan_req usr_scan_req;
+   struct wilc_conn_info conn_info;
+   struct wilc_remain_ch remain_on_ch;
+   u64 p2p_timeout;
+
+   enum host_if_state hif_state;
+
+   u8 assoc_bssid[ETH_ALEN];
+
+   struct timer_list scan_timer;
+   struct wilc_vif *scan_timer_vif;
+
+   struct timer_list connect_timer;
+   struct wilc_vif *connect_timer_vif;
+
+   struct timer_list remain_on_ch_timer;
+   struct wilc_vif *remain_on_ch_timer_vif;
+
+   bool ifc_up;
+   u8 assoc_resp[WILC_MAX_ASSOC_RESP_FRAME_SIZE];
+};
+
+struct wilc_vif;
+int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
+int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
+int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
+u8 index);
+int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
+   u8 index, u8 mode, enum authtype auth_type);
+int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
+const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
+u8 mode, u8 cipher_mode, u8 index);
+s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
+  u32 *out_val);
+int wilc_add_rx_gtk(struct wilc_vif *vif,

[PATCH v4 14/18] wilc1000: add sdio.c

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/sdio.c' to
'drivers/net/wireless/microchip/wilc1000/sdio.c'.

Signed-off-by: Ajay Singh 
---
 .../net/wireless/microchip/wilc1000/sdio.c| 1030 +
 1 file changed, 1030 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/sdio.c

diff --git a/drivers/net/wireless/microchip/wilc1000/sdio.c 
b/drivers/net/wireless/microchip/wilc1000/sdio.c
new file mode 100644
index ..2301e90c21ca
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/sdio.c
@@ -0,0 +1,1030 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include "netdev.h"
+#include "cfg80211.h"
+
+#define SDIO_MODALIAS "wilc1000_sdio"
+
+#define SDIO_VENDOR_ID_WILC 0x0296
+#define SDIO_DEVICE_ID_WILC 0x5347
+
+static const struct sdio_device_id wilc_sdio_ids[] = {
+   { SDIO_DEVICE(SDIO_VENDOR_ID_WILC, SDIO_DEVICE_ID_WILC) },
+   { },
+};
+
+#define WILC_SDIO_BLOCK_SIZE 512
+
+struct wilc_sdio {
+   bool irq_gpio;
+   u32 block_size;
+   int has_thrpt_enh3;
+};
+
+struct sdio_cmd52 {
+   u32 read_write: 1;
+   u32 function:   3;
+   u32 raw:1;
+   u32 address:17;
+   u32 data:   8;
+};
+
+struct sdio_cmd53 {
+   u32 read_write: 1;
+   u32 function:   3;
+   u32 block_mode: 1;
+   u32 increment:  1;
+   u32 address:17;
+   u32 count:  9;
+   u8 *buffer;
+   u32 block_size;
+};
+
+static const struct wilc_hif_func wilc_hif_sdio;
+
+static void wilc_sdio_interrupt(struct sdio_func *func)
+{
+   sdio_release_host(func);
+   wilc_handle_isr(sdio_get_drvdata(func));
+   sdio_claim_host(func);
+}
+
+static int wilc_sdio_cmd52(struct wilc *wilc, struct sdio_cmd52 *cmd)
+{
+   struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev);
+   int ret;
+   u8 data;
+
+   sdio_claim_host(func);
+
+   func->num = cmd->function;
+   if (cmd->read_write) {  /* write */
+   if (cmd->raw) {
+   sdio_writeb(func, cmd->data, cmd->address, &ret);
+   data = sdio_readb(func, cmd->address, &ret);
+   cmd->data = data;
+   } else {
+   sdio_writeb(func, cmd->data, cmd->address, &ret);
+   }
+   } else {/* read */
+   data = sdio_readb(func, cmd->address, &ret);
+   cmd->data = data;
+   }
+
+   sdio_release_host(func);
+
+   if (ret)
+   dev_err(&func->dev, "%s..failed, err(%d)\n", __func__, ret);
+   return ret;
+}
+
+static int wilc_sdio_cmd53(struct wilc *wilc, struct sdio_cmd53 *cmd)
+{
+   struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev);
+   int size, ret;
+
+   sdio_claim_host(func);
+
+   func->num = cmd->function;
+   func->cur_blksize = cmd->block_size;
+   if (cmd->block_mode)
+   size = cmd->count * cmd->block_size;
+   else
+   size = cmd->count;
+
+   if (cmd->read_write) {  /* write */
+   ret = sdio_memcpy_toio(func, cmd->address,
+  (void *)cmd->buffer, size);
+   } else {/* read */
+   ret = sdio_memcpy_fromio(func, (void *)cmd->buffer,
+cmd->address,  size);
+   }
+
+   sdio_release_host(func);
+
+   if (ret)
+   dev_err(&func->dev, "%s..failed, err(%d)\n", __func__,  ret);
+
+   return ret;
+}
+
+static int wilc_sdio_probe(struct sdio_func *func,
+  const struct sdio_device_id *id)
+{
+   struct wilc *wilc;
+   int ret;
+   struct gpio_desc *gpio = NULL;
+   struct wilc_sdio *sdio_priv;
+
+   sdio_priv = kzalloc(sizeof(*sdio_priv), GFP_KERNEL);
+   if (!sdio_priv)
+   return -ENOMEM;
+
+   if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
+   gpio = gpiod_get(&func->dev, "irq", GPIOD_IN);
+   if (IS_ERR(gpio)) {
+   /* get the GPIO descriptor from hardcode GPIO number */
+   gpio = gpio_to_desc(GPIO_NUM);
+   if (!gpio)
+   dev_err(&func->dev, "failed to get irq gpio\n");
+   }
+   }
+
+   ret = wilc_cfg80211_init(&wilc, &func->dev, WILC_HIF_SDIO,
+&wilc_hif_sdio);
+   if (ret) {
+   kfree(sdio_priv);
+   return ret;
+   }
+   sdio_set_drvdata(func, wilc);
+   wilc->bus_data = sdio_priv;
+   wilc->dev = &func->dev;
+   wilc->gpio_irq = gpio;
+
+   wilc->rtc_clk = devm_clk_get(&func->card->dev, "rtc_clk");
+   

[PATCH v4 04/18] wilc1000: add wlan_cfg.h

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/wlan_cfg.h' to
'drivers/net/wireless/microchip/wilc1000/wlan_cfg.h'.

Signed-off-by: Ajay Singh 
---
 .../wireless/microchip/wilc1000/wlan_cfg.h| 54 +++
 1 file changed, 54 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/wlan_cfg.h

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan_cfg.h 
b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.h
new file mode 100644
index ..614c5673f232
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.h
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#ifndef WILC_WLAN_CFG_H
+#define WILC_WLAN_CFG_H
+
+struct wilc_cfg_byte {
+   u16 id;
+   u8 val;
+};
+
+struct wilc_cfg_hword {
+   u16 id;
+   u16 val;
+};
+
+struct wilc_cfg_word {
+   u16 id;
+   u32 val;
+};
+
+struct wilc_cfg_str {
+   u16 id;
+   u8 *str;
+};
+
+struct wilc_cfg_str_vals {
+   u8 mac_address[7];
+   u8 firmware_version[129];
+   u8 assoc_rsp[256];
+};
+
+struct wilc_cfg {
+   struct wilc_cfg_byte *b;
+   struct wilc_cfg_hword *hw;
+   struct wilc_cfg_word *w;
+   struct wilc_cfg_str *s;
+   struct wilc_cfg_str_vals *str_vals;
+};
+
+struct wilc;
+int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size);
+int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id);
+int wilc_wlan_cfg_get_val(struct wilc *wl, u16 wid, u8 *buffer,
+ u32 buffer_size);
+void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+  struct wilc_cfg_rsp *rsp);
+int wilc_wlan_cfg_init(struct wilc *wl);
+void wilc_wlan_cfg_deinit(struct wilc *wl);
+
+#endif
-- 
2.24.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 12/18] wilc1000: add wlan.h

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/wlan.h' to
'drivers/net/wireless/microchip/wilc1000/wlan.h'.

Signed-off-by: Ajay Singh 
---
 .../net/wireless/microchip/wilc1000/wlan.h| 398 ++
 1 file changed, 398 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/wlan.h

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.h 
b/drivers/net/wireless/microchip/wilc1000/wlan.h
new file mode 100644
index ..5999c5490ea5
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.h
@@ -0,0 +1,398 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#ifndef WILC_WLAN_H
+#define WILC_WLAN_H
+
+#include 
+#include 
+
+/
+ *
+ *  Mac eth header length
+ *
+ /
+#define MAX_MAC_HDR_LEN26 /* QOS_MAC_HDR_LEN */
+#define SUB_MSDU_HEADER_LENGTH 14
+#define SNAP_HDR_LEN   8
+#define ETHERNET_HDR_LEN   14
+#define WORD_ALIGNMENT_PAD 0
+
+#define ETH_ETHERNET_HDR_OFFSET(MAX_MAC_HDR_LEN + \
+SUB_MSDU_HEADER_LENGTH + \
+SNAP_HDR_LEN - \
+ETHERNET_HDR_LEN + \
+WORD_ALIGNMENT_PAD)
+
+#define HOST_HDR_OFFSET4
+#define ETHERNET_HDR_LEN   14
+#define IP_HDR_LEN 20
+#define IP_HDR_OFFSET  ETHERNET_HDR_LEN
+#define UDP_HDR_OFFSET (IP_HDR_LEN + IP_HDR_OFFSET)
+#define UDP_HDR_LEN8
+#define UDP_DATA_OFFSET(UDP_HDR_OFFSET + UDP_HDR_LEN)
+#define ETH_CONFIG_PKT_HDR_LEN UDP_DATA_OFFSET
+
+#define ETH_CONFIG_PKT_HDR_OFFSET  (ETH_ETHERNET_HDR_OFFSET + \
+ETH_CONFIG_PKT_HDR_LEN)
+
+/
+ *
+ *  Register Defines
+ *
+ /
+#define WILC_PERIPH_REG_BASE   0x1000
+#define WILC_CHANGING_VIR_IF   0x108c
+#define WILC_CHIPIDWILC_PERIPH_REG_BASE
+#define WILC_GLB_RESET_0   (WILC_PERIPH_REG_BASE + 0x400)
+#define WILC_PIN_MUX_0 (WILC_PERIPH_REG_BASE + 0x408)
+#define WILC_HOST_TX_CTRL  (WILC_PERIPH_REG_BASE + 0x6c)
+#define WILC_HOST_RX_CTRL_0(WILC_PERIPH_REG_BASE + 0x70)
+#define WILC_HOST_RX_CTRL_1(WILC_PERIPH_REG_BASE + 0x74)
+#define WILC_HOST_VMM_CTL  (WILC_PERIPH_REG_BASE + 0x78)
+#define WILC_HOST_RX_CTRL  (WILC_PERIPH_REG_BASE + 0x80)
+#define WILC_HOST_RX_EXTRA_SIZE(WILC_PERIPH_REG_BASE + 0x84)
+#define WILC_HOST_TX_CTRL_1(WILC_PERIPH_REG_BASE + 0x88)
+#define WILC_MISC  (WILC_PERIPH_REG_BASE + 0x428)
+#define WILC_INTR_REG_BASE (WILC_PERIPH_REG_BASE + 0xa00)
+#define WILC_INTR_ENABLE   WILC_INTR_REG_BASE
+#define WILC_INTR2_ENABLE  (WILC_INTR_REG_BASE + 4)
+
+#define WILC_INTR_POLARITY (WILC_INTR_REG_BASE + 0x10)
+#define WILC_INTR_TYPE (WILC_INTR_REG_BASE + 0x20)
+#define WILC_INTR_CLEAR(WILC_INTR_REG_BASE + 0x30)
+#define WILC_INTR_STATUS   (WILC_INTR_REG_BASE + 0x40)
+
+#define WILC_RF_REVISION_ID0x13f4
+
+#define WILC_VMM_TBL_SIZE  64
+#define WILC_VMM_TX_TBL_BASE   0x150400
+#define WILC_VMM_RX_TBL_BASE   0x150500
+
+#define WILC_VMM_BASE  0x15
+#define WILC_VMM_CORE_CTL  WILC_VMM_BASE
+#define WILC_VMM_TBL_CTL   (WILC_VMM_BASE + 0x4)
+#define WILC_VMM_TBL_ENTRY (WILC_VMM_BASE + 0x8)
+#define WILC_VMM_TBL0_SIZE (WILC_VMM_BASE + 0xc)
+#define WILC_VMM_TO_HOST_SIZE  (WILC_VMM_BASE + 0x10)
+#define WILC_VMM_CORE_CFG  (WILC_VMM_BASE + 0x14)
+#define WILC_VMM_TBL_ACTIVE(WILC_VMM_BASE + 040)
+#define WILC_VMM_TBL_STATUS(WILC_VMM_BASE + 0x44)
+
+#define WILC_SPI_REG_BASE  0xe800
+#define WILC_SPI_CTL   WILC_SPI_REG_BASE
+#define WILC_SPI_MASTER_DMA_ADDR   (WILC_SPI_REG_BASE + 0x4)
+#define WILC_SPI_MASTER_DMA_COUNT  (WILC_SPI_REG_BASE + 0x8)
+#define WILC_SPI_SLAVE_DMA_ADDR(WILC_SPI_REG_BASE + 0xc)
+#define WILC_SPI_SLAVE_DMA_COUNT   (WILC_SPI_REG_BASE + 0x10)
+#define WILC_SPI_TX_MODE   (WILC_SPI_REG_BASE + 0x20)
+#define WILC_SPI_PROTOCOL_CONFIG   (WILC_SPI_REG_BASE + 0x24)
+#define WILC_SPI_INTR_CTL  (WILC_SPI_REG_BASE + 0x2c)
+#define WILC_SPI_INT_STATUS(WILC_SPI_REG_BASE + 0x40)
+#define WILC_SPI_INT_CLEAR (WILC_SPI_REG_BASE + 0x44)
+
+#define 

[PATCH v4 09/18] wilc1000: add netdev.c

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/netdev.c' to
'drivers/net/wireless/microchip/wilc1000/netdev.c'.

Signed-off-by: Ajay Singh 
---
 .../net/wireless/microchip/wilc1000/netdev.c  | 940 ++
 1 file changed, 940 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/netdev.c

diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c 
b/drivers/net/wireless/microchip/wilc1000/netdev.c
new file mode 100644
index ..045f5cdfdca0
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
@@ -0,0 +1,940 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cfg80211.h"
+#include "wlan_cfg.h"
+
+#define WILC_MULTICAST_TABLE_SIZE  8
+
+static irqreturn_t isr_uh_routine(int irq, void *user_data)
+{
+   struct net_device *dev = user_data;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
+
+   if (wilc->close) {
+   netdev_err(dev, "Can't handle UH interrupt\n");
+   return IRQ_HANDLED;
+   }
+   return IRQ_WAKE_THREAD;
+}
+
+static irqreturn_t isr_bh_routine(int irq, void *userdata)
+{
+   struct net_device *dev = userdata;
+   struct wilc_vif *vif = netdev_priv(userdata);
+   struct wilc *wilc = vif->wilc;
+
+   if (wilc->close) {
+   netdev_err(dev, "Can't handle BH interrupt\n");
+   return IRQ_HANDLED;
+   }
+
+   wilc_handle_isr(wilc);
+
+   return IRQ_HANDLED;
+}
+
+static int init_irq(struct net_device *dev)
+{
+   int ret = 0;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wl = vif->wilc;
+
+   ret = gpiod_direction_input(wl->gpio_irq);
+   if (ret) {
+   netdev_err(dev, "could not obtain gpio for WILC_INTR\n");
+   return ret;
+   }
+
+   wl->dev_irq_num = gpiod_to_irq(wl->gpio_irq);
+
+   ret = request_threaded_irq(wl->dev_irq_num, isr_uh_routine,
+  isr_bh_routine,
+  IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+  "WILC_IRQ", dev);
+   if (ret < 0)
+   netdev_err(dev, "Failed to request IRQ\n");
+   else
+   netdev_dbg(dev, "IRQ request succeeded IRQ-NUM= %d\n",
+  wl->dev_irq_num);
+
+   return ret;
+}
+
+static void deinit_irq(struct net_device *dev)
+{
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
+
+   /* Deinitialize IRQ */
+   if (wilc->dev_irq_num)
+   free_irq(wilc->dev_irq_num, wilc);
+}
+
+void wilc_mac_indicate(struct wilc *wilc)
+{
+   s8 status;
+
+   wilc_wlan_cfg_get_val(wilc, WID_STATUS, &status, 1);
+   if (wilc->mac_status == WILC_MAC_STATUS_INIT) {
+   wilc->mac_status = status;
+   complete(&wilc->sync_event);
+   } else {
+   wilc->mac_status = status;
+   }
+}
+
+static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header)
+{
+   struct net_device *ndev = NULL;
+   struct wilc_vif *vif;
+   struct ieee80211_hdr *h = (struct ieee80211_hdr *)mac_header;
+
+   list_for_each_entry_rcu(vif, &wilc->vif_list, list) {
+   if (vif->mode == WILC_STATION_MODE)
+   if (ether_addr_equal_unaligned(h->addr2, vif->bssid)) {
+   ndev = vif->ndev;
+   goto out;
+   }
+   if (vif->mode == WILC_AP_MODE)
+   if (ether_addr_equal_unaligned(h->addr1, vif->bssid)) {
+   ndev = vif->ndev;
+   goto out;
+   }
+   }
+out:
+   return ndev;
+}
+
+void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode)
+{
+   struct wilc_vif *vif = netdev_priv(wilc_netdev);
+
+   if (bssid)
+   ether_addr_copy(vif->bssid, bssid);
+   else
+   eth_zero_addr(vif->bssid);
+
+   vif->mode = mode;
+}
+
+int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
+{
+   int srcu_idx;
+   u8 ret_val = 0;
+   struct wilc_vif *vif;
+
+   srcu_idx = srcu_read_lock(&wilc->srcu);
+   list_for_each_entry_rcu(vif, &wilc->vif_list, list) {
+   if (!is_zero_ether_addr(vif->bssid))
+   ret_val++;
+   }
+   srcu_read_unlock(&wilc->srcu, srcu_idx);
+   return ret_val;
+}
+
+static int wilc_txq_task(void *vp)
+{
+   int ret;
+   u32 txq_count;
+   struct wilc *wl = vp;
+
+   complete(&wl->txq_thread_started);
+   while (1) {
+   wait_for_completion(&wl->txq_event);
+
+   if (wl->close) {
+   complete(&wl->txq_thread_start

[PATCH v4 13/18] wilc1000: add wlan.c

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/wlan.c' to
'drivers/net/wireless/microchip/wilc1000/wlan.c'.

Signed-off-by: Ajay Singh 
---
 .../net/wireless/microchip/wilc1000/wlan.c| 1238 +
 1 file changed, 1238 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/wlan.c

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c 
b/drivers/net/wireless/microchip/wilc1000/wlan.c
new file mode 100644
index ..6a82fb2f283e
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -0,0 +1,1238 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#include 
+#include 
+#include "cfg80211.h"
+#include "wlan_cfg.h"
+
+static inline bool is_wilc1000(u32 id)
+{
+   return (id & (~WILC_CHIP_REV_FIELD)) == WILC_1000_BASE_ID;
+}
+
+static inline void acquire_bus(struct wilc *wilc, enum bus_acquire acquire)
+{
+   mutex_lock(&wilc->hif_cs);
+   if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP)
+   chip_wakeup(wilc);
+}
+
+static inline void release_bus(struct wilc *wilc, enum bus_release release)
+{
+   if (release == WILC_BUS_RELEASE_ALLOW_SLEEP)
+   chip_allow_sleep(wilc);
+   mutex_unlock(&wilc->hif_cs);
+}
+
+static void wilc_wlan_txq_remove(struct wilc *wilc, struct txq_entry_t *tqe)
+{
+   list_del(&tqe->list);
+   wilc->txq_entries -= 1;
+}
+
+static struct txq_entry_t *
+wilc_wlan_txq_remove_from_head(struct net_device *dev)
+{
+   struct txq_entry_t *tqe = NULL;
+   unsigned long flags;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
+
+   spin_lock_irqsave(&wilc->txq_spinlock, flags);
+
+   if (!list_empty(&wilc->txq_head.list)) {
+   tqe = list_first_entry(&wilc->txq_head.list, struct txq_entry_t,
+  list);
+   list_del(&tqe->list);
+   wilc->txq_entries -= 1;
+   }
+   spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
+   return tqe;
+}
+
+static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
+ struct txq_entry_t *tqe)
+{
+   unsigned long flags;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
+
+   spin_lock_irqsave(&wilc->txq_spinlock, flags);
+
+   list_add_tail(&tqe->list, &wilc->txq_head.list);
+   wilc->txq_entries += 1;
+
+   spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
+
+   complete(&wilc->txq_event);
+}
+
+static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif,
+ struct txq_entry_t *tqe)
+{
+   unsigned long flags;
+   struct wilc *wilc = vif->wilc;
+
+   mutex_lock(&wilc->txq_add_to_head_cs);
+
+   spin_lock_irqsave(&wilc->txq_spinlock, flags);
+
+   list_add(&tqe->list, &wilc->txq_head.list);
+   wilc->txq_entries += 1;
+
+   spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
+   mutex_unlock(&wilc->txq_add_to_head_cs);
+   complete(&wilc->txq_event);
+}
+
+#define NOT_TCP_ACK(-1)
+
+static inline void add_tcp_session(struct wilc_vif *vif, u32 src_prt,
+  u32 dst_prt, u32 seq)
+{
+   struct tcp_ack_filter *f = &vif->ack_filter;
+
+   if (f->tcp_session < 2 * MAX_TCP_SESSION) {
+   f->ack_session_info[f->tcp_session].seq_num = seq;
+   f->ack_session_info[f->tcp_session].bigger_ack_num = 0;
+   f->ack_session_info[f->tcp_session].src_port = src_prt;
+   f->ack_session_info[f->tcp_session].dst_port = dst_prt;
+   f->tcp_session++;
+   }
+}
+
+static inline void update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack)
+{
+   struct tcp_ack_filter *f = &vif->ack_filter;
+
+   if (index < 2 * MAX_TCP_SESSION &&
+   ack > f->ack_session_info[index].bigger_ack_num)
+   f->ack_session_info[index].bigger_ack_num = ack;
+}
+
+static inline void add_tcp_pending_ack(struct wilc_vif *vif, u32 ack,
+  u32 session_index,
+  struct txq_entry_t *txqe)
+{
+   struct tcp_ack_filter *f = &vif->ack_filter;
+   u32 i = f->pending_base + f->pending_acks_idx;
+
+   if (i < MAX_PENDING_ACKS) {
+   f->pending_acks[i].ack_num = ack;
+   f->pending_acks[i].txqe = txqe;
+   f->pending_acks[i].session_index = session_index;
+   txqe->ack_idx = i;
+   f->pending_acks_idx++;
+   }
+}
+
+static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
+{
+   void *buffer = tqe->buffer;
+   const struct ethhdr *eth_hdr_ptr = buffer;
+   int i;
+   unsigned long flags;
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wilc = vif->wilc;
+ 

[PATCH v4 08/18] wilc1000: add netdev.h

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/netdev.h' to
'drivers/net/wireless/microchip/wilc1000/netdev.h'.

Signed-off-by: Ajay Singh 
---
 .../net/wireless/microchip/wilc1000/netdev.h  | 295 ++
 1 file changed, 295 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/netdev.h

diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h 
b/drivers/net/wireless/microchip/wilc1000/netdev.h
new file mode 100644
index ..e3689e2a4abb
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.h
@@ -0,0 +1,295 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#ifndef WILC_NETDEV_H
+#define WILC_NETDEV_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "hif.h"
+#include "wlan.h"
+#include "wlan_cfg.h"
+
+#define FLOW_CONTROL_LOWER_THRESHOLD   128
+#define FLOW_CONTROL_UPPER_THRESHOLD   256
+
+#define PMKID_FOUND1
+#define NUM_STA_ASSOCIATED 8
+
+#define NUM_REG_FRAME  2
+
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH   54
+#define DEFAULT_LINK_SPEED 72
+
+struct wilc_wfi_stats {
+   unsigned long rx_packets;
+   unsigned long tx_packets;
+   unsigned long rx_bytes;
+   unsigned long tx_bytes;
+   u64 rx_time;
+   u64 tx_time;
+
+};
+
+struct wilc_wfi_key {
+   u8 *key;
+   u8 *seq;
+   int key_len;
+   int seq_len;
+   u32 cipher;
+};
+
+struct wilc_wfi_wep_key {
+   u8 *key;
+   u8 key_len;
+   u8 key_idx;
+};
+
+struct sta_info {
+   u8 sta_associated_bss[WILC_MAX_NUM_STA][ETH_ALEN];
+};
+
+/* Parameters needed for host interface for remaining on channel */
+struct wilc_wfi_p2p_listen_params {
+   struct ieee80211_channel *listen_ch;
+   u32 listen_duration;
+   u64 listen_cookie;
+};
+
+static const u32 wilc_cipher_suites[] = {
+   WLAN_CIPHER_SUITE_WEP40,
+   WLAN_CIPHER_SUITE_WEP104,
+   WLAN_CIPHER_SUITE_TKIP,
+   WLAN_CIPHER_SUITE_CCMP,
+   WLAN_CIPHER_SUITE_AES_CMAC
+};
+
+#define CHAN2G(_channel, _freq, _flags) {   \
+   .band = NL80211_BAND_2GHZ, \
+   .center_freq  = (_freq), \
+   .hw_value = (_channel),  \
+   .flags= (_flags),\
+   .max_antenna_gain = 0,   \
+   .max_power= 30,  \
+}
+
+static const struct ieee80211_channel wilc_2ghz_channels[] = {
+   CHAN2G(1,  2412, 0),
+   CHAN2G(2,  2417, 0),
+   CHAN2G(3,  2422, 0),
+   CHAN2G(4,  2427, 0),
+   CHAN2G(5,  2432, 0),
+   CHAN2G(6,  2437, 0),
+   CHAN2G(7,  2442, 0),
+   CHAN2G(8,  2447, 0),
+   CHAN2G(9,  2452, 0),
+   CHAN2G(10, 2457, 0),
+   CHAN2G(11, 2462, 0),
+   CHAN2G(12, 2467, 0),
+   CHAN2G(13, 2472, 0),
+   CHAN2G(14, 2484, 0)
+};
+
+#define RATETAB_ENT(_rate, _hw_value, _flags) {\
+   .bitrate  = (_rate),\
+   .hw_value = (_hw_value),\
+   .flags= (_flags),   \
+}
+
+static struct ieee80211_rate wilc_bitrates[] = {
+   RATETAB_ENT(10,  0,  0),
+   RATETAB_ENT(20,  1,  0),
+   RATETAB_ENT(55,  2,  0),
+   RATETAB_ENT(110, 3,  0),
+   RATETAB_ENT(60,  9,  0),
+   RATETAB_ENT(90,  6,  0),
+   RATETAB_ENT(120, 7,  0),
+   RATETAB_ENT(180, 8,  0),
+   RATETAB_ENT(240, 9,  0),
+   RATETAB_ENT(360, 10, 0),
+   RATETAB_ENT(480, 11, 0),
+   RATETAB_ENT(540, 12, 0)
+};
+
+struct wilc_priv {
+   struct wireless_dev wdev;
+   struct cfg80211_scan_request *scan_req;
+
+   struct wilc_wfi_p2p_listen_params remain_on_ch_params;
+   u64 tx_cookie;
+
+   bool cfg_scanning;
+
+   u8 associated_bss[ETH_ALEN];
+   struct sta_info assoc_stainfo;
+   struct sk_buff *skb;
+   struct net_device *dev;
+   struct host_if_drv *hif_drv;
+   struct wilc_pmkid_attr pmkid_list;
+   u8 wep_key[4][WLAN_KEY_LEN_WEP104];
+   u8 wep_key_len[4];
+
+   /* The real interface that the monitor is on */
+   struct net_device *real_ndev;
+   struct wilc_wfi_key *wilc_gtk[WILC_MAX_NUM_STA];
+   struct wilc_wfi_key *wilc_ptk[WILC_MAX_NUM_STA];
+   u8 wilc_groupkey;
+
+   /* mutexes */
+   struct mutex scan_req_lock;
+   bool p2p_listen_state;
+   int scanned_cnt;
+
+   u64 inc_roc_cookie;
+};
+
+struct frame_reg {
+   u16 type;
+   bool reg;
+};
+
+#define MAX_TCP_SESSION25
+#define MAX_PENDING_ACKS   256
+
+struct ack_session_info {
+   u32 seq_num;
+   u32 bigger_ack_num;
+   u16 src_port;
+   u16 dst_port;
+   u16 status;
+};
+
+struct pending_acks {
+   u32 ack_num;
+   u32 session_index;
+   struct txq_entry

[PATCH v4 17/18] dt: bindings: net: add microchip,wilc1000,spi.yaml

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved '/drivers/staging/wilc1000//microchip,wilc1000,spi.yaml' to
'Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml'.

Signed-off-by: Ajay Singh 
---
 .../net/wireless/microchip,wilc1000,spi.yaml  | 61 +++
 1 file changed, 61 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml

diff --git 
a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml 
b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml
new file mode 100644
index ..cc8ed64ce627
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/wireless/microchip,wilc1000,spi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip WILC wireless SPI devicetree bindings
+
+maintainers:
+  - Adham Abozaeid 
+  - Ajay Singh 
+
+description:
+  The wilc1000 chips can be connected via SPI. This document describes
+  the binding for the SPI connected module.
+
+properties:
+  compatible:
+const: microchip,wilc1000-spi
+
+  spi-max-frequency:
+description: Maximum SPI clocking speed of device in Hz.
+maxItems: 1
+
+  reg:
+description: Chip select address of device.
+maxItems: 1
+
+  irq-gpios:
+description: The GPIO phandle connect to a host IRQ.
+maxItems: 1
+
+  clocks:
+description: phandle to the clock connected on rtc clock line.
+maxItems: 1
+
+required:
+  - compatible
+  - spi-max-frequency
+  - reg
+  - irq-gpios
+
+examples:
+  - |
+spi1: spi@fc018000 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+  cs-gpios = <&pioB 21 0>;
+  status = "okay";
+  wilc_spi@0 {
+compatible = "microchip,wilc1000-spi";
+spi-max-frequency = <4800>;
+reg = <0>;
+irq-gpios = <&pioC 27 0>;
+clocks = <&pck1>;
+clock-names = "rtc_clk";
+assigned-clocks = <&pck1>;
+assigned-clock-rates = <32768>;
+status = "okay";
+  };
+};
-- 
2.24.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 18/18] wilc1000: add Makefile and Kconfig files for wilc1000 compilation

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Added Makefile and Kconfig files for compiling wilc1000 module from
'drivers/net/wireless/microchip/'.

Signed-off-by: Ajay Singh 
---
 drivers/net/wireless/Kconfig  |  1 +
 drivers/net/wireless/Makefile |  1 +
 drivers/net/wireless/microchip/Kconfig| 15 +++
 drivers/net/wireless/microchip/Makefile   |  2 +
 .../net/wireless/microchip/wilc1000/Kconfig   | 42 +++
 .../net/wireless/microchip/wilc1000/Makefile  | 14 +++
 drivers/staging/Kconfig   |  2 -
 drivers/staging/Makefile  |  1 -
 8 files changed, 75 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/wireless/microchip/Kconfig
 create mode 100644 drivers/net/wireless/microchip/Makefile
 create mode 100644 drivers/net/wireless/microchip/wilc1000/Kconfig
 create mode 100644 drivers/net/wireless/microchip/wilc1000/Makefile

diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 1c98d781ae49..86faf8f3d9b0 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -47,6 +47,7 @@ source "drivers/net/wireless/st/Kconfig"
 source "drivers/net/wireless/ti/Kconfig"
 source "drivers/net/wireless/zydas/Kconfig"
 source "drivers/net/wireless/quantenna/Kconfig"
+source "drivers/net/wireless/microchip/Kconfig"
 
 config PCMCIA_RAYCS
tristate "Aviator/Raytheon 2.4GHz wireless support"
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
index 6cfe74515c95..f9a51c2889ca 100644
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_WLAN_VENDOR_ST) += st/
 obj-$(CONFIG_WLAN_VENDOR_TI) += ti/
 obj-$(CONFIG_WLAN_VENDOR_ZYDAS) += zydas/
 obj-$(CONFIG_WLAN_VENDOR_QUANTENNA) += quantenna/
+obj-$(CONFIG_WLAN_VENDOR_MICROCHIP) += microchip/
 
 # 16-bit wireless PCMCIA client drivers
 obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o
diff --git a/drivers/net/wireless/microchip/Kconfig 
b/drivers/net/wireless/microchip/Kconfig
new file mode 100644
index ..a6b46fb6b1ec
--- /dev/null
+++ b/drivers/net/wireless/microchip/Kconfig
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0
+config WLAN_VENDOR_MICROCHIP
+   bool "Microchip devices"
+   default y
+   help
+   If you have a wireless card belonging to this class, say Y.
+
+   Note that the answer to this question doesn't directly affect the
+   kernel: saying N will just cause the configurator to skip all the
+   questions about these cards. If you say Y, you will be asked for
+   your specific card in the following questions.
+
+if WLAN_VENDOR_MICROCHIP
+source "drivers/net/wireless/microchip/wilc1000/Kconfig"
+endif # WLAN_VENDOR_MICROCHIP
diff --git a/drivers/net/wireless/microchip/Makefile 
b/drivers/net/wireless/microchip/Makefile
new file mode 100644
index ..73b763c7393e
--- /dev/null
+++ b/drivers/net/wireless/microchip/Makefile
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_WILC1000) += wilc1000/
diff --git a/drivers/net/wireless/microchip/wilc1000/Kconfig 
b/drivers/net/wireless/microchip/wilc1000/Kconfig
new file mode 100644
index ..59e58550d139
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/Kconfig
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: GPL-2.0
+config WILC1000
+   tristate
+   help
+ This module only support IEEE 802.11n WiFi.
+
+config WILC1000_SDIO
+   tristate "Atmel WILC1000 SDIO (WiFi only)"
+   depends on CFG80211 && INET && MMC
+   select WILC1000
+   help
+ This module adds support for the SDIO interface of adapters using
+ WILC1000 chipset. The Atmel WILC1000 SDIO is a full speed interface.
+ It meets SDIO card specification version 2.0. The interface supports
+ the 1-bit/4-bit SD transfer mode at the clock range of 0-50 MHz.
+ The host can use this interface to read and write from any register
+ within the chip as well as configure the WILC1000 for data DMA.
+ To use this interface, pin9 (SDIO_SPI_CFG) must be grounded. Select
+ this if your platform is using the SDIO bus.
+
+config WILC1000_SPI
+   tristate "Atmel WILC1000 SPI (WiFi only)"
+   depends on CFG80211 && INET && SPI
+   select WILC1000
+   help
+ This module adds support for the SPI interface of adapters using
+ WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral
+ Interface (SPI) that operates as a SPI slave. This SPI interface can
+ be used for control and for serial I/O of 802.11 data. The SPI is a
+ full-duplex slave synchronous serial interface that is available
+ immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to
+ VDDIO. Select this if your platform is using the SPI bus.
+
+config WILC1000_HW_OOB_INTR
+   bool "WILC1000 out of band interrupt"
+   depends on WILC1000_SDIO
+   he

[PATCH v4 06/18] wilc1000: add cfg80211.c

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/cfg80211.c' to
'drivers/net/wireless/microchip/wilc1000/cfg80211.c'.

Signed-off-by: Ajay Singh 
---
 .../wireless/microchip/wilc1000/cfg80211.c| 1850 +
 1 file changed, 1850 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/cfg80211.c

diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c 
b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
new file mode 100644
index ..54e02807cebf
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
@@ -0,0 +1,1850 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#include "cfg80211.h"
+
+#define GO_NEG_REQ 0x00
+#define GO_NEG_RSP 0x01
+#define GO_NEG_CONF0x02
+#define P2P_INV_REQ0x03
+#define P2P_INV_RSP0x04
+
+#define WILC_INVALID_CHANNEL   0
+
+/* Operation at 2.4 GHz with channels 1-13 */
+#define WILC_WLAN_OPERATING_CLASS_2_4GHZ   0x51
+
+static const struct ieee80211_txrx_stypes
+   wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
+   [NL80211_IFTYPE_STATION] = {
+   .tx = 0x,
+   .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+   BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
+   },
+   [NL80211_IFTYPE_AP] = {
+   .tx = 0x,
+   .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+   BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+   BIT(IEEE80211_STYPE_AUTH >> 4) |
+   BIT(IEEE80211_STYPE_DEAUTH >> 4) |
+   BIT(IEEE80211_STYPE_ACTION >> 4)
+   },
+   [NL80211_IFTYPE_P2P_CLIENT] = {
+   .tx = 0x,
+   .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+   BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+   BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+   BIT(IEEE80211_STYPE_AUTH >> 4) |
+   BIT(IEEE80211_STYPE_DEAUTH >> 4)
+   }
+};
+
+static const struct wiphy_wowlan_support wowlan_support = {
+   .flags = WIPHY_WOWLAN_ANY
+};
+
+struct wilc_p2p_mgmt_data {
+   int size;
+   u8 *buff;
+};
+
+struct wilc_p2p_pub_act_frame {
+   u8 category;
+   u8 action;
+   u8 oui[3];
+   u8 oui_type;
+   u8 oui_subtype;
+   u8 dialog_token;
+   u8 elem[];
+} __packed;
+
+struct wilc_vendor_specific_ie {
+   u8 tag_number;
+   u8 tag_len;
+   u8 oui[3];
+   u8 oui_type;
+   u8 attr[];
+} __packed;
+
+struct wilc_attr_entry {
+   u8  attr_type;
+   __le16 attr_len;
+   u8 val[];
+} __packed;
+
+struct wilc_attr_oper_ch {
+   u8 attr_type;
+   __le16 attr_len;
+   u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
+   u8 op_class;
+   u8 op_channel;
+} __packed;
+
+struct wilc_attr_ch_list {
+   u8 attr_type;
+   __le16 attr_len;
+   u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
+   u8 elem[];
+} __packed;
+
+struct wilc_ch_list_elem {
+   u8 op_class;
+   u8 no_of_channels;
+   u8 ch_list[];
+} __packed;
+
+static void cfg_scan_result(enum scan_event scan_event,
+   struct wilc_rcvd_net_info *info, void *user_void)
+{
+   struct wilc_priv *priv = user_void;
+
+   if (!priv->cfg_scanning)
+   return;
+
+   if (scan_event == SCAN_EVENT_NETWORK_FOUND) {
+   s32 freq;
+   struct ieee80211_channel *channel;
+   struct cfg80211_bss *bss;
+   struct wiphy *wiphy = priv->dev->ieee80211_ptr->wiphy;
+
+   if (!wiphy || !info)
+   return;
+
+   freq = ieee80211_channel_to_frequency((s32)info->ch,
+ NL80211_BAND_2GHZ);
+   channel = ieee80211_get_channel(wiphy, freq);
+   if (!channel)
+   return;
+
+   bss = cfg80211_inform_bss_frame(wiphy, channel, info->mgmt,
+   info->frame_len,
+   (s32)info->rssi * 100,
+   GFP_KERNEL);
+   if (!bss)
+   cfg80211_put_bss(wiphy, bss);
+   } else if (scan_event == SCAN_EVENT_DONE) {
+   mutex_lock(&priv->scan_req_lock);
+
+   if (priv->scan_req) {
+   struct cfg80211_scan_info info = {
+   .aborted = false,
+  

[PATCH v4 11/18] wilc1000: add spi.c

2020-03-02 Thread Ajay.Kathat
From: Ajay Singh 

Moved 'drivers/staging/wilc1000/spi.c' to
'drivers/net/wireless/microchip/wilc1000/spi.c'.

Signed-off-by: Ajay Singh 
---
 drivers/net/wireless/microchip/wilc1000/spi.c | 1001 +
 1 file changed, 1001 insertions(+)
 create mode 100644 drivers/net/wireless/microchip/wilc1000/spi.c

diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c 
b/drivers/net/wireless/microchip/wilc1000/spi.c
new file mode 100644
index ..dfd25df75780
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/spi.c
@@ -0,0 +1,1001 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#include 
+#include 
+
+#include "netdev.h"
+#include "cfg80211.h"
+
+struct wilc_spi {
+   int crc_off;
+};
+
+static const struct wilc_hif_func wilc_hif_spi;
+
+/
+ *
+ *  Crc7
+ *
+ /
+
+static const u8 crc7_syndrome_table[256] = {
+   0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f,
+   0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77,
+   0x19, 0x10, 0x0b, 0x02, 0x3d, 0x34, 0x2f, 0x26,
+   0x51, 0x58, 0x43, 0x4a, 0x75, 0x7c, 0x67, 0x6e,
+   0x32, 0x3b, 0x20, 0x29, 0x16, 0x1f, 0x04, 0x0d,
+   0x7a, 0x73, 0x68, 0x61, 0x5e, 0x57, 0x4c, 0x45,
+   0x2b, 0x22, 0x39, 0x30, 0x0f, 0x06, 0x1d, 0x14,
+   0x63, 0x6a, 0x71, 0x78, 0x47, 0x4e, 0x55, 0x5c,
+   0x64, 0x6d, 0x76, 0x7f, 0x40, 0x49, 0x52, 0x5b,
+   0x2c, 0x25, 0x3e, 0x37, 0x08, 0x01, 0x1a, 0x13,
+   0x7d, 0x74, 0x6f, 0x66, 0x59, 0x50, 0x4b, 0x42,
+   0x35, 0x3c, 0x27, 0x2e, 0x11, 0x18, 0x03, 0x0a,
+   0x56, 0x5f, 0x44, 0x4d, 0x72, 0x7b, 0x60, 0x69,
+   0x1e, 0x17, 0x0c, 0x05, 0x3a, 0x33, 0x28, 0x21,
+   0x4f, 0x46, 0x5d, 0x54, 0x6b, 0x62, 0x79, 0x70,
+   0x07, 0x0e, 0x15, 0x1c, 0x23, 0x2a, 0x31, 0x38,
+   0x41, 0x48, 0x53, 0x5a, 0x65, 0x6c, 0x77, 0x7e,
+   0x09, 0x00, 0x1b, 0x12, 0x2d, 0x24, 0x3f, 0x36,
+   0x58, 0x51, 0x4a, 0x43, 0x7c, 0x75, 0x6e, 0x67,
+   0x10, 0x19, 0x02, 0x0b, 0x34, 0x3d, 0x26, 0x2f,
+   0x73, 0x7a, 0x61, 0x68, 0x57, 0x5e, 0x45, 0x4c,
+   0x3b, 0x32, 0x29, 0x20, 0x1f, 0x16, 0x0d, 0x04,
+   0x6a, 0x63, 0x78, 0x71, 0x4e, 0x47, 0x5c, 0x55,
+   0x22, 0x2b, 0x30, 0x39, 0x06, 0x0f, 0x14, 0x1d,
+   0x25, 0x2c, 0x37, 0x3e, 0x01, 0x08, 0x13, 0x1a,
+   0x6d, 0x64, 0x7f, 0x76, 0x49, 0x40, 0x5b, 0x52,
+   0x3c, 0x35, 0x2e, 0x27, 0x18, 0x11, 0x0a, 0x03,
+   0x74, 0x7d, 0x66, 0x6f, 0x50, 0x59, 0x42, 0x4b,
+   0x17, 0x1e, 0x05, 0x0c, 0x33, 0x3a, 0x21, 0x28,
+   0x5f, 0x56, 0x4d, 0x44, 0x7b, 0x72, 0x69, 0x60,
+   0x0e, 0x07, 0x1c, 0x15, 0x2a, 0x23, 0x38, 0x31,
+   0x46, 0x4f, 0x54, 0x5d, 0x62, 0x6b, 0x70, 0x79
+};
+
+static u8 crc7_byte(u8 crc, u8 data)
+{
+   return crc7_syndrome_table[(crc << 1) ^ data];
+}
+
+static u8 crc7(u8 crc, const u8 *buffer, u32 len)
+{
+   while (len--)
+   crc = crc7_byte(crc, *buffer++);
+   return crc;
+}
+
+static u8 wilc_get_crc7(u8 *buffer, u32 len)
+{
+   return crc7(0x7f, (const u8 *)buffer, len) << 1;
+}
+
+/
+ *
+ *  Spi protocol Function
+ *
+ /
+
+#define CMD_DMA_WRITE  0xc1
+#define CMD_DMA_READ   0xc2
+#define CMD_INTERNAL_WRITE 0xc3
+#define CMD_INTERNAL_READ  0xc4
+#define CMD_TERMINATE  0xc5
+#define CMD_REPEAT 0xc6
+#define CMD_DMA_EXT_WRITE  0xc7
+#define CMD_DMA_EXT_READ   0xc8
+#define CMD_SINGLE_WRITE   0xc9
+#define CMD_SINGLE_READ0xca
+#define CMD_RESET  0xcf
+
+#define DATA_PKT_SZ_256256
+#define DATA_PKT_SZ_512512
+#define DATA_PKT_SZ_1K 1024
+#define DATA_PKT_SZ_4K (4 * 1024)
+#define DATA_PKT_SZ_8K (8 * 1024)
+#define DATA_PKT_SZDATA_PKT_SZ_8K
+
+#define USE_SPI_DMA0
+
+#define WILC_SPI_COMMAND_STAT_SUCCESS  0
+#define WILC_GET_RESP_HDR_START(h) (((h) >> 4) & 0xf)
+
+struct wilc_spi_cmd {
+   u8 cmd_type;
+   union {
+   struct {
+   u8 addr[3];
+   u8 crc[];
+   } __packed simple_cmd;
+   struct {
+   u8 addr[3];
+   u8 size[2];
+   u8 crc[];
+   } __packed dma_cmd;
+   struct {
+   u8 addr[3];
+   u8 size[3];
+   u8 crc[];
+   } __packed dma_cmd_ext;
+   

Re: [PATCH v3 00/18] wilc1000: move out of staging

2020-03-02 Thread Ajay.Kathat
Hi Dan,


On 02/03/20 2:53 pm, Dan Carpenter wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
> content is safe
> 
> There are a few static checker warnings from Friday's linux-next.  Only
> the first one is important.  (Not all these Smatch warnings have been
> published).

Thanks. I have submitted a patch series to address Smatch static checker
warnings in staging ml. I will send v4 for this series by including
those changes.

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


[PATCH v2] media: staging: tegra-vde: Use devm_platform_ioremap_resource_byname()

2020-03-02 Thread Dmitry Osipenko
There is a new devm_platform_ioremap_resource_byname() helper in the
kernel now, which helps to make code cleaner a tad by replacing few
"boilerplate" lines of code with a single line. Let's utilize that
new helper in the VDE driver.

Signed-off-by: Dmitry Osipenko 
---

Changelog:

v2: Updated commit's message to make it more informative, as was requested
by Dan Carpenter in the review comment to v1.

 drivers/staging/media/tegra-vde/vde.c | 55 +--
 1 file changed, 9 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/media/tegra-vde/vde.c 
b/drivers/staging/media/tegra-vde/vde.c
index e18fd48981da..d3e63512a765 100644
--- a/drivers/staging/media/tegra-vde/vde.c
+++ b/drivers/staging/media/tegra-vde/vde.c
@@ -949,7 +949,6 @@ static int tegra_vde_runtime_resume(struct device *dev)
 static int tegra_vde_probe(struct platform_device *pdev)
 {
struct device *dev = &pdev->dev;
-   struct resource *regs;
struct tegra_vde *vde;
int irq, err;
 
@@ -959,75 +958,39 @@ static int tegra_vde_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, vde);
 
-   regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sxe");
-   if (!regs)
-   return -ENODEV;
-
-   vde->sxe = devm_ioremap_resource(dev, regs);
+   vde->sxe = devm_platform_ioremap_resource_byname(pdev, "sxe");
if (IS_ERR(vde->sxe))
return PTR_ERR(vde->sxe);
 
-   regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "bsev");
-   if (!regs)
-   return -ENODEV;
-
-   vde->bsev = devm_ioremap_resource(dev, regs);
+   vde->bsev = devm_platform_ioremap_resource_byname(pdev, "bsev");
if (IS_ERR(vde->bsev))
return PTR_ERR(vde->bsev);
 
-   regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mbe");
-   if (!regs)
-   return -ENODEV;
-
-   vde->mbe = devm_ioremap_resource(dev, regs);
+   vde->mbe = devm_platform_ioremap_resource_byname(pdev, "mbe");
if (IS_ERR(vde->mbe))
return PTR_ERR(vde->mbe);
 
-   regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ppe");
-   if (!regs)
-   return -ENODEV;
-
-   vde->ppe = devm_ioremap_resource(dev, regs);
+   vde->ppe = devm_platform_ioremap_resource_byname(pdev, "ppe");
if (IS_ERR(vde->ppe))
return PTR_ERR(vde->ppe);
 
-   regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mce");
-   if (!regs)
-   return -ENODEV;
-
-   vde->mce = devm_ioremap_resource(dev, regs);
+   vde->mce = devm_platform_ioremap_resource_byname(pdev, "mce");
if (IS_ERR(vde->mce))
return PTR_ERR(vde->mce);
 
-   regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tfe");
-   if (!regs)
-   return -ENODEV;
-
-   vde->tfe = devm_ioremap_resource(dev, regs);
+   vde->tfe = devm_platform_ioremap_resource_byname(pdev, "tfe");
if (IS_ERR(vde->tfe))
return PTR_ERR(vde->tfe);
 
-   regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ppb");
-   if (!regs)
-   return -ENODEV;
-
-   vde->ppb = devm_ioremap_resource(dev, regs);
+   vde->ppb = devm_platform_ioremap_resource_byname(pdev, "ppb");
if (IS_ERR(vde->ppb))
return PTR_ERR(vde->ppb);
 
-   regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vdma");
-   if (!regs)
-   return -ENODEV;
-
-   vde->vdma = devm_ioremap_resource(dev, regs);
+   vde->vdma = devm_platform_ioremap_resource_byname(pdev, "vdma");
if (IS_ERR(vde->vdma))
return PTR_ERR(vde->vdma);
 
-   regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "frameid");
-   if (!regs)
-   return -ENODEV;
-
-   vde->frameid = devm_ioremap_resource(dev, regs);
+   vde->frameid = devm_platform_ioremap_resource_byname(pdev, "frameid");
if (IS_ERR(vde->frameid))
return PTR_ERR(vde->frameid);
 
-- 
2.25.1

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


Re: [PATCH v2 2/3] binder: do not initialize locals passed to copy_from_user()

2020-03-02 Thread Greg KH
On Mon, Mar 02, 2020 at 02:04:29PM +0100, gli...@google.com wrote:
> Certain copy_from_user() invocations in binder.c are known to
> unconditionally initialize locals before their first use, like e.g. in
> the following case:
> 
>   struct binder_transaction_data tr;
>   if (copy_from_user(&tr, ptr, sizeof(tr)))
>   return -EFAULT;
> 
> In such cases enabling CONFIG_INIT_STACK_ALL leads to insertion of
> redundant locals initialization that the compiler fails to remove.
> To work around this problem till Clang can deal with it, we apply
> __no_initialize to local Binder structures.

I would like to see actual benchmark numbers showing this is
needed/useful otherwise it's going to just be random people adding this
marking to random places with no real reason.

thanks,

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


Re: [PATCH v2 3/3] sched/wait: avoid double initialization in ___wait_event()

2020-03-02 Thread Greg Kroah-Hartman
On Mon, Mar 02, 2020 at 07:03:19PM +0100, Alexander Potapenko wrote:
> > > case BINDER_SET_MAX_THREADS: {
> > > -   int max_threads;
> > > +   int max_threads __no_initialize;
> >
> > Is this really needed? A single integer in a rarely called ioctl()
> > being initialized twice doesn't warrant this optimization.
> 
> It really does not, and I didn't have this bit in v1.
> But if we don't want this diff to bit rot, we'd better have a
> Coccinelle script generating it.
> The script I added to the description of patch 2/3 introduced this
> annotation, and I thought keeping it is better than trying to teach
> the script about the size of the arguments.

Please fix the script, don't add stuff to the kernel that is not needed.

thanks,

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


Re: [PATCH v2 2/3] binder: do not initialize locals passed to copy_from_user()

2020-03-02 Thread Alexander Potapenko
On Mon, Mar 2, 2020 at 6:38 PM Greg KH  wrote:
>
> On Mon, Mar 02, 2020 at 02:04:29PM +0100, gli...@google.com wrote:
> > Certain copy_from_user() invocations in binder.c are known to
> > unconditionally initialize locals before their first use, like e.g. in
> > the following case:
> >
> >   struct binder_transaction_data tr;
> >   if (copy_from_user(&tr, ptr, sizeof(tr)))
> >   return -EFAULT;
> >
> > In such cases enabling CONFIG_INIT_STACK_ALL leads to insertion of
> > redundant locals initialization that the compiler fails to remove.
> > To work around this problem till Clang can deal with it, we apply
> > __no_initialize to local Binder structures.
>
> I would like to see actual benchmark numbers showing this is
> needed/useful otherwise it's going to just be random people adding this
> marking to random places with no real reason.
This were lib[hw]binder_benchmarks.
I will update patch description with benchmark data.
> thanks,
>
> greg k-h



-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: vt6656: vnt_int_start_interrupt remove spin lock.

2020-03-02 Thread Malcolm Priestley
This formed part of the legacy driver and potentially multi
users.

The driver now has only one user mac80211 remove this lock.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6656/int.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
index 3fa61c368464..fcf92cd1234b 100644
--- a/drivers/staging/vt6656/int.c
+++ b/drivers/staging/vt6656/int.c
@@ -26,16 +26,11 @@
 int vnt_int_start_interrupt(struct vnt_private *priv)
 {
int ret = 0;
-   unsigned long flags;
 
dev_dbg(&priv->usb->dev, ">Interrupt Polling Thread\n");
 
-   spin_lock_irqsave(&priv->lock, flags);
-
ret = vnt_start_interrupt_urb(priv);
 
-   spin_unlock_irqrestore(&priv->lock, flags);
-
return ret;
 }
 
-- 
2.25.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


PATCH 2/3] staging: vt6656: Remove function vnt_int_process_data.

2020-03-02 Thread Malcolm Priestley
call vnt_start_interrupt_urb directly from vnt_start.

Move debug message to vnt_start_interrupt_urb.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6656/int.c  | 11 ---
 drivers/staging/vt6656/int.h  |  1 -
 drivers/staging/vt6656/main_usb.c |  2 +-
 drivers/staging/vt6656/usbpipe.c  |  2 ++
 4 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
index fcf92cd1234b..139be3f845c3 100644
--- a/drivers/staging/vt6656/int.c
+++ b/drivers/staging/vt6656/int.c
@@ -23,17 +23,6 @@
 #include "power.h"
 #include "usbpipe.h"
 
-int vnt_int_start_interrupt(struct vnt_private *priv)
-{
-   int ret = 0;
-
-   dev_dbg(&priv->usb->dev, ">Interrupt Polling Thread\n");
-
-   ret = vnt_start_interrupt_urb(priv);
-
-   return ret;
-}
-
 static int vnt_int_report_rate(struct vnt_private *priv, u8 pkt_no, u8 tsr)
 {
struct vnt_usb_send_context *context;
diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h
index 8a6d60569ceb..0b7473a7f190 100644
--- a/drivers/staging/vt6656/int.h
+++ b/drivers/staging/vt6656/int.h
@@ -41,7 +41,6 @@ struct vnt_interrupt_data {
u8 sw[2];
 } __packed;
 
-int vnt_int_start_interrupt(struct vnt_private *priv);
 void vnt_int_process_data(struct vnt_private *priv);
 
 #endif /* __INT_H__ */
diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index 9135aad0863d..a22f88b1f5e9 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -549,7 +549,7 @@ static int vnt_start(struct ieee80211_hw *hw)
 
priv->int_interval = 1;  /* bInterval is set to 1 */
 
-   ret = vnt_int_start_interrupt(priv);
+   ret = vnt_start_interrupt_urb(priv);
if (ret)
goto free_all;
 
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index e93c2175543f..0e29dc2f4b0d 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -176,6 +176,8 @@ int vnt_start_interrupt_urb(struct vnt_private *priv)
 {
int ret = 0;
 
+   dev_dbg(&priv->usb->dev, ">Interrupt Polling Thread\n");
+
if (priv->int_buf.in_use) {
ret = -EBUSY;
goto err;
-- 
2.25.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/3] staging: vt6656: Delete int.c/h file and move functions to usbpipe

2020-03-02 Thread Malcolm Priestley
Move functions vnt_int_process_data and vnt_int_report_rate to
usbpipe.c and vnt_interrupt_data to usbpipe.h

These form part of the USB structure.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6656/Makefile   |   3 +-
 drivers/staging/vt6656/int.c  | 110 --
 drivers/staging/vt6656/int.h  |  46 -
 drivers/staging/vt6656/main_usb.c |   1 -
 drivers/staging/vt6656/usbpipe.c  |  88 +++-
 drivers/staging/vt6656/usbpipe.h  |  23 +++
 6 files changed, 111 insertions(+), 160 deletions(-)
 delete mode 100644 drivers/staging/vt6656/int.c
 delete mode 100644 drivers/staging/vt6656/int.h

diff --git a/drivers/staging/vt6656/Makefile b/drivers/staging/vt6656/Makefile
index b64c0d87f612..60a41fe62bed 100644
--- a/drivers/staging/vt6656/Makefile
+++ b/drivers/staging/vt6656/Makefile
@@ -15,7 +15,6 @@ vt6656_stage-y += main_usb.o \
rf.o \
usbpipe.o \
channel.o \
-   firmware.o \
-   int.o
+   firmware.o
 
 obj-$(CONFIG_VT6656) +=vt6656_stage.o
diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
deleted file mode 100644
index 139be3f845c3..
--- a/drivers/staging/vt6656/int.c
+++ /dev/null
@@ -1,110 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
- * All rights reserved.
- *
- * File: int.c
- *
- * Purpose: Handle USB interrupt endpoint
- *
- * Author: Jerry Chen
- *
- * Date: Apr. 2, 2004
- *
- * Functions:
- *
- * Revision History:
- *  04-02-2004 Jerry Chen:  Initial release
- *
- */
-
-#include "int.h"
-#include "mac.h"
-#include "power.h"
-#include "usbpipe.h"
-
-static int vnt_int_report_rate(struct vnt_private *priv, u8 pkt_no, u8 tsr)
-{
-   struct vnt_usb_send_context *context;
-   struct ieee80211_tx_info *info;
-   u8 tx_retry = (tsr & 0xf0) >> 4;
-   s8 idx;
-
-   if (pkt_no >= priv->num_tx_context)
-   return -EINVAL;
-
-   context = priv->tx_context[pkt_no];
-
-   if (!context->skb)
-   return -EINVAL;
-
-   info = IEEE80211_SKB_CB(context->skb);
-   idx = info->control.rates[0].idx;
-
-   ieee80211_tx_info_clear_status(info);
-
-   info->status.rates[0].count = tx_retry;
-
-   if (!(tsr & TSR_TMO)) {
-   info->status.rates[0].idx = idx;
-
-   if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
-   info->flags |= IEEE80211_TX_STAT_ACK;
-   }
-
-   ieee80211_tx_status_irqsafe(priv->hw, context->skb);
-
-   context->in_use = false;
-
-   return 0;
-}
-
-void vnt_int_process_data(struct vnt_private *priv)
-{
-   struct vnt_interrupt_data *int_data;
-   struct ieee80211_low_level_stats *low_stats = &priv->low_stats;
-
-   dev_dbg(&priv->usb->dev, ">s_nsInterruptProcessData\n");
-
-   int_data = (struct vnt_interrupt_data *)priv->int_buf.data_buf;
-
-   if (int_data->tsr0 & TSR_VALID)
-   vnt_int_report_rate(priv, int_data->pkt0, int_data->tsr0);
-
-   if (int_data->tsr1 & TSR_VALID)
-   vnt_int_report_rate(priv, int_data->pkt1, int_data->tsr1);
-
-   if (int_data->tsr2 & TSR_VALID)
-   vnt_int_report_rate(priv, int_data->pkt2, int_data->tsr2);
-
-   if (int_data->tsr3 & TSR_VALID)
-   vnt_int_report_rate(priv, int_data->pkt3, int_data->tsr3);
-
-   if (int_data->isr0 != 0) {
-   if (int_data->isr0 & ISR_BNTX &&
-   priv->op_mode == NL80211_IFTYPE_AP)
-   vnt_schedule_command(priv, WLAN_CMD_BECON_SEND);
-
-   if (int_data->isr0 & ISR_TBTT &&
-   priv->hw->conf.flags & IEEE80211_CONF_PS) {
-   if (!priv->wake_up_count)
-   priv->wake_up_count =
-   priv->hw->conf.listen_interval;
-
-   --priv->wake_up_count;
-
-   /* Turn on wake up to listen next beacon */
-   if (priv->wake_up_count == 1)
-   vnt_schedule_command(priv,
-WLAN_CMD_TBTT_WAKEUP);
-   }
-   priv->current_tsf = le64_to_cpu(int_data->tsf);
-
-   low_stats->dot11RTSSuccessCount += int_data->rts_success;
-   low_stats->dot11RTSFailureCount += int_data->rts_fail;
-   low_stats->dot11ACKFailureCount += int_data->ack_fail;
-   low_stats->dot11FCSErrorCount += int_data->fcs_err;
-   }
-
-   priv->int_buf.in_use = false;
-}
diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h
deleted file mode 100644
index 0b7473a7f190..
--- a/drivers/staging/vt6656/int.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+

Re: [PATCH v2 2/3] binder: do not initialize locals passed to copy_from_user()

2020-03-02 Thread Joe Perches
On Mon, 2020-03-02 at 19:17 +0100, Alexander Potapenko wrote:
> On Mon, Mar 2, 2020 at 3:00 PM Joe Perches  wrote:
> > On Mon, 2020-03-02 at 14:25 +0100, Alexander Potapenko wrote:
> > > On Mon, Mar 2, 2020 at 2:11 PM Joe Perches  wrote:
> > > > On Mon, 2020-03-02 at 14:04 +0100, gli...@google.com wrote:
> > > > > Certain copy_from_user() invocations in binder.c are known to
> > > > > unconditionally initialize locals before their first use, like e.g. in
> > > > > the following case:
> > > > []
> > > > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> > > > []
> > > > > @@ -3788,7 +3788,7 @@ static int binder_thread_write(struct 
> > > > > binder_proc *proc,
> > > > > 
> > > > >   case BC_TRANSACTION_SG:
> > > > >   case BC_REPLY_SG: {
> > > > > - struct binder_transaction_data_sg tr;
> > > > > + struct binder_transaction_data_sg tr 
> > > > > __no_initialize;
> > > > > 
> > > > >   if (copy_from_user(&tr, ptr, sizeof(tr)))
> > > > 
> > > > I fail to see any value in marking tr with __no_initialize
> > > > when it's immediately written to by copy_from_user.
> > > 
> > > This is being done exactly because it's immediately written to by 
> > > copy_to_user()
> > > Clang is currently unable to figure out that copy_to_user() initializes 
> > > memory.
> > > So building the kernel with CONFIG_INIT_STACK_ALL=y basically leads to
> > > the following code:
> > > 
> > >   struct binder_transaction_data_sg tr;
> > >   memset(&tr, 0xAA, sizeof(tr));
> > >   if (copy_from_user(&tr, ptr, sizeof(tr))) {...}
> > > 
> > > This unnecessarily slows the code down, so we add __no_initialize to
> > > prevent the compiler from emitting the redundant initialization.
> > 
> > So?  CONFIG_INIT_STACK_ALL by design slows down code.
> Correct.
> 
> > This marking would likely need to be done for nearly all
> > 3000+ copy_from_user entries.
> Unfortunately, yes. I was just hoping to do so for a handful of hot
> cases that we encounter, but in the long-term a compiler solution must
> supersede them.
> 
> > Why not try to get something done on the compiler side
> > to mark the function itself rather than the uses?
> This is being worked on in the meantime as well (see
> http://lists.llvm.org/pipermail/cfe-dev/2020-February/064633.html)
> Do you have any particular requisitions about how this should look on
> the source level?

I presume something like the below when appropriate for
automatic variables when not already initialized or modified.
---
 include/linux/uaccess.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 8a215c..3e034b5 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -138,7 +138,8 @@ _copy_to_user(void __user *, const void *, unsigned long);
 #endif
 
 static __always_inline unsigned long __must_check
-copy_from_user(void *to, const void __user *from, unsigned long n)
+copy_from_user(void __no_initialize *to, const void __user *from,
+  unsigned long n)
 {
if (likely(check_copy_size(to, n, false)))
n = _copy_from_user(to, from, n);


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


Re: [PATCH v4 16/18] dt: bindings: net: add microchip,wilc1000,sdio.yaml

2020-03-02 Thread Rob Herring
On Mon, Mar 02, 2020 at 04:34:40PM +, ajay.kat...@microchip.com wrote:
> From: Ajay Singh 
> 
> Moved '/drivers/staging/wilc1000/microchip,wilc1000,sdio.yaml' to
> 'Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml'.
> 
> Signed-off-by: Ajay Singh 
> ---
>  .../net/wireless/microchip,wilc1000,sdio.yaml | 68 +++
>  1 file changed, 68 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml 
> b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml
> new file mode 100644
> index ..b338f569f7e2
> --- /dev/null
> +++ 
> b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml
> @@ -0,0 +1,68 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/wireless/microchip,wilc1000,sdio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Microchip WILC wireless SDIO devicetree bindings
> +
> +maintainers:
> +  - Adham Abozaeid 
> +  - Ajay Singh 
> +
> +description:
> +  The wilc1000 chips can be connected via SDIO. The node is used to
> +  specify child node to the SDIO controller that connects the device
> +  to the system.
> +
> +properties:
> +  compatible:
> +const: microchip,wilc1000-sdio
> +
> +  irq-gpios:

Unless you need GPIO control of the line, use 'interrupts' instead.

> +description: The GPIO phandle connect to a host IRQ.
> +maxItems: 1
> +
> +  reg:
> +description: Slot ID used in the controller.

No, it's the function number. But you can just drop this.

> +maxItems: 1
> +
> +  clocks:
> +description: phandle to the clock connected on rtc clock line.
> +maxItems: 1
> +
> +  bus-width:

I believe this is defined to go in the parent node.

> +description: The number of data lines wired up the slot.
> +allOf:
> +  - $ref: /schemas/types.yaml#/definitions/uint32
> +  - enum: [1, 4, 8]
> +  - default: 1
> +
> +required:
> +  - compatible
> +  - irq-gpios
> +  - reg
> +
> +examples:
> +  - |
> +mmc1: mmc@fc00 {
> +  #address-cells = <1>;
> +  #size-cells = <0>;
> +  pinctrl-names = "default";
> +  pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3>;
> +  non-removable;
> +  vmmc-supply = <&vcc_mmc1_reg>;
> +  vqmmc-supply = <&vcc_3v3_reg>;
> +  status = "okay";

Don't show 'status' in examples.

> +  wilc_sdio@0 {

wifi@0

> +compatible = "microchip,wilc1000-sdio";
> +  irq-gpios = <&pioC 27 0>;
> +  reg = <0>;
> +  clocks = <&pck1>;
> +  clock-names = "rtc_clk";
> +  assigned-clocks = <&pck1>;
> +  assigned-clock-rates = <32768>;
> +  status = "okay";
> +  bus-width = <4>;
> +};
> +};
> -- 
> 2.24.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 17/18] dt: bindings: net: add microchip,wilc1000,spi.yaml

2020-03-02 Thread Rob Herring
On Mon, Mar 02, 2020 at 04:34:40PM +, ajay.kat...@microchip.com wrote:
> From: Ajay Singh 
> 
> Moved '/drivers/staging/wilc1000//microchip,wilc1000,spi.yaml' to
> 'Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml'.

Not a useful changelog.

I think this should be combined with the SDIO version. Details below.

> 
> Signed-off-by: Ajay Singh 
> ---
>  .../net/wireless/microchip,wilc1000,spi.yaml  | 61 +++
>  1 file changed, 61 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml 
> b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml
> new file mode 100644
> index ..cc8ed64ce627
> --- /dev/null
> +++ 
> b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml
> @@ -0,0 +1,61 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/wireless/microchip,wilc1000,spi.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Microchip WILC wireless SPI devicetree bindings
> +
> +maintainers:
> +  - Adham Abozaeid 
> +  - Ajay Singh 
> +
> +description:
> +  The wilc1000 chips can be connected via SPI. This document describes
> +  the binding for the SPI connected module.
> +
> +properties:
> +  compatible:
> +const: microchip,wilc1000-spi

You can drop '-spi' (and '-sdio'). They don't need to be different 
because they already sit on different buses.

> +
> +  spi-max-frequency:
> +description: Maximum SPI clocking speed of device in Hz.
> +maxItems: 1
> +
> +  reg:
> +description: Chip select address of device.
> +maxItems: 1
> +
> +  irq-gpios:
> +description: The GPIO phandle connect to a host IRQ.
> +maxItems: 1
> +
> +  clocks:
> +description: phandle to the clock connected on rtc clock line.
> +maxItems: 1
> +
> +required:
> +  - compatible
> +  - spi-max-frequency

This should not be required.

> +  - reg
> +  - irq-gpios
> +
> +examples:
> +  - |
> +spi1: spi@fc018000 {
> +  #address-cells = <1>;
> +  #size-cells = <0>;
> +  cs-gpios = <&pioB 21 0>;
> +  status = "okay";
> +  wilc_spi@0 {
> +compatible = "microchip,wilc1000-spi";
> +spi-max-frequency = <4800>;
> +reg = <0>;
> +irq-gpios = <&pioC 27 0>;
> +clocks = <&pck1>;
> +clock-names = "rtc_clk";

Not documented. '_clk' is redundant.

> +assigned-clocks = <&pck1>;
> +assigned-clock-rates = <32768>;

Not documented.

> +status = "okay";
> +  };
> +};
> -- 
> 2.24.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 1/2] staging: exfat: clean up d_entry rebuilding.

2020-03-02 Thread kohada.tetsuh...@dc.mitsubishielectric.co.jp
Thanks for your comment.

> Are you sure this is OK to do? exfat_get_entry_type() does a lot of 
> mapping between values, using a file_dentry_t->type, while
> fid->type is a file_id_t->type.

The fid argument of exfat_rename_file()/move_file()from old_dentry->fid of 
exfat_rename().
 * exfat_rename_file() <- ffsMoveFile() <- exfat_rename()
 * move_file() <- ffsMoveFile() <- exfat_rename()

The value that vfs sets to the old_dentry of exfat_rename() is the dentry value 
returned by exfat_lookup(), exfat_create(), and create_dir().
In each function, the value of dentry->fid is initialized to fid->type at 
create_file(), ffsLookupFile(), and create_dir().

 * create_file() <- ffsCreateFile() <-exfat_create()
 * ffsLookupFile() <- exfat_find() <-exfat_lookup()
 * exfat_mkdir() <- ffsCreateDir() <-create_dir()

> and at first read it's not obvious to 
> fid->me whether type is guaranteed to have the correct value already.

A valid value is set in fid->type for all paths.
What do you think?

--
Kohada Tetsuhiro 


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


Re: [PATCH 1/2] staging: exfat: clean up d_entry rebuilding.

2020-03-02 Thread Valdis Klētnieks
On Tue, 03 Mar 2020 03:07:51 +, 
"kohada.tetsuh...@dc.mitsubishielectric.co.jp" said:

> > Are you sure this is OK to do? exfat_get_entry_type() does a lot of
> > mapping between values, using a file_dentry_t->type, while
> > fid->type is a file_id_t->type.

> The value that vfs sets to the old_dentry of exfat_rename() is the dentry 
> value returned by exfat_lookup(), exfat_create(), and create_dir().
> In each function, the value of dentry->fid is initialized to fid->type at 
> create_file(), ffsLookupFile(), and create_dir().
>
>  * create_file() <- ffsCreateFile() <-exfat_create()
>  * ffsLookupFile() <- exfat_find() <-exfat_lookup()
>  * exfat_mkdir() <- ffsCreateDir() <-create_dir()
>
> > and at first read it's not obvious to
> > me whether type is guaranteed to have the correct value already.
>
> A valid value is set in fid->type for all paths.
> What do you think?

OK, that's the part I was worried about, but I hadn't had enough caffeine
to do that analysis.  Thanks.

Acked-by: Valdis Kletnieks 



pgps0FPJU1hsI.pgp
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Hello 03/03/2020

2020-03-02 Thread Hello Friend


Good day,

My name is Reem E. Hashimy, the Emirates Minister of State and Managing 
Director of the United Arab Emirates (Dubai) World Expo 2020 Committee.
 
I am writing you to manage my funds I received as financial gratification from 
various foreign companies I assisted to receive participation slot in the 
incoming Dubai World Expo 2020. 

The amount is $44,762,906.00 United States dollars.The cumulative deposit were 
given as an expression of appreciation from the various foreign companies whose 
applications received approval to participate in the in-coming Dubai Expo 2020. 
But I could not receive the various gratifications to my personal account in my 
country because my social status as a married Muslim lady with limitations to 
certain investment opportunities. 
 
For this reason, an agreement was reached with a consulting firm to keep the 
funds in open beneficiary account with a financial institution where it will be 
possible to instruct transfer of the funds to a third party account for 
investment purpose which is the reason I am contacting you to receive and 
manage the funds as my investment partner. 

The detail will be discuss on your indication of interest with your information 
and capacity to manage the fund.

However, if you are not ready to take up responsibility in this partnership, 
please do not reply.
 
While looking forward to good partnership, I am wishing you the best of the 
year.

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


Re: [PATCH v2] media: staging: tegra-vde: Use devm_platform_ioremap_resource_byname()

2020-03-02 Thread Dan Carpenter
Thanks!

Reviewed-by: Dan Carpenter 

regards,
dan carpenter

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