[PATCH 1/5] staging: wilc1000: use the real data type
From: Johnny Kim johnny@atmel.com This patch changes the type of gu8FlushedJoinReqDrvHandler with his real data type becasue typecasting is not necessary. In result, typecasting which is not necessary and some building warnings is removed. Signed-off-by: Johnny Kim johnny@atmel.com Signed-off-by: Tony Cho tony@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 66fa677..0913d18 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -578,7 +578,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 */ @@ -1940,7 +1940,7 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps /*BugID_5137*/ if (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); @@ -2191,11 +2191,11 @@ static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) 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) { kfree(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } - if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { + if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == drvHandler) { kfree(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } @@ -2617,11 +2617,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy /*BugID_5213*/ /*Freeing flushed join request params on receiving*/ /*MAC_DISCONNECTED while connected*/ - if (gu8FlushedJoinReq != NULL gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { + if (gu8FlushedJoinReq != NULL gu8FlushedJoinReqDrvHandler == drvHandler) { kfree(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } - if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { + if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == drvHandler) { kfree(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } @@ -3117,11 +3117,11 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) /*BugID_5137*/ - if (gu8FlushedJoinReq != NULL gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { + if (gu8FlushedJoinReq != NULL gu8FlushedJoinReqDrvHandler == drvHandler) { kfree(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } - if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { + if (gu8FlushedInfoElemAsoc != NULL gu8FlushedJoinReqDrvHandler == drvHandler) { kfree(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/5] staging: wilc1000: change address to fixed value
From: Johnny Kim johnny@atmel.com The linux_wlan_init_test_config() is called once when net driver is loaded. And because the pointer type of the pstrWFIDrv is changed with the interger type, this patch replaces it with designated value instead of pointer. Signed-off-by: Johnny Kim johnny@atmel.com Signed-off-by: Tony Cho tony@atmel.com --- drivers/staging/wilc1000/linux_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index b3cc9f5..4b2cba7 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1052,7 +1052,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n goto _fail_; } - *(int *)c_val = (u32)pstrWFIDrv; + *(int *)c_val = 1; if (!g_linux_wlan-oup.wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0)) goto _fail_; @@ -1291,7 +1291,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, 1)) goto _fail_; return 0; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/5] staging: wilc1000: use id value as argument
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. Signed-off-by: Johnny Kim johnny@atmel.com Signed-off-by: Tony Cho tony@atmel.com --- drivers/staging/wilc1000/host_interface.c | 241 +++--- drivers/staging/wilc1000/host_interface.h | 1 + drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 - 3 files changed, 176 insertions(+), 67 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 47e43cc..4b5e62a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -531,8 +531,8 @@ typedef enum { /* Global Variabls */ /* */ /*/ - - +/* Zero is not used, because a zero ID means termination */ +static tstrWILC_WFIDrv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; tstrWILC_WFIDrv *terminated_handle; tstrWILC_WFIDrv *gWFiDrvHandle; #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP @@ -592,6 +592,56 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); extern void chip_sleep_manually(u32 u32SleepTime); extern int linux_wlan_get_num_conn_ifcs(void); +static int add_handler_in_list(tstrWILC_WFIDrv *handler) +{ + int i; + + for (i = 1; i ARRAY_SIZE(wfidrv_list); i++) { + if (!wfidrv_list[i]) { + wfidrv_list[i] = handler; + return 0; + } + } + + return -ENOBUFS; +} + +static int remove_handler_in_list(tstrWILC_WFIDrv *handler) +{ + int i; + + for (i = 1; i ARRAY_SIZE(wfidrv_list); i++) { + if (wfidrv_list[i] == handler) { + wfidrv_list[i] = NULL; + return 0; + } + } + + return -EINVAL; +} + +static int get_id_from_handler(tstrWILC_WFIDrv *handler) +{ + int i; + + if (!handler) + return 0; + + for (i = 1; i ARRAY_SIZE(wfidrv_list); i++) { + if (wfidrv_list[i] == handler) + return i; + } + + return 0; +} + +static tstrWILC_WFIDrv *get_handler_from_id(int id) +{ + if (id = 0 || id ARRAY_SIZE(wfidrv_list)) + return NULL; + return wfidrv_list[id]; +} + /** * @brief Handle_SetChannel * @detailsSending config packet to firmware to set channel @@ -616,7 +666,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 = SendConfigPkt(SET_CFG, strWID, 1, true, +get_id_from_handler(pstrWFIDrv)); if (s32Error) { PRINT_ER(Failed to set channel\n); WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); @@ -654,8 +705,8 @@ static s32 Handle_SetWfiDrvHandler(tstrWILC_WFIDrv *drvHandler, /*Sending Cfg*/ - s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, (u32)pstrWFIDrv); - + s32Error = SendConfigPkt(SET_CFG, strWID, 1, true, +pstrHostIfSetDrvHandler-u32Address); if (pstrWFIDrv == NULL) up(hSemDeinitDrvHandle); @@ -699,7 +750,8 @@ static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetOpe /*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, +get_id_from_handler(pstrWFIDrv)); if ((pstrHostIfSetOperationMode-u32Mode) == (u32)NULL) @@ -748,8 +800,8 @@ s32 Handle_set_IPAddress(tstrWILC_WFIDrv *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, +
Re: [PATCH v5 01/46] usb: gadget: encapsulate endpoint claiming mechanism
On 08/20/2015 06:48 PM, Felipe Balbi wrote: On Thu, Aug 20, 2015 at 06:28:14PM +0200, Robert Baldyga wrote: Hi Felipe, On 08/20/2015 05:35 PM, Felipe Balbi wrote: [...] just letting you know that this regresses all gadget drivers making them try to disable previously disabled endpoints and enable previously enabled endpoints. I have a possible fix (see below) but then it shows a problem on the host side when using with g_zero (see further below): commit 3b8932100aacb6cfbffe288ca93025d8b8430c00 Author: Felipe Balbi ba...@ti.com Date: Wed Aug 19 18:05:27 2015 -0500 usb: gadget: fix ep-claimed lifetime In order to fix a regression introduced by commit cc476b42a39d (usb: gadget: encapsulate endpoint claiming mechanism) we have to introduce a simple helper to check if a particular is enabled or not. After that, we need to move ep-claimed lifetime to usb_ep_enable() and usb_ep_disable() since those are the only functions which actually enable and disable endpoints. A follow-up patch will come to drop all driver_data checks from function drivers, since those are, now, pointless. Fixes: cc476b42a39d (usb: gadget: encapsulate endpoint claiming mechanism) Cc: Robert Baldyga r.bald...@samsung.com Signed-off-by: Felipe Balbi ba...@ti.com diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 978435a51038..ad45070cd76f 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -126,7 +126,6 @@ found_ep: ep-address = desc-bEndpointAddress; ep-desc = NULL; ep-comp_desc = NULL; - ep-claimed = true; Removing this line causes autoconfig can return the same endpoint many times. This probably causes problems with g_zero. I will try to fix it ASAP. I was considering the same thing, but the lifetime of -claimed doesn't look correct to me either way. Note that once the flag is enabled, it won't get disabled by most gadget drivers. And it should not be. This flag is indicator, that endpoint is used by some function. It should be set once by usb_ep_autoconfig() and cleared by usb_ep_autoconfig_reset(). I wonder what is reason of this enable/disable regression. Maybe the problem is that we don't set ep-driver_data to NULL in usb_ep_autoconfig_reset() (so far it was done). Does this problem occur while gadget is binded to UDC for the first time, or at any next time? Unfortunately at this moment I don't have access to my hardware, so it will take a moment before I will setup some testing environment. Thanks, Robert ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wilc1000: simplify 'memset' of 2D array
From: Hari Prasath Gujulan Elango hguju...@visteon.com This patch simplifies the 'memset' done on a static 2D array. Signed-off-by: Hari Prasath Gujulan Elango hguju...@visteon.com --- drivers/staging/wilc1000/host_interface.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 66fa677..908156e 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1492,8 +1492,7 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps PRINT_D(GENERIC_DBG, Handling connect request\n); #ifndef CONNECT_DIRECT - memset(gapu8RcvdSurveyResults[0], 0, MAX_SURVEY_RESULT_FRAG_SIZE); - memset(gapu8RcvdSurveyResults[1], 0, MAX_SURVEY_RESULT_FRAG_SIZE); + memset(gapu8RcvdSurveyResults, 0, sizeof(gapu8RcvdSurveyResults)); PRINT_D(HOSTINF_DBG, Getting site survey results\n); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/18] staging: mt29f_spinand: Export OF module alias information
The SPI core always reports the MODALIAS uevent as spi:modalias regardless of the mechanism that was used to register the device (i.e: OF or board code) and the table that is used later to match the driver with the device (i.e: SPI id table or OF match table). So drivers needs to export the SPI id table and this be built into the module or udev won't have the necessary information to autoload the needed driver module when the device is added. But this means that OF-only drivers needs to have both OF and SPI id tables that have to be kept in sync and also the dev node compatible manufacturer prefix is stripped when reporting the MODALIAS. Which can lead to issues if two vendors use the same SPI device name for example. To avoid the above, the SPI core behavior may be changed in the future to not require an SPI device table for OF-only drivers and report the OF module alias. So, it's better to also export the OF table even when is unused now to prevent breaking module loading when the core changes. Signed-off-by: Javier Martinez Canillas jav...@osg.samsung.com --- drivers/staging/mt29f_spinand/mt29f_spinand.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c index ad30ce4206ef..1aa449e5fecf 100644 --- a/drivers/staging/mt29f_spinand/mt29f_spinand.c +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c @@ -941,6 +941,7 @@ static const struct of_device_id spinand_dt[] = { { .compatible = spinand,mt29f, }, {} }; +MODULE_DEVICE_TABLE(of, spinand_dt); /* * Device name structure description -- 2.4.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: fsl-mc: Upgraded MC flibs used in MC bus driver
On Wed, Aug 19, 2015 at 11:52:40AM -0500, J. German Rivera wrote: Since signatures of flib functions have changed, we had to change all the corresponding calls in the MC bus driver What does upgrade mean here? I feel like this is the kind of patch we reject without reading the patch because the description is too vague and you can tell from the diff stats that it is going to be too huge to review. I looked at the first few lines and we are making a ball of changes. Copyright notices, adding function parameters, renaming functions. This needs to be explained a lot better and probably split into multiple patches. Btw, the trees are closed for the next 3-4 weeks until after 4.3-rc2 is released. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging:android: fix coding style issue
From 16fb0b08e802ecee754ca609f7371694fd648e1b Mon Sep 17 00:00:00 2001 From: snonez sironhide0n...@gmail.com Date: Thu, 20 Aug 2015 17:07:45 +0800 Subject: [PATCH] staging:android: fix coding style issue Signed-off-by: snonez sironhide0n...@gmail.com --- drivers/staging/android/ashmem.c | 15 --- drivers/staging/android/lowmemorykiller.c | 9 ++--- drivers/staging/android/sw_sync.c | 6 +++--- drivers/staging/android/sync.c| 22 +++--- drivers/staging/android/sync.h| 5 ++--- drivers/staging/android/timed_gpio.c | 15 --- 6 files changed, 38 insertions(+), 34 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 60200a3..d786ec1 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -618,7 +618,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend) /* Case #3: We overlap from the rear, so adjust it */ if (range-pgend = pgend) { -range_shrink(range, range-pgstart, pgstart-1); +range_shrink(range, range-pgstart, + pgstart - 1); continue; } @@ -715,7 +716,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, if (unlikely((pin.offset | pin.len) ~PAGE_MASK)) return -EINVAL; - if (unlikely(((__u32) -1) - pin.offset pin.len)) + if (unlikely(((__u32)-1) - pin.offset pin.len)) return -EINVAL; if (unlikely(PAGE_ALIGN(asma-size) pin.offset + pin.len)) @@ -759,7 +760,7 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINVAL; if (!asma-file) { ret = 0; - asma-size = (size_t) arg; + asma-size = (size_t)arg; } break; case ASHMEM_GET_SIZE: @@ -833,16 +834,16 @@ static int __init ashmem_init(void) int ret; ashmem_area_cachep = kmem_cache_create(ashmem_area_cache, - sizeof(struct ashmem_area), - 0, 0, NULL); + sizeof(struct ashmem_area), + 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { pr_err(failed to create slab cache\n); return -ENOMEM; } ashmem_range_cachep = kmem_cache_create(ashmem_range_cache, - sizeof(struct ashmem_range), - 0, 0, NULL); + sizeof(struct ashmem_range), + 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { pr_err(failed to create slab cache\n); return -ENOMEM; diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 872bd60..72cd1b5 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -42,20 +42,23 @@ #include linux/profile.h #include linux/notifier.h -static uint32_t lowmem_debug_level = 1; +static u32 lowmem_debug_level = 1; static short lowmem_adj[6] = { 0, 1, 6, 12, }; + static int lowmem_adj_size = 4; + static int lowmem_minfree[6] = { 3 * 512, /* 6MB */ 2 * 1024, /* 8MB */ 4 * 1024, /* 16MB */ 16 * 1024, /* 64MB */ }; + static int lowmem_minfree_size = 4; static unsigned long lowmem_deathpending_timeout; @@ -104,8 +107,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) } lowmem_print(3, lowmem_scan %lu, %x, ofree %d %d, ma %hd\n, - sc-nr_to_scan, sc-gfp_mask, other_free, - other_file, min_score_adj); + sc-nr_to_scan, sc-gfp_mask, other_free, + other_file, min_score_adj); if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) { lowmem_print(5, lowmem_scan %lu, %x, return 0\n, diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index c90838d..29b5c35 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -145,7 +145,7 @@ static int sw_sync_open(struct inode *inode, struct file *file) get_task_comm(task_comm, current); obj = sw_sync_timeline_create(task_comm); - if (obj == NULL) + if (!obj) return -ENOMEM; file-private_data = obj; @@ -179,14 +179,14 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj, } pt = sw_sync_pt_create(obj, data.value); - if (pt == NULL) { + if (!pt) { err = -ENOMEM; goto err; } data.name[sizeof(data.name) - 1] = '\0'; fence = sync_fence_create(data.name, pt); - if (fence == NULL) { + if (!fence) { sync_pt_free(pt); err = -ENOMEM; goto err; diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index f83e00c..e0c1acb 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, return NULL; obj = kzalloc(size, GFP_KERNEL); - if (obj == NULL) + if (!obj) return NULL; kref_init(obj-kref); @@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size) return NULL; pt = kzalloc(size, GFP_KERNEL); - if (pt == NULL) + if (!pt) return NULL;
Re: [PATCH v3 1/4] i2c: tegra: implement slave mode
On 24.07.2015 13:52, Wolfram Sang wrote: At the begin of my work on this patchset I even denied clock disable call if slave is registered (to minimize code that can affect transfer). I hacked something like this, but it seems it was not enough. If only slave mode is used, then this logic is not needed. This is not sufficent. We shouldn't break being a master only because we also listen to a slave address (as long as the HW supports that of course). tegra_i2c_init is called on probe and resume. Also it is called in case of xfer fail. If xfer is ok, then I think slave addr must be kept unchanged. This is fragile. Try scanning the bus with i2cdetect and slave setup will be gone. As far as I understand it is a loopback mode. Probably it will not work (Stephen Warren already mentioned this). Just to make clear: I am not saying we should support talking to our own slave address. But it should still be possible to communicate with other remote devices on the bus. Sorry for the long delay. I tried to analyze the issue. Attached patch works on AC100 (Misha Komarovsky helped me with testing). Wolfram could you please try the patch with your environment? Thanks. From 0927b4007786b19e51415c4900863dd4e74fa034 Mon Sep 17 00:00:00 2001 From: Andrey Danin danind...@mail.ru Date: Thu, 20 Aug 2015 00:41:39 +0300 Subject: [PATCH] i2c: tegra: don't reset I2C slave address on init Init function is called multuple times. If I2C controller works in slave mode, then driver must keep slave registers otherwise slave configuration will be reseted. Signed-off-by: Andrey Danin danind...@mail.ru --- drivers/i2c/busses/i2c-tegra.c | 42 +-- 1 files changed, 27 insertions(+), 15 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 6467ce0..50250a1 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -402,6 +402,22 @@ static void tegra_dvc_init(struct tegra_i2c_dev *i2c_dev) dvc_writel(i2c_dev, val, DVC_CTRL_REG1); } +static int tegra_i2c_init_slave(struct tegra_i2c_dev *i2c_dev, u32 addr, u32 flags) +{ + int addr2 = 0; + + i2c_writel(i2c_dev, I2C_SL_CNFG_NEWSL, I2C_SL_CNFG); + i2c_writel(i2c_dev, I2C_SL_DELAY_COUNT_DEFAULT, I2C_SL_DELAY_COUNT); + + if (flags I2C_CLIENT_TEN) + addr2 = (addr 7) | I2C_SL_ADDR2_TEN_BIT_MODE; + + i2c_writel(i2c_dev, addr, I2C_SL_ADDR1); + i2c_writel(i2c_dev, addr2, I2C_SL_ADDR2); + + return 0; +} + static inline int tegra_i2c_clock_enable(struct tegra_i2c_dev *i2c_dev) { int ret; @@ -461,12 +477,16 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) i2c_writel(i2c_dev, clk_divisor, I2C_CLK_DIVISOR); if (!i2c_dev-is_dvc) { - u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG); - sl_cfg |= I2C_SL_CNFG_NACK | I2C_SL_CNFG_NEWSL; - i2c_writel(i2c_dev, sl_cfg, I2C_SL_CNFG); - i2c_writel(i2c_dev, 0xfc, I2C_SL_ADDR1); - i2c_writel(i2c_dev, 0x00, I2C_SL_ADDR2); - + if (i2c_dev-slave) { + tegra_i2c_init_slave(i2c_dev, i2c_dev-slave-addr, + i2c_dev-slave-flags); + } else { + u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG); + sl_cfg |= I2C_SL_CNFG_NACK | I2C_SL_CNFG_NEWSL; + i2c_writel(i2c_dev, sl_cfg, I2C_SL_CNFG); + i2c_writel(i2c_dev, 0xfc, I2C_SL_ADDR1); + i2c_writel(i2c_dev, 0x00, I2C_SL_ADDR2); + } } val = 7 I2C_FIFO_CONTROL_TX_TRIG_SHIFT | @@ -767,7 +787,6 @@ static u32 tegra_i2c_func(struct i2c_adapter *adap) static int tegra_reg_slave(struct i2c_client *slave) { struct tegra_i2c_dev *i2c_dev = i2c_get_adapdata(slave-adapter); - int addr2 = 0; if (i2c_dev-slave) return -EBUSY; @@ -776,14 +795,7 @@ static int tegra_reg_slave(struct i2c_client *slave) tegra_i2c_clock_enable(i2c_dev); - i2c_writel(i2c_dev, I2C_SL_CNFG_NEWSL, I2C_SL_CNFG); - i2c_writel(i2c_dev, I2C_SL_DELAY_COUNT_DEFAULT, I2C_SL_DELAY_COUNT); - - if (slave-flags I2C_CLIENT_TEN) - addr2 = (slave-addr 7) | I2C_SL_ADDR2_TEN_BIT_MODE; - - i2c_writel(i2c_dev, slave-addr, I2C_SL_ADDR1); - i2c_writel(i2c_dev, addr2, I2C_SL_ADDR2); + tegra_i2c_init_slave(i2c_dev, slave-addr, slave-flags); return 0; } -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] [media] staging: omap4iss: get entity ID using media_entity_id()
Hi Javier, On Friday 21 August 2015 02:14:05 Javier Martinez Canillas wrote: On 08/20/2015 08:37 PM, Laurent Pinchart wrote: On Wednesday 19 August 2015 17:35:19 Javier Martinez Canillas wrote: The struct media_entity does not have an .id field anymore since now the entity ID is stored in the embedded struct media_gobj. This caused the omap4iss driver fail to build. Fix by using the media_entity_id() macro to obtain the entity ID. Signed-off-by: Javier Martinez Canillas jav...@osg.samsung.com This looks fine to me. The patch needs to be moved between Mauro's 1/8 and 2/8 patches to avoid breaking bisection with patch 3/8. I'd squash this patch and 2/4 into a single media: Use media_entity_id() in drivers patch. Yes, Hans and Mauro already mentioned it and I completely agree that should be squashed with Mauro's patch to maintain git bisect-ability. I wouldn't squash patches 1/4 and 2/4 into Mauro's 3/8 patch as Hans proposed, but instead squashing them together into a single patch and move the result as 1.5/8 in Mauro's series. -- Regards, Laurent Pinchart ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] [media] staging: omap4iss: get entity ID using media_entity_id()
Hello Laurent, On 08/21/2015 02:15 AM, Laurent Pinchart wrote: Hi Javier, On Friday 21 August 2015 02:14:05 Javier Martinez Canillas wrote: On 08/20/2015 08:37 PM, Laurent Pinchart wrote: On Wednesday 19 August 2015 17:35:19 Javier Martinez Canillas wrote: The struct media_entity does not have an .id field anymore since now the entity ID is stored in the embedded struct media_gobj. This caused the omap4iss driver fail to build. Fix by using the media_entity_id() macro to obtain the entity ID. Signed-off-by: Javier Martinez Canillas jav...@osg.samsung.com This looks fine to me. The patch needs to be moved between Mauro's 1/8 and 2/8 patches to avoid breaking bisection with patch 3/8. I'd squash this patch and 2/4 into a single media: Use media_entity_id() in drivers patch. Yes, Hans and Mauro already mentioned it and I completely agree that should be squashed with Mauro's patch to maintain git bisect-ability. I wouldn't squash patches 1/4 and 2/4 into Mauro's 3/8 patch as Hans proposed, but instead squashing them together into a single patch and move the result as 1.5/8 in Mauro's series. I see. I don't mind either option tbh, I'm OK with whatever works better. Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] [media] staging: omap4iss: get entity ID using media_entity_id()
Hello Laurent, On 08/20/2015 08:37 PM, Laurent Pinchart wrote: Hi Javier, Thank you for the patch. On Wednesday 19 August 2015 17:35:19 Javier Martinez Canillas wrote: The struct media_entity does not have an .id field anymore since now the entity ID is stored in the embedded struct media_gobj. This caused the omap4iss driver fail to build. Fix by using the media_entity_id() macro to obtain the entity ID. Signed-off-by: Javier Martinez Canillas jav...@osg.samsung.com This looks fine to me. The patch needs to be moved between Mauro's 1/8 and 2/8 patches to avoid breaking bisection with patch 3/8. I'd squash this patch and 2/4 into a single media: Use media_entity_id() in drivers patch. Yes, Hans and Mauro already mentioned it and I completely agree that should be squashed with Mauro's patch to maintain git bisect-ability. Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v5 01/46] usb: gadget: encapsulate endpoint claiming mechanism
Hi, On Thu, Aug 20, 2015 at 07:16:48PM +0200, Robert Baldyga wrote: On 08/20/2015 06:48 PM, Felipe Balbi wrote: On Thu, Aug 20, 2015 at 06:28:14PM +0200, Robert Baldyga wrote: Hi Felipe, On 08/20/2015 05:35 PM, Felipe Balbi wrote: [...] just letting you know that this regresses all gadget drivers making them try to disable previously disabled endpoints and enable previously enabled endpoints. I have a possible fix (see below) but then it shows a problem on the host side when using with g_zero (see further below): commit 3b8932100aacb6cfbffe288ca93025d8b8430c00 Author: Felipe Balbi ba...@ti.com Date: Wed Aug 19 18:05:27 2015 -0500 usb: gadget: fix ep-claimed lifetime In order to fix a regression introduced by commit cc476b42a39d (usb: gadget: encapsulate endpoint claiming mechanism) we have to introduce a simple helper to check if a particular is enabled or not. After that, we need to move ep-claimed lifetime to usb_ep_enable() and usb_ep_disable() since those are the only functions which actually enable and disable endpoints. A follow-up patch will come to drop all driver_data checks from function drivers, since those are, now, pointless. Fixes: cc476b42a39d (usb: gadget: encapsulate endpoint claiming mechanism) Cc: Robert Baldyga r.bald...@samsung.com Signed-off-by: Felipe Balbi ba...@ti.com diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 978435a51038..ad45070cd76f 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -126,7 +126,6 @@ found_ep: ep-address = desc-bEndpointAddress; ep-desc = NULL; ep-comp_desc = NULL; - ep-claimed = true; Removing this line causes autoconfig can return the same endpoint many times. This probably causes problems with g_zero. I will try to fix it ASAP. I was considering the same thing, but the lifetime of -claimed doesn't look correct to me either way. Note that once the flag is enabled, it won't get disabled by most gadget drivers. And it should not be. This flag is indicator, that endpoint is used by some function. It should be set once by usb_ep_autoconfig() and cleared by usb_ep_autoconfig_reset(). have you considered switching interfaces and/or alternate settings ? I wonder what is reason of this enable/disable regression. Maybe the problem is that we don't set ep-driver_data to NULL in usb_ep_autoconfig_reset() (so far it was done). Does this problem occur while gadget is binded to UDC for the first time, or at any next time? Unfortunately at this moment I don't have access to my hardware, so it will take a moment before I will setup some testing environment. yeah, that's okay. We've got time. -- balbi signature.asc Description: Digital signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] [media] staging: omap4iss: get entity ID using media_entity_id()
Hi Javier, Thank you for the patch. On Wednesday 19 August 2015 17:35:19 Javier Martinez Canillas wrote: The struct media_entity does not have an .id field anymore since now the entity ID is stored in the embedded struct media_gobj. This caused the omap4iss driver fail to build. Fix by using the media_entity_id() macro to obtain the entity ID. Signed-off-by: Javier Martinez Canillas jav...@osg.samsung.com This looks fine to me. The patch needs to be moved between Mauro's 1/8 and 2/8 patches to avoid breaking bisection with patch 3/8. I'd squash this patch and 2/4 into a single media: Use media_entity_id() in drivers patch. --- drivers/staging/media/omap4iss/iss.c | 2 +- drivers/staging/media/omap4iss/iss_video.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c index f32ab7b98ae2..7226553ceb2f 100644 --- a/drivers/staging/media/omap4iss/iss.c +++ b/drivers/staging/media/omap4iss/iss.c @@ -607,7 +607,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe, * crashed. Mark it as such, the ISS will be reset when * applications will release it. */ - iss-crashed |= 1U subdev-entity.id; + iss-crashed |= 1U media_entity_id(subdev-entity); failure = -ETIMEDOUT; } } diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c index bae67742706f..25e9e7a6b99d 100644 --- a/drivers/staging/media/omap4iss/iss_video.c +++ b/drivers/staging/media/omap4iss/iss_video.c @@ -784,7 +784,7 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) entity = video-video.entity; media_entity_graph_walk_start(graph, entity); while ((entity = media_entity_graph_walk_next(graph))) - pipe-entities |= 1 entity-id; + pipe-entities |= 1 media_entity_id(entity); /* Verify that the currently configured format matches the output of * the connected subdev. -- Regards, Laurent Pinchart ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/4] [media] Media entity cleanups and build fixes
On 08/19/15 17:35, Javier Martinez Canillas wrote: Hello, This series contains a couple of build fixes and cleanups for the Media Controller framework. The goal of the series is to get rid of the struct media_entity .parent member since now that a media_gobj is embedded into entities, the media_gobj .mdev member can be used to store a pointer to the parent struct media_device. So the .parent field becomes redundant and can be removed after all the users are converted to use entity .graph_obj.mdev instead. Patches 1/4 and 2/4 are build fixes I found while build testing if no regressions were introduced by the conversion. Patch 3/4 converts all the drivers and the MC core to use .mdev instead of .parent and finally patch 4/4 removes the .parent field since now is unused. Regarding patches 1 and 2: these should of course be merged with Mauro's patches that make this particular change (patch 3/8), otherwise it would break git bisect. Anyway, Acked-by: Hans Verkuil hans.verk...@cisco.com for the changes in patch 1 and 2, as long as they are added to Mauro's patch 3/8. Regards, Hans The series depend on Mauro's [PATCH v6 0/8] MC preparation patches series [0]. The transformation were automated using a coccinelle semantic patch and the drivers were build tested using allyesconfig and x-building the ARM Exynos and OMAP defconfigs + the needed media config options. Best regards, Javier [0]: http://www.mail-archive.com/linux-media@vger.kernel.org/msg91330.html Javier Martinez Canillas (4): [media] staging: omap4iss: get entity ID using media_entity_id() [media] omap3isp: get entity ID using media_entity_id() [media] media: use entity.graph_obj.mdev instead of .parent [media] media: remove media entity .parent field drivers/media/media-device.c | 8 ++--- drivers/media/media-entity.c | 34 -- drivers/media/platform/exynos4-is/fimc-isp-video.c | 6 ++-- drivers/media/platform/exynos4-is/fimc-lite.c | 8 ++--- drivers/media/platform/exynos4-is/media-dev.c | 2 +- drivers/media/platform/exynos4-is/media-dev.h | 8 ++--- drivers/media/platform/omap3isp/isp.c | 11 --- drivers/media/platform/omap3isp/ispccdc.c | 2 +- drivers/media/platform/omap3isp/ispvideo.c | 10 --- drivers/media/platform/vsp1/vsp1_video.c | 2 +- drivers/media/platform/xilinx/xilinx-dma.c | 2 +- drivers/staging/media/davinci_vpfe/vpfe_video.c| 6 ++-- drivers/staging/media/omap4iss/iss.c | 6 ++-- drivers/staging/media/omap4iss/iss_video.c | 4 +-- include/media/media-entity.h | 1 - 15 files changed, 58 insertions(+), 52 deletions(-) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: fbtft: Removed a space
Removed a space before parenthesis to remove a coding style error detected by checkpatch. The error is given below: drivers/staging/fbtft/fb_bd663474.c:118: ERROR: space prohibited before that close parenthesis ')' Signed-off-by: Aparna Karuthodi kdasapa...@gmail.com --- drivers/staging/fbtft/fb_bd663474.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fb_bd663474.c b/drivers/staging/fbtft/fb_bd663474.c index 7e00c60..8619426 100644 --- a/drivers/staging/fbtft/fb_bd663474.c +++ b/drivers/staging/fbtft/fb_bd663474.c @@ -115,7 +115,7 @@ static int init_display(struct fbtft_par *par) write_reg(par, 0x100, 0x7120 ); write_reg(par, 0x007, 0x0103 ); mdelay( 10 ); - write_reg(par, 0x007, 0x0113 ); + write_reg(par, 0x007, 0x0113); return 0; } -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/4] [media] media: use entity.graph_obj.mdev instead of .parent
On 08/19/15 17:35, Javier Martinez Canillas wrote: The struct media_entity has a .parent field that stores a pointer to the parent struct media_device. But recently a media_gobj was embedded into the entities and since struct media_gojb already has a pointer to a struct media_device in the .mdev field, the .parent field becomes redundant and can be removed. This patch replaces all the usage of .parent by .graph_obj.mdev so that field will become unused and can be removed on a later patch. No functional changes. The transformation was made using the following coccinelle spatch: @@ struct media_entity *me; @@ - me-parent + me-graph_obj.mdev @@ struct media_entity *link; @@ - link-source-entity-parent + link-source-entity-graph_obj.mdev @@ struct exynos_video_entity *ve; @@ - ve-vdev.entity.parent + ve-vdev.entity.graph_obj.mdev Suggested-by: Mauro Carvalho Chehab mche...@osg.samsung.com Signed-off-by: Javier Martinez Canillas jav...@osg.samsung.com Acked-by: Hans Verkuil hans.verk...@cisco.com Regards, Hans ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/4] [media] Media entity cleanups and build fixes
Hello Hans, On 08/20/2015 02:41 PM, Hans Verkuil wrote: On 08/19/15 17:35, Javier Martinez Canillas wrote: Hello, This series contains a couple of build fixes and cleanups for the Media Controller framework. The goal of the series is to get rid of the struct media_entity .parent member since now that a media_gobj is embedded into entities, the media_gobj .mdev member can be used to store a pointer to the parent struct media_device. So the .parent field becomes redundant and can be removed after all the users are converted to use entity .graph_obj.mdev instead. Patches 1/4 and 2/4 are build fixes I found while build testing if no regressions were introduced by the conversion. Patch 3/4 converts all the drivers and the MC core to use .mdev instead of .parent and finally patch 4/4 removes the .parent field since now is unused. Regarding patches 1 and 2: these should of course be merged with Mauro's patches that make this particular change (patch 3/8), otherwise it would break git bisect. Anyway, Acked-by: Hans Verkuil hans.verk...@cisco.com for the changes in patch Thanks a lot for the acks. 1 and 2, as long as they are added to Mauro's patch 3/8. Indeed, I completely agree that these should be squashed with Mauro's patch to maintain git bisect-ability. Regards, Hans Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 00/18] Export SPI and OF module aliases in missing drivers
On Thu, Aug 20, 2015 at 09:07:13AM +0200, Javier Martinez Canillas wrote: Patches #1 and #2 solves a), patches #3 to #8 solves b) and patches ^^^ I'm dying to know how this sentence ends :) Patch #18 changes the logic of spi_uevent() to report an OF modalias if the device was registered using OF. But this patch is included in the series only as an RFC for illustration purposes since changing that without first applying all the other patches in this series, will break module autoloading for the drivers of devices registered using OF but that lacks an of_match_table. I'll repost patch #18 once all the patches in this series have landed. On a more productive note, the patches I've looked at look good to me. The missing aliases are a problem enough that should be fixed (i.e., part (b)). I'll leave the SPI framework changes to others to comment on. Brian ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: fbtft: Removed a space before comma
Removed a space before coma to remove a coding style error detected by checkpatch. The error is given below: drivers/staging/fbtft/fb_ili9340.c:47: ERROR: space prohibited before that ',' (ctx:WxW) Signed-off-by: Aparna Karuthodi kdasapa...@gmail.com --- drivers/staging/fbtft/fb_ili9340.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fb_ili9340.c b/drivers/staging/fbtft/fb_ili9340.c index 985687d..5753f03 100644 --- a/drivers/staging/fbtft/fb_ili9340.c +++ b/drivers/staging/fbtft/fb_ili9340.c @@ -44,7 +44,7 @@ static int init_display(struct fbtft_par *par) write_reg(par, 0xE8, 0x85 , 0x00 , 0x78); write_reg(par, 0xCB, 0x39 , 0x2C , 0x00 , 0x34 , 0x02); write_reg(par, 0xF7, 0x20); - write_reg(par, 0xEA, 0x00 , 0x00); + write_reg(par, 0xEA, 0x00, 0x00); /* Power Control 1 */ write_reg(par, 0xC0, 0x23); -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v5 01/46] usb: gadget: encapsulate endpoint claiming mechanism
Hi, On Fri, Jul 31, 2015 at 04:00:13PM +0200, Robert Baldyga wrote: So far it was necessary for usb functions to set ep-driver_data in endpoint obtained from autoconfig to non-null value, to indicate that endpoint is claimed by function (in autoconfig it was checked if endpoint has set this field to non-null value, and if it has, it was assumed that it is claimed). It could cause bugs because if some function doesn't set this field autoconfig could return the same endpoint more than one time. To help to avoid such bugs this patch adds claimed flag to struct usb_ep, and encapsulates endpoint claiming mechanism inside usb_ep_autoconfig_ss() and usb_ep_autoconfig_reset(), so now usb functions don't need to perform any additional actions to mark endpoint obtained from autoconfig as claimed. Signed-off-by: Robert Baldyga r.bald...@samsung.com just letting you know that this regresses all gadget drivers making them try to disable previously disabled endpoints and enable previously enabled endpoints. I have a possible fix (see below) but then it shows a problem on the host side when using with g_zero (see further below): commit 3b8932100aacb6cfbffe288ca93025d8b8430c00 Author: Felipe Balbi ba...@ti.com Date: Wed Aug 19 18:05:27 2015 -0500 usb: gadget: fix ep-claimed lifetime In order to fix a regression introduced by commit cc476b42a39d (usb: gadget: encapsulate endpoint claiming mechanism) we have to introduce a simple helper to check if a particular is enabled or not. After that, we need to move ep-claimed lifetime to usb_ep_enable() and usb_ep_disable() since those are the only functions which actually enable and disable endpoints. A follow-up patch will come to drop all driver_data checks from function drivers, since those are, now, pointless. Fixes: cc476b42a39d (usb: gadget: encapsulate endpoint claiming mechanism) Cc: Robert Baldyga r.bald...@samsung.com Signed-off-by: Felipe Balbi ba...@ti.com diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 978435a51038..ad45070cd76f 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -126,7 +126,6 @@ found_ep: ep-address = desc-bEndpointAddress; ep-desc = NULL; ep-comp_desc = NULL; - ep-claimed = true; return ep; } EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss); @@ -182,11 +181,6 @@ EXPORT_SYMBOL_GPL(usb_ep_autoconfig); */ void usb_ep_autoconfig_reset (struct usb_gadget *gadget) { - struct usb_ep *ep; - - list_for_each_entry (ep, gadget-ep_list, ep_list) { - ep-claimed = false; - } gadget-in_epnum = 0; gadget-out_epnum = 0; } diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index c14a69b36d27..9b3d60c1cf9f 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -243,6 +243,22 @@ static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep, } /** + * usb_ep_enabled - is endpoint enabled ? + * @ep: the endpoint being checked. may not be the endpoint named ep0. + * + * Whenever a function driver wants to check if a particular endpoint is + * enabled or not, it must check using this helper function. This will + * encapsulate details about how the endpoint is checked, saving the function + * driver from using private methods for doing so. + * + * return true if endpoint is enabled, false otherwise. + */ +static inline bool usb_ep_enabled(struct usb_ep *ep) +{ + return ep-claimed; +} + +/** * usb_ep_enable - configure endpoint, making it usable * @ep:the endpoint being configured. may not be the endpoint named ep0. * drivers discover endpoints through the ep_list of a usb_gadget. @@ -264,7 +280,18 @@ static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep, */ static inline int usb_ep_enable(struct usb_ep *ep) { - return ep-ops-enable(ep, ep-desc); + int ret; + + if (usb_ep_enabled(ep)) + return 0; + + ret = ep-ops-enable(ep, ep-desc); + if (ret) + return ret; + + ep-claimed = true; + + return 0; } /** @@ -281,7 +308,18 @@ static inline int usb_ep_enable(struct usb_ep *ep) */ static inline int usb_ep_disable(struct usb_ep *ep) { - return ep-ops-disable(ep); + int ret; + + if (!usb_ep_enabled(ep)) + return 0; + + ret = ep-ops-disable(ep); + if (ret) + return ret; + + ep-claimed = false; + + return 0; } /** [ 73.290345] WARNING: CPU: 0 PID: 300 at lib/kobject.c:240 kobject_add_internal+0x25c/0x2d8() [ 73.299172] kobject_add_internal failed for ep_81 with -EEXIST, don't try to register things with the same name in the same directory. [ 73.311825] Modules linked in: usbtest usb_f_ss_lb g_zero libcomposite xhci_plat_hcd xhci_hcd usbcore joydev dwc3 udc_core usb_common m25p80
[GIT PULL] Staging driver patches for 4.3-rc1
The following changes since commit f7644cbfcdf03528f0f450f3940c4985b2291f49: Linux 4.2-rc6 (2015-08-09 15:54:30 -0400) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ tags/staging-4.3-rc1 for you to fetch changes up to 415bcb5c6eff630967baa4e671cebe883d83ee79: staging/lustre/o2iblnd: remove references to ib_reg_phsy_mr() (2015-08-18 19:53:41 -0700) Staging driver patches for 4.3-rc1 Here is the big staging driver updates for 4.3-rc1. Lots of things all over the place, almost all of them trivial fixups and changes. The usual IIO updates and new drivers and we have added the MOST driver subsystem which is getting cleaned up in the tree. The ozwpan driver is finally being deleted as it is obviously abandoned and no one cares about it. Full details are in the shortlog, and all of these have been in linux-next with no reported issues. Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org Aaron Ouellette (1): staging: sm750fb: removed extra parentheses Abdul Hussain (5): Staging: comedi: dmm32at: Simplify a trivial if-return sequence Staging: comedi: fl512: Simplify a trivial if-return sequence Staging: comedi: dac02: Simplify a trivial if-return sequence Staging: comedi: ni_daq_dio24: Simplify a trivial if-return sequence Staging: comedi: s626: Simplify a trivial if-return sequence Abhilash Jindal (1): staging: comedi: serial2002: Use monotonic clock Adrian Remonda (4): Staging: most: mostcore/core.c. Fix missing static keyword warnings Staging: most: mostcore/core.c. Fix Using plain integer as NULL pointer warnings Staging: most: hdm-usb/hdm_usb.c. Fix missing static keyword warnings Staging: most: aim-cdev/cdev.c. Fix missing static keyword warnings Adriana Reus (3): iio: Documentation: Add additional *scale_available attributes iio: inv-mpu: Export scale_available attributes iio: light: Add support for TXC PA12 als and proximity sensor Aleksei Fedotov (1): staging: speakup: Fix warning reported by checkpatch Alex Wilson (1): staging: panel: fix block comment usage Ana Calinov (2): iio: accel: kxcjk-1013: Remove blank lines iio: frequency: adf4350: Delete blank line Anatoly Stepanov (11): staging: sm750fb: replace spaces with tabs staging: sm750fb: remove trailing whitespaces staging: sm750fb: insert space between ')' and '{' staging: sm750fb: insert space before open parenthesis staging: sm750fb: fix indentation of pointer operator staging: sm750fb: put open brace on the previous line staging: sm750fb: fix indentation in 'else' statements staging: sm750fb: fix 'switch and case' indentation staging: sm750fb: remove assignment from if condition staging: sm750fb: fix open brace in function declaration staging: sm750fb: add required spaces around C operators Anders Fridlund (2): staging:lustre: fix space required after that ', ' error in cl_page.c Staging: sm750fb: ddk750_dvi.h: Fix brace coding style issue Andrea Galbusera (1): iio: adc: mcp320x: Add support for mcp3301 Andreas Dannenberg (1): iio: light: add support for TI's opt3001 light sensor Andrzej Hajda (1): staging/lustre: use kmemdup rather than duplicating its implementation Antoine BLIN (1): staging: sm750fb: ddk750_power.c: Split lines over 80 characters. Antonio Borneo (2): iio: ssp_sensors: Remove redundant spi driver bus initialization staging: mt29f_spinand: Remove redundant spi driver bus initialization Arjun Krishna Babu (1): staging: vt6656: Fixed two lines over 80 characters long Bastien Nocera (2): iio:accel:bmc150-accel: Move bmc150_accel_chip_init() iio:accel:bmc150-accel: Use the chip ID to detect sensor variant Benjamin Romer (1): staging: unisys: fix copyright statements Bernd Porr (2): staging/comedi/drivers/usbduxsigma.c: updated address details staging/comedi/drivers/usbduxsigma.c: added support for ehci drivers BuĊ£iu Alexandru Octavian (1): drivers: staging: rtl8188eu Refactored rtw_free_assoc_resources CHANG FU CHIAO (1): staging: ft1000: ft1000-usb: remove unnecessary out of memory warning Chaehyun Lim (35): staging: wilc1000: wilc_wfi_netdevice.c: remove prohibited space before semicolon staging: wilc1000: wilc_wfi_netdevice.c: remove prohibited space staging: wilc1000: wilc_wfi_netdevice.c: remove braces for single statement block staging: wilc1000: wilc_wfi_netdevice.c: Insert blank line after declarations staging: wilc1000: wilc_wfi_netdevice.c: move statement after declarations staging: wilc1000: wilc_wfi_netdevice.c: remove commented codes staging: wilc1000: wilc_wfi_netdevice.c:
Re: [PATCH v5 01/46] usb: gadget: encapsulate endpoint claiming mechanism
On 8/20/2015 10:45 AM, Felipe Balbi wrote: Hi, On Thu, Aug 20, 2015 at 07:16:48PM +0200, Robert Baldyga wrote: On 08/20/2015 06:48 PM, Felipe Balbi wrote: On Thu, Aug 20, 2015 at 06:28:14PM +0200, Robert Baldyga wrote: Hi Felipe, On 08/20/2015 05:35 PM, Felipe Balbi wrote: [...] just letting you know that this regresses all gadget drivers making them try to disable previously disabled endpoints and enable previously enabled endpoints. I have a possible fix (see below) but then it shows a problem on the host side when using with g_zero (see further below): commit 3b8932100aacb6cfbffe288ca93025d8b8430c00 Author: Felipe Balbi ba...@ti.com Date: Wed Aug 19 18:05:27 2015 -0500 usb: gadget: fix ep-claimed lifetime In order to fix a regression introduced by commit cc476b42a39d (usb: gadget: encapsulate endpoint claiming mechanism) we have to introduce a simple helper to check if a particular is enabled or not. After that, we need to move ep-claimed lifetime to usb_ep_enable() and usb_ep_disable() since those are the only functions which actually enable and disable endpoints. A follow-up patch will come to drop all driver_data checks from function drivers, since those are, now, pointless. Fixes: cc476b42a39d (usb: gadget: encapsulate endpoint claiming mechanism) Cc: Robert Baldyga r.bald...@samsung.com Signed-off-by: Felipe Balbi ba...@ti.com diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 978435a51038..ad45070cd76f 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -126,7 +126,6 @@ found_ep: ep-address = desc-bEndpointAddress; ep-desc = NULL; ep-comp_desc = NULL; - ep-claimed = true; Removing this line causes autoconfig can return the same endpoint many times. This probably causes problems with g_zero. I will try to fix it ASAP. I was considering the same thing, but the lifetime of -claimed doesn't look correct to me either way. Note that once the flag is enabled, it won't get disabled by most gadget drivers. And it should not be. This flag is indicator, that endpoint is used by some function. It should be set once by usb_ep_autoconfig() and cleared by usb_ep_autoconfig_reset(). And the 'claimed' flag should be used for the ep autoconfig mechanism alone. We may want to reset it during the autoconfig phase for multiple configs and alt-interfaces. So there should be separate 'claimed' and 'enabled' flags. have you considered switching interfaces and/or alternate settings ? We ran into similar issues before with this very scenario. Handling of set_config(0 or N), in both addressed and configured states, and set_interface requests. John ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 00/18] Export SPI and OF module aliases in missing drivers
Hello Brian, On 08/20/2015 11:11 PM, Brian Norris wrote: On Thu, Aug 20, 2015 at 09:07:13AM +0200, Javier Martinez Canillas wrote: Patches #1 and #2 solves a), patches #3 to #8 solves b) and patches ^^^ I'm dying to know how this sentence ends :) Sigh, I did some last minute restructuring of the cover letter and seems I missed a sentence. I meant to said: and patches #9 to #17 solves c). Patch #18 changes the logic of spi_uevent() to report an OF modalias if the device was registered using OF. But this patch is included in the series only as an RFC for illustration purposes since changing that without first applying all the other patches in this series, will break module autoloading for the drivers of devices registered using OF but that lacks an of_match_table. I'll repost patch #18 once all the patches in this series have landed. On a more productive note, the patches I've looked at look good to me. The missing aliases are a problem enough that should be fixed (i.e., part (b)). I'll leave the SPI framework changes to others to comment on. Great, thanks a lot for your feedback. Brian Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/5] staging: wilc1000: support 64bit machine and remove warnings
This includes the remaining patches for 64bits. The driver uses the redundant typecasting to communicate with the chipset, which causes several compile warnings. However, this patch uses the real data type and removes unnecessary typecasting. Also, the driver allocates the ID value to the pointer address representing the handlers and adds it into the data frames instead of the pointer address. In results, the driver sends and gets the data frame to/from the chipset together with ID value instead of pointer address as a handler. The ID value is vaild from 0 to NUM_CONCURRENT_IFC. Only 0 value is the reserved value to terminate a handler and to inform it to chipset. This series of patch removes the warnings which 64 bit issue and the redundant typecasting cause as well. Johnny Kim (5): staging: wilc1000: use the real data type staging: wilc1000: add an argument for Handle_SetWfiDrvHandler staging: wilc1000: use id value as argument staging: wilc1000: change address to fixed value staging: wilc1000: define undefined operation mode drivers/staging/wilc1000/host_interface.c | 271 ++ drivers/staging/wilc1000/host_interface.h | 2 + drivers/staging/wilc1000/linux_wlan.c | 4 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 - 4 files changed, 195 insertions(+), 83 deletions(-) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v5 01/46] usb: gadget: encapsulate endpoint claiming mechanism
On Thu, Aug 20, 2015 at 06:28:14PM +0200, Robert Baldyga wrote: Hi Felipe, On 08/20/2015 05:35 PM, Felipe Balbi wrote: [...] just letting you know that this regresses all gadget drivers making them try to disable previously disabled endpoints and enable previously enabled endpoints. I have a possible fix (see below) but then it shows a problem on the host side when using with g_zero (see further below): commit 3b8932100aacb6cfbffe288ca93025d8b8430c00 Author: Felipe Balbi ba...@ti.com Date: Wed Aug 19 18:05:27 2015 -0500 usb: gadget: fix ep-claimed lifetime In order to fix a regression introduced by commit cc476b42a39d (usb: gadget: encapsulate endpoint claiming mechanism) we have to introduce a simple helper to check if a particular is enabled or not. After that, we need to move ep-claimed lifetime to usb_ep_enable() and usb_ep_disable() since those are the only functions which actually enable and disable endpoints. A follow-up patch will come to drop all driver_data checks from function drivers, since those are, now, pointless. Fixes: cc476b42a39d (usb: gadget: encapsulate endpoint claiming mechanism) Cc: Robert Baldyga r.bald...@samsung.com Signed-off-by: Felipe Balbi ba...@ti.com diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 978435a51038..ad45070cd76f 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -126,7 +126,6 @@ found_ep: ep-address = desc-bEndpointAddress; ep-desc = NULL; ep-comp_desc = NULL; -ep-claimed = true; Removing this line causes autoconfig can return the same endpoint many times. This probably causes problems with g_zero. I will try to fix it ASAP. I was considering the same thing, but the lifetime of -claimed doesn't look correct to me either way. Note that once the flag is enabled, it won't get disabled by most gadget drivers. -- balbi signature.asc Description: Digital signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel