Re: [PATCH] staging/ks7010: Fix coding style problems [Version 2]

2021-08-23 Thread Dan Carpenter
Google for how to format a v2 patch.

On Mon, Aug 16, 2021 at 08:04:47PM +0200, Leon Krieg wrote:
> By doing some last-second wording changes directly in the diff I've
> screwed up and managed to use spaces instead of tabs for the Kconfig file.
> This is embarrassing!
> 

I love adding backstory to my commit messages and but this is a bit
much.  :P  Just say "Use tabs instead of spaces".  Add the backstory
under the --- cut off line if necessary.

Also it doesn't just change the Kconfig file.  There are a lot of
unrelated changes as well.

regards,
dan carpenter

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


Re: [PATCH] staging/ks7010: Fix coding style problems [Version 2]

2021-08-16 Thread kernel test robot
Hi Leon,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:
https://github.com/0day-ci/linux/commits/Leon-Krieg/staging-ks7010-Fix-coding-style-problems-Version-2/20210817-020702
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
ff63261978ee1f00758f447d63276a6f180a81dc
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/0day-ci/linux/commit/be523ea1038288a8b2c8e5cf10bb2e6a02830a0a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Leon-Krieg/staging-ks7010-Fix-coding-style-problems-Version-2/20210817-020702
git checkout be523ea1038288a8b2c8e5cf10bb2e6a02830a0a
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross 
O=build_dir ARCH=m68k SHELL=/bin/bash drivers/staging/ks7010/

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

All errors (new ones prefixed by >>):

   In file included from include/linux/compiler_types.h:65,
from :
   drivers/staging/ks7010/ks_wlan_net.c: In function 'ks_wlan_set_freq':
>> include/linux/compiler_attributes.h:210:41: error: invalid use of attribute 
>> 'fallthrough'
 210 | # define fallthrough
__attribute__((__fallthrough__))
 | ^
   drivers/staging/ks7010/ks_wlan_net.c:191:17: note: in expansion of macro 
'fallthrough'
 191 | fallthrough;
 | ^~~


vim +/fallthrough +210 include/linux/compiler_attributes.h

294f69e662d1570 Joe Perches   2019-10-05  197  
294f69e662d1570 Joe Perches   2019-10-05  198  /*
294f69e662d1570 Joe Perches   2019-10-05  199   * Add the pseudo keyword 
'fallthrough' so case statement blocks
294f69e662d1570 Joe Perches   2019-10-05  200   * must end with any of these 
keywords:
294f69e662d1570 Joe Perches   2019-10-05  201   *   break;
294f69e662d1570 Joe Perches   2019-10-05  202   *   fallthrough;
ca0760e7d79e2bb Wei Ming Chen 2021-05-06  203   *   continue;
294f69e662d1570 Joe Perches   2019-10-05  204   *   goto ;
294f69e662d1570 Joe Perches   2019-10-05  205   *   return [expression];
294f69e662d1570 Joe Perches   2019-10-05  206   *
294f69e662d1570 Joe Perches   2019-10-05  207   *  gcc: 
https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
294f69e662d1570 Joe Perches   2019-10-05  208   */
294f69e662d1570 Joe Perches   2019-10-05  209  #if 
__has_attribute(__fallthrough__)
294f69e662d1570 Joe Perches   2019-10-05 @210  # define fallthrough 
   __attribute__((__fallthrough__))
294f69e662d1570 Joe Perches   2019-10-05  211  #else
294f69e662d1570 Joe Perches   2019-10-05  212  # define fallthrough 
   do {} while (0)  /* fallthrough */
a3f8a30f3f0079c Miguel Ojeda  2018-08-30  213  #endif
a3f8a30f3f0079c Miguel Ojeda  2018-08-30  214  

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


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


Re: [PATCH] staging/ks7010: Fix coding style problems [Version 2]

2021-08-16 Thread kernel test robot
Hi Leon,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:
https://github.com/0day-ci/linux/commits/Leon-Krieg/staging-ks7010-Fix-coding-style-problems-Version-2/20210817-020702
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
ff63261978ee1f00758f447d63276a6f180a81dc
config: riscv-randconfig-r042-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# 
https://github.com/0day-ci/linux/commit/be523ea1038288a8b2c8e5cf10bb2e6a02830a0a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Leon-Krieg/staging-ks7010-Fix-coding-style-problems-Version-2/20210817-020702
git checkout be523ea1038288a8b2c8e5cf10bb2e6a02830a0a
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir 
ARCH=riscv SHELL=/bin/bash drivers/staging/ks7010/

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

All errors (new ones prefixed by >>):

>> drivers/staging/ks7010/ks_wlan_net.c:191:3: error: fallthrough annotation is 
>> outside switch statement
   fallthrough;
   ^
   include/linux/compiler_attributes.h:210:56: note: expanded from macro 
'fallthrough'
   # define fallthrough__attribute__((__fallthrough__))
  ^
   1 error generated.


vim +191 drivers/staging/ks7010/ks_wlan_net.c

   171  
   172  static int ks_wlan_set_freq(struct net_device *dev,
   173  struct iw_request_info *info,
   174  union iwreq_data *fwrq, char *extra)
   175  {
   176  struct ks_wlan_private *priv = netdev_priv(dev);
   177  int channel;
   178  
   179  if (priv->sleep_mode == SLP_SLEEP)
   180  return -EPERM;
   181  
   182  /* for SLEEP MODE */
   183  /* If setting by frequency, convert to a channel */
   184  if (fwrq->freq.e == 1 &&
   185  fwrq->freq.m >= 24120 && fwrq->freq.m <= 24870) {
   186  int f = fwrq->freq.m / 10;
   187  int c = 0;
   188  
   189  while ((c < 14) && (f != frequency_list[c]))
   190  c++;
 > 191  fallthrough;
   192  fwrq->freq.e = 0;
   193  fwrq->freq.m = c + 1;
   194  }
   195  /* Setting by channel number */
   196  if (fwrq->freq.m > 1000 || fwrq->freq.e > 0)
   197  return -EOPNOTSUPP;
   198  
   199  channel = fwrq->freq.m;
   200  /* We should do a better check than that,
   201   * based on the card capability !!!
   202   */
   203  if (channel < 1 || channel > 14) {
   204  netdev_dbg(dev, "%s: New channel value of %d is 
invalid!\n",
   205 dev->name, fwrq->freq.m);
   206  return -EINVAL;
   207  }
   208  
   209  /* Yes ! We can set it !!! */
   210  priv->reg.channel = (u8)(channel);
   211  priv->need_commit |= SME_MODE_SET;
   212  
   213  return -EINPROGRESS;/* Call commit handler */
   214  }
   215  

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


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


Re: [PATCH] staging/ks7010: Fix coding style problems [Version 2]

2021-08-16 Thread Greg KH
On Mon, Aug 16, 2021 at 08:04:47PM +0200, Leon Krieg wrote:
> By doing some last-second wording changes directly in the diff I've
> screwed up and managed to use spaces instead of tabs for the Kconfig file.
> This is embarrassing!
> 
> Signed-off-by: Leon Krieg 
> ---
>  drivers/staging/ks7010/Kconfig   |  7 ---
>  drivers/staging/ks7010/ks_hostif.c   |  2 +-
>  drivers/staging/ks7010/ks_wlan_net.c | 20 ++--
>  3 files changed, 15 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/Kconfig b/drivers/staging/ks7010/Kconfig
> index 0987fdc2f70d..4bc17e50ac89 100644
> --- a/drivers/staging/ks7010/Kconfig
> +++ b/drivers/staging/ks7010/Kconfig
> @@ -6,6 +6,7 @@ config KS7010
>   select WEXT_PRIV
>   select FW_LOADER
>   help
> -   This is a driver for KeyStream KS7010 based SDIO WIFI cards. It is
> -   found on at least later Spectec SDW-821 (FCC-ID "S2Y-WLAN-11G-K" only,
> -   sadly not FCC-ID "S2Y-WLAN-11B-G") and Spectec SDW-823 microSD cards.
> +   Selecting this option enables the driver for KeyStream KS7010 SDIO
> +   hardware found in at least Spectec SDW-821 and SDW-823 microSD cards
> +   (FCC-ID "S2Y-WLAN-11G-K" but not FCC-ID "S2Y-WLAN-11B-G" and Spectec
> +   SDW-823).
> 
> diff --git a/drivers/staging/ks7010/ks_hostif.c 
> b/drivers/staging/ks7010/ks_hostif.c
> index eaa70893224a..d2f9d0ed62c1 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -134,7 +134,7 @@ int get_current_ap(struct ks_wlan_private *priv, struct 
> link_ap_info *ap_info)
>   size = (ap_info->rsn.size <= RSN_IE_BODY_MAX) ?
>   ap_info->rsn.size : RSN_IE_BODY_MAX;
>   if ((ap_info->rsn_mode & RSN_MODE_WPA2) &&
> - (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2)) {
> + priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) {
>   ap->rsn_ie.id = RSN_INFO_ELEM_ID;
>   ap->rsn_ie.size = size;
>   memcpy(ap->rsn_ie.body, ap_info->rsn.body, size);
> diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
> b/drivers/staging/ks7010/ks_wlan_net.c
> index 09e7b4cd0138..33abb6a7dbe0 100644
> --- a/drivers/staging/ks7010/ks_wlan_net.c
> +++ b/drivers/staging/ks7010/ks_wlan_net.c
> @@ -181,26 +181,26 @@ static int ks_wlan_set_freq(struct net_device *dev,
>  
>   /* for SLEEP MODE */
>   /* If setting by frequency, convert to a channel */
> - if ((fwrq->freq.e == 1) &&
> - (fwrq->freq.m >= 24120) && (fwrq->freq.m <= 24870)) {
> + if (fwrq->freq.e == 1 &&
> + fwrq->freq.m >= 24120 && fwrq->freq.m <= 24870) {
>   int f = fwrq->freq.m / 10;
>   int c = 0;
>  
>   while ((c < 14) && (f != frequency_list[c]))
>   c++;
> - /* Hack to fall through... */
> + fallthrough;
>   fwrq->freq.e = 0;
>   fwrq->freq.m = c + 1;
>   }
>   /* Setting by channel number */
> - if ((fwrq->freq.m > 1000) || (fwrq->freq.e > 0))
> + if (fwrq->freq.m > 1000 || fwrq->freq.e > 0)
>   return -EOPNOTSUPP;
>  
>   channel = fwrq->freq.m;
>   /* We should do a better check than that,
>* based on the card capability !!!
>*/
> - if ((channel < 1) || (channel > 14)) {
> + if (channel < 1 || channel > 14) {
>   netdev_dbg(dev, "%s: New channel value of %d is invalid!\n",
>  dev->name, fwrq->freq.m);
>   return -EINVAL;
> @@ -664,7 +664,7 @@ static int ks_wlan_set_rts(struct net_device *dev, struct 
> iw_request_info *info,
>   /* for SLEEP MODE */
>   if (vwrq->rts.disabled)
>   rthr = 2347;
> - if ((rthr < 0) || (rthr > 2347))
> + if (rthr < 0 || rthr > 2347)
>   return -EINVAL;
>  
>   priv->reg.rts = rthr;
> @@ -702,7 +702,7 @@ static int ks_wlan_set_frag(struct net_device *dev,
>   /* for SLEEP MODE */
>   if (vwrq->frag.disabled)
>   fthr = 2346;
> - if ((fthr < 256) || (fthr > 2346))
> + if (fthr < 256 || fthr > 2346)
>   return -EINVAL;
>  
>   fthr &= ~0x1;   /* Get an even value - is it really needed ??? */
> @@ -781,7 +781,7 @@ static int ks_wlan_set_encode(struct net_device *dev,
>   return -EINVAL;
>  
>   /* for SLEEP MODE */
> - if ((index < 0) || (index > 4))
> + if (index < 0 || index > 4)
>   return -EINVAL;
>  
>   index = (index == 0) ? priv->reg.wep_index : (index - 1);
> @@ -882,7 +882,7 @@ static int ks_wlan_get_encode(struct net_device *dev,
>   }
>  
>   /* Which key do we want ? -1 -> tx index */
> - if ((index < 0) || (index >= 4))
> + if (index < 0 || index >= 4)
>   index = priv->reg.wep_index;
>   if (priv->reg.privacy_invoked) {
>   enc->flags &= ~IW_ENCODE_DISABLED;
> @@ -1860,7 +1860,7 @@ static int ks_wlan_set_power_mgmt(struct 

[PATCH] staging/ks7010: Fix coding style problems [Version 2]

2021-08-16 Thread Leon Krieg
By doing some last-second wording changes directly in the diff I've
screwed up and managed to use spaces instead of tabs for the Kconfig file.
This is embarrassing!

Signed-off-by: Leon Krieg 
---
 drivers/staging/ks7010/Kconfig   |  7 ---
 drivers/staging/ks7010/ks_hostif.c   |  2 +-
 drivers/staging/ks7010/ks_wlan_net.c | 20 ++--
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/ks7010/Kconfig b/drivers/staging/ks7010/Kconfig
index 0987fdc2f70d..4bc17e50ac89 100644
--- a/drivers/staging/ks7010/Kconfig
+++ b/drivers/staging/ks7010/Kconfig
@@ -6,6 +6,7 @@ config KS7010
select WEXT_PRIV
select FW_LOADER
help
- This is a driver for KeyStream KS7010 based SDIO WIFI cards. It is
- found on at least later Spectec SDW-821 (FCC-ID "S2Y-WLAN-11G-K" only,
- sadly not FCC-ID "S2Y-WLAN-11B-G") and Spectec SDW-823 microSD cards.
+ Selecting this option enables the driver for KeyStream KS7010 SDIO
+ hardware found in at least Spectec SDW-821 and SDW-823 microSD cards
+ (FCC-ID "S2Y-WLAN-11G-K" but not FCC-ID "S2Y-WLAN-11B-G" and Spectec
+ SDW-823).

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index eaa70893224a..d2f9d0ed62c1 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -134,7 +134,7 @@ int get_current_ap(struct ks_wlan_private *priv, struct 
link_ap_info *ap_info)
size = (ap_info->rsn.size <= RSN_IE_BODY_MAX) ?
ap_info->rsn.size : RSN_IE_BODY_MAX;
if ((ap_info->rsn_mode & RSN_MODE_WPA2) &&
-   (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2)) {
+   priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) {
ap->rsn_ie.id = RSN_INFO_ELEM_ID;
ap->rsn_ie.size = size;
memcpy(ap->rsn_ie.body, ap_info->rsn.body, size);
diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
b/drivers/staging/ks7010/ks_wlan_net.c
index 09e7b4cd0138..33abb6a7dbe0 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -181,26 +181,26 @@ static int ks_wlan_set_freq(struct net_device *dev,
 
/* for SLEEP MODE */
/* If setting by frequency, convert to a channel */
-   if ((fwrq->freq.e == 1) &&
-   (fwrq->freq.m >= 24120) && (fwrq->freq.m <= 24870)) {
+   if (fwrq->freq.e == 1 &&
+   fwrq->freq.m >= 24120 && fwrq->freq.m <= 24870) {
int f = fwrq->freq.m / 10;
int c = 0;
 
while ((c < 14) && (f != frequency_list[c]))
c++;
-   /* Hack to fall through... */
+   fallthrough;
fwrq->freq.e = 0;
fwrq->freq.m = c + 1;
}
/* Setting by channel number */
-   if ((fwrq->freq.m > 1000) || (fwrq->freq.e > 0))
+   if (fwrq->freq.m > 1000 || fwrq->freq.e > 0)
return -EOPNOTSUPP;
 
channel = fwrq->freq.m;
/* We should do a better check than that,
 * based on the card capability !!!
 */
-   if ((channel < 1) || (channel > 14)) {
+   if (channel < 1 || channel > 14) {
netdev_dbg(dev, "%s: New channel value of %d is invalid!\n",
   dev->name, fwrq->freq.m);
return -EINVAL;
@@ -664,7 +664,7 @@ static int ks_wlan_set_rts(struct net_device *dev, struct 
iw_request_info *info,
/* for SLEEP MODE */
if (vwrq->rts.disabled)
rthr = 2347;
-   if ((rthr < 0) || (rthr > 2347))
+   if (rthr < 0 || rthr > 2347)
return -EINVAL;
 
priv->reg.rts = rthr;
@@ -702,7 +702,7 @@ static int ks_wlan_set_frag(struct net_device *dev,
/* for SLEEP MODE */
if (vwrq->frag.disabled)
fthr = 2346;
-   if ((fthr < 256) || (fthr > 2346))
+   if (fthr < 256 || fthr > 2346)
return -EINVAL;
 
fthr &= ~0x1;   /* Get an even value - is it really needed ??? */
@@ -781,7 +781,7 @@ static int ks_wlan_set_encode(struct net_device *dev,
return -EINVAL;
 
/* for SLEEP MODE */
-   if ((index < 0) || (index > 4))
+   if (index < 0 || index > 4)
return -EINVAL;
 
index = (index == 0) ? priv->reg.wep_index : (index - 1);
@@ -882,7 +882,7 @@ static int ks_wlan_get_encode(struct net_device *dev,
}
 
/* Which key do we want ? -1 -> tx index */
-   if ((index < 0) || (index >= 4))
+   if (index < 0 || index >= 4)
index = priv->reg.wep_index;
if (priv->reg.privacy_invoked) {
enc->flags &= ~IW_ENCODE_DISABLED;
@@ -1860,7 +1860,7 @@ static int ks_wlan_set_power_mgmt(struct net_device *dev,
return -EINVAL;
 
if ((*uwrq == POWER_MGMT_SAVE1 || *uwrq == POWER_MGMT_SAVE2) &&
-