Re: [patch] staging: wilc1000: off by one in get_handler_from_id()
Hello Dan. On 2015년 09월 15일 15:54, Dan Carpenter wrote: The > should be >= here or we read beyond the end of the array. You are right. :) Thanks a lot. Johnny. Fixes: d42ab0838d04 ('staging: wilc1000: use id value as argument') Signed-off-by: Dan Carpenterdiff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 59a1a9d..621fd18 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -637,7 +637,7 @@ static int get_id_from_handler(tstrWILC_WFIDrv *handler) static tstrWILC_WFIDrv *get_handler_from_id(int id) { - if (id <= 0 || id > ARRAY_SIZE(wfidrv_list)) + if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) return NULL; return wfidrv_list[id]; } ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/5] staging: wilc1000: use id value as argument
On 2015년 09월 04일 12:51, Greg KH wrote: On Fri, Sep 04, 2015 at 12:24:29PM +0900, johnny.kim wrote: On 2015년 09월 04일 00:47, Greg KH wrote: On Thu, Sep 03, 2015 at 04:00:08PM +0900, johnny.kim wrote: Hello Greg. On 2015년 09월 03일 10:33, Greg KH wrote: On Thu, Aug 20, 2015 at 04:32:52PM +0900, Tony Cho wrote: From: Johnny Kim <johnny@atmel.com> The driver communicates with the chipset via the address of handlers to distinguish async data frame. The SendConfigPkt function gets the pointer address indicating the handlers as the last argument, but this requires redundant typecasting and does not support the 64 bit machine. This patch adds the function which assigns ID values instead of pointer representing the driver handler to the address and then uses the ID instead of pointer as the last argument of SendConfigPkt. The driver also gets the handler's address from the ID in the data frame when it receives them. I don't understand this code at all. You are randomly adding values to a list, and then assuming that you can use the index into that list for some type of representation? As this is a local list, why not just use the real variables instead of having a list and dealing with them in this very ackward manner? In other words, I don't see the need for the list at all, just use the real types here, you have all the needed information (hint, if you know the index, you really know the data as well...) The value is needed to send it to chipset and to distinguish async data packet mutually. What is the value, the index or some random pointer? The value of current patch substitutes the corresponding index for some random pointer(= address of device handler). Ok. The length of the data field is 4byte and the data field has been filled with the address of pointer so far. So the data field can just be any random number, as long as it is consistent? What does the chip do with the random number? Current driver normally create a couple of network interface. Multiple network interfaces for the same hardware? Yes. A chipset supports multiple network interface. The driver can send some commands(data frame) to the network interfaces at the same time and wait the results. Both driver and chipset need unique value to distinguish whom the interface owner of the commands is. And the value always has same value while the interface is alive. But as you created the interfaces, just use a unique number for each. It could be a #define, as you know how many interfaces you will create, that's not a dynamic thing. No need to keep looking up something in an index and converting to a structure. I think your opinion is right only if the driver send some commands to chipset. The driver should look for the network interface corresponding to the #define value to know owner of data frame which received from chipset. Network interface structure dynamically is allocated as 'ifconfig up' command of shell. As a result, look-up table is needed. But this patch changes it to unique index value corresponding to the address for 64bit address machine. If real type is used as your opinion, new patch will have the same meaning with current code. index now, but was using a pointer before? That sounds like you are changing the functionality. confused, There is a reserved field to distinguish the data frames in chipset. Because the field has 4byte space, this patch creates the index corresponding to the pointer and uses the index to input the identifier in the size instead of the pointer value. I'm sorry, too. It's not easy to explain it in English. It's not easy to explain that in any language :) Thanks for your generous mind. As you "know" the interfaces you create, just use a "fixed" number for them, and refer to them that way. No need to have an array and iterate over the whole array every time. There are lots of wrapper functions and pointers in this driver that need to be stripped away. I think you will find the end result of all of that work to be much simpler, and smaller. See the patches that I did for the driver this evening as an example, it removed code, and in doing so, also fixed a long-time bug. There's a lot of work to be done here still... I know current driver has a lot of stripping code and is heavy . My members is waiting to send patches after x64bit issue is closed. And I improve this driver continuously. Thanks. Johnny. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/5] staging: wilc1000: use id value as argument
Hello Greg. On 2015년 09월 03일 10:33, Greg KH wrote: On Thu, Aug 20, 2015 at 04:32:52PM +0900, Tony Cho wrote: From: Johnny Kim <johnny@atmel.com> The driver communicates with the chipset via the address of handlers to distinguish async data frame. The SendConfigPkt function gets the pointer address indicating the handlers as the last argument, but this requires redundant typecasting and does not support the 64 bit machine. This patch adds the function which assigns ID values instead of pointer representing the driver handler to the address and then uses the ID instead of pointer as the last argument of SendConfigPkt. The driver also gets the handler's address from the ID in the data frame when it receives them. I don't understand this code at all. You are randomly adding values to a list, and then assuming that you can use the index into that list for some type of representation? As this is a local list, why not just use the real variables instead of having a list and dealing with them in this very ackward manner? In other words, I don't see the need for the list at all, just use the real types here, you have all the needed information (hint, if you know the index, you really know the data as well...) The value is needed to send it to chipset and to distinguish async data packet mutually. The length of the data field is 4byte and the data field has been filled with the address of pointer so far. But this patch changes it to unique index value corresponding to the address for 64bit address machine. If real type is used as your opinion, new patch will have the same meaning with current code. Thanks Johnny. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/5] staging: wilc1000: use id value as argument
On 2015년 09월 04일 00:47, Greg KH wrote: On Thu, Sep 03, 2015 at 04:00:08PM +0900, johnny.kim wrote: Hello Greg. On 2015년 09월 03일 10:33, Greg KH wrote: On Thu, Aug 20, 2015 at 04:32:52PM +0900, Tony Cho wrote: From: Johnny Kim <johnny@atmel.com> The driver communicates with the chipset via the address of handlers to distinguish async data frame. The SendConfigPkt function gets the pointer address indicating the handlers as the last argument, but this requires redundant typecasting and does not support the 64 bit machine. This patch adds the function which assigns ID values instead of pointer representing the driver handler to the address and then uses the ID instead of pointer as the last argument of SendConfigPkt. The driver also gets the handler's address from the ID in the data frame when it receives them. I don't understand this code at all. You are randomly adding values to a list, and then assuming that you can use the index into that list for some type of representation? As this is a local list, why not just use the real variables instead of having a list and dealing with them in this very ackward manner? In other words, I don't see the need for the list at all, just use the real types here, you have all the needed information (hint, if you know the index, you really know the data as well...) The value is needed to send it to chipset and to distinguish async data packet mutually. What is the value, the index or some random pointer? The value of current patch substitutes the corresponding index for some random pointer(= address of device handler). The length of the data field is 4byte and the data field has been filled with the address of pointer so far. So the data field can just be any random number, as long as it is consistent? What does the chip do with the random number? Current driver normally create a couple of network interface. The driver can send some commands(data frame) to the network interfaces at the same time and wait the results. Both driver and chipset need unique value to distinguish whom the interface owner of the commands is. And the value always has same value while the interface is alive. But this patch changes it to unique index value corresponding to the address for 64bit address machine. If real type is used as your opinion, new patch will have the same meaning with current code. I'm sorry, but I don't understand. How exactly does the chip need an index now, but was using a pointer before? That sounds like you are changing the functionality. confused, There is a reserved field to distinguish the data frames in chipset. Because the field has 4byte space, this patch creates the index corresponding to the pointer and uses the index to input the identifier in the size instead of the pointer value. I'm sorry, too. It's not easy to explain it in English. Thanks. Johnny. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 5/5] staging: wilc1000: use id value as argument
Hello Dan. On 2015년 08월 18일 18:12, Dan Carpenter wrote: On Tue, Aug 18, 2015 at 12:10:53PM +0900, Johnny Kim wrote: Hello Dan. On 2015년 08월 13일 23:49, Dan Carpenter wrote: On Thu, Aug 13, 2015 at 01:41:23PM +0900, Tony Cho wrote: +static u32 get_id_from_handler(tstrWILC_WFIDrv *handler) +{ + u32 id; + + if (!handler) + return 0; + + for (id = 0; id NUM_CONCURRENT_IFC; id++) { + if (wfidrv_list[id] == handler) { + id += 1; + break; + } + } + + if (id NUM_CONCURRENT_IFC) + return 0; + else + return id; +} + This still has an off by one bug. Just use zero offset arrays throughout. static int get_id_from_handler(tstrWILC_WFIDrv *handler) { int id; if (!handler) return -ENOBUFS; for (id = 0; id NUM_CONCURRENT_IFC; id++) { if (wfidrv_list[id] == handler) return id; } return -ENOBUFS; } Thanks for your review. The return value of this function has from 0 till 2. 1 and 2 value is real ID value. only 0 value is reserved to remove a registered id. But I also think that error handling should be added about the overflowed value as your opinion. I thought we had created id here in this patch so we don't have to pass function pointers through a u32 value (which can't fit a 64 bit pointer). What do you mean it is a real ID value? Is it there in the hardware spec? Real ID value means the value mapped to an alive NIC handler. And when the driver transmits and receives some data frame with chipset, the ID is used to distinguish the data frame's owner. Just like the driver, chipset uses the appointed identifier. the data frame always includes the identifier. You know, current driver is using 32bit pointer address as the identifier. So, this patch converts the address value to integer value. As mentioned earlier, '0' value is the reserved value to terminate an alive NIC handler and inform it to chipset. Anyway, this code is buggy and messy. Please find a different way to write it. Regards. Johnny. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 5/5] staging: wilc1000: use id value as argument
Hello Dan. On 2015년 08월 13일 23:49, Dan Carpenter wrote: On Thu, Aug 13, 2015 at 01:41:23PM +0900, Tony Cho wrote: +static u32 get_id_from_handler(tstrWILC_WFIDrv *handler) +{ + u32 id; + + if (!handler) + return 0; + + for (id = 0; id NUM_CONCURRENT_IFC; id++) { + if (wfidrv_list[id] == handler) { + id += 1; + break; + } + } + + if (id NUM_CONCURRENT_IFC) + return 0; + else + return id; +} + This still has an off by one bug. Just use zero offset arrays throughout. static int get_id_from_handler(tstrWILC_WFIDrv *handler) { int id; if (!handler) return -ENOBUFS; for (id = 0; id NUM_CONCURRENT_IFC; id++) { if (wfidrv_list[id] == handler) return id; } return -ENOBUFS; } Thanks for your review. The return value of this function has from 0 till 2. 1 and 2 value is real ID value. only 0 value is reserved to remove a registered id. But I also think that error handling should be added about the overflowed value as your opinion. +static tstrWILC_WFIDrv *get_handler_from_id(u32 id) +{ + if (id 0 id = NUM_CONCURRENT_IFC) + return wfidrv_list[id - 1]; + else + return NULL; +} static tstrWILC_WFIDrv *get_handler_from_id(int id) { if (id 0 || id = NUM_CONCURRENT_IFC) return NULL; return wfidrv_list[id]; } regards, dan carpenter Regards. Johnny Kim. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 5/5] staging: wilc1000: use id value as argument
Hello Julian. On 2015년 08월 10일 15:47, Julian Calaby wrote: Hi Tony and Johnny, On Mon, Aug 10, 2015 at 3:58 PM, Tony Cho tony@atmel.com wrote: From: Johnny Kim johnny@atmel.com The driver communicates with the chipset via the address of handlers to distinguish async data frame. The SendConfigPkt function gets the pointer address indicating the handlers as the last argument, but this requires redundant typecasting and does not support the 64 bit machine. This patch adds the function which assigns ID values instead of pointer representing the driver handler to the address and then uses the ID instead of pointer as the last argument of SendConfigPkt. The driver also gets the handler's address from the ID in the data frame when it receives them. Excellent work! A couple of minor questions: diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c4e27c7..5a0277f 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -616,7 +680,8 @@ static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetChan *pst PRINT_D(HOSTINF_DBG, Setting channel\n); /*Sending Cfg*/ - s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, (u32)pstrWFIDrv); + s32Error = (SET_CFG, strWID, 1, true, +get_id_from_handler(pstrWFIDrv)); Would it make sense to call get_id_from_handler() inside SendConfigPkt() instead? SendConfigPkt function can't be aware of tstrWILC_WFIDrv type because SendConfigPkt is defined before tstrWILC_WFIDrv. if (s32Error) { PRINT_ER(Failed to set channel\n); WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); @@ -653,7 +718,8 @@ static s32 Handle_SetWfiDrvHandler(tstrHostIfSetDrvHandler *pstrHostIfSetDrvHand /*Sending Cfg*/ - s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, (u32)pstrWFIDrv); + s32Error = SendConfigPkt(SET_CFG, strWID, 1, true,host_int_set_wfi_drv_handler +pstrHostIfSetDrvHandler-u32Address); Is this correct? pstrHostIfSetDrvHandler-u32Address value which is input as argument isn't pointer address but ID value. The value was filled in host_int_set_wfi_drv_handler function. if ((pstrHostIfSetDrvHandler-u32Address) == (u32)NULL) @@ -6772,11 +6888,11 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; - u32 drvHandler; + u32 id; tstrWILC_WFIDrv *pstrWFIDrv = NULL; - drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] 8) | (pu8Buffer[u32Length - 2] 16) | (pu8Buffer[u32Length - 1] 24)); - pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; + id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] 8) | (pu8Buffer[u32Length - 2] 16) | (pu8Buffer[u32Length - 1] 24)); Would be32_to_cpu() or something like that be able to help you do this? Thank for your comment. I will fix it on another subject. + pstrWFIDrv = get_handler_from_id(id); Thanks, ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/3] staging: wilc1000: wilc_wlan_cfg_get(): replace integer with void pointer
On 2015년 07월 10일 15:25, Julian Calaby wrote: Hi Johnny, On Fri, Jul 10, 2015 at 3:55 PM, Johnny Kim johnny@atmel.com wrote: Last argument of wilc_wlan_cfg_get function is actually structure's address. This should be changed to be compatible with 64bit machine. Because wilc_wlan_cfg_get function is mapped by function pointer later, wilc_wlan_oup_t.wlan_cfg_get should be changed together. tstrWILC_WFIDrv structure is defined after wilc_wlan_oup_t.wlan_cfg_get is defined. So, this patch changes the argument to void type pointer. Why not add a patch moving the structure definition before wilc_wlan_oup_t.wlan_cfg_get is defined? Current patch focus on accessing 64bit address rightly. The define order you and I mentioned should be repaired with another subject because of complexity among files. Signed-off-by: Johnny Kim johnny@atmel.com --- drivers/staging/wilc1000/coreconfigurator.c | 2 +- drivers/staging/wilc1000/wilc_wlan.c| 2 +- drivers/staging/wilc1000/wilc_wlan_if.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index b069614..141d7b4 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -2094,7 +2094,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, (counter == u32WIDsCount - 1)); if (!gpstrWlanOps-wlan_cfg_get(!counter, pstrWIDs[counter].u16WIDid, - (counter == u32WIDsCount - 1), drvHandler)) { + (counter == u32WIDsCount - 1), (void *)drvHandler)) { If I recall correctly, you shouldn't need void * casts. Thanks, Thanks. Johnny. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/3] staging: wilc1000: wilc_wlan_cfg_commit(): replace integer with pointer
On 2015년 07월 10일 15:20, Julian Calaby wrote: Hi Johnny, On Fri, Jul 10, 2015 at 3:55 PM, Johnny Kim johnny@atmel.com wrote: A argument of wilc_wlan_cfg_commit() is address of structure. But because the size is restricted to 32bit, it is not correct for 64bit machine. So, this changes the interger value to obvious structure pointer. Signed-off-by: Johnny Kim johnny@atmel.com --- drivers/staging/wilc1000/wilc_wlan.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index def72fd..d32e45e 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1862,13 +1862,13 @@ static void wilc_wlan_cleanup(void) } -static int wilc_wlan_cfg_commit(int type, uint32_t drvHandler) +static int wilc_wlan_cfg_commit(int type, tstrWILC_WFIDrv *drvHandler) { wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)g_wlan; wilc_cfg_frame_t *cfg = p-cfg_frame; int total_len = p-cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE; int seq_no = p-cfg_seq_no % 256; - int driver_handler = (u32)drvHandler; + uintptr_t driver_handler = (uintptr_t)drvHandler; Er, why not just remove this variable and use drvHandler directly? A control packet with the address value is sent to chipset. Namely, it is used to distinguish various packet via the address finally. @@ -1923,7 +1923,7 @@ static int wilc_wlan_cfg_set(int start, uint32_t wid, uint8_t *buffer, uint32_t p-cfg_frame_in_use = 1; /*Edited by Amr - BugID_4720*/ - if (wilc_wlan_cfg_commit(WILC_CFG_SET, drvHandler)) + if (wilc_wlan_cfg_commit(WILC_CFG_SET, (tstrWILC_WFIDrv *)drvHandler)) No need to cast it to it's own type. drvHandler value is u32 integer. So I thought I need to cast it. I will remove the patch as your opinion. ret_size = 0; /* BugID_5213 */ if (p-os_func.os_wait(p-cfg_wait, CFG_PKTS_TIMEOUT)) { @@ -1960,7 +1960,7 @@ static int wilc_wlan_cfg_get(int start, uint32_t wid, int commit, uint32_t drvHa p-cfg_frame_in_use = 1; /*Edited by Amr - BugID_4720*/ - if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drvHandler)) + if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, (tstrWILC_WFIDrv *)drvHandler)) Ditto. Thanks, Thanks. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/5] staging: wilc1000: SendConfigPkt(): replace integer with void pointer
This patch replaces a integer argument of SendConfigPkt function with void type pointer and fix code that the function is called. Because tstrWILC_WFIDrv structure is defined after SendConfigPkt function is defined, the function can not refer to the structure type. So this patch change the argument to void type pointer. Signed-off-by: Johnny Kim johnny@atmel.com --- drivers/staging/wilc1000/coreconfigurator.c | 4 +- drivers/staging/wilc1000/coreconfigurator.h | 2 +- drivers/staging/wilc1000/host_interface.c | 102 ++-- 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 5c1096d..e274f1b 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -1893,7 +1893,7 @@ s32 ConfigWaitResponse(char *pcRespBuffer, s32 s32MaxRespBuffLen, s32 *ps32Bytes */ #ifdef SIMULATION s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, - u32 u32WIDsCount, bool bRespRequired, u32 drvHandler) + u32 u32WIDsCount, bool bRespRequired, void *drvHandler) { s32 s32Error = WILC_SUCCESS; s32 err = WILC_SUCCESS; @@ -2072,7 +2072,7 @@ extern wilc_wlan_oup_t *gpstrWlanOps; * @version 1.0 */ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, - u32 u32WIDsCount, bool bRespRequired, u32 drvHandler) + u32 u32WIDsCount, bool bRespRequired, void *drvHandler) { s32 counter = 0, ret = 0; if (gpstrWlanOps == NULL) { diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 9059c8d..c39802f 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -175,7 +175,7 @@ extern s32 CoreConfiguratorInit(void); extern s32 CoreConfiguratorDeInit(void); extern s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, -u32 u32WIDsCount, bool bRespRequired, u32 drvHandler); +u32 u32WIDsCount, bool bRespRequired, void *drvHandler); extern s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo); extern s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo); diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c089e73..dfd8e01 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -619,7 +619,7 @@ static s32 Handle_SetChannel(void *drvHandler, tstrHostIFSetChan *pstrHostIFSetC PRINT_D(HOSTINF_DBG, Setting channel\n); /*Sending Cfg*/ - s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, (u32)pstrWFIDrv); + s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, pstrWFIDrv); if (s32Error) { PRINT_ER(Failed to set channel\n); WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); @@ -656,7 +656,7 @@ static s32 Handle_SetWfiDrvHandler(tstrHostIfSetDrvHandler *pstrHostIfSetDrvHand /*Sending Cfg*/ - s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, (u32)pstrWFIDrv); + s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, pstrWFIDrv); if ((pstrHostIfSetDrvHandler-u32Address) == (u32)NULL) @@ -701,7 +701,7 @@ static s32 Handle_SetOperationMode(void *drvHandler, tstrHostIfSetOperationMode /*Sending Cfg*/ PRINT_INFO(HOSTINF_DBG, pstrWFIDrv= %p\n, pstrWFIDrv); - s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, (u32)pstrWFIDrv); + s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, pstrWFIDrv); if ((pstrHostIfSetOperationMode-u32Mode) == (u32)NULL) @@ -750,7 +750,7 @@ s32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) strWID.ps8WidVal = (u8 *)pu8IPAddr; strWID.s32ValueSize = IP_ALEN; - s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, (u32)pstrWFIDrv); + s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, pstrWFIDrv); @@ -794,7 +794,7 @@ s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) strWID.ps8WidVal = (u8 *)WILC_MALLOC(IP_ALEN); strWID.s32ValueSize = IP_ALEN; - s32Error = SendConfigPkt(GET_CFG, strWID, 1, true, (u32)pstrWFIDrv); + s32Error = SendConfigPkt(GET_CFG, strWID, 1, true, pstrWFIDrv); PRINT_INFO(HOSTINF_DBG, %pI4\n, strWID.ps8WidVal); @@ -855,7 +855,7 @@ static s32 Handle_SetMacAddress(void *drvHandler, tstrHostIfSetMacAddress *pstrH strWID.s32ValueSize = ETH_ALEN; PRINT_D(GENERIC_DBG, mac addr = :%x:%x:%x:%x:%x:%x\n, strWID.ps8WidVal[0], strWID.ps8WidVal[1], strWID.ps8WidVal[2], strWID.ps8WidVal[3], strWID.ps8WidVal[4], strWID.ps8WidVal[5]); /*Sending Cfg*/ - s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, (u32)pstrWFIDrv); + s32Error = SendConfigPkt
[PATCH 5/5] staging: wilc1000: change variable of limited 32bit size to pointer
gu8FlushedJoinReqDrvHandler variable is be using to save structure pointer. But because that is restricted to 32bit and has needless casting, the varibale should be changed to pointer of same type. Signed-off-by: Johnny Kim johnny@atmel.com --- drivers/staging/wilc1000/host_interface.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index dfd8e01..a82e0a8 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -581,7 +581,7 @@ u8 gu8Flushed11iMode; u8 gu8FlushedAuthType; u32 gu32FlushedJoinReqSize; u32 gu32FlushedInfoElemAsocSize; -u32 gu8FlushedJoinReqDrvHandler; +tstrWILC_WFIDrv *gu8FlushedJoinReqDrvHandler; #define REAL_JOIN_REQ 0 #define FLUSHED_JOIN_REQ 1 #define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */ @@ -1948,7 +1948,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon /*BugID_5137*/ if (WILC_memcmp(DIRECT-, pstrHostIFconnectAttr-pu8ssid, 7)) { memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize); - gu8FlushedJoinReqDrvHandler = (u32)pstrWFIDrv; + gu8FlushedJoinReqDrvHandler = pstrWFIDrv; } PRINT_D(GENERIC_DBG, send HOST_IF_WAITING_CONN_RESP\n); @@ -2199,11 +2199,11 @@ static s32 Handle_ConnectTimeout(void *drvHandler) WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); /*BugID_5213*/ /*Freeing flushed join request params on connect timeout*/ - if (gu8FlushedJoinReq != NULL gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { + if (gu8FlushedJoinReq != NULL gu8FlushedJoinReqDrvHandler == drvHandler) { WILC_FREE(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } - if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { + if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == drvHandler) { WILC_FREE(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } @@ -2624,11 +2624,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /*BugID_5213*/ /*Freeing flushed join request params on receiving*/ /*MAC_DISCONNECTED while connected*/ - if (gu8FlushedJoinReq != NULL gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { + if (gu8FlushedJoinReq != NULL gu8FlushedJoinReqDrvHandler == drvHandler) { WILC_FREE(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } - if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { + if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == drvHandler) { WILC_FREE(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } @@ -3125,11 +3125,11 @@ static void Handle_Disconnect(void *drvHandler) /*BugID_5137*/ - if (gu8FlushedJoinReq != NULL gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { + if (gu8FlushedJoinReq != NULL gu8FlushedJoinReqDrvHandler == drvHandler) { WILC_FREE(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } - if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { + if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == drvHandler) { WILC_FREE(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] staging: wilc1000: wilc_wlan_cfg_commit(): replace integer with pointer
A argument of wilc_wlan_cfg_commit() is address of structure. But because the size is restricted to 32bit, it is not correct for 64bit machine. So, this changes the interger value to obvious structure pointer. Signed-off-by: Johnny Kim johnny@atmel.com --- drivers/staging/wilc1000/wilc_wlan.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index def72fd..d32e45e 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1862,13 +1862,13 @@ static void wilc_wlan_cleanup(void) } -static int wilc_wlan_cfg_commit(int type, uint32_t drvHandler) +static int wilc_wlan_cfg_commit(int type, tstrWILC_WFIDrv *drvHandler) { wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)g_wlan; wilc_cfg_frame_t *cfg = p-cfg_frame; int total_len = p-cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE; int seq_no = p-cfg_seq_no % 256; - int driver_handler = (u32)drvHandler; + uintptr_t driver_handler = (uintptr_t)drvHandler; /** @@ -1923,7 +1923,7 @@ static int wilc_wlan_cfg_set(int start, uint32_t wid, uint8_t *buffer, uint32_t p-cfg_frame_in_use = 1; /*Edited by Amr - BugID_4720*/ - if (wilc_wlan_cfg_commit(WILC_CFG_SET, drvHandler)) + if (wilc_wlan_cfg_commit(WILC_CFG_SET, (tstrWILC_WFIDrv *)drvHandler)) ret_size = 0; /* BugID_5213 */ if (p-os_func.os_wait(p-cfg_wait, CFG_PKTS_TIMEOUT)) { @@ -1960,7 +1960,7 @@ static int wilc_wlan_cfg_get(int start, uint32_t wid, int commit, uint32_t drvHa p-cfg_frame_in_use = 1; /*Edited by Amr - BugID_4720*/ - if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drvHandler)) + if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, (tstrWILC_WFIDrv *)drvHandler)) ret_size = 0; /* BugID_5213 */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging: wilc1000: wilc_wlan_cfg_get(): replace integer with void pointer
Last argument of wilc_wlan_cfg_get function is actually structure's address. This should be changed to be compatible with 64bit machine. Because wilc_wlan_cfg_get function is mapped by function pointer later, wilc_wlan_oup_t.wlan_cfg_get should be changed together. tstrWILC_WFIDrv structure is defined after wilc_wlan_oup_t.wlan_cfg_get is defined. So, this patch changes the argument to void type pointer. Signed-off-by: Johnny Kim johnny@atmel.com --- drivers/staging/wilc1000/coreconfigurator.c | 2 +- drivers/staging/wilc1000/wilc_wlan.c| 2 +- drivers/staging/wilc1000/wilc_wlan_if.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index b069614..141d7b4 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -2094,7 +2094,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, (counter == u32WIDsCount - 1)); if (!gpstrWlanOps-wlan_cfg_get(!counter, pstrWIDs[counter].u16WIDid, - (counter == u32WIDsCount - 1), drvHandler)) { + (counter == u32WIDsCount - 1), (void *)drvHandler)) { ret = -1; printk([Sendconfigpkt]Get Timed out\n); break; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index d32e45e..c0a8063 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1938,7 +1938,7 @@ static int wilc_wlan_cfg_set(int start, uint32_t wid, uint8_t *buffer, uint32_t return ret_size; } -static int wilc_wlan_cfg_get(int start, uint32_t wid, int commit, uint32_t drvHandler) +static int wilc_wlan_cfg_get(int start, uint32_t wid, int commit, void* drvHandler) { wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)g_wlan; uint32_t offset; diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 8735a6a..8c293ab 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -194,7 +194,7 @@ typedef struct { void (*wlan_handle_rx_isr)(void); void (*wlan_cleanup)(void); int (*wlan_cfg_set)(int, uint32_t, uint8_t *, uint32_t, int, uint32_t); - int (*wlan_cfg_get)(int, uint32_t, int, uint32_t); + int (*wlan_cfg_get)(int, uint32_t, int, void *); int (*wlan_cfg_get_value)(uint32_t, uint8_t *, uint32_t); /*Bug3959: transmitting mgmt frames received from host*/ #if defined(WILC_AP_EXTERNAL_MLME) || defined(WILC_P2P) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/3] staging: wilc1000: rework integer value for x64
Hello Greg. This driver convert pointer address to integer value and use it as function argument. because the value has a limited 32bit size, current driver happen many issues on x64 machine. I have split it up enough sensibliy to allow review. If this patches are accepted, I will update more patches related with this patch. Best regards. Johnny. Johnny Kim (3): staging: wilc1000: wilc_wlan_cfg_commit(): replace integer with pointer staging: wilc1000: wilc_wlan_cfg_get(): replace integer with void pointer staging: wilc1000: wilc_wlan_cfg_set(): replace integer with void pointer drivers/staging/wilc1000/coreconfigurator.c | 4 ++-- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.c| 12 ++-- drivers/staging/wilc1000/wilc_wlan_if.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] staging: wilc1000: wilc_wlan_cfg_set(): replace integer with void pointer
Last argument of wilc_wlan_cfg_set function is actually structure's address. This should be changed to be compatible with 64bit machine. Because wilc_wlan_cfg_set function is mapped by function pointer later, wilc_wlan_oup_t.wlan_cfg_set should be changed together. tstrWILC_WFIDrv structure is defined after wilc_wlan_oup_t.wlan_cfg_set is defined. So, this patch changes the argument to void type pointer. Signed-off-by: Johnny Kim johnny@atmel.com --- drivers/staging/wilc1000/coreconfigurator.c | 2 +- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.c| 2 +- drivers/staging/wilc1000/wilc_wlan_if.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 141d7b4..5c1096d 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -2117,7 +2117,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, if (!gpstrWlanOps-wlan_cfg_set(!counter, pstrWIDs[counter].u16WIDid, pstrWIDs[counter].ps8WidVal, pstrWIDs[counter].s32ValueSize, - (counter == u32WIDsCount - 1), drvHandler)) { + (counter == u32WIDsCount - 1), (void *)drvHandler)) { ret = -1; printk([Sendconfigpkt]Set Timed out\n); break; diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 5a794df..eadc500 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1340,7 +1340,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n goto _fail_; c_val[0] = 1; /* Enable N with immediate block ack. */ - if (!g_linux_wlan-oup.wlan_cfg_set(0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, 1, (u32)pstrWFIDrv)) + if (!g_linux_wlan-oup.wlan_cfg_set(0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, 1, (void *)pstrWFIDrv)) goto _fail_; return 0; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index c0a8063..f9dbd40 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1899,7 +1899,7 @@ static int wilc_wlan_cfg_commit(int type, tstrWILC_WFIDrv *drvHandler) return 0; } -static int wilc_wlan_cfg_set(int start, uint32_t wid, uint8_t *buffer, uint32_t buffer_size, int commit, uint32_t drvHandler) +static int wilc_wlan_cfg_set(int start, uint32_t wid, uint8_t *buffer, uint32_t buffer_size, int commit, void *drvHandler) { wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)g_wlan; uint32_t offset; diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 8c293ab..9d42bd8 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -193,7 +193,7 @@ typedef struct { void (*wlan_handle_rx_que)(void); void (*wlan_handle_rx_isr)(void); void (*wlan_cleanup)(void); - int (*wlan_cfg_set)(int, uint32_t, uint8_t *, uint32_t, int, uint32_t); + int (*wlan_cfg_set)(int, uint32_t, uint8_t *, uint32_t, int, void *); int (*wlan_cfg_get)(int, uint32_t, int, void *); int (*wlan_cfg_get_value)(uint32_t, uint8_t *, uint32_t); /*Bug3959: transmitting mgmt frames received from host*/ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging: wilc1000: modify data type
This replace the argument of the function to the independent data type in system. Signed-off-by: Johnny Kim johnny@atmel.com --- drivers/staging/wilc1000/coreconfigurator.c | 4 +- drivers/staging/wilc1000/coreconfigurator.h | 2 +- drivers/staging/wilc1000/host_interface.c | 132 +++--- drivers/staging/wilc1000/host_interface.h | 6 +- drivers/staging/wilc1000/linux_wlan.c | 10 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 8 +- drivers/staging/wilc1000/wilc_wlan_if.h | 4 +- 9 files changed, 86 insertions(+), 86 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index e3e3f20..fa1c99a 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -1949,7 +1949,7 @@ WILC_Sint32 ConfigWaitResponse(WILC_Char *pcRespBuffer, WILC_Sint32 s32MaxRespBu */ #ifdef SIMULATION WILC_Sint32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, - WILC_Uint32 u32WIDsCount, WILC_Bool bRespRequired, WILC_Uint32 drvHandler) + WILC_Uint32 u32WIDsCount, WILC_Bool bRespRequired, size_t drvHandler) { WILC_Sint32 s32Error = WILC_SUCCESS; WILC_Sint32 err = WILC_SUCCESS; @@ -2128,7 +2128,7 @@ extern wilc_wlan_oup_t *gpstrWlanOps; * @version 1.0 */ WILC_Sint32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, - WILC_Uint32 u32WIDsCount, WILC_Bool bRespRequired, WILC_Uint32 drvHandler) + WILC_Uint32 u32WIDsCount, WILC_Bool bRespRequired, size_t drvHandler) { WILC_Sint32 counter = 0, ret = 0; if (gpstrWlanOps == NULL) { diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 73cdbef..03672d0 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -476,7 +476,7 @@ extern WILC_Sint32 CoreConfiguratorInit(void); extern WILC_Sint32 CoreConfiguratorDeInit(void); extern WILC_Sint32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, -WILC_Uint32 u32WIDsCount, WILC_Bool bRespRequired, WILC_Uint32 drvHandler); +WILC_Uint32 u32WIDsCount, WILC_Bool bRespRequired, size_t drvHandler); extern WILC_Sint32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo); extern WILC_Sint32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo); diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index afe5126..cfe3364 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -584,7 +584,7 @@ u8 gu8Flushed11iMode; u8 gu8FlushedAuthType; WILC_Uint32 gu32FlushedJoinReqSize; WILC_Uint32 gu32FlushedInfoElemAsocSize; -WILC_Uint32 gu8FlushedJoinReqDrvHandler; +size_t gu8FlushedJoinReqDrvHandler; #define REAL_JOIN_REQ 0 #define FLUSHED_JOIN_REQ 1 #define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */ @@ -622,7 +622,7 @@ static WILC_Sint32 Handle_SetChannel(void *drvHandler, tstrHostIFSetChan *pstrHo PRINT_D(HOSTINF_DBG, Setting channel\n); /*Sending Cfg*/ - s32Error = SendConfigPkt(SET_CFG, strWID, 1, WILC_TRUE, (WILC_Uint32)pstrWFIDrv); + s32Error = SendConfigPkt(SET_CFG, strWID, 1, WILC_TRUE, (size_t)pstrWFIDrv); if (s32Error) { PRINT_ER(Failed to set channel\n); WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); @@ -659,10 +659,10 @@ static WILC_Sint32 Handle_SetWfiDrvHandler(tstrHostIfSetDrvHandler *pstrHostIfSe /*Sending Cfg*/ - s32Error = SendConfigPkt(SET_CFG, strWID, 1, WILC_TRUE, (WILC_Uint32)pstrWFIDrv); + s32Error = SendConfigPkt(SET_CFG, strWID, 1, WILC_TRUE, (size_t)pstrWFIDrv); - if ((pstrHostIfSetDrvHandler-u32Address) == (WILC_Uint32)NULL) { + if ((pstrHostIfSetDrvHandler-u32Address) == (size_t)NULL) { up(hSemDeinitDrvHandle); } @@ -705,10 +705,10 @@ static WILC_Sint32 Handle_SetOperationMode(void *drvHandler, tstrHostIfSetOperat /*Sending Cfg*/ PRINT_INFO(HOSTINF_DBG, (WILC_Uint32)pstrWFIDrv= %x \n, (WILC_Uint32)pstrWFIDrv); - s32Error = SendConfigPkt(SET_CFG, strWID, 1, WILC_TRUE, (WILC_Uint32)pstrWFIDrv); + s32Error = SendConfigPkt(SET_CFG, strWID, 1, WILC_TRUE, (size_t)pstrWFIDrv); - if ((pstrHostIfSetOperationMode-u32Mode) == (WILC_Uint32)NULL) { + if ((pstrHostIfSetOperationMode-u32Mode) == 0) { up(hSemDeinitDrvHandle); } @@ -755,7 +755,7 @@ WILC_Sint32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) strWID.ps8WidVal = (u8
[PATCH 0/4] staging: wilc1000: fix compile warnings and clean other
Hello Greg. I have rebased on the lastest staging-testing and fixed compile warnings This patches is prepared to fix the compatibilty issue for 64bit machine and wrong casting. I am aware that the others should be patched additonally. However I need internally to discuss on the other patch. Then, the others will be sent soon. Johnny. Johnny Kim (4): staging: wilc1000: modify data type staging: wilc1000: add syntax for 64-bit machine staging: wilc1000: modify printk format staging: wilc1000: remove uninitialized warnings drivers/staging/wilc1000/coreconfigurator.c | 4 +- drivers/staging/wilc1000/coreconfigurator.h | 2 +- drivers/staging/wilc1000/host_interface.c | 158 -- drivers/staging/wilc1000/host_interface.h | 6 +- drivers/staging/wilc1000/linux_wlan.c | 14 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 18 +-- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 27 ++-- drivers/staging/wilc1000/wilc_wlan.h | 6 +- drivers/staging/wilc1000/wilc_wlan_if.h | 4 +- 10 files changed, 136 insertions(+), 105 deletions(-) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] staging: wilc1000: add syntax for 64-bit machine
The driver take pointer value to integer value for message packet. So, The driver was fixed to save and load the address on 64-bit machine. Signed-off-by: Johnny Kim johnny@atmel.com --- drivers/staging/wilc1000/host_interface.c | 24 drivers/staging/wilc1000/wilc_wlan.c | 19 +++ drivers/staging/wilc1000/wilc_wlan.h | 6 +- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index cfe3364..4b005fa 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -6918,9 +6918,14 @@ void NetworkInfoReceived(u8 *pu8Buffer, WILC_Uint32 u32Length) { WILC_Sint32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; - size_t drvHandler; + size_t drvHandler = 0; tstrWILC_WFIDrv *pstrWFIDrv = NULL; +#ifdef CONFIG_64BIT + drvHandler = ((pu8Buffer[u32Length - 8]) | (pu8Buffer[u32Length - 7] 8) | (pu8Buffer[u32Length - 6] 16) | (pu8Buffer[u32Length - 5] 24)); + drvHandler = 32; +#endif + drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] 8) | (pu8Buffer[u32Length - 2] 16) | (pu8Buffer[u32Length - 1] 24)); pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; @@ -6968,13 +6973,18 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, WILC_Uint32 u32Length) { WILC_Sint32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; - size_t drvHandler; + size_t drvHandler = 0; tstrWILC_WFIDrv *pstrWFIDrv = NULL; /*BugID_5348*/ down(hSemHostIntDeinit); - drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] 8) | (pu8Buffer[u32Length - 2] 16) | (pu8Buffer[u32Length - 1] 24)); +#ifdef CONFIG_64BIT + drvHandler = ((pu8Buffer[u32Length - 8]) | (pu8Buffer[u32Length - 7] 8) | (pu8Buffer[u32Length - 6] 16) | (pu8Buffer[u32Length - 5] 24)); + drvHandler = 32; +#endif + + drvHandler |= ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] 8) | (pu8Buffer[u32Length - 2] 16) | (pu8Buffer[u32Length - 1] 24)); pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; PRINT_D(HOSTINF_DBG, General asynchronous info packet received \n); @@ -7031,8 +7041,14 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, WILC_Uint32 u32Length) { WILC_Sint32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; - size_t drvHandler; + size_t drvHandler = 0; tstrWILC_WFIDrv *pstrWFIDrv = NULL; + +#ifdef CONFIG_64BIT + drvHandler = ((pu8Buffer[u32Length - 8]) | (pu8Buffer[u32Length - 7] 8) | (pu8Buffer[u32Length - 6] 16) | (pu8Buffer[u32Length - 5] 24)); + drvHandler = 32; +#endif + drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] 8) | (pu8Buffer[u32Length - 2] 16) | (pu8Buffer[u32Length - 1] 24)); pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 739be55..d20ffe0 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1867,7 +1867,7 @@ static int wilc_wlan_cfg_commit(int type, size_t drvHandler) { wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)g_wlan; wilc_cfg_frame_t *cfg = p-cfg_frame; - int total_len = p-cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE; + int total_len = p-cfg_frame_offset + sizeof(size_t) + DRIVER_HANDLER_SIZE; int seq_no = p-cfg_seq_no % 256; size_t driver_handler = (size_t)drvHandler; @@ -1883,10 +1883,21 @@ static int wilc_wlan_cfg_commit(int type, size_t drvHandler) cfg-wid_header[1] = seq_no;/* sequence number */ cfg-wid_header[2] = (uint8_t)total_len; cfg-wid_header[3] = (uint8_t)(total_len 8); +#ifdef CONFIG_64BIT cfg-wid_header[4] = (uint8_t)driver_handler; - cfg-wid_header[5] = (uint8_t)(driver_handler 8); - cfg-wid_header[6] = (uint8_t)(driver_handler 16); - cfg-wid_header[7] = (uint8_t)(driver_handler 24); + cfg-wid_header[5] = (uint8_t)(driver_handler 8L); + cfg-wid_header[6] = (uint8_t)(driver_handler 16L); + cfg-wid_header[7] = (uint8_t)(driver_handler 24L); + cfg-wid_header[8] = (uint8_t)(driver_handler 32L); + cfg-wid_header[9] = (uint8_t)(driver_handler 40L); + cfg-wid_header[10] = (uint8_t)(driver_handler 48L); + cfg-wid_header[11] = (uint8_t)(driver_handler 56L); +#else + cfg-wid_header[4] = (uint8_t)driver_handler; + cfg-wid_header[5] = (uint8_t)(driver_handler 8L); + cfg-wid_header[6] = (uint8_t)(driver_handler 16L); + cfg-wid_header[7] = (uint8_t)(driver_handler 24L); +#endif p-cfg_seq_no = seq_no; /** diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 0ba7ec6..e026baf 100644
[PATCH 4/4] staging: wilc1000: remove uninitialized warnings
This patch is for the initialization of the local variables. Signed-off-by: Johnny Kim johnny@atmel.com --- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index cb0765f..10de9d7 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -2778,7 +2778,7 @@ late_initcall(init_wilc_driver); static void __exit exit_wilc_driver(void) { int i = 0; - perInterface_wlan_t *nic[NUM_CONCURRENT_IFC]; + perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,}; #define CLOSE_TIMEOUT (12 * 1000) if ((g_linux_wlan != NULL) (((g_linux_wlan-strInterfaceInfo[0].wilc_netdev) != NULL) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index f3068c0..aa79a5d 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -829,9 +829,9 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, WILC_Uint32 i; u8 u8security = NO_ENCRYPT; AUTHTYPE_T tenuAuth_type = ANY; - WILC_Char *pcgroup_encrypt_val; - WILC_Char *pccipher_group; - WILC_Char *pcwpa_version; + WILC_Char *pcgroup_encrypt_val = NULL; + WILC_Char *pccipher_group = NULL; + WILC_Char *pcwpa_version = NULL; struct WILC_WFI_priv *priv; tstrWILC_WFIDrv *pstrWFIDrv; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] staging: wilc1000: modify printk format
This remove compile warnings about printk format. Signed-off-by: Johnny Kim johnny@atmel.com --- drivers/staging/wilc1000/host_interface.c | 8 drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4b005fa..e4ad07a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -703,7 +703,7 @@ static WILC_Sint32 Handle_SetOperationMode(void *drvHandler, tstrHostIfSetOperat strWID.s32ValueSize = sizeof(WILC_Uint32); /*Sending Cfg*/ - PRINT_INFO(HOSTINF_DBG, (WILC_Uint32)pstrWFIDrv= %x \n, (WILC_Uint32)pstrWFIDrv); + PRINT_INFO(HOSTINF_DBG, (size_t)pstrWFIDrv= %p \n, pstrWFIDrv); s32Error = SendConfigPkt(SET_CFG, strWID, 1, WILC_TRUE, (size_t)pstrWFIDrv); @@ -6631,7 +6631,7 @@ WILC_Sint32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) g_obtainingIP = WILC_FALSE; #endif - PRINT_D(HOSTINF_DBG, Global handle pointer value=%x\n, (WILC_Uint32)pstrWFIDrv); + PRINT_D(HOSTINF_DBG, Global handle pointer value=%p\n, pstrWFIDrv); /* /// */ if (clients_count == 0) { sema_init(hSemHostIFthrdEnd, 0); @@ -6933,7 +6933,7 @@ void NetworkInfoReceived(u8 *pu8Buffer, WILC_Uint32 u32Length) if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { - PRINT_ER(NetworkInfo received but driver not init[%x]\n, (WILC_Uint32)pstrWFIDrv); + PRINT_ER(NetworkInfo received but driver not init[%p]\n, pstrWFIDrv); return; } @@ -7053,7 +7053,7 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, WILC_Uint32 u32Length) pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - PRINT_D(GENERIC_DBG, Scan notification received %x\n, (WILC_Uint32)pstrWFIDrv); + PRINT_D(GENERIC_DBG, Scan notification received %p\n, pstrWFIDrv); if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { return; diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 49d7d8c..cb0765f 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1113,7 +1113,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n #endif priv = wiphy_priv(dev-ieee80211_ptr-wiphy); pstrWFIDrv = (tstrWILC_WFIDrv *)priv-hWILCWFIDrv; - PRINT_D(INIT_DBG, Host = %x\n, (WILC_Uint32)pstrWFIDrv); + PRINT_D(INIT_DBG, Host = %p\n, pstrWFIDrv); PRINT_D(INIT_DBG, MAC address is : %02x-%02x-%02x-%02x-%02x-%02x\n, mac_add[0], mac_add[1], mac_add[2], mac_add[3], mac_add[4], mac_add[5]); wilc_get_chipid(0); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index e6cc1e9..f3068c0 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -844,7 +844,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, host_int_set_wfi_drv_handler((size_t)priv-hWILCWFIDrv); - PRINT_D(CFG80211_DBG, Connecting to SSID [%s] on netdev [%p] host if [%x]\n, sme-ssid, dev, (WILC_Uint32)priv-hWILCWFIDrv); + PRINT_D(CFG80211_DBG, Connecting to SSID [%s] on netdev [%p] host if [%p]\n, sme-ssid, dev, priv-hWILCWFIDrv); #ifdef WILC_P2P if (!(WILC_strncmp(sme-ssid, DIRECT-, 7))) { PRINT_D(CFG80211_DBG, Connected to Direct network,OBSS disabled\n); @@ -1147,7 +1147,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k PRINT_D(CFG80211_DBG, Adding key with cipher suite = %x\n, params-cipher); /*BugID_5137*/ - PRINT_D(CFG80211_DBG, %x %x %d\n, (WILC_Uint32)wiphy, (WILC_Uint32)netdev, key_index); + PRINT_D(CFG80211_DBG, %p %p %d\n, wiphy, netdev, key_index); PRINT_D(CFG80211_DBG, key %x %x %x\n, params-key[0], params-key[1], @@ -3062,7 +3062,7 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev dev-ieee80211_ptr-iftype = type; priv-wdev-iftype = type; nic-iftype = AP_MODE; - PRINT_D(CORECONFIG_DBG, (WILC_Uint32)priv-hWILCWFIDrv[%x]\n, (WILC_Uint32)priv-hWILCWFIDrv); + PRINT_D(CORECONFIG_DBG, priv-hWILCWFIDrv[%p]\n, priv-hWILCWFIDrv); #ifndef SIMULATION PRINT_D(HOSTAPD_DBG, Downloading AP firmware\n); @@ -3108,7 +3108,7 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev dev-ieee80211_ptr-iftype = type; priv-wdev-iftype = type
Re: [PATCH 1/4] staging: wilc1000: modify data type
On 2015년 06월 11일 09:40, Greg KH wrote: On Wed, Jun 10, 2015 at 05:06:44PM +0900, Johnny Kim wrote: -static int wilc_wlan_cfg_commit(int type, uint32_t drvHandler) +static int wilc_wlan_cfg_commit(int type, size_t drvHandler) Shouldn't this just be a void *? And if so, why not the real function pointer instead? Also, lots of these seem to be just pointers, please use a pointer instead of hiding it in a size_t as that's the most portable, and correct, way to do it. No need to hide any function pointers here, this isn't Windows :) thanks, greg k-h To replace the integer to the pointer as your counsel, I need a lot of discussion internally. But I will fix the type and the related things like your thinking. I know there is the build warning for 64-bit machine and this driver stays in BROKEN status on linux-next. I want to know if the reason is 64bit build warning. Thanks for your help. Regards Johnny ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 00/12] wilc1000: dead code removal and other cleanup
On 2015년 06월 02일 14:20, Greg KH wrote: On Tue, Jun 02, 2015 at 01:53:31PM +0900, Greg KH wrote: On Mon, Jun 01, 2015 at 09:06:33PM +0200, Arnd Bergmann wrote: Hi Greg, Next try, I've rebased on top of your staging-testing branch and fixed the two build errors. While I had done my normal build testing on the driver (a few hundred randconfig builds), I don't normally do 'make clean', so the stale Makefile entry ended up picking the old object files and succeeding with that. Thanks, I've applied these but there are still a bunch of warnings. It's obvious no one has ever built this code on a 64bit processor (Atmel, come on, not all the world is 32bits...) I'll take a pass at it to see if I can clean up some stuff to maybe reduce the number of warnings, but right now, it's still way too many for linux-next to want to enable as it blows up their logs... Ugh, that's a rabbit hole you can disappear into for a long time. I did a few patches but ran out of time, I can spend days mucking down in there unwinding the mess... Johnny, Rachel, Dean, and Chris, can you all fix up all of the build warnings as soon as possible? Take my tree and work off of that, just build it on your desktop 64bit Linux build and get rid of all of them properly and send me the patches. Hopefully by the end of this week so that linux-next can get some testing with this driver enabled. OK. I will fix the warnings and 64bits dependency on current staging-next by the end of this week. Thanks for your review. Best regards. Johnny. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 2/2] staging: MAINTAINERS: add maintainer for wilc1000 device
Add myself as maintainer for atmel wilc1000 Signed-off-by: Johnny Kim johnny@atmel.com Signed-off-by: Rachel Kim rachel@atmel.com Signed-off-by: Dean Lee dean@atmel.com Signed-off-by: Chris Park chris.p...@atmel.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com --- Changes in v3: - fix the permissions. - fix the folder tree. - forget to add the mailing-list during the previous sending. - remove driverdev.osuosl.org mailing MAINTAINERS | 9 + 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 1b8263c..e5cef88 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9473,6 +9473,15 @@ M: Forest Bond for...@alittletooquiet.net S: Odd Fixes F: drivers/staging/vt665?/ +STAGING - WILC1000 WIFI DRIVER +M: Johnny Kim johnny@atmel.com +M: Rachel Kim rachel@atmel.com +M: Dean Lee dean@atmel.com +M: Chris Park chris.p...@atmel.com +L: linux-wirel...@vger.kernel.org +S: Supported +F: drivers/staging/wilc1000/ + STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER M: Arnaud Patard arnaud.pat...@rtp-net.org S: Odd Fixes -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] staging: MAINTAINERS: add maintainer for wilc1000 device
Add myself as maintainer for atmel wilc1000 Signed-off-by: Johnny Kim johnny@atmel.com Signed-off-by: Rachel Kim rachel@atmel.com Signed-off-by: Dean Lee dean@atmel.com Signed-off-by: Chris Park chris.p...@atmel.com --- MAINTAINERS | 10 ++ 1 file changed, 10 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 1b8263c..e4252b5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9473,6 +9473,16 @@ M: Forest Bond for...@alittletooquiet.net S: Odd Fixes F: drivers/staging/vt665?/ +STAGING - WILC1000 WIFI DRIVER +M: Johnny Kim johnny@atmel.com +M: Rachel Kim rachel@atmel.com +M: Dean Lee dean@atmel.com +M: Chris Park chris.p...@atmel.com +L: de...@driverdev.osuosl.org +L: linux-wirel...@vger.kernel.org +S: Supported +F: drivers/staging/atmel/wilc1000/ + STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER M: Arnaud Patard arnaud.pat...@rtp-net.org S: Odd Fixes -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel