Re: [PATCH 7/9] drivers: staging: rtl8187se: fixed checkpatch.pl errors
On Saturday 01 March 2014 9:36:31 PM Joe Perches wrote: > On Sat, 2014-03-01 at 22:22 -0700, Axel Rasmussen wrote: > > The definition of the driver's ChannelPlan array produced a large number > > of checkpatch.pl errors. This patch fixes all of them by adding spaces > > and wrapping the resulting overly-long lines. > > I think the current code is better. > > > diff --git a/drivers/staging/rtl8187se/r8180_core.c > > b/drivers/staging/rtl8187se/r8180_core.c > [] > > > @@ -2242,17 +2242,44 @@ static void watch_dog_adaptive(unsigned long data) > > [for instance] > > > static struct rtl8187se_channel_list channel_plan_list[] = { > > > > - {{1,2,3,4,5,6,7,8,9,10,11,36,40,44,48,52,56,60,64},19}, /* FCC > > */ > > [] > > > + /* FCC */ > > + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, > > + 44, 48, 52, 56, 60, 64}, 19}, > > If you really do this, it may be better to > remove the len variable and test for != 0 > instead of channel_plan_list[].len > > So instead of: > > drivers/staging/rtl8187se/r8180_core.c: > for (i = 0; i < channel_plan_list[channel_plan].len; > i++) { > Maybe: > for (i = 0; channel_plan_list[channel_plan].channel[i]; > i++) { True, removing the length and using a 0 terminating element would simplify the channel plan list, allowing it to just be a list of arrays, rather than a list of structs. The one thing I'd be curious about is, judging by the driver's TODO file, it seems that its existing private ieee80211 implementation is going to be replaced with one that already exists elsewhere in the kernel, so the entire channel plan list may disappear at that point? If true, I'm not sure it's worth doing anything very complicated to the existing implementation. Maybe someone can confirm that this channel plan list will go away once the driver is integrated with drivers/net/wireless/rtl818x? Otherwise, I can alter this patch to replace struct rtl8187se_channel_list with a simple array of channels. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 7/9] drivers: staging: rtl8187se: fixed checkpatch.pl errors
On Saturday 01 March 2014 9:36:31 PM Joe Perches wrote: On Sat, 2014-03-01 at 22:22 -0700, Axel Rasmussen wrote: The definition of the driver's ChannelPlan array produced a large number of checkpatch.pl errors. This patch fixes all of them by adding spaces and wrapping the resulting overly-long lines. I think the current code is better. diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c [] @@ -2242,17 +2242,44 @@ static void watch_dog_adaptive(unsigned long data) [for instance] static struct rtl8187se_channel_list channel_plan_list[] = { - {{1,2,3,4,5,6,7,8,9,10,11,36,40,44,48,52,56,60,64},19}, /* FCC */ [] + /* FCC */ + {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 36, 40, + 44, 48, 52, 56, 60, 64}, 19}, If you really do this, it may be better to remove the len variable and test for != 0 instead of channel_plan_list[].len So instead of: drivers/staging/rtl8187se/r8180_core.c: for (i = 0; i channel_plan_list[channel_plan].len; i++) { Maybe: for (i = 0; channel_plan_list[channel_plan].channel[i]; i++) { True, removing the length and using a 0 terminating element would simplify the channel plan list, allowing it to just be a list of arrays, rather than a list of structs. The one thing I'd be curious about is, judging by the driver's TODO file, it seems that its existing private ieee80211 implementation is going to be replaced with one that already exists elsewhere in the kernel, so the entire channel plan list may disappear at that point? If true, I'm not sure it's worth doing anything very complicated to the existing implementation. Maybe someone can confirm that this channel plan list will go away once the driver is integrated with drivers/net/wireless/rtl818x? Otherwise, I can alter this patch to replace struct rtl8187se_channel_list with a simple array of channels. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] staging: rtl8187se: fix checkpatch.pl issues
From: Axel Rasmussen Date: Mon, 17 Feb 2014 23:50:05 -0700 Subject: [PATCH] staging: rtl8187se: fix checkpatch.pl issues Reformatted many lines which were too long, replaced various printk calls with appropriate netdev_* calls, and fixed some spelling errors. Signed-off-by: Axel Rasmussen --- drivers/staging/rtl8187se/r8180_core.c | 551 + 1 file changed, 350 insertions(+), 201 deletions(-) diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index 6cafee2..dc1d647 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -258,7 +258,8 @@ static int proc_get_stats_tx(struct seq_file *m, void *v) struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); unsigned long totalOK; - totalOK = priv->stats.txnpokint+priv->stats.txhpokint+priv->stats.txlpokint; + totalOK = priv->stats.txnpokint + priv->stats.txhpokint + + priv->stats.txlpokint; seq_printf(m, "TX OK: %lu\n" "TX Error: %lu\n" @@ -470,7 +471,8 @@ static short check_nic_enought_desc(struct net_device *dev, int priority) struct ieee80211_device *ieee = netdev_priv(dev); int requiredbyte, required; - requiredbyte = priv->ieee80211->fts + sizeof(struct ieee80211_header_data); + requiredbyte = priv->ieee80211->fts + + sizeof(struct ieee80211_header_data); if (ieee->current_network.QoS_Enable) requiredbyte += 2; @@ -484,7 +486,7 @@ static short check_nic_enought_desc(struct net_device *dev, int priority) * between the tail and the head */ - return (required+2 < get_curr_tx_free_desc(dev, priority)); + return required+2 < get_curr_tx_free_desc(dev, priority); } void fix_tx_fifo(struct net_device *dev) @@ -649,7 +651,7 @@ void rtl8180_set_chan(struct net_device *dev, short ch) struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); if ((ch > 14) || (ch < 1)) { - printk("In %s: Invalid chnanel %d\n", __func__, ch); + netdev_err(dev, "In %s: Invalid channel %d\n", __func__, ch); return; } @@ -742,43 +744,50 @@ static short alloc_tx_desc_ring(struct net_device *dev, int bufsize, int count, switch (addr) { case TX_MANAGEPRIORITY_RING_ADDR: - if (-1 == buffer_add(&(priv->txmapbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add(&(priv->txmapbufs), + buf, dma_tmp, NULL)) { DMESGE("Unable to allocate mem for buffer NP"); return -ENOMEM; } break; case TX_BKPRIORITY_RING_ADDR: - if (-1 == buffer_add(&(priv->txbkpbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add(&(priv->txbkpbufs), + buf, dma_tmp, NULL)) { DMESGE("Unable to allocate mem for buffer LP"); return -ENOMEM; } break; case TX_BEPRIORITY_RING_ADDR: - if (-1 == buffer_add(&(priv->txbepbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add(&(priv->txbepbufs), + buf, dma_tmp, NULL)) { DMESGE("Unable to allocate mem for buffer NP"); return -ENOMEM; } break; case TX_VIPRIORITY_RING_ADDR: - if (-1 == buffer_add(&(priv->txvipbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add(&(priv->txvipbufs), + buf, dma_tmp, NULL)) { DMESGE("Unable to allocate mem for buffer LP"); return -ENOMEM; } break; case TX_VOPRIORITY_RING_ADDR: - if (-1 == buffer_add(&(priv->txvopbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add(&(priv->txvopbufs), + buf, dma_tmp, NULL)) { DMESGE("Unable to allocate mem for buffer NP"); return -ENOMEM; } break; case TX_HIGHPRIORITY_RING_ADDR: - if (-1 == buffer_add(&(priv->txhpbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add(&(priv->txhpbufs), + buf, dma_tmp, NULL)) { DMESGE("Unable to allocate mem
[PATCH] staging: rtl8187se: fix checkpatch.pl issues
From: Axel Rasmussen axel.rasmuss...@gmail.com Date: Mon, 17 Feb 2014 23:50:05 -0700 Subject: [PATCH] staging: rtl8187se: fix checkpatch.pl issues Reformatted many lines which were too long, replaced various printk calls with appropriate netdev_* calls, and fixed some spelling errors. Signed-off-by: Axel Rasmussen axel.rasmuss...@gmail.com --- drivers/staging/rtl8187se/r8180_core.c | 551 + 1 file changed, 350 insertions(+), 201 deletions(-) diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index 6cafee2..dc1d647 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -258,7 +258,8 @@ static int proc_get_stats_tx(struct seq_file *m, void *v) struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); unsigned long totalOK; - totalOK = priv-stats.txnpokint+priv-stats.txhpokint+priv-stats.txlpokint; + totalOK = priv-stats.txnpokint + priv-stats.txhpokint + + priv-stats.txlpokint; seq_printf(m, TX OK: %lu\n TX Error: %lu\n @@ -470,7 +471,8 @@ static short check_nic_enought_desc(struct net_device *dev, int priority) struct ieee80211_device *ieee = netdev_priv(dev); int requiredbyte, required; - requiredbyte = priv-ieee80211-fts + sizeof(struct ieee80211_header_data); + requiredbyte = priv-ieee80211-fts + + sizeof(struct ieee80211_header_data); if (ieee-current_network.QoS_Enable) requiredbyte += 2; @@ -484,7 +486,7 @@ static short check_nic_enought_desc(struct net_device *dev, int priority) * between the tail and the head */ - return (required+2 get_curr_tx_free_desc(dev, priority)); + return required+2 get_curr_tx_free_desc(dev, priority); } void fix_tx_fifo(struct net_device *dev) @@ -649,7 +651,7 @@ void rtl8180_set_chan(struct net_device *dev, short ch) struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); if ((ch 14) || (ch 1)) { - printk(In %s: Invalid chnanel %d\n, __func__, ch); + netdev_err(dev, In %s: Invalid channel %d\n, __func__, ch); return; } @@ -742,43 +744,50 @@ static short alloc_tx_desc_ring(struct net_device *dev, int bufsize, int count, switch (addr) { case TX_MANAGEPRIORITY_RING_ADDR: - if (-1 == buffer_add((priv-txmapbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add((priv-txmapbufs), + buf, dma_tmp, NULL)) { DMESGE(Unable to allocate mem for buffer NP); return -ENOMEM; } break; case TX_BKPRIORITY_RING_ADDR: - if (-1 == buffer_add((priv-txbkpbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add((priv-txbkpbufs), + buf, dma_tmp, NULL)) { DMESGE(Unable to allocate mem for buffer LP); return -ENOMEM; } break; case TX_BEPRIORITY_RING_ADDR: - if (-1 == buffer_add((priv-txbepbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add((priv-txbepbufs), + buf, dma_tmp, NULL)) { DMESGE(Unable to allocate mem for buffer NP); return -ENOMEM; } break; case TX_VIPRIORITY_RING_ADDR: - if (-1 == buffer_add((priv-txvipbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add((priv-txvipbufs), + buf, dma_tmp, NULL)) { DMESGE(Unable to allocate mem for buffer LP); return -ENOMEM; } break; case TX_VOPRIORITY_RING_ADDR: - if (-1 == buffer_add((priv-txvopbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add((priv-txvopbufs), + buf, dma_tmp, NULL)) { DMESGE(Unable to allocate mem for buffer NP); return -ENOMEM; } break; case TX_HIGHPRIORITY_RING_ADDR: - if (-1 == buffer_add((priv-txhpbufs), buf, dma_tmp, NULL)) { + if (-1 == buffer_add((priv-txhpbufs), + buf, dma_tmp, NULL)) { DMESGE(Unable to allocate mem for