Re: [PATCH] staging: ks7010: Fix coding style issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Fernando,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.17-rc1 next-20180417]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Fernando-Pereira/staging-ks7010-Fix-coding-style-issues/20180417-190035
config: x86_64-randconfig-x001-201815 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10:0,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers/staging/ks7010/ks_wlan_net.c:12:
   drivers/staging/ks7010/ks_wlan_net.c: In function 'ks_wlan_set_freq':
   drivers/staging/ks7010/ks_wlan_net.c:209:15: error: SSE register return with SSE disabled
         (fwrq->m >= 2.412e8) && (fwrq->m <= 2.487e8)) {
         ~~~~~~~~~^~~~~~~~~~~
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> drivers/staging/ks7010/ks_wlan_net.c:208:2: note: in expansion of macro 'if'
     if ((fwrq->e == 1) &&
     ^~

vim +/if +208 drivers/staging/ks7010/ks_wlan_net.c

13a9930d Wolfram Sang         2016-05-31  @12  #include <linux/module.h>
13a9930d Wolfram Sang         2016-05-31   13  #include <linux/kernel.h>
13a9930d Wolfram Sang         2016-05-31   14  #include <linux/compiler.h>
13a9930d Wolfram Sang         2016-05-31   15  #include <linux/init.h>
13a9930d Wolfram Sang         2016-05-31   16  #include <linux/ioport.h>
13a9930d Wolfram Sang         2016-05-31   17  #include <linux/netdevice.h>
13a9930d Wolfram Sang         2016-05-31   18  #include <linux/etherdevice.h>
13a9930d Wolfram Sang         2016-05-31   19  #include <linux/if_arp.h>
13a9930d Wolfram Sang         2016-05-31   20  #include <linux/rtnetlink.h>
13a9930d Wolfram Sang         2016-05-31   21  #include <linux/delay.h>
13a9930d Wolfram Sang         2016-05-31   22  #include <linux/completion.h>
13a9930d Wolfram Sang         2016-05-31   23  #include <linux/mii.h>
13a9930d Wolfram Sang         2016-05-31   24  #include <linux/pci.h>
13a9930d Wolfram Sang         2016-05-31   25  #include <linux/ctype.h>
13a9930d Wolfram Sang         2016-05-31   26  #include <linux/timer.h>
99a751c7 Sabitha George       2016-10-10   27  #include <linux/atomic.h>
13a9930d Wolfram Sang         2016-05-31   28  #include <linux/io.h>
99a751c7 Sabitha George       2016-10-10   29  #include <linux/uaccess.h>
13a9930d Wolfram Sang         2016-05-31   30  
13a9930d Wolfram Sang         2016-05-31   31  static int wep_on_off;
13a9930d Wolfram Sang         2016-05-31   32  #define	WEP_OFF		0
13a9930d Wolfram Sang         2016-05-31   33  #define	WEP_ON_64BIT	1
13a9930d Wolfram Sang         2016-05-31   34  #define	WEP_ON_128BIT	2
13a9930d Wolfram Sang         2016-05-31   35  
13a9930d Wolfram Sang         2016-05-31   36  #include "ks_wlan.h"
13a9930d Wolfram Sang         2016-05-31   37  #include "ks_hostif.h"
13a9930d Wolfram Sang         2016-05-31   38  #include "ks_wlan_ioctl.h"
13a9930d Wolfram Sang         2016-05-31   39  
13a9930d Wolfram Sang         2016-05-31   40  /* Include Wireless Extension definition and check version */
13a9930d Wolfram Sang         2016-05-31   41  #include <linux/wireless.h>
13a9930d Wolfram Sang         2016-05-31   42  #define WIRELESS_SPY	/* enable iwspy support */
13a9930d Wolfram Sang         2016-05-31   43  #include <net/iw_handler.h>	/* New driver API */
13a9930d Wolfram Sang         2016-05-31   44  
13a9930d Wolfram Sang         2016-05-31   45  /* Frequency list (map channels to frequencies) */
13a9930d Wolfram Sang         2016-05-31   46  static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442,
1df65547 Wolfram Sang         2016-05-31   47  	2447, 2452, 2457, 2462, 2467, 2472, 2484
1df65547 Wolfram Sang         2016-05-31   48  };
13a9930d Wolfram Sang         2016-05-31   49  
13a9930d Wolfram Sang         2016-05-31   50  /* A few details needed for WEP (Wireless Equivalent Privacy) */
13a9930d Wolfram Sang         2016-05-31   51  #define MAX_KEY_SIZE 13	/* 128 (?) bits */
13a9930d Wolfram Sang         2016-05-31   52  #define MIN_KEY_SIZE  5	/* 40 bits RC4 - WEP */
acefb645 Sabitha George       2016-10-13   53  struct wep_key {
13a9930d Wolfram Sang         2016-05-31   54  	u16 len;
13a9930d Wolfram Sang         2016-05-31   55  	u8 key[16];	/* 40-bit and 104-bit keys */
acefb645 Sabitha George       2016-10-13   56  };
13a9930d Wolfram Sang         2016-05-31   57  
13a9930d Wolfram Sang         2016-05-31   58  /* Backward compatibility */
13a9930d Wolfram Sang         2016-05-31   59  #ifndef IW_ENCODE_NOKEY
13a9930d Wolfram Sang         2016-05-31   60  #define IW_ENCODE_NOKEY 0x0800	/* Key is write only, so not present */
13a9930d Wolfram Sang         2016-05-31   61  #define IW_ENCODE_MODE  (IW_ENCODE_DISABLED | IW_ENCODE_RESTRICTED | IW_ENCODE_OPEN)
13a9930d Wolfram Sang         2016-05-31   62  #endif /* IW_ENCODE_NOKEY */
13a9930d Wolfram Sang         2016-05-31   63  
13a9930d Wolfram Sang         2016-05-31   64  /* List of Wireless Handlers (new API) */
13a9930d Wolfram Sang         2016-05-31   65  static const struct iw_handler_def ks_wlan_handler_def;
13a9930d Wolfram Sang         2016-05-31   66  
13a9930d Wolfram Sang         2016-05-31   67  #define KSC_OPNOTSUPP	/* Operation Not Support */
13a9930d Wolfram Sang         2016-05-31   68  
13a9930d Wolfram Sang         2016-05-31   69  /*
13a9930d Wolfram Sang         2016-05-31   70   *	function prototypes
13a9930d Wolfram Sang         2016-05-31   71   */
13a9930d Wolfram Sang         2016-05-31   72  static int ks_wlan_open(struct net_device *dev);
13a9930d Wolfram Sang         2016-05-31   73  static void ks_wlan_tx_timeout(struct net_device *dev);
13a9930d Wolfram Sang         2016-05-31   74  static int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev);
13a9930d Wolfram Sang         2016-05-31   75  static int ks_wlan_close(struct net_device *dev);
13a9930d Wolfram Sang         2016-05-31   76  static void ks_wlan_set_multicast_list(struct net_device *dev);
13a9930d Wolfram Sang         2016-05-31   77  static struct net_device_stats *ks_wlan_get_stats(struct net_device *dev);
13a9930d Wolfram Sang         2016-05-31   78  static int ks_wlan_set_mac_address(struct net_device *dev, void *addr);
1df65547 Wolfram Sang         2016-05-31   79  static int ks_wlan_netdev_ioctl(struct net_device *dev, struct ifreq *rq,
1df65547 Wolfram Sang         2016-05-31   80  				int cmd);
13a9930d Wolfram Sang         2016-05-31   81  
13a9930d Wolfram Sang         2016-05-31   82  static atomic_t update_phyinfo;
13a9930d Wolfram Sang         2016-05-31   83  static struct timer_list update_phyinfo_timer;
13a9930d Wolfram Sang         2016-05-31   84  static
feedcf1a Wolfram Sang         2016-05-31   85  int ks_wlan_update_phy_information(struct ks_wlan_private *priv)
13a9930d Wolfram Sang         2016-05-31   86  {
13a9930d Wolfram Sang         2016-05-31   87  	struct iw_statistics *wstats = &priv->wstats;
13a9930d Wolfram Sang         2016-05-31   88  
5259b329 Sergio Paracuellos   2018-03-15   89  	netdev_dbg(priv->net_dev, "in_interrupt = %ld\n", in_interrupt());
13a9930d Wolfram Sang         2016-05-31   90  
6b750fac Muraru Mihaela       2016-10-04   91  	if (priv->dev_state < DEVICE_STATE_READY)
aa6ca807 Tobin C. Harding     2017-03-14   92  		return -EBUSY;	/* not finished initialize */
6b750fac Muraru Mihaela       2016-10-04   93  
13a9930d Wolfram Sang         2016-05-31   94  	if (atomic_read(&update_phyinfo))
aa6ca807 Tobin C. Harding     2017-03-14   95  		return -EPERM;
13a9930d Wolfram Sang         2016-05-31   96  
13a9930d Wolfram Sang         2016-05-31   97  	/* The status */
13a9930d Wolfram Sang         2016-05-31   98  	wstats->status = priv->reg.operation_mode;	/* Operation mode */
13a9930d Wolfram Sang         2016-05-31   99  
13a9930d Wolfram Sang         2016-05-31  100  	/* Signal quality and co. But where is the noise level ??? */
13a9930d Wolfram Sang         2016-05-31  101  	hostif_sme_enqueue(priv, SME_PHY_INFO_REQUEST);
13a9930d Wolfram Sang         2016-05-31  102  
13a9930d Wolfram Sang         2016-05-31  103  	/* interruptible_sleep_on_timeout(&priv->confirm_wait, HZ/2); */
1df65547 Wolfram Sang         2016-05-31  104  	if (!wait_for_completion_interruptible_timeout
1df65547 Wolfram Sang         2016-05-31  105  	    (&priv->confirm_wait, HZ / 2)) {
5259b329 Sergio Paracuellos   2018-03-15  106  		netdev_dbg(priv->net_dev, "wait time out!!\n");
13a9930d Wolfram Sang         2016-05-31  107  	}
13a9930d Wolfram Sang         2016-05-31  108  
13a9930d Wolfram Sang         2016-05-31  109  	atomic_inc(&update_phyinfo);
13a9930d Wolfram Sang         2016-05-31  110  	update_phyinfo_timer.expires = jiffies + HZ;	/* 1sec */
13a9930d Wolfram Sang         2016-05-31  111  	add_timer(&update_phyinfo_timer);
13a9930d Wolfram Sang         2016-05-31  112  
13a9930d Wolfram Sang         2016-05-31  113  	return 0;
13a9930d Wolfram Sang         2016-05-31  114  }
13a9930d Wolfram Sang         2016-05-31  115  
13a9930d Wolfram Sang         2016-05-31  116  static
8a81f749 Kees Cook            2017-10-24  117  void ks_wlan_update_phyinfo_timeout(struct timer_list *unused)
13a9930d Wolfram Sang         2016-05-31  118  {
5259b329 Sergio Paracuellos   2018-03-15  119  	pr_debug("in_interrupt = %ld\n", in_interrupt());
13a9930d Wolfram Sang         2016-05-31  120  	atomic_set(&update_phyinfo, 0);
13a9930d Wolfram Sang         2016-05-31  121  }
13a9930d Wolfram Sang         2016-05-31  122  
1df65547 Wolfram Sang         2016-05-31  123  int ks_wlan_setup_parameter(struct ks_wlan_private *priv,
1df65547 Wolfram Sang         2016-05-31  124  			    unsigned int commit_flag)
13a9930d Wolfram Sang         2016-05-31  125  {
13a9930d Wolfram Sang         2016-05-31  126  	hostif_sme_enqueue(priv, SME_STOP_REQUEST);
13a9930d Wolfram Sang         2016-05-31  127  
13a9930d Wolfram Sang         2016-05-31  128  	if (commit_flag & SME_RTS)
13a9930d Wolfram Sang         2016-05-31  129  		hostif_sme_enqueue(priv, SME_RTS_THRESHOLD_REQUEST);
13a9930d Wolfram Sang         2016-05-31  130  	if (commit_flag & SME_FRAG)
13a9930d Wolfram Sang         2016-05-31  131  		hostif_sme_enqueue(priv, SME_FRAGMENTATION_THRESHOLD_REQUEST);
13a9930d Wolfram Sang         2016-05-31  132  
13a9930d Wolfram Sang         2016-05-31  133  	if (commit_flag & SME_WEP_INDEX)
13a9930d Wolfram Sang         2016-05-31  134  		hostif_sme_enqueue(priv, SME_WEP_INDEX_REQUEST);
13a9930d Wolfram Sang         2016-05-31  135  	if (commit_flag & SME_WEP_VAL1)
13a9930d Wolfram Sang         2016-05-31  136  		hostif_sme_enqueue(priv, SME_WEP_KEY1_REQUEST);
13a9930d Wolfram Sang         2016-05-31  137  	if (commit_flag & SME_WEP_VAL2)
13a9930d Wolfram Sang         2016-05-31  138  		hostif_sme_enqueue(priv, SME_WEP_KEY2_REQUEST);
13a9930d Wolfram Sang         2016-05-31  139  	if (commit_flag & SME_WEP_VAL3)
13a9930d Wolfram Sang         2016-05-31  140  		hostif_sme_enqueue(priv, SME_WEP_KEY3_REQUEST);
13a9930d Wolfram Sang         2016-05-31  141  	if (commit_flag & SME_WEP_VAL4)
13a9930d Wolfram Sang         2016-05-31  142  		hostif_sme_enqueue(priv, SME_WEP_KEY4_REQUEST);
13a9930d Wolfram Sang         2016-05-31  143  	if (commit_flag & SME_WEP_FLAG)
13a9930d Wolfram Sang         2016-05-31  144  		hostif_sme_enqueue(priv, SME_WEP_FLAG_REQUEST);
13a9930d Wolfram Sang         2016-05-31  145  
13a9930d Wolfram Sang         2016-05-31  146  	if (commit_flag & SME_RSN) {
13a9930d Wolfram Sang         2016-05-31  147  		hostif_sme_enqueue(priv, SME_RSN_ENABLED_REQUEST);
13a9930d Wolfram Sang         2016-05-31  148  		hostif_sme_enqueue(priv, SME_RSN_MODE_REQUEST);
13a9930d Wolfram Sang         2016-05-31  149  	}
13a9930d Wolfram Sang         2016-05-31  150  	if (commit_flag & SME_RSN_MULTICAST)
13a9930d Wolfram Sang         2016-05-31  151  		hostif_sme_enqueue(priv, SME_RSN_MCAST_REQUEST);
13a9930d Wolfram Sang         2016-05-31  152  	if (commit_flag & SME_RSN_UNICAST)
13a9930d Wolfram Sang         2016-05-31  153  		hostif_sme_enqueue(priv, SME_RSN_UCAST_REQUEST);
13a9930d Wolfram Sang         2016-05-31  154  	if (commit_flag & SME_RSN_AUTH)
13a9930d Wolfram Sang         2016-05-31  155  		hostif_sme_enqueue(priv, SME_RSN_AUTH_REQUEST);
13a9930d Wolfram Sang         2016-05-31  156  
13a9930d Wolfram Sang         2016-05-31  157  	hostif_sme_enqueue(priv, SME_MODE_SET_REQUEST);
13a9930d Wolfram Sang         2016-05-31  158  
13a9930d Wolfram Sang         2016-05-31  159  	hostif_sme_enqueue(priv, SME_START_REQUEST);
13a9930d Wolfram Sang         2016-05-31  160  
13a9930d Wolfram Sang         2016-05-31  161  	return 0;
13a9930d Wolfram Sang         2016-05-31  162  }
13a9930d Wolfram Sang         2016-05-31  163  
13a9930d Wolfram Sang         2016-05-31  164  /*
13a9930d Wolfram Sang         2016-05-31  165   * Initial Wireless Extension code for Ks_Wlannet driver by :
13a9930d Wolfram Sang         2016-05-31  166   *	Jean Tourrilhes <jt@xxxxxxxxxx> - HPL - 17 November 00
13a9930d Wolfram Sang         2016-05-31  167   * Conversion to new driver API by :
13a9930d Wolfram Sang         2016-05-31  168   *	Jean Tourrilhes <jt@xxxxxxxxxx> - HPL - 26 March 02
13a9930d Wolfram Sang         2016-05-31  169   * Javier also did a good amount of work here, adding some new extensions
13a9930d Wolfram Sang         2016-05-31  170   * and fixing my code. Let's just say that without him this code just
13a9930d Wolfram Sang         2016-05-31  171   * would not work at all... - Jean II
13a9930d Wolfram Sang         2016-05-31  172   */
13a9930d Wolfram Sang         2016-05-31  173  
1df65547 Wolfram Sang         2016-05-31  174  static int ks_wlan_get_name(struct net_device *dev,
1df65547 Wolfram Sang         2016-05-31  175  			    struct iw_request_info *info, char *cwrq,
1df65547 Wolfram Sang         2016-05-31  176  			    char *extra)
13a9930d Wolfram Sang         2016-05-31  177  {
2b0d92b2 Tobin C. Harding     2017-04-27  178  	struct ks_wlan_private *priv = netdev_priv(dev);
13a9930d Wolfram Sang         2016-05-31  179  
6b750fac Muraru Mihaela       2016-10-04  180  	if (priv->sleep_mode == SLP_SLEEP)
1df65547 Wolfram Sang         2016-05-31  181  		return -EPERM;
6b750fac Muraru Mihaela       2016-10-04  182  
1df65547 Wolfram Sang         2016-05-31  183  	/* for SLEEP MODE */
6b750fac Muraru Mihaela       2016-10-04  184  	if (priv->dev_state < DEVICE_STATE_READY)
13a9930d Wolfram Sang         2016-05-31  185  		strcpy(cwrq, "NOT READY!");
6b750fac Muraru Mihaela       2016-10-04  186  	else if (priv->reg.phy_type == D_11B_ONLY_MODE)
13a9930d Wolfram Sang         2016-05-31  187  		strcpy(cwrq, "IEEE 802.11b");
6b750fac Muraru Mihaela       2016-10-04  188  	else if (priv->reg.phy_type == D_11G_ONLY_MODE)
13a9930d Wolfram Sang         2016-05-31  189  		strcpy(cwrq, "IEEE 802.11g");
6b750fac Muraru Mihaela       2016-10-04  190  	else
13a9930d Wolfram Sang         2016-05-31  191  		strcpy(cwrq, "IEEE 802.11b/g");
13a9930d Wolfram Sang         2016-05-31  192  
13a9930d Wolfram Sang         2016-05-31  193  	return 0;
13a9930d Wolfram Sang         2016-05-31  194  }
13a9930d Wolfram Sang         2016-05-31  195  
1df65547 Wolfram Sang         2016-05-31  196  static int ks_wlan_set_freq(struct net_device *dev,
1df65547 Wolfram Sang         2016-05-31  197  			    struct iw_request_info *info, struct iw_freq *fwrq,
1df65547 Wolfram Sang         2016-05-31  198  			    char *extra)
13a9930d Wolfram Sang         2016-05-31  199  {
2b0d92b2 Tobin C. Harding     2017-04-27  200  	struct ks_wlan_private *priv = netdev_priv(dev);
ba932876 Tobin C. Harding     2017-04-10  201  	int channel;
13a9930d Wolfram Sang         2016-05-31  202  
6b750fac Muraru Mihaela       2016-10-04  203  	if (priv->sleep_mode == SLP_SLEEP)
1df65547 Wolfram Sang         2016-05-31  204  		return -EPERM;
13a9930d Wolfram Sang         2016-05-31  205  
1df65547 Wolfram Sang         2016-05-31  206  	/* for SLEEP MODE */
13a9930d Wolfram Sang         2016-05-31  207  	/* If setting by frequency, convert to a channel */
13a9930d Wolfram Sang         2016-05-31 @208  	if ((fwrq->e == 1) &&
89a9d50b Fernando Pereira     2018-04-16  209  	    (fwrq->m >= 2.412e8) && (fwrq->m <= 2.487e8)) {
13a9930d Wolfram Sang         2016-05-31  210  		int f = fwrq->m / 100000;
13a9930d Wolfram Sang         2016-05-31  211  		int c = 0;
fe497530 Yamanappagouda Patil 2016-12-03  212  
13a9930d Wolfram Sang         2016-05-31  213  		while ((c < 14) && (f != frequency_list[c]))
13a9930d Wolfram Sang         2016-05-31  214  			c++;
13a9930d Wolfram Sang         2016-05-31  215  		/* Hack to fall through... */
13a9930d Wolfram Sang         2016-05-31  216  		fwrq->e = 0;
13a9930d Wolfram Sang         2016-05-31  217  		fwrq->m = c + 1;
13a9930d Wolfram Sang         2016-05-31  218  	}
13a9930d Wolfram Sang         2016-05-31  219  	/* Setting by channel number */
ba932876 Tobin C. Harding     2017-04-10  220  	if ((fwrq->m > 1000) || (fwrq->e > 0))
13b05e46 Tobin C. Harding     2017-03-21  221  		return -EOPNOTSUPP;
ba932876 Tobin C. Harding     2017-04-10  222  
ba932876 Tobin C. Harding     2017-04-10  223  	channel = fwrq->m;
13a9930d Wolfram Sang         2016-05-31  224  	/* We should do a better check than that,
64068bc3 Tobin C. Harding     2017-03-14  225  	 * based on the card capability !!!
64068bc3 Tobin C. Harding     2017-03-14  226  	 */
13a9930d Wolfram Sang         2016-05-31  227  	if ((channel < 1) || (channel > 14)) {
ba932876 Tobin C. Harding     2017-04-10  228  		netdev_dbg(dev, "%s: New channel value of %d is invalid!\n",
1df65547 Wolfram Sang         2016-05-31  229  			   dev->name, fwrq->m);
13b05e46 Tobin C. Harding     2017-03-21  230  		return -EINVAL;
ba932876 Tobin C. Harding     2017-04-10  231  	}
ba932876 Tobin C. Harding     2017-04-10  232  
13a9930d Wolfram Sang         2016-05-31  233  	/* Yes ! We can set it !!! */
13a9930d Wolfram Sang         2016-05-31  234  	priv->reg.channel = (u8)(channel);
13a9930d Wolfram Sang         2016-05-31  235  	priv->need_commit |= SME_MODE_SET;
13a9930d Wolfram Sang         2016-05-31  236  
13b05e46 Tobin C. Harding     2017-03-21  237  	return -EINPROGRESS;	/* Call commit handler */
13a9930d Wolfram Sang         2016-05-31  238  }
13a9930d Wolfram Sang         2016-05-31  239  

:::::: The code at line 208 was first introduced by commit
:::::: 13a9930d15b424ab7d3b906af8ba7ff8c409edfe staging: ks7010: add driver from Nanonote extra-repository

:::::: TO: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux