[PATCH] Staging: fix coding style in rtl8188eu/core
Set constant on the left of the test, and jump a new line to avoid to exceed the 80 char length limit. Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index cdcf0ea..8d6b368 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -22,10 +22,11 @@ bool rtw_IOL_applied(struct adapter *adapter) { - if (1 == adapter->registrypriv.fw_iol) + if (adapter->registrypriv.fw_iol == 1) return true; - if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed)) + if ((adapter->registrypriv.fw_iol == 2) + && (!adapter_to_dvobj(adapter)->ishighspeed)) return true; return false; } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: fix coding style in rtl8188eu/core
On Tue, 2016-02-02 at 13:14 -0800, Joe Perches wrote: > On Tue, 2016-02-02 at 21:57 +0100, Colin Vidal wrote: > > Set constant on the left of the test, and jump a new line to avoid > > to > > exceed the 80 char length limit. > [] > > diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c > > b/drivers/staging/rtl8188eu/core/rtw_iol.c > [] > > @@ -22,10 +22,11 @@ > > > > bool rtw_IOL_applied(struct adapter *adapter) > > { > > - if (1 == adapter->registrypriv.fw_iol) > > + if (adapter->registrypriv.fw_iol == 1) > > return true; > > > > - if ((2 == adapter->registrypriv.fw_iol) && > > (!adapter_to_dvobj(adapter)->ishighspeed)) > > + if ((adapter->registrypriv.fw_iol == 2) > > + && (!adapter_to_dvobj(adapter)->ishighspeed)) > > return true; > > return false; > > } > > Please review your patches with scripts/checkpatch.pl > > Perhaps this is better as: > > bool rtw_IOL_applied(struct adapter *adapter) > { > if (adapter->registrypriv.fw_iol == 1) > return true; > > if (adapter->registrypriv.fw_iol == 2 && > !adapter_to_dvobj(adapter)->ishighspeed) > return true; > > return false; > } > > or maybe even > > bool rtw_IOL_applied(struct adapter *adapter) > { > return adapter->registrypriv.fw_iol == 1 || > (adapter->registrypriv.fw_iol == 2 && > !adapter_to_dvobj(adapter)->ishighspeed); > } > Oh, yeah, the second one is obviously finer. If I'm right, I should resend a new patch with a subject which looks something like "[PATCH v2] ... " ? Thanks ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: fix coding style in rtl8188eu/core
Set constant operand on right of test, and refactor the code in a more compact and readable way. Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index cdcf0ea..00e1136 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -18,14 +18,11 @@ * **/ -#include +#include -bool rtw_IOL_applied(struct adapter *adapter) +bool rtw_IOL_applied(struct adapter *adapter) { - if (1 == adapter->registrypriv.fw_iol) - return true; - - if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed)) - return true; - return false; + return adapter->registrypriv.fw_iol == 1 || + (adapter->registrypriv.fw_iol == 2 && +!adapter_to_dvobj(adapter)->ishighspeed); } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: fix coding style in rtl8188eu/core
On Tue, 2016-02-02 at 23:54 +0100, Colin Vidal wrote: > Set constant operand on right of test, and refactor the code in a > more > compact and readable way. > > Signed-off-by: Colin Vidal > --- > drivers/staging/rtl8188eu/core/rtw_iol.c | 13 + > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c > b/drivers/staging/rtl8188eu/core/rtw_iol.c > index cdcf0ea..00e1136 100644 > --- a/drivers/staging/rtl8188eu/core/rtw_iol.c > +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c > @@ -18,14 +18,11 @@ > * > > * > */ > > -#include > +#include > > -bool rtw_IOL_applied(struct adapter *adapter) > +bool rtw_IOL_applied(struct adapter *adapter) > { > - if (1 == adapter->registrypriv.fw_iol) > - return true; > - > - if ((2 == adapter->registrypriv.fw_iol) && > (!adapter_to_dvobj(adapter)->ishighspeed)) > - return true; > - return false; > + return adapter->registrypriv.fw_iol == 1 || > + (adapter->registrypriv.fw_iol == 2 && > + !adapter_to_dvobj(adapter)->ishighspeed); > } Argh... The subject should be prefixed by "[PATCH v2]"... Missing training, sorry. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] Staging: fix coding style in rtl8188eu/core
Set constant operand on right of test, and refactor the code in a more compact and readable way. Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index cdcf0ea..00e1136 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -18,14 +18,11 @@ * **/ -#include +#include -bool rtw_IOL_applied(struct adapter *adapter) +bool rtw_IOL_applied(struct adapter *adapter) { - if (1 == adapter->registrypriv.fw_iol) - return true; - - if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed)) - return true; - return false; + return adapter->registrypriv.fw_iol == 1 || + (adapter->registrypriv.fw_iol == 2 && +!adapter_to_dvobj(adapter)->ishighspeed); } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 1/5] Staging: rtl8188eu/core: remove paragraph which mention FSF address in comment header
Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index cdcf0ea..000a81c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -11,10 +11,6 @@ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * * **/ -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 3/5] Staging: rtl8188eu/core: Coding style fix, set constant operand on right in tests
Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index 7642c22..3dd1a9a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -18,10 +18,10 @@ bool rtw_IOL_applied(struct adapter *adapter) { - if (1 == adapter->registrypriv.fw_iol) + if (adapter->registrypriv.fw_iol == 1) return true; - if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed)) + if ((adapter->registrypriv.fw_iol == 2) && (!adapter_to_dvobj(adapter)->ishighspeed)) return true; return false; } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 5/5] Staging: rtl8188eu/core: make core more readable
Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index 2e2145c..ba6c492 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -18,11 +18,7 @@ bool rtw_IOL_applied(struct adapter *adapter) { - if (adapter->registrypriv.fw_iol == 1) - return true; - - if ((adapter->registrypriv.fw_iol == 2) && - (!adapter_to_dvobj(adapter)->ishighspeed)) - return true; - return false; + return adapter->registrypriv.fw_iol == 1 || + (adapter->registrypriv.fw_iol == 2 && +!adapter_to_dvobj(adapter)->ishighspeed); } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 4/5] Staging: rtl8188eu/core: Coding style fix, avoid line over 80 characters
Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index 3dd1a9a..2e2145c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -21,7 +21,8 @@ bool rtw_IOL_applied(struct adapter *adapter) if (adapter->registrypriv.fw_iol == 1) return true; - if ((adapter->registrypriv.fw_iol == 2) && (!adapter_to_dvobj(adapter)->ishighspeed)) + if ((adapter->registrypriv.fw_iol == 2) && + (!adapter_to_dvobj(adapter)->ishighspeed)) return true; return false; } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 2/5] Staging: rtl8188eu/core: Coding style fix, set conform spaces between identifiers
Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index 000a81c..7642c22 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -14,9 +14,9 @@ * **/ -#include +#include -bool rtw_IOL_applied(struct adapter *adapter) +bool rtw_IOL_applied(struct adapter *adapter) { if (1 == adapter->registrypriv.fw_iol) return true; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 5/5] Staging: rtl8188eu/core: make core more readable
On Sun, 2016-02-14 at 16:39 -0800, Greg Kroah-Hartman wrote: > On Fri, Feb 12, 2016 at 07:05:53PM +0100, Colin Vidal wrote: > > Signed-off-by: Colin Vidal > > --- > > drivers/staging/rtl8188eu/core/rtw_iol.c | 10 +++--- > > 1 file changed, 3 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c > > b/drivers/staging/rtl8188eu/core/rtw_iol.c > > index 2e2145c..ba6c492 100644 > > --- a/drivers/staging/rtl8188eu/core/rtw_iol.c > > +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c > > @@ -18,11 +18,7 @@ > > > > bool rtw_IOL_applied(struct adapter *adapter) > > { > > - if (adapter->registrypriv.fw_iol == 1) > > - return true; > > - > > - if ((adapter->registrypriv.fw_iol == 2) && > > - (!adapter_to_dvobj(adapter)->ishighspeed)) > > - return true; > > - return false; > > + return adapter->registrypriv.fw_iol == 1 || > > + (adapter->registrypriv.fw_iol == 2 && > > + !adapter_to_dvobj(adapter)->ishighspeed); > > } > > I'm sorry, but this patch does not do what you said it does, it's > much > harder to read now :( > > Also, I can't take a patch without a changelog text :( > > thanks, > > greg k-h Hi Greg, Thanks for you replie! OK, I thought it was a better idea (as suggests Joe Perches) to group the test in a way to avoid multiples - and maybe confusing - returns. So, I'll remove this one. Sorry about the changelot, I missed it while making patch series, I'll resend it. Thanks, Colin ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 1/4] Staging: rtl8188eu/core: remove paragraph which mention FSF address in comment header
As FSF address changed in the past, and can change in the future, remove the address paragraph in the comment header, and avoid a warning of checkpatch. Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index cdcf0ea..000a81c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -11,10 +11,6 @@ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * * **/ -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 3/4] Staging: rtl8188eu/core: Coding style fix, set constant operand on right in tests
Remove a checkpatch warning, putting constant operant on right of two tests. Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index 7642c22..3dd1a9a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -18,10 +18,10 @@ bool rtw_IOL_applied(struct adapter *adapter) { - if (1 == adapter->registrypriv.fw_iol) + if (adapter->registrypriv.fw_iol == 1) return true; - if ((2 == adapter->registrypriv.fw_iol) && (!adapter_to_dvobj(adapter)->ishighspeed)) + if ((adapter->registrypriv.fw_iol == 2) && (!adapter_to_dvobj(adapter)->ishighspeed)) return true; return false; } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 4/4] Staging: rtl8188eu/core: Coding style fix, avoid line over 80 characters
Jump a new line after and operator of the test. It avoids to exceed 80 chars line, and remove a checkpatch warning. Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index 3dd1a9a..2e2145c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -21,7 +21,8 @@ bool rtw_IOL_applied(struct adapter *adapter) if (adapter->registrypriv.fw_iol == 1) return true; - if ((adapter->registrypriv.fw_iol == 2) && (!adapter_to_dvobj(adapter)->ishighspeed)) + if ((adapter->registrypriv.fw_iol == 2) && + (!adapter_to_dvobj(adapter)->ishighspeed)) return true; return false; } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 2/4] Staging: rtl8188eu/core: Coding style fix, set conform spaces between identifiers
And a space after include keyword, making the preprocessor more readable, and remove an unexpected space between a type and variable name. Signed-off-by: Colin Vidal --- drivers/staging/rtl8188eu/core/rtw_iol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c index 000a81c..7642c22 100644 --- a/drivers/staging/rtl8188eu/core/rtw_iol.c +++ b/drivers/staging/rtl8188eu/core/rtw_iol.c @@ -14,9 +14,9 @@ * **/ -#include +#include -bool rtw_IOL_applied(struct adapter *adapter) +bool rtw_IOL_applied(struct adapter *adapter) { if (1 == adapter->registrypriv.fw_iol) return true; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/rtl8192u: add endianness conversions
Fields frag_size and playload_size of struct ieee80211_txb are encoded as short little-endian. This patch adds conversions to / from cpu byte order when copy / write these values in variables of architecture independent byte order. It also avoid a sparse type warning. Signed-off-by: Colin Vidal --- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index 1ab0aea..2b0e1b4 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -250,7 +250,7 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, memset(txb, 0, sizeof(struct ieee80211_txb)); txb->nr_frags = nr_frags; - txb->frag_size = txb_size; + txb->frag_size = __cpu_to_le16(txb_size); for (i = 0; i < nr_frags; i++) { txb->fragments[i] = dev_alloc_skb(txb_size); @@ -752,7 +752,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) goto failed; } txb->encrypted = encrypt; - txb->payload_size = bytes; + txb->payload_size = __cpu_to_le16(bytes); //if (ieee->current_network.QoS_Enable) if(qos_actived) @@ -859,7 +859,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) } txb->encrypted = 0; - txb->payload_size = skb->len; + txb->payload_size = __cpu_to_le16(skb->len); memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len); } @@ -896,7 +896,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) }else{ if ((*ieee->hard_start_xmit)(txb, dev) == 0) { stats->tx_packets++; - stats->tx_bytes += txb->payload_size; + stats->tx_bytes += __le16_to_cpu(txb->payload_size); return 0; } ieee80211_txb_free(txb); -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel