Re: [PATCH] staging/vc04_services: Use __user annotation for user-space pointers

2018-07-30 Thread Carlos Maiolino
On Mon, Jul 30, 2018 at 11:49 AM, Stefan Wahren  wrote:
> Am 30.07.2018 um 11:43 schrieb Carlos Maiolino:
>> On Mon, Jul 30, 2018 at 11:34 AM, Stefan Wahren  
>> wrote:
>>> i think easiest the way would be to get a recent Raspbian Lite (
>>> https://www.raspberrypi.org/downloads/raspbian/ ),
>>> build the kernel with bcm2835_defconfig, modify config.txt to use the
>>> upstream DTB, add the upstream kernel and DTB to boot partition.
>>>
>>> The following command must be successful:
>>>
>>> vchiq_test -f 1
>> K, I'll take a look and find a way to test it, I don't have a rPI at
>> the moment to test
>> it, I'll take a look if I can borrow one. in mean time, can it be
>> tested somehow in x86 environment?
>
> I don't see a chance because this driver talks to the VC4 firmware.
>

kk

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


Re: [PATCH] staging/vc04_services: Use __user annotation for user-space pointers

2018-07-30 Thread Carlos Maiolino
On Mon, Jul 30, 2018 at 11:34 AM, Stefan Wahren  wrote:
> Hi Carlos,
>
> Am 30.07.2018 um 11:25 schrieb Carlos Maiolino:
>>
>> On Mon, Jul 30, 2018 at 11:13 AM, Stefan Wahren 
>> wrote:
>>>
>>> Hi Carlos,
>>>
>>>
>>> Am 30.07.2018 um 11:08 schrieb Carlos Maiolino:
>>>>
>>>> On Mon, Jul 30, 2018 at 10:58 AM, Greg KH  wrote:
>>>>>
>>>>> On Tue, Jul 24, 2018 at 10:32:17AM +0200, Carlos Maiolino wrote:
>>>>>>
>>>>>> Fix several sparse warnings regarding different address space
>>>>>> assignments, like example below, by properly annotating pointers
>>>>>> expected to carry user space addresses.
>>>>>>
>>>>>> warning: incorrect type in argument 1 (different address spaces)
>>>>>> Signed-off-by: Carlos Maiolino 
>>>>>> ---
>>>>>
>>>>> We need a blank line befor your signed-off-by line please.
>>>>>
>>>> Thanks, I'll resend, or do you prefer me to way until this get a review
>>>> from
>>>> the maintainer, and I resend the fixed description with the reviewed-by?
>>>
>>>
>>> did you test your patch via vchiq_test or something else?
>>>
>> Hi, no. Can you please point me where I can get it?
>>
>>
>
> i think easiest the way would be to get a recent Raspbian Lite (
> https://www.raspberrypi.org/downloads/raspbian/ ),
> build the kernel with bcm2835_defconfig, modify config.txt to use the
> upstream DTB, add the upstream kernel and DTB to boot partition.
>
> The following command must be successful:
>
> vchiq_test -f 1

K, I'll take a look and find a way to test it, I don't have a rPI at
the moment to test
it, I'll take a look if I can borrow one. in mean time, can it be
tested somehow in x86 environment?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging/vc04_services: Use __user annotation for user-space pointers

2018-07-30 Thread Carlos Maiolino
On Mon, Jul 30, 2018 at 11:13 AM, Stefan Wahren  wrote:
> Hi Carlos,
>
>
> Am 30.07.2018 um 11:08 schrieb Carlos Maiolino:
>>
>> On Mon, Jul 30, 2018 at 10:58 AM, Greg KH  wrote:
>>>
>>> On Tue, Jul 24, 2018 at 10:32:17AM +0200, Carlos Maiolino wrote:
>>>>
>>>> Fix several sparse warnings regarding different address space
>>>> assignments, like example below, by properly annotating pointers
>>>> expected to carry user space addresses.
>>>>
>>>> warning: incorrect type in argument 1 (different address spaces)
>>>> Signed-off-by: Carlos Maiolino 
>>>> ---
>>>
>>> We need a blank line befor your signed-off-by line please.
>>>
>> Thanks, I'll resend, or do you prefer me to way until this get a review
>> from
>> the maintainer, and I resend the fixed description with the reviewed-by?
>
>
> did you test your patch via vchiq_test or something else?
>

Hi, no. Can you please point me where I can get it?


> Please add Eric Anholt

Sure, will do

>and fix my mail address in the second version, i only
> received this via mailing list.
>

Meh, I shall use copy/paste next time :P
> Stefan
>
>>
>>
>>>> + const struct vchiq_element __user *elements;
>>>>   } VCHIQ_QUEUE_MESSAGE_T;
>>>>
>>>>   typedef struct {
>>>
>>> It would be great to have an ack from the maintainers here :)
>>>
>>> thanks,
>>>
>>> greg k-h
>>
>> ___
>> linux-rpi-kernel mailing list
>> linux-rpi-ker...@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel
>
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging/vc04_services: Use __user annotation for user-space pointers

2018-07-30 Thread Carlos Maiolino
On Mon, Jul 30, 2018 at 10:58 AM, Greg KH  wrote:
> On Tue, Jul 24, 2018 at 10:32:17AM +0200, Carlos Maiolino wrote:
>> Fix several sparse warnings regarding different address space
>> assignments, like example below, by properly annotating pointers
>> expected to carry user space addresses.
>>
>> warning: incorrect type in argument 1 (different address spaces)
>> Signed-off-by: Carlos Maiolino 
>> ---
>
> We need a blank line befor your signed-off-by line please.
>

Thanks, I'll resend, or do you prefer me to way until this get a review from
the maintainer, and I resend the fixed description with the reviewed-by?


>> + const struct vchiq_element __user *elements;
>>  } VCHIQ_QUEUE_MESSAGE_T;
>>
>>  typedef struct {
>
> It would be great to have an ack from the maintainers here :)
>
> thanks,
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging/vc04_services: Use __user annotation for user-space pointers

2018-07-24 Thread Carlos Maiolino
Fix several sparse warnings regarding different address space
assignments, like example below, by properly annotating pointers
expected to carry user space addresses.

warning: incorrect type in argument 1 (different address spaces)
Signed-off-by: Carlos Maiolino 
---

I'm not subscribed to the list, so, please, CC me on any reply.
Thanks a lot.

 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c   | 4 ++--
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index bc05c69383b8..42f471471e57 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1648,8 +1648,8 @@ vchiq_compat_ioctl_queue_message(struct file *file,
 unsigned int cmd,
 unsigned long arg)
 {
-   VCHIQ_QUEUE_MESSAGE_T *args;
-   struct vchiq_element *elements;
+   VCHIQ_QUEUE_MESSAGE_T __user *args;
+   struct vchiq_element __user *elements;
struct vchiq_queue_message32 args32;
unsigned int count;
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index 9f859953f45c..1776fab41e40 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -50,7 +50,7 @@ typedef struct {
 typedef struct {
unsigned int handle;
unsigned int count;
-   const struct vchiq_element *elements;
+   const struct vchiq_element __user *elements;
 } VCHIQ_QUEUE_MESSAGE_T;
 
 typedef struct {
-- 
2.14.3

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


Re: [PATCH] staging: rtl8188eu: Fix coding style errors

2016-10-17 Thread Carlos Maiolino
Yes, thanks for the heads up. I'll try to avoid such mistakes in the
next patches

On Mon, Oct 17, 2016 at 6:29 PM, Greg KH <gre...@linuxfoundation.org> wrote:
> On Mon, Oct 17, 2016 at 06:17:21PM +0200, Carlos Maiolino wrote:
>> >> ---
>> >>  drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 28 
>> >> +--
>> >>  1 file changed, 14 insertions(+), 14 deletions(-)
>> >
>> > Any reason you didn't use scripts/get_maintainer.pl to cc: the relevant
>> > maintainers and developers of this code?
>> >
>> > thanks,
>> >
>> > greg k-h
>>
>> Not at all Greg, I was going to CC you on the patch too, but I did a
>> mistake while adding the list to git send-email, and I needed to
>> run git-send-email again, and was afraid to add you again and send you
>> two copies of the same patch, but, after I sent it to the list,
>> I realized the first try didn't send it to anybody at all, but I had
>> already sent it to the list. I apologize, it was a mistake while using
>> git-send-email.
>>
>> Should I re-send it?
>
> Nah, it's fine, I'll queue it up in a few days, just wanting to make
> sure you knew to do that in the future...
>
> thanks,
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8188eu: Fix coding style errors

2016-10-17 Thread Carlos Maiolino
>> ---
>>  drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 28 
>> +--
>>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> Any reason you didn't use scripts/get_maintainer.pl to cc: the relevant
> maintainers and developers of this code?
>
> thanks,
>
> greg k-h

Not at all Greg, I was going to CC you on the patch too, but I did a
mistake while adding the list to git send-email, and I needed to
run git-send-email again, and was afraid to add you again and send you
two copies of the same patch, but, after I sent it to the list,
I realized the first try didn't send it to anybody at all, but I had
already sent it to the list. I apologize, it was a mistake while using
git-send-email.

Should I re-send it?

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


[PATCH] staging: rtl8188eu: Fix coding style errors

2016-10-17 Thread Carlos Maiolino
Fix coding style errors reported by checkpatch.pl, specifically:

ERROR: space prohibited before that ',' (ctx:WxW)

This patch get rid of all "ERROR" messages from checkpatch.pl for this file

Signed-off-by: Carlos Maiolino <cmaiolin...@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 28 +--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index c94700c..d9c1147 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -669,10 +669,10 @@ static int issue_probereq(struct adapter *padapter, 
struct ndis_802_11_ssid *pss
get_rate_set(padapter, bssrate, _len);
 
if (bssrate_len > 8) {
-   pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, 
&(pattrib->pktlen));
-   pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , 
(bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
+   pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, 8, bssrate, 
&(pattrib->pktlen));
+   pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, 
(bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
} else {
-   pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , 
bssrate, &(pattrib->pktlen));
+   pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, bssrate_len, 
bssrate, &(pattrib->pktlen));
}
 
/* add wps_ie for wps2.0 */
@@ -1001,7 +1001,7 @@ static void issue_asocrsp(struct adapter *padapter, 
unsigned short status,
}
 
if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_REALTEK)
-   pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 6 , 
REALTEK_96B_IE, &(pattrib->pktlen));
+   pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 6, 
REALTEK_96B_IE, &(pattrib->pktlen));
 
/* add WPS IE ie for wps 2.0 */
if (pmlmepriv->wps_assoc_resp_ie && pmlmepriv->wps_assoc_resp_ie_len > 
0) {
@@ -1122,10 +1122,10 @@ static void issue_assocreq(struct adapter *padapter)
 
 
if (bssrate_len > 8) {
-   pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, 
&(pattrib->pktlen));
-   pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , 
(bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
+   pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, 8, bssrate, 
&(pattrib->pktlen));
+   pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, 
(bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
} else {
-   pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , 
bssrate, &(pattrib->pktlen));
+   pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, bssrate_len, 
bssrate, &(pattrib->pktlen));
}
 
/* RSN */
@@ -1167,7 +1167,7 @@ static void issue_assocreq(struct adapter *padapter)
memcpy(>HT_caps.mcs, MCS_rate_2R, 
16);
break;
}
-   pframe = rtw_set_ie(pframe, _HT_CAPABILITY_IE_, ie_len 
, (u8 *)(&(pmlmeinfo->HT_caps)), &(pattrib->pktlen));
+   pframe = rtw_set_ie(pframe, _HT_CAPABILITY_IE_, ie_len, 
(u8 *)(&(pmlmeinfo->HT_caps)), &(pattrib->pktlen));
}
}
 
@@ -1196,7 +1196,7 @@ static void issue_assocreq(struct adapter *padapter)
}
 
if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_REALTEK)
-   pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 6 , 
REALTEK_96B_IE, &(pattrib->pktlen));
+   pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 6, 
REALTEK_96B_IE, &(pattrib->pktlen));
 
pattrib->last_txcmdsz = pattrib->pktlen;
dump_mgntframe(padapter, pmgntframe);
@@ -2646,7 +2646,7 @@ static unsigned int OnBeacon(struct adapter *padapter,
ret = rtw_check_bcn_info(padapter, pframe, len);
if (!ret) {
DBG_88E_LEVEL(_drv_info_, "ap 
has changed, disconnect now\n ");
-   receive_disconnect(padapter, 
pmlmeinfo->network.MacAddress , 65535);
+   receive_disconnect(padapter, 
pmlmeinfo->network.MacAddress, 65535);
return _SUCCESS;
}
/* update WMM, ERP in the beacon */
@@ -2804,7 +2804,7 @@ static unsigned int OnAuth(struct adapter *padapter,
/* checking for challenging txt... */
DBG_88E("checking for challenging txt.

Re: [PATCH 0/3] staging: ks7010: Coding style fixes

2016-10-17 Thread Carlos Maiolino
Hi Greg,

I've based these patches on top of linux-next. Thanks anyway.

Which tree are you applying these patches on? I'll make sure to submit
next patches based on your tree.

Cheers

On Mon, Oct 17, 2016 at 10:27 AM, Greg KH <gre...@linuxfoundation.org> wrote:
> On Sun, Oct 16, 2016 at 10:16:00PM +0200, Carlos Maiolino wrote:
>> A small patchset fixing some coding style errors identified by checkpatch.pl
>>
>> Greg. I splitted the single patch into 3 different patches now, hope I set it
>> right now :)
>>
>> Also added a blank line before the signed-off.
>
> None of these apply to my tree as I think others have already made them
> before you did, sorry :(
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/3] staging: ks7010: add missing blank lines

2016-10-16 Thread Carlos Maiolino
Use blank lines to separate variable declarations from statements, fixing the
following checkpatch.pl issue:

WARNING: Missing a blank line after declarations

Signed-off-by: Carlos Maiolino <cmaiolin...@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 7a6cac2..1a301ef 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -765,6 +765,7 @@ void hostif_start_confirm(struct ks_wlan_private *priv)
 {
 #ifdef WPS
union iwreq_data wrqu;
+
wrqu.data.length = 0;
wrqu.data.flags = 0;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -786,6 +787,7 @@ void hostif_connect_indication(struct ks_wlan_private *priv)
unsigned int old_status = priv->connect_status;
struct net_device *netdev = priv->net_dev;
union iwreq_data wrqu0;
+
connect_code = get_WORD(priv);
 
switch (connect_code) {
@@ -925,6 +927,7 @@ static
 void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
 {
uint16_t result_code;
+
DPRINTK(3, "\n");
result_code = get_WORD(priv);
DPRINTK(3, "result code = %d\n", result_code);
@@ -990,6 +993,7 @@ void hostif_bss_scan_confirm(struct ks_wlan_private *priv)
unsigned int result_code;
struct net_device *dev = priv->net_dev;
union iwreq_data wrqu;
+
result_code = get_DWORD(priv);
DPRINTK(2, "result=%d :: scan_ind_count=%d\n", result_code,
priv->scan_ind_count);
@@ -1888,6 +1892,7 @@ static
 void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
 {
uint32_t val;
+
switch (type) {
case SME_WEP_INDEX_REQUEST:
val = cpu_to_le32((uint32_t)(priv->reg.wep_index));
@@ -2364,6 +2369,7 @@ static
 void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
 {
uint32_t val;
+
switch (type) {
case SME_SET_FLAG:
val = cpu_to_le32((uint32_t)(priv->reg.privacy_invoked));
-- 
2.7.4

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


[PATCH 2/3] staging: ks7010: Fix coding style spacing issues

2016-10-16 Thread Carlos Maiolino
Fix the following checkpatch.pl spacing errors/warnings:

CHECK: No space is necessary after a cast
WARNING: please, no spaces at the start of a line
WARNING: please, no spaces at the start of a line
ERROR: space prohibited after that open parenthesis '('
ERROR: space prohibited before that close parenthesis ')'
ERROR: exactly one space required after that #ifdef
ERROR: space prohibited after that '&' (ctx:WxW)

Signed-off-by: Carlos Maiolino <cmaiolin...@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c | 202 ++---
 1 file changed, 101 insertions(+), 101 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index e0a5eda..7a6cac2 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -23,11 +23,11 @@
 
 /* macro */
 #define inc_smeqhead(priv) \
-( priv->sme_i.qhead = (priv->sme_i.qhead + 1) % SME_EVENT_BUFF_SIZE )
+   (priv->sme_i.qhead = (priv->sme_i.qhead + 1) % SME_EVENT_BUFF_SIZE)
 #define inc_smeqtail(priv) \
-( priv->sme_i.qtail = (priv->sme_i.qtail + 1) % SME_EVENT_BUFF_SIZE )
+   (priv->sme_i.qtail = (priv->sme_i.qtail + 1) % SME_EVENT_BUFF_SIZE)
 #define cnt_smeqbody(priv) \
-(((priv->sme_i.qtail + SME_EVENT_BUFF_SIZE) - (priv->sme_i.qhead)) % 
SME_EVENT_BUFF_SIZE )
+   (((priv->sme_i.qtail + SME_EVENT_BUFF_SIZE) - (priv->sme_i.qhead)) % 
SME_EVENT_BUFF_SIZE)
 
 #define KS_WLAN_MEM_FLAG (GFP_ATOMIC)
 
@@ -763,7 +763,7 @@ void hostif_sleep_confirm(struct ks_wlan_private *priv)
 static
 void hostif_start_confirm(struct ks_wlan_private *priv)
 {
-#ifdef  WPS
+#ifdef WPS
union iwreq_data wrqu;
wrqu.data.length = 0;
wrqu.data.flags = 0;
@@ -1238,37 +1238,37 @@ int hostif_data_request(struct ks_wlan_private *priv, 
struct sk_buff *packet)
&& !(priv->wpa.key[1].key_len)
&& !(priv->wpa.key[2].key_len)
&& !(priv->wpa.key[3].key_len)) {
-   pp->auth_type = cpu_to_le16((uint16_t) TYPE_AUTH);  
/* no encryption */
+   pp->auth_type = cpu_to_le16((uint16_t)TYPE_AUTH);   
/* no encryption */
} else {
if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) {
-   MichaelMICFunction(_mic, (uint8_t *) 
priv->wpa.key[0].tx_mic_key, (uint8_t *) & pp->data[0], (int)packet_len, 
(uint8_t) 0,   /* priority */
-  (uint8_t *) michel_mic.
+   MichaelMICFunction(_mic, (uint8_t 
*)priv->wpa.key[0].tx_mic_key, (uint8_t *)>data[0], (int)packet_len, 
(uint8_t)0,   /* priority */
+  (uint8_t *)michel_mic.
   Result);
memcpy(p, michel_mic.Result, 8);
length += 8;
packet_len += 8;
p += 8;
pp->auth_type =
-   cpu_to_le16((uint16_t) TYPE_DATA);
+   cpu_to_le16((uint16_t)TYPE_DATA);
 
} else if (priv->wpa.pairwise_suite ==
   IW_AUTH_CIPHER_CCMP) {
pp->auth_type =
-   cpu_to_le16((uint16_t) TYPE_DATA);
+   cpu_to_le16((uint16_t)TYPE_DATA);
}
}
} else {
if (eth_proto == ETHER_PROTOCOL_TYPE_EAP)
-   pp->auth_type = cpu_to_le16((uint16_t) TYPE_AUTH);
+   pp->auth_type = cpu_to_le16((uint16_t)TYPE_AUTH);
else
-   pp->auth_type = cpu_to_le16((uint16_t) TYPE_DATA);
+   pp->auth_type = cpu_to_le16((uint16_t)TYPE_DATA);
}
 
/* header value set */
pp->header.size =
cpu_to_le16((uint16_t)
(sizeof(*pp) - sizeof(pp->header.size) + packet_len));
-   pp->header.event = cpu_to_le16((uint16_t) HIF_DATA_REQ);
+   pp->header.event = cpu_to_le16((uint16_t)HIF_DATA_REQ);
 
/* tx request */
result =
@@ -1311,9 +1311,9 @@ void hostif_mib_get_request(struct ks_wlan_private *priv,
return;
}
pp->header.size =
-   cpu_to_le16((uint16_t) (sizeof(*pp) - sizeof(pp->header.size)));
-   pp->header.event = cpu_to_le16((uint16_t) HIF_MIB_GET_REQ);
-   pp->mib_attribute = cpu_to_le32((uint32_t) mib_attribute);
+   cpu_to_le16((uint16_t)(sizeof(*pp) - sizeof(pp->header.size)));
+   pp->header.event = cpu_to_le16((uint16_t)

[PATCH 1/3] staging: ks7010: Fix conditional statements coding style

2016-10-16 Thread Carlos Maiolino
Fix coding style issues in if statements braces, specifically:

WARNING: braces {} are not necessary for single statement blocks
WARNING: braces {} are not necessary for any arm of this statement
CHECK: braces {} should be used on all arms of this statement

Signed-off-by: Carlos Maiolino <cmaiolin...@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c | 30 +-
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index c57ca58..e0a5eda 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -97,11 +97,10 @@ int ks_wlan_do_power_save(struct ks_wlan_private *priv)
 {
DPRINTK(4, "psstatus.status=%d\n", atomic_read(>psstatus.status));
 
-   if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
+   if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS)
hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);
-   } else {
+   else
priv->dev_state = DEVICE_STATE_READY;
-   }
return 0;
 }
 
@@ -705,15 +704,13 @@ void hostif_mib_set_confirm(struct ks_wlan_private *priv)
break;
case DOT11_GMK1_TSC:
DPRINTK(2, "DOT11_GMK1_TSC:mib_status=%d\n", (int)mib_status);
-   if (atomic_read(>psstatus.snooze_guard)) {
+   if (atomic_read(>psstatus.snooze_guard))
atomic_set(>psstatus.snooze_guard, 0);
-   }
break;
case DOT11_GMK2_TSC:
DPRINTK(2, "DOT11_GMK2_TSC:mib_status=%d\n", (int)mib_status);
-   if (atomic_read(>psstatus.snooze_guard)) {
+   if (atomic_read(>psstatus.snooze_guard))
atomic_set(>psstatus.snooze_guard, 0);
-   }
break;
case LOCAL_PMK:
DPRINTK(2, "LOCAL_PMK:mib_status=%d\n", (int)mib_status);
@@ -2172,8 +2169,9 @@ void hostif_sme_mode_setup(struct ks_wlan_private *priv)
else
rate_octet[i] =
priv->reg.rate_set.body[i];
-   } else
+   } else {
break;
+   }
}
 
} else {/* D_11G_ONLY_MODE or D_11BG_COMPATIBLE_MODE */
@@ -2187,8 +2185,9 @@ void hostif_sme_mode_setup(struct ks_wlan_private *priv)
else
rate_octet[i] =
priv->reg.rate_set.body[i];
-   } else
+   } else {
break;
+   }
}
}
rate_size = i;
@@ -2461,9 +2460,8 @@ void hostif_sme_execute(struct ks_wlan_private *priv, int 
event)
DPRINTK(3, "event=%d\n", event);
switch (event) {
case SME_START:
-   if (priv->dev_state == DEVICE_STATE_BOOT) {
+   if (priv->dev_state == DEVICE_STATE_BOOT)
hostif_mib_get_request(priv, DOT11_MAC_ADDRESS);
-   }
break;
case SME_MULTICAST_REQUEST:
hostif_sme_multicast_set(priv);
@@ -2508,14 +2506,12 @@ void hostif_sme_execute(struct ks_wlan_private *priv, 
int event)
}
break;
case SME_GET_MAC_ADDRESS:
-   if (priv->dev_state == DEVICE_STATE_BOOT) {
+   if (priv->dev_state == DEVICE_STATE_BOOT)
hostif_mib_get_request(priv, DOT11_PRODUCT_VERSION);
-   }
break;
case SME_GET_PRODUCT_VERSION:
-   if (priv->dev_state == DEVICE_STATE_BOOT) {
+   if (priv->dev_state == DEVICE_STATE_BOOT)
priv->dev_state = DEVICE_STATE_PREINIT;
-   }
break;
case SME_STOP_REQUEST:
hostif_stop_request(priv);
@@ -2594,9 +2590,9 @@ void hostif_sme_execute(struct ks_wlan_private *priv, int 
event)
/* for power save */
atomic_set(>psstatus.snooze_guard, 0);
atomic_set(>psstatus.confirm_wait, 0);
-   if (priv->dev_state == DEVICE_STATE_PREINIT) {
+   if (priv->dev_state == DEVICE_STATE_PREINIT)
priv->dev_state = DEVICE_STATE_INIT;
-   }
+
/* wake_up_interruptible_all(>confirm_wait); */
complete(>confirm_wait);
break;
-- 
2.7.4

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


[PATCH 0/3] staging: ks7010: Coding style fixes

2016-10-16 Thread Carlos Maiolino
A small patchset fixing some coding style errors identified by checkpatch.pl

Greg. I splitted the single patch into 3 different patches now, hope I set it
right now :)

Also added a blank line before the signed-off.

Cheers

Carlos Maiolino (3):
  staging: ks7010: Fix conditional statements coding style
  staging: ks7010: Fix coding style spacing issues
  staging: ks7010: add missing blank lines

 drivers/staging/ks7010/ks_hostif.c | 238 +++--
 1 file changed, 120 insertions(+), 118 deletions(-)

-- 
2.7.4

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


[PATCH] staging: ks7010: Fix coding style errors

2016-10-16 Thread Carlos Maiolino
Fixes the following checkpatch.pl errors/warnings:

WARNING: please, no spaces at the start of a line
ERROR: space prohibited after that open parenthesis '('
ERROR: space prohibited before that close parenthesis ')'
ERROR: space required before the open brace '{'
ERROR: exactly one space required after that #ifdef
WARNING: Missing a blank line after declarations
ERROR: space prohibited after that '&' (ctx:WxW)
WARNING: braces {} are not necessary for single statement blocks
CHECK: No space is necessary after a cast
Signed-off-by: Carlos Maiolino <cmaiolin...@gmail.com>
---
 drivers/staging/ks7010/ks_hostif.c | 32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index c57ca58..e2277c5 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -23,11 +23,11 @@
 
 /* macro */
 #define inc_smeqhead(priv) \
-( priv->sme_i.qhead = (priv->sme_i.qhead + 1) % SME_EVENT_BUFF_SIZE )
+   (priv->sme_i.qhead = (priv->sme_i.qhead + 1) % SME_EVENT_BUFF_SIZE)
 #define inc_smeqtail(priv) \
-( priv->sme_i.qtail = (priv->sme_i.qtail + 1) % SME_EVENT_BUFF_SIZE )
+   (priv->sme_i.qtail = (priv->sme_i.qtail + 1) % SME_EVENT_BUFF_SIZE)
 #define cnt_smeqbody(priv) \
-(((priv->sme_i.qtail + SME_EVENT_BUFF_SIZE) - (priv->sme_i.qhead)) % 
SME_EVENT_BUFF_SIZE )
+   (((priv->sme_i.qtail + SME_EVENT_BUFF_SIZE) - (priv->sme_i.qhead)) % 
SME_EVENT_BUFF_SIZE)
 
 #define KS_WLAN_MEM_FLAG (GFP_ATOMIC)
 
@@ -97,11 +97,10 @@ int ks_wlan_do_power_save(struct ks_wlan_private *priv)
 {
DPRINTK(4, "psstatus.status=%d\n", atomic_read(>psstatus.status));
 
-   if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
+   if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS)
hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);
-   } else {
+   else
priv->dev_state = DEVICE_STATE_READY;
-   }
return 0;
 }
 
@@ -386,7 +385,7 @@ void hostif_data_indication(struct ks_wlan_private *priv)
   (priv->rxp) + ((priv->rx_size) - 8), 8);
priv->rx_size = priv->rx_size - 8;
if (auth_type > 0 && auth_type < 4) {   /* 
auth_type check */
-   MichaelMICFunction(_mic, 
(uint8_t *) priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *) priv->rxp, 
(int)priv->rx_size, (uint8_t) 0,/* priority */
+   MichaelMICFunction(_mic, 
(uint8_t *)priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *)priv->rxp, 
(int)priv->rx_size, (uint8_t)0,   /* priority */
   (uint8_t *)
   michel_mic.Result);
}
@@ -766,8 +765,9 @@ void hostif_sleep_confirm(struct ks_wlan_private *priv)
 static
 void hostif_start_confirm(struct ks_wlan_private *priv)
 {
-#ifdef  WPS
+#ifdef WPS
union iwreq_data wrqu;
+
wrqu.data.length = 0;
wrqu.data.flags = 0;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -789,6 +789,7 @@ void hostif_connect_indication(struct ks_wlan_private *priv)
unsigned int old_status = priv->connect_status;
struct net_device *netdev = priv->net_dev;
union iwreq_data wrqu0;
+
connect_code = get_WORD(priv);
 
switch (connect_code) {
@@ -928,6 +929,7 @@ static
 void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
 {
uint16_t result_code;
+
DPRINTK(3, "\n");
result_code = get_WORD(priv);
DPRINTK(3, "result code = %d\n", result_code);
@@ -993,6 +995,7 @@ void hostif_bss_scan_confirm(struct ks_wlan_private *priv)
unsigned int result_code;
struct net_device *dev = priv->net_dev;
union iwreq_data wrqu;
+
result_code = get_DWORD(priv);
DPRINTK(2, "result=%d :: scan_ind_count=%d\n", result_code,
priv->scan_ind_count);
@@ -1244,7 +1247,7 @@ int hostif_data_request(struct ks_wlan_private *priv, 
struct sk_buff *packet)
pp->auth_type = cpu_to_le16((uint16_t) TYPE_AUTH);  
/* no encryption */
} else {
if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) {
-   MichaelMICFunction(_mic, (uint8_t *) 
priv->wpa.key[0].tx_mic_key, (uint8_t *) & pp->data[0], (int)packet_len, 
(uint8_t) 0,   /* priority */
+   MichaelMICFunction(_mic, (uint8_t 
*)priv->wpa.key[0].tx_mic_key, (uint8_t *)>data[0], (int)packet_len, 
(uint8_t)0,   /* pri