Re: [PATCH RESEND] android: binder: Sanity check at binder ioctl
On Tue, Jan 19, 2016 at 03:49:27PM +0800, chenfeng wrote: > > > On 2016/1/19 15:33, Greg KH wrote: > > On Tue, Jan 19, 2016 at 11:45:36AM +0800, Chen Feng wrote: > >> When a process fork a child process, we should not allow the > >> child process use the binder which opened by parent process. > >> > >> But if the binder-object creater is a thread of one process who exit, > >> the other thread can also use this binder-object normally. > >> We can distinguish this by the member proc->tsk->mm. > >> If the thread exit the tsk->mm will be NULL. > >> > >> proc->tsk->mm != current->mm && proc->tsk->mm > >> > >> So only allow the shared mm_struct to use the same binder-object and > >> check the existence of mm_struct. > >> > >> Signed-off-by: Chen Feng > >> Signed-off-by: Wei Dong > >> Signed-off-by: Junmin Zhao > >> Reviewed-by: Zhuangluan Su > >> --- > >> drivers/android/binder.c | 2 ++ > >> 1 file changed, 2 insertions(+) > > > > Why resend? What changed from the previous version? > > > My fault, it's my error commit. > mistake the current->mm with current->tsk->mm. > The robot-compile finds out this error. Then please make it a 'v2' patch, and say what you changed, otherwise I'll assume it's identical to the first patch you sent in. And how did you test the first patch if it couldn't even compile? greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH RESEND] android: binder: Sanity check at binder ioctl
On 2016/1/19 16:35, Greg KH wrote: > On Tue, Jan 19, 2016 at 03:49:27PM +0800, chenfeng wrote: >> >> >> On 2016/1/19 15:33, Greg KH wrote: >>> On Tue, Jan 19, 2016 at 11:45:36AM +0800, Chen Feng wrote: When a process fork a child process, we should not allow the child process use the binder which opened by parent process. But if the binder-object creater is a thread of one process who exit, the other thread can also use this binder-object normally. We can distinguish this by the member proc->tsk->mm. If the thread exit the tsk->mm will be NULL. proc->tsk->mm != current->mm && proc->tsk->mm So only allow the shared mm_struct to use the same binder-object and check the existence of mm_struct. Signed-off-by: Chen Feng Signed-off-by: Wei Dong Signed-off-by: Junmin Zhao Reviewed-by: Zhuangluan Su --- drivers/android/binder.c | 2 ++ 1 file changed, 2 insertions(+) >>> >>> Why resend? What changed from the previous version? >>> >> My fault, it's my error commit. >> mistake the current->mm with current->tsk->mm. >> The robot-compile finds out this error. > > Then please make it a 'v2' patch, and say what you changed, otherwise > I'll assume it's identical to the first patch you sent in. > > And how did you test the first patch if it couldn't even compile? > It works well on our platform with hundreds of mobile phone. Since our working branch is not mainline,and the patch is send for mainline review. I made a mistake while making the patch. I will send a new V2 for this patch. Thanks! > greg k-h > > . > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] android: binder: Sanity check at binder ioctl
When a process fork a child process, we should not allow the child process use the binder which opened by parent process. But if the binder-object creater is a thread of one process who exit, the other thread can also use this binder-object normally. We can distinguish this by the member proc->tsk->mm. If the thread exit the tsk->mm will be NULL. proc->tsk->mm != current->mm && proc->tsk->mm So only allow the shared mm_struct to use the same binder-object and check the existence of mm_struct. V2: Fix compile error for error commit Signed-off-by: Chen Feng Signed-off-by: Wei Dong Signed-off-by: Junmin Zhao Reviewed-by: Zhuangluan Su --- drivers/android/binder.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index a39e85f..279063c 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2736,6 +2736,8 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) /*pr_info("binder_ioctl: %d:%d %x %lx\n", proc->pid, current->pid, cmd, arg);*/ + if (unlikely(proc->tsk->mm != current->mm && proc->tsk->mm)) + return -EINVAL; trace_binder_ioctl(cmd, arg); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging: wilc1000: remove redundant initialization for counter variable
There is no need to set counter variable to 0 because it is initialized in next for-loop statement. So, just delete it. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/coreconfigurator.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index ee9f91f..86dfe77 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -607,7 +607,6 @@ int wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, break; } } - counter = 0; for (counter = 0; counter < count; counter++) { wids[counter].size = wilc_wlan_cfg_get_val( wids[counter].id, -- 2.6.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] staging: wilc1000: use int type for counter variable
counter is used as for-loop control variable and indicating index of struct wid array so that it is better to use int type. There is no need to set to 0 when it is declared at the top of this function. counter is initialized as 0 in for-loop statement. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/coreconfigurator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 86dfe77..7e8e423 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -591,7 +591,7 @@ s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo) int wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, u32 count, u32 drv) { - s32 counter = 0; + int counter; int ret = 0; if (mode == GET_CFG) { -- 2.6.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] staging: wilc1000: fix return type of wilc_send_config_pkt
wilc_send_config_pkt is returned to 0 or -ETIMEDOUT according to return value of wilc_wlan_cfg_get and wilc_wlan_cfg_set functions. It is better to use int type in order to represent linux standard error code. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/coreconfigurator.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 2d4d3f1..ee9f91f 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -588,10 +588,11 @@ s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo) * @date 1 Mar 2012 * @version 1.0 */ -s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, +int wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, u32 count, u32 drv) { - s32 counter = 0, ret = 0; + s32 counter = 0; + int ret = 0; if (mode == GET_CFG) { for (counter = 0; counter < count; counter++) { -- 2.6.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC 00/29] De-stage android's sync framework
On Fri, Jan 15, 2016 at 12:55:10PM -0200, Gustavo Padovan wrote: > From: Gustavo Padovan > > This patch series de-stage the sync framework, and in order to accomplish that > a bunch of cleanups/improvements on the sync and fence were made. > > The sync framework contained some abstractions around struct fence and those > were removed in the de-staging process among other changes: > > Userspace visible changes > - > > * The sw_sync file was moved from /dev/sw_sync to /sync/sw_sync. No > other change. > > Kernel API changes > -- > > * struct sync_timeline is now struct fence_timeline > * sync_timeline_ops is now fence_timeline_ops and they now carry struct > fence as parameter instead of struct sync_pt > * a .cleanup() fence op was added to allow sync_fence to run a cleanup when > the fence_timeline is destroyed > * added fence_add_used_data() to pass a private point to struct fence. This > pointer is sent back on the .cleanup op. > * The sync timeline function were moved to be fence_timeline functions: >- sync_timeline_create() -> fence_timeline_create() >- sync_timeline_get() -> fence_timeline_get() >- sync_timeline_put() -> fence_timeline_put() >- sync_timeline_destroy() -> fence_timeline_destroy() >- sync_timeline_signal() -> fence_timeline_signal() > > * sync_pt_create() was replaced be fence_create_on_timeline() > > Internal changes > > > * fence_timeline_ops was removed in favor of direct use fence_ops > * fence default functions were created for fence_ops > * removed structs sync_pt, sw_sync_timeline and sw_sync_pt Bunch of fairly random comments all over: - include/uapi/linux/sw_sync.h imo should be dropped, it's just a private debugfs interface between fence fds and the testsuite. Since the plan is to have the testcases integrated into the kernel tree too we don't need a public header. - similar for include/linux/sw_sync.h Imo that should all be moved into sync_debug.c. Same for sw_sync.c, that should all land in sync_debug imo, and made optional with a Kconfig option. At least we should reuse CONFIG_DEBUGFS. - fence_context and fence_timeline are really the same. timeline has some super-basic support for doing sw-only fence timelines, but imo that's not really worth keeping (and if so better to keep seperate in a sw-fence.c or similar, like seqno-fence.c). The other main thing timeline provides is support to clean up fences on a timeline. And imo that cleanup should be done by the core fence support, not by the add-on stuff. Interlude about fence cleanup on driver unload: Working drivers imo should never call timeline_destroy when there's still an unsignalled fence around for that timeline/context. That just means they're broken and failed to clean up all the pending work. So the problem really is only what to do with fences where the driver disappeared, and for that we essentially need a fence_revoke() function (which could be called internally from timeline_free). So here's what I think timeline_free should do: for_each_fence_on_timel() { WARN_ON(!fence_is_signalled()); fence_revoke(fence); } Implementing fence_revoke is a bit tricky since we need to make sure the memory contained ->ops and similar stuff doesn't disappear. Simplest option might be to grab a temporary reference (using kref_get_unless_zero), and then exchange ->ops with one that has only a release function. We don't need anything else as long as all fence_* functions the kernel might call check for signalling correctly first (fence_wait is broken at least). Or we just give up (for now) and declare module unload as slightly racy. dma-buf is similar. An intermediate option might be to at least add a THIS_MODULE reference to each fence (but that's a bit expensive ...). - back to timeline vs. context: I have no idea how to best clean up this mess, but least painful option long-term is probably to switch over all current users of fence_context_alloc to timelines and remove the plain context interface. - Imo the interface in include/linux/sync.h is duplicating too much of fence.h. I think the only bits we need are the refcounting, creating, fd-install and that's it. Plus a macro to loop over all the fences in a sync_fence. With that drivers will only ever deal with a pile of struct fence, making implicit fencing (using the fence list in dma-buf) and explicit fencing (using the fence list in sync_fence) much more similar. And we can easily do that since no internal users ;-) - get_timeline_name and get_driver_name are imo too much indirection, just add ->(drv_)name field to each of these. - struct sync_fence is a major confusion imo against struct fence. It made much more sense in the pure-android world where fence == sync_pt. Maybe we can rename sync_fence to sync_fence_fd (a bit long, and fd is a bit
[PATCH RESEND] staging: android: sync_debug.c: remove unnecessary braces
Remove unnecessary braces {} around a single statement within a for loop. Indicated by checkpatch. Signed-off-by: Robin Krahl --- drivers/staging/android/sync_debug.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c index f45d13c..02a1649 100644 --- a/drivers/staging/android/sync_debug.c +++ b/drivers/staging/android/sync_debug.c @@ -158,9 +158,8 @@ static void sync_print_fence(struct seq_file *s, struct sync_fence *fence) seq_printf(s, "[%p] %s: %s\n", fence, fence->name, sync_status_str(atomic_read(&fence->status))); - for (i = 0; i < fence->num_fences; ++i) { + for (i = 0; i < fence->num_fences; ++i) sync_print_pt(s, fence->cbs[i].sync_pt, true); - } spin_lock_irqsave(&fence->wq.lock, flags); list_for_each_entry(pos, &fence->wq.task_list, task_list) { -- 2.5.0 signature.asc Description: Digital signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/3] staging: wilc1000: use int type for counter variable
On Tue, Jan 19, 2016 at 07:26:17PM +0900, Chaehyun Lim wrote: > counter is used as for-loop control variable and indicating index of > struct wid array so that it is better to use int type. > There is no need to set to 0 when it is declared at the top of this > function. counter is initialized as 0 in for-loop statement. > > Signed-off-by: Chaehyun Lim > --- > drivers/staging/wilc1000/coreconfigurator.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/wilc1000/coreconfigurator.c > b/drivers/staging/wilc1000/coreconfigurator.c > index 86dfe77..7e8e423 100644 > --- a/drivers/staging/wilc1000/coreconfigurator.c > +++ b/drivers/staging/wilc1000/coreconfigurator.c > @@ -591,7 +591,7 @@ s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo > *pstrConnectRespInfo) > int wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, >u32 count, u32 drv) > { > - s32 counter = 0; > + int counter; rename it to "i" as well. "int i;" regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v1 1/3] staging: rtl8188eu: provide an absolute path to include folder
On Thu, 2015-12-10 at 17:43 +0200, Andy Shevchenko wrote: > Otherwise compiler will complain as follows > > CC [M] drivers/staging/rtl8188eu/core/rtw_ap.o > cc1: warning: drivers/staging/rtl8188eu/include: No such file or > directory [-Wmissing-include-dirs] Any comments on the series? > > Signed-off-by: Andy Shevchenko > --- > drivers/staging/rtl8188eu/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/rtl8188eu/Makefile > b/drivers/staging/rtl8188eu/Makefile > index ed72358..29b9834 100644 > --- a/drivers/staging/rtl8188eu/Makefile > +++ b/drivers/staging/rtl8188eu/Makefile > @@ -53,4 +53,4 @@ r8188eu-y :=\ > > obj-$(CONFIG_R8188EU):= r8188eu.o > > -ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/include > +ccflags-y += -D__CHECK_ENDIAN__ -I$(srctree)/$(src)/include -- Andy Shevchenko Intel Finland Oy ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC 00/29] De-stage android's sync framework
Hi Daniel, 2016-01-19 Daniel Vetter : > On Fri, Jan 15, 2016 at 12:55:10PM -0200, Gustavo Padovan wrote: > > From: Gustavo Padovan > > > > This patch series de-stage the sync framework, and in order to accomplish > > that > > a bunch of cleanups/improvements on the sync and fence were made. > > > > The sync framework contained some abstractions around struct fence and those > > were removed in the de-staging process among other changes: > > > > Userspace visible changes > > - > > > > * The sw_sync file was moved from /dev/sw_sync to /sync/sw_sync. > > No > > other change. > > > > Kernel API changes > > -- > > > > * struct sync_timeline is now struct fence_timeline > > * sync_timeline_ops is now fence_timeline_ops and they now carry struct > > fence as parameter instead of struct sync_pt > > * a .cleanup() fence op was added to allow sync_fence to run a cleanup when > > the fence_timeline is destroyed > > * added fence_add_used_data() to pass a private point to struct fence. This > > pointer is sent back on the .cleanup op. > > * The sync timeline function were moved to be fence_timeline functions: > > - sync_timeline_create() -> fence_timeline_create() > > - sync_timeline_get() -> fence_timeline_get() > > - sync_timeline_put() -> fence_timeline_put() > > - sync_timeline_destroy() -> fence_timeline_destroy() > > - sync_timeline_signal() -> fence_timeline_signal() > > > > * sync_pt_create() was replaced be fence_create_on_timeline() > > > > Internal changes > > > > > > * fence_timeline_ops was removed in favor of direct use fence_ops > > * fence default functions were created for fence_ops > > * removed structs sync_pt, sw_sync_timeline and sw_sync_pt > > Bunch of fairly random comments all over: > > - include/uapi/linux/sw_sync.h imo should be dropped, it's just a private > debugfs interface between fence fds and the testsuite. Since the plan is > to have the testcases integrated into the kernel tree too we don't need > a public header. > > - similar for include/linux/sw_sync.h Imo that should all be moved into > sync_debug.c. Same for sw_sync.c, that should all land in sync_debug > imo, and made optional with a Kconfig option. At least we should reuse > CONFIG_DEBUGFS. These two items sounds reasonable to me. > > - fence_context and fence_timeline are really the same. timeline has some > super-basic support for doing sw-only fence timelines, but imo that's > not really worth keeping (and if so better to keep seperate in a > sw-fence.c or similar, like seqno-fence.c). The other main thing > timeline provides is support to clean up fences on a timeline. And imo > that cleanup should be done by the core fence support, not by the add-on > stuff. Yes, they are. But I currently doesn't know how to merge them best, so I decided to go for a RFC instead of trying some crazy solution touching all fence_context users. > > Interlude about fence cleanup on driver unload: > > Working drivers imo should never call timeline_destroy when there's still > an unsignalled fence around for that timeline/context. That just means > they're broken and failed to clean up all the pending work. So the problem > really is only what to do with fences where the driver disappeared, and > for that we essentially need a fence_revoke() function (which could be > called internally from timeline_free). So here's what I think > timeline_free should do: > > for_each_fence_on_timel() { > WARN_ON(!fence_is_signalled()); > > fence_revoke(fence); > } > > Implementing fence_revoke is a bit tricky since we need to make sure the > memory contained ->ops and similar stuff doesn't disappear. Simplest > option might be to grab a temporary reference (using > kref_get_unless_zero), and then exchange ->ops with one that has only a > release function. We don't need anything else as long as all fence_* > functions the kernel might call check for signalling correctly first > (fence_wait is broken at least). > > Or we just give up (for now) and declare module unload as slightly racy. > dma-buf is similar. An intermediate option might be to at least add a > THIS_MODULE reference to each fence (but that's a bit expensive ...). I'd say we just give up for now as we don't have any driver using timeline_destroy for now. So we could go for other improvements first. > - back to timeline vs. context: I have no idea how to best clean up this > mess, but least painful option long-term is probably to switch over all > current users of fence_context_alloc to timelines and remove the plain > context interface. Agreed. > > - Imo the interface in include/linux/sync.h is duplicating too much of > fence.h. I think the only bits we need are the refcounting, creating, > fd-install and that's it. Plus a macro to loop over all the fences in a > sync_fence. With that drive
Re: [RFC 00/29] De-stage android's sync framework
On 19/01/2016 15:23, Gustavo Padovan wrote: Hi Daniel, 2016-01-19 Daniel Vetter : On Fri, Jan 15, 2016 at 12:55:10PM -0200, Gustavo Padovan wrote: From: Gustavo Padovan This patch series de-stage the sync framework, and in order to accomplish that a bunch of cleanups/improvements on the sync and fence were made. The sync framework contained some abstractions around struct fence and those were removed in the de-staging process among other changes: Userspace visible changes - * The sw_sync file was moved from /dev/sw_sync to /sync/sw_sync. No other change. Kernel API changes -- * struct sync_timeline is now struct fence_timeline * sync_timeline_ops is now fence_timeline_ops and they now carry struct fence as parameter instead of struct sync_pt * a .cleanup() fence op was added to allow sync_fence to run a cleanup when the fence_timeline is destroyed * added fence_add_used_data() to pass a private point to struct fence. This pointer is sent back on the .cleanup op. * The sync timeline function were moved to be fence_timeline functions: - sync_timeline_create() -> fence_timeline_create() - sync_timeline_get() -> fence_timeline_get() - sync_timeline_put() -> fence_timeline_put() - sync_timeline_destroy() -> fence_timeline_destroy() - sync_timeline_signal() -> fence_timeline_signal() * sync_pt_create() was replaced be fence_create_on_timeline() Internal changes * fence_timeline_ops was removed in favor of direct use fence_ops * fence default functions were created for fence_ops * removed structs sync_pt, sw_sync_timeline and sw_sync_pt Bunch of fairly random comments all over: - include/uapi/linux/sw_sync.h imo should be dropped, it's just a private debugfs interface between fence fds and the testsuite. Since the plan is to have the testcases integrated into the kernel tree too we don't need a public header. - similar for include/linux/sw_sync.h Imo that should all be moved into sync_debug.c. Same for sw_sync.c, that should all land in sync_debug imo, and made optional with a Kconfig option. At least we should reuse CONFIG_DEBUGFS. These two items sounds reasonable to me. I have just posted our in-progress IGT for testing i915 syncs (with a CC of Gustavo). It uses the sw_sync mechanisms. Can you take a quick look and see if it is the kind of thing you would expect us to be doing? Or is it using interfaces that you are planning to remove and/or make kernel only? I'm not sure having a kernel only test is the best way to go. Having user land tests like IGT would be much more versatile. - fence_context and fence_timeline are really the same. timeline has some super-basic support for doing sw-only fence timelines, but imo that's not really worth keeping (and if so better to keep seperate in a sw-fence.c or similar, like seqno-fence.c). The other main thing timeline provides is support to clean up fences on a timeline. And imo that cleanup should be done by the core fence support, not by the add-on stuff. Yes, they are. But I currently doesn't know how to merge them best, so I decided to go for a RFC instead of trying some crazy solution touching all fence_context users. Interlude about fence cleanup on driver unload: Working drivers imo should never call timeline_destroy when there's still an unsignalled fence around for that timeline/context. That just means they're broken and failed to clean up all the pending work. So the problem really is only what to do with fences where the driver disappeared, and for that we essentially need a fence_revoke() function (which could be called internally from timeline_free). So here's what I think timeline_free should do: for_each_fence_on_timel() { WARN_ON(!fence_is_signalled()); fence_revoke(fence); } Implementing fence_revoke is a bit tricky since we need to make sure the memory contained ->ops and similar stuff doesn't disappear. Simplest option might be to grab a temporary reference (using kref_get_unless_zero), and then exchange ->ops with one that has only a release function. We don't need anything else as long as all fence_* functions the kernel might call check for signalling correctly first (fence_wait is broken at least). Or we just give up (for now) and declare module unload as slightly racy. dma-buf is similar. An intermediate option might be to at least add a THIS_MODULE reference to each fence (but that's a bit expensive ...). I'd say we just give up for now as we don't have any driver using timeline_destroy for now. So we could go for other improvements first. - back to timeline vs. context: I have no idea how to best clean up this mess, but least painful option long-term is probably to switch over all current users of fence_context_alloc to timelines and remove the plain context interface. Agreed.
[PATCH 1/6] staging: wlan-ng: Fixed block comments coding style issue
All block comment lines now begin with "*" and end with "*/" on a new line. Signed-off-by: Pranjal Bhor --- drivers/staging/wlan-ng/p80211conv.c | 33 + 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index 1b02cdf..3121e1d 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -49,7 +49,8 @@ * * * -* */ +* +*/ #include #include @@ -101,7 +102,8 @@ static u8 oui_8021h[] = { 0x00, 0x00, 0xf8 }; * * Call context: * May be called in interrupt or non-interrupt context -*/ +* +*/ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, struct sk_buff *skb, union p80211_hdr *p80211_hdr, struct p80211_metawep *p80211_wep) @@ -238,7 +240,8 @@ static void orinoco_spy_gather(wlandevice_t *wlandev, char *mac, int i; /* Gather wireless spy statistics: for each packet, compare the -* source address with out list, and if match, get the stats... */ +* source address with out list, and if match, get the stats... +*/ for (i = 0; i < wlandev->spy_number; i++) { @@ -273,7 +276,8 @@ static void orinoco_spy_gather(wlandevice_t *wlandev, char *mac, * * Call context: * May be called in interrupt or non-interrupt context -*/ +* +*/ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, struct sk_buff *skb) { @@ -421,7 +425,8 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, && (e_llc->ctl == 0x03)) { pr_debug("802.1h/RFC1042 len: %d\n", payload_length); /* it's an 802.1h frame || (an RFC1042 && protocol not in STT) - build a DIXII + RFC894 */ +* build a DIXII + RFC894 +*/ /* Test for an overlength frame */ if ((payload_length - sizeof(struct wlan_llc) - @@ -521,14 +526,15 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, * * Call context: * May be called in interrupt or non-interrupt context -*/ +* +*/ int p80211_stt_findproto(u16 proto) { /* Always return found for now. This is the behavior used by the */ - /* Zoom Win95 driver when 802.1h mode is selected */ + /* Zoom Win95 driver when 802.1h mode is selected */ /* TODO: If necessary, add an actual search we'll probably - need this to match the CMAC's way of doing things. - Need to do some testing to confirm. +* need this to match the CMAC's way of doing things. +* Need to do some testing to confirm. */ if (proto == ETH_P_AARP)/* APPLETALK */ @@ -551,7 +557,8 @@ int p80211_stt_findproto(u16 proto) * * Call context: * May be called in interrupt or non-interrupt context -*/ +* +*/ void p80211skb_rxmeta_detach(struct sk_buff *skb) { struct p80211_rxmeta *rxmeta; @@ -595,7 +602,8 @@ void p80211skb_rxmeta_detach(struct sk_buff *skb) * * Call context: * May be called in interrupt or non-interrupt context -*/ +* +*/ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb) { int result = 0; @@ -648,7 +656,8 @@ exit: * * Call context: * May be called in interrupt or non-interrupt context -*/ +* +*/ void p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb) { struct p80211_frmmeta *meta; -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/6] staging: wlan-ng: Removed blank lines after braces
Blank lines before closing braces and after opening braces have been removed. Signed-off-by: Pranjal Bhor --- drivers/staging/wlan-ng/p80211conv.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index 81f3624..00d82e2 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -108,7 +108,6 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, struct sk_buff *skb, union p80211_hdr *p80211_hdr, struct p80211_metawep *p80211_wep) { - __le16 fc; u16 proto; struct wlan_ethhdr e_hdr; @@ -169,7 +168,6 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, e_llc->dsap = 0xAA; /* SNAP, see IEEE 802 */ e_llc->ssap = 0xAA; e_llc->ctl = 0x03; - } } @@ -244,7 +242,6 @@ static void orinoco_spy_gather(wlandevice_t *wlandev, char *mac, */ for (i = 0; i < wlandev->spy_number; i++) { - if (!memcmp(wlandev->spy_address[i], mac, ETH_ALEN)) { memcpy(wlandev->spy_address[i], mac, ETH_ALEN); wlandev->spy_stat[i].level = rxmeta->signal; @@ -486,7 +483,6 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, /* chop off the 802.11 CRC */ skb_trim(skb, skb->len - WLAN_CRC_LEN); - } /* -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/6] staging: wlan-ng: Logical continuation fixes
Logical continuation coding style issues fixed while condition checking Signed-off-by: Pranjal Bhor --- drivers/staging/wlan-ng/p80211conv.c | 47 ++-- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index 3121e1d..81f3624 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -153,8 +153,8 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, (struct wlan_snap *) skb_push(skb, sizeof(struct wlan_snap)); e_snap->type = htons(proto); - if (ethconv == WLAN_ETHCONV_8021h - && p80211_stt_findproto(proto)) { + if (ethconv == WLAN_ETHCONV_8021h && + p80211_stt_findproto(proto)) { memcpy(e_snap->oui, oui_8021h, WLAN_IEEE_OUI_LEN); } else { @@ -204,8 +204,8 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, p80211_wep->data = NULL; - if ((wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) - && (wlandev->hostwep & HOSTWEP_ENCRYPT)) { + if ((wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) && + (wlandev->hostwep & HOSTWEP_ENCRYPT)) { /* need to pick keynum other than default? */ p80211_wep->data = kmalloc(skb->len, GFP_ATOMIC); @@ -304,12 +304,12 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, if ((WLAN_GET_FC_TODS(fc) == 0) && (WLAN_GET_FC_FROMDS(fc) == 0)) { ether_addr_copy(daddr, w_hdr->a3.a1); ether_addr_copy(saddr, w_hdr->a3.a2); - } else if ((WLAN_GET_FC_TODS(fc) == 0) - && (WLAN_GET_FC_FROMDS(fc) == 1)) { + } else if ((WLAN_GET_FC_TODS(fc) == 0) && + (WLAN_GET_FC_FROMDS(fc) == 1)) { ether_addr_copy(daddr, w_hdr->a3.a1); ether_addr_copy(saddr, w_hdr->a3.a3); - } else if ((WLAN_GET_FC_TODS(fc) == 1) - && (WLAN_GET_FC_FROMDS(fc) == 0)) { + } else if ((WLAN_GET_FC_TODS(fc) == 1) && + (WLAN_GET_FC_FROMDS(fc) == 0)) { ether_addr_copy(daddr, w_hdr->a3.a3); ether_addr_copy(saddr, w_hdr->a3.a2); } else { @@ -324,8 +324,9 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, } /* perform de-wep if necessary.. */ - if ((wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) && WLAN_GET_FC_ISWEP(fc) - && (wlandev->hostwep & HOSTWEP_DECRYPT)) { + if ((wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) && + WLAN_GET_FC_ISWEP(fc) && + (wlandev->hostwep & HOSTWEP_DECRYPT)) { if (payload_length <= 8) { netdev_err(netdev, "WEP frame too short (%u).\n", skb->len); @@ -383,15 +384,15 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, skb_trim(skb, skb->len - WLAN_CRC_LEN); } else if ((payload_length >= sizeof(struct wlan_llc) + - sizeof(struct wlan_snap)) - && (e_llc->dsap == 0xaa) - && (e_llc->ssap == 0xaa) - && (e_llc->ctl == 0x03) - && - (((memcmp(e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN) == 0) -&& (ethconv == WLAN_ETHCONV_8021h) -&& (p80211_stt_findproto(le16_to_cpu(e_snap->type - || (memcmp(e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN) != + sizeof(struct wlan_snap)) && + (e_llc->dsap == 0xaa) && + (e_llc->ssap == 0xaa) && + (e_llc->ctl == 0x03) && + (((memcmp(e_snap->oui, oui_rfc1042, + WLAN_IEEE_OUI_LEN) == 0) && + (ethconv == WLAN_ETHCONV_8021h) && + (p80211_stt_findproto(le16_to_cpu(e_snap->type || + (memcmp(e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN) != 0))) { pr_debug("SNAP+RFC1042 len: %d\n", payload_length); /* it's a SNAP + RFC1042 frame && protocol is in STT */ @@ -419,10 +420,10 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, skb_trim(skb, skb->len - WLAN_CRC_LEN); } else if ((payload_length >= sizeof(struct wlan_llc) + - sizeof(struct wlan_snap)) - && (e_llc->dsap == 0xaa) - && (e_llc->ssap == 0xaa) - && (e_llc->ctl == 0x03)) { + sizeof(struct wlan_snap)) && + (e_llc->dsap == 0xaa) && + (e_llc->ssap == 0xaa) && + (e_llc->ctl == 0x03)) { pr_debug("802.1h/RFC1042 len: %d\n", payload_length)
[PATCH 4/6] staging: wlan-ng: Coding style fix for casting operation
Removed spaces after casting operating Signed-off-by: Pranjal Bhor --- drivers/staging/wlan-ng/p80211conv.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index 00d82e2..c4fd5b2 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -149,7 +149,7 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, /* tack on SNAP */ e_snap = - (struct wlan_snap *) skb_push(skb, + (struct wlan_snap *)skb_push(skb, sizeof(struct wlan_snap)); e_snap->type = htons(proto); if (ethconv == WLAN_ETHCONV_8021h && @@ -163,7 +163,7 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, /* tack on llc */ e_llc = - (struct wlan_llc *) skb_push(skb, + (struct wlan_llc *)skb_push(skb, sizeof(struct wlan_llc)); e_llc->dsap = 0xAA; /* SNAP, see IEEE 802 */ e_llc->ssap = 0xAA; @@ -294,7 +294,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, payload_length = skb->len - WLAN_HDR_A3_LEN - WLAN_CRC_LEN; payload_offset = WLAN_HDR_A3_LEN; - w_hdr = (union p80211_hdr *) skb->data; + w_hdr = (union p80211_hdr *)skb->data; /* setup some vars for convenience */ fc = le16_to_cpu(w_hdr->a3.fc); @@ -352,11 +352,11 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, wlandev->rx.decrypt++; } - e_hdr = (struct wlan_ethhdr *) (skb->data + payload_offset); + e_hdr = (struct wlan_ethhdr *)(skb->data + payload_offset); - e_llc = (struct wlan_llc *) (skb->data + payload_offset); + e_llc = (struct wlan_llc *)(skb->data + payload_offset); e_snap = - (struct wlan_snap *) (skb->data + payload_offset + + (struct wlan_snap *)(skb->data + payload_offset + sizeof(struct wlan_llc)); /* Test for the various encodings */ @@ -631,7 +631,7 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb) /* Overlay a frmmeta_t onto skb->cb */ memset(skb->cb, 0, sizeof(struct p80211_frmmeta)); - frmmeta = (struct p80211_frmmeta *) (skb->cb); + frmmeta = (struct p80211_frmmeta *)(skb->cb); frmmeta->magic = P80211_FRMMETA_MAGIC; frmmeta->rx = rxmeta; exit: -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/6] staging: wlan-ng: Open parenthesis alignment style fix
Alignment of lines matched with open parenthesis Signed-off-by: Pranjal Bhor --- drivers/staging/wlan-ng/p80211conv.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index c4fd5b2..81f0f06 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -215,8 +215,8 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, p80211_wep->iv, p80211_wep->icv); if (foo) { netdev_warn(wlandev->netdev, - "Host en-WEP failed, dropping frame (%d).\n", - foo); + "Host en-WEP failed, dropping frame (%d).\n", + foo); return 2; } fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1)); @@ -330,10 +330,10 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, return 1; } foo = wep_decrypt(wlandev, skb->data + payload_offset + 4, - payload_length - 8, -1, - skb->data + payload_offset, - skb->data + payload_offset + - payload_length - 4); + payload_length - 8, -1, + skb->data + payload_offset, + skb->data + payload_offset + + payload_length - 4); if (foo) { /* de-wep failed, drop skb. */ pr_debug("Host de-WEP failed, dropping frame (%d).\n", @@ -371,7 +371,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, /* A bogus length ethfrm has been encap'd. */ /* Is someone trying an oflow attack? */ netdev_err(netdev, "ENCAP frame too large (%d > %d)\n", - payload_length, netdev->mtu + ETH_HLEN); + payload_length, netdev->mtu + ETH_HLEN); return 1; } @@ -400,7 +400,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, /* A bogus length ethfrm has been sent. */ /* Is someone trying an oflow attack? */ netdev_err(netdev, "SNAP frame too large (%d > %d)\n", - payload_length, netdev->mtu); + payload_length, netdev->mtu); return 1; } @@ -433,9 +433,9 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, /* A bogus length ethfrm has been sent. */ /* Is someone trying an oflow attack? */ netdev_err(netdev, "DIXII frame too large (%ld > %d)\n", - (long int)(payload_length - - sizeof(struct wlan_llc) - - sizeof(struct wlan_snap)), netdev->mtu); + (long int)(payload_length - + sizeof(struct wlan_llc) - + sizeof(struct wlan_snap)), netdev->mtu); return 1; } @@ -468,7 +468,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, /* A bogus length ethfrm has been sent. */ /* Is someone trying an oflow attack? */ netdev_err(netdev, "OTHER frame too large (%d > %d)\n", - payload_length, netdev->mtu); + payload_length, netdev->mtu); return 1; } -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/6] staging: wlan-ng: NULL comparisons made elegant
Elegance added for NULL comparisons Signed-off-by: Pranjal Bhor --- drivers/staging/wlan-ng/p80211conv.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index 81f0f06..0a8f396 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -562,17 +562,17 @@ void p80211skb_rxmeta_detach(struct sk_buff *skb) struct p80211_frmmeta *frmmeta; /* Sanity checks */ - if (skb == NULL) { /* bad skb */ + if (!skb) { /* bad skb */ pr_debug("Called w/ null skb.\n"); return; } frmmeta = P80211SKB_FRMMETA(skb); - if (frmmeta == NULL) { /* no magic */ + if (!frmmeta) { /* no magic */ pr_debug("Called w/ bad frmmeta magic.\n"); return; } rxmeta = frmmeta->rx; - if (rxmeta == NULL) { /* bad meta ptr */ + if (!rxmeta) { /* bad meta ptr */ pr_debug("Called w/ bad rxmeta ptr.\n"); return; } @@ -608,7 +608,7 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb) struct p80211_frmmeta *frmmeta; /* If these already have metadata, we error out! */ - if (P80211SKB_RXMETA(skb) != NULL) { + if (P80211SKB_RXMETA(skb)) { netdev_err(wlandev->netdev, "%s: RXmeta already attached!\n", wlandev->name); result = 0; @@ -618,7 +618,7 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb) /* Allocate the rxmeta */ rxmeta = kzalloc(sizeof(struct p80211_rxmeta), GFP_ATOMIC); - if (rxmeta == NULL) { + if (!rxmeta) { netdev_err(wlandev->netdev, "%s: Failed to allocate rxmeta.\n", wlandev->name); result = 1; -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC 00/29] De-stage android's sync framework
2016-01-19 John Harrison : > On 19/01/2016 15:23, Gustavo Padovan wrote: > >Hi Daniel, > > > >2016-01-19 Daniel Vetter : > > > >>On Fri, Jan 15, 2016 at 12:55:10PM -0200, Gustavo Padovan wrote: > >>>From: Gustavo Padovan > >>> > >>>This patch series de-stage the sync framework, and in order to accomplish > >>>that > >>>a bunch of cleanups/improvements on the sync and fence were made. > >>> > >>>The sync framework contained some abstractions around struct fence and > >>>those > >>>were removed in the de-staging process among other changes: > >>> > >>>Userspace visible changes > >>>- > >>> > >>> * The sw_sync file was moved from /dev/sw_sync to > >>> /sync/sw_sync. No > >>> other change. > >>> > >>>Kernel API changes > >>>-- > >>> > >>> * struct sync_timeline is now struct fence_timeline > >>> * sync_timeline_ops is now fence_timeline_ops and they now carry struct > >>> fence as parameter instead of struct sync_pt > >>> * a .cleanup() fence op was added to allow sync_fence to run a cleanup > >>> when > >>> the fence_timeline is destroyed > >>> * added fence_add_used_data() to pass a private point to struct fence. > >>> This > >>> pointer is sent back on the .cleanup op. > >>> * The sync timeline function were moved to be fence_timeline functions: > >>>- sync_timeline_create() -> fence_timeline_create() > >>>- sync_timeline_get() -> fence_timeline_get() > >>>- sync_timeline_put() -> fence_timeline_put() > >>>- sync_timeline_destroy() -> fence_timeline_destroy() > >>>- sync_timeline_signal() -> fence_timeline_signal() > >>> > >>> * sync_pt_create() was replaced be fence_create_on_timeline() > >>> > >>>Internal changes > >>> > >>> > >>> * fence_timeline_ops was removed in favor of direct use fence_ops > >>> * fence default functions were created for fence_ops > >>> * removed structs sync_pt, sw_sync_timeline and sw_sync_pt > >>Bunch of fairly random comments all over: > >> > >>- include/uapi/linux/sw_sync.h imo should be dropped, it's just a private > >> debugfs interface between fence fds and the testsuite. Since the plan is > >> to have the testcases integrated into the kernel tree too we don't need > >> a public header. > >> > >>- similar for include/linux/sw_sync.h Imo that should all be moved into > >> sync_debug.c. Same for sw_sync.c, that should all land in sync_debug > >> imo, and made optional with a Kconfig option. At least we should reuse > >> CONFIG_DEBUGFS. > >These two items sounds reasonable to me. > > I have just posted our in-progress IGT for testing i915 syncs (with a CC of > Gustavo). It uses the sw_sync mechanisms. Can you take a quick look and see > if it is the kind of thing you would expect us to be doing? Or is it using > interfaces that you are planning to remove and/or make kernel only? > > I'm not sure having a kernel only test is the best way to go. Having user > land tests like IGT would be much more versatile. I agree with you, we should allow IGT and other test tools to access sw_sync. include/linux/sw_sync.h can be kept private, but the uapi one needs wil be needed for testing, unless we replicate the header file inside IGT, but not sure if it is a good idea. Gustavo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC 00/29] De-stage android's sync framework
On Tue, Jan 19, 2016 at 03:52:26PM -0200, Gustavo Padovan wrote: > 2016-01-19 John Harrison : > > > On 19/01/2016 15:23, Gustavo Padovan wrote: > > >Hi Daniel, > > > > > >2016-01-19 Daniel Vetter : > > > > > >>On Fri, Jan 15, 2016 at 12:55:10PM -0200, Gustavo Padovan wrote: > > >>>From: Gustavo Padovan > > >>> > > >>>This patch series de-stage the sync framework, and in order to > > >>>accomplish that > > >>>a bunch of cleanups/improvements on the sync and fence were made. > > >>> > > >>>The sync framework contained some abstractions around struct fence and > > >>>those > > >>>were removed in the de-staging process among other changes: > > >>> > > >>>Userspace visible changes > > >>>- > > >>> > > >>> * The sw_sync file was moved from /dev/sw_sync to > > >>> /sync/sw_sync. No > > >>> other change. > > >>> > > >>>Kernel API changes > > >>>-- > > >>> > > >>> * struct sync_timeline is now struct fence_timeline > > >>> * sync_timeline_ops is now fence_timeline_ops and they now carry struct > > >>> fence as parameter instead of struct sync_pt > > >>> * a .cleanup() fence op was added to allow sync_fence to run a cleanup > > >>> when > > >>> the fence_timeline is destroyed > > >>> * added fence_add_used_data() to pass a private point to struct fence. > > >>> This > > >>> pointer is sent back on the .cleanup op. > > >>> * The sync timeline function were moved to be fence_timeline functions: > > >>> - sync_timeline_create() -> fence_timeline_create() > > >>> - sync_timeline_get() -> fence_timeline_get() > > >>> - sync_timeline_put() -> fence_timeline_put() > > >>> - sync_timeline_destroy() -> fence_timeline_destroy() > > >>> - sync_timeline_signal() -> fence_timeline_signal() > > >>> > > >>> * sync_pt_create() was replaced be fence_create_on_timeline() > > >>> > > >>>Internal changes > > >>> > > >>> > > >>> * fence_timeline_ops was removed in favor of direct use fence_ops > > >>> * fence default functions were created for fence_ops > > >>> * removed structs sync_pt, sw_sync_timeline and sw_sync_pt > > >>Bunch of fairly random comments all over: > > >> > > >>- include/uapi/linux/sw_sync.h imo should be dropped, it's just a private > > >> debugfs interface between fence fds and the testsuite. Since the plan > > >> is > > >> to have the testcases integrated into the kernel tree too we don't need > > >> a public header. > > >> > > >>- similar for include/linux/sw_sync.h Imo that should all be moved into > > >> sync_debug.c. Same for sw_sync.c, that should all land in sync_debug > > >> imo, and made optional with a Kconfig option. At least we should reuse > > >> CONFIG_DEBUGFS. > > >These two items sounds reasonable to me. > > > > I have just posted our in-progress IGT for testing i915 syncs (with a CC of > > Gustavo). It uses the sw_sync mechanisms. Can you take a quick look and see > > if it is the kind of thing you would expect us to be doing? Or is it using > > interfaces that you are planning to remove and/or make kernel only? > > > > I'm not sure having a kernel only test is the best way to go. Having user > > land tests like IGT would be much more versatile. > > I agree with you, we should allow IGT and other test tools to access > sw_sync. include/linux/sw_sync.h can be kept private, but the uapi one > needs wil be needed for testing, unless we replicate the header file > inside IGT, but not sure if it is a good idea. We replicate all the debugfs stuff in igt that igt needs. uapi really only should be stuff that's guaranteed to stick around, not debug interfaces we are ok with breaking (if needed). -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v1 1/3] staging: rtl8188eu: provide an absolute path to include folder
On Tue, Jan 19, 2016 at 01:50:35PM +0200, Andy Shevchenko wrote: > On Thu, 2015-12-10 at 17:43 +0200, Andy Shevchenko wrote: > > Otherwise compiler will complain as follows > > > > CC [M] drivers/staging/rtl8188eu/core/rtw_ap.o > > cc1: warning: drivers/staging/rtl8188eu/include: No such file or > > directory [-Wmissing-include-dirs] > > Any comments on the series? It's in my queue, please wait for after 4.5-rc1 is out. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [patch] staging: rdma: shift wrapping bug in c2_get_dma_mr()
On 01/08/2016 08:29 AM, Christoph Hellwig wrote: > Looks fine. > > Doug: what's the status of the staged out drivers? I thought we were > going to delete them for 4.5? > I am. They will be going away shortly. -- Doug Ledford GPG KeyID: 0E572FDD signature.asc Description: OpenPGP digital signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC 00/29] De-stage android's sync framework
2016-01-19 Daniel Vetter : > On Tue, Jan 19, 2016 at 03:52:26PM -0200, Gustavo Padovan wrote: > > 2016-01-19 John Harrison : > > > > > On 19/01/2016 15:23, Gustavo Padovan wrote: > > > >Hi Daniel, > > > > > > > >2016-01-19 Daniel Vetter : > > > > > > > >>On Fri, Jan 15, 2016 at 12:55:10PM -0200, Gustavo Padovan wrote: > > > >>>From: Gustavo Padovan > > > >>> > > > >>>This patch series de-stage the sync framework, and in order to > > > >>>accomplish that > > > >>>a bunch of cleanups/improvements on the sync and fence were made. > > > >>> > > > >>>The sync framework contained some abstractions around struct fence and > > > >>>those > > > >>>were removed in the de-staging process among other changes: > > > >>> > > > >>>Userspace visible changes > > > >>>- > > > >>> > > > >>> * The sw_sync file was moved from /dev/sw_sync to > > > >>> /sync/sw_sync. No > > > >>> other change. > > > >>> > > > >>>Kernel API changes > > > >>>-- > > > >>> > > > >>> * struct sync_timeline is now struct fence_timeline > > > >>> * sync_timeline_ops is now fence_timeline_ops and they now carry > > > >>> struct > > > >>> fence as parameter instead of struct sync_pt > > > >>> * a .cleanup() fence op was added to allow sync_fence to run a > > > >>> cleanup when > > > >>> the fence_timeline is destroyed > > > >>> * added fence_add_used_data() to pass a private point to struct > > > >>> fence. This > > > >>> pointer is sent back on the .cleanup op. > > > >>> * The sync timeline function were moved to be fence_timeline > > > >>> functions: > > > >>>- sync_timeline_create() -> fence_timeline_create() > > > >>>- sync_timeline_get() -> fence_timeline_get() > > > >>>- sync_timeline_put() -> fence_timeline_put() > > > >>>- sync_timeline_destroy() -> fence_timeline_destroy() > > > >>>- sync_timeline_signal() -> fence_timeline_signal() > > > >>> > > > >>> * sync_pt_create() was replaced be fence_create_on_timeline() > > > >>> > > > >>>Internal changes > > > >>> > > > >>> > > > >>> * fence_timeline_ops was removed in favor of direct use fence_ops > > > >>> * fence default functions were created for fence_ops > > > >>> * removed structs sync_pt, sw_sync_timeline and sw_sync_pt > > > >>Bunch of fairly random comments all over: > > > >> > > > >>- include/uapi/linux/sw_sync.h imo should be dropped, it's just a > > > >>private > > > >> debugfs interface between fence fds and the testsuite. Since the > > > >> plan is > > > >> to have the testcases integrated into the kernel tree too we don't > > > >> need > > > >> a public header. > > > >> > > > >>- similar for include/linux/sw_sync.h Imo that should all be moved into > > > >> sync_debug.c. Same for sw_sync.c, that should all land in sync_debug > > > >> imo, and made optional with a Kconfig option. At least we should > > > >> reuse > > > >> CONFIG_DEBUGFS. > > > >These two items sounds reasonable to me. > > > > > > I have just posted our in-progress IGT for testing i915 syncs (with a CC > > > of > > > Gustavo). It uses the sw_sync mechanisms. Can you take a quick look and > > > see > > > if it is the kind of thing you would expect us to be doing? Or is it using > > > interfaces that you are planning to remove and/or make kernel only? > > > > > > I'm not sure having a kernel only test is the best way to go. Having user > > > land tests like IGT would be much more versatile. > > > > I agree with you, we should allow IGT and other test tools to access > > sw_sync. include/linux/sw_sync.h can be kept private, but the uapi one > > needs wil be needed for testing, unless we replicate the header file > > inside IGT, but not sure if it is a good idea. > > We replicate all the debugfs stuff in igt that igt needs. uapi really only > should be stuff that's guaranteed to stick around, not debug interfaces we > are ok with breaking (if needed). Okay, that sounds quite good for me. Gustavo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC 00/29] De-stage android's sync framework
2016-01-19 Daniel Vetter : > On Fri, Jan 15, 2016 at 12:55:10PM -0200, Gustavo Padovan wrote: > > From: Gustavo Padovan > > > > This patch series de-stage the sync framework, and in order to accomplish > > that > > a bunch of cleanups/improvements on the sync and fence were made. > > > > The sync framework contained some abstractions around struct fence and those > > were removed in the de-staging process among other changes: > > > > Userspace visible changes > > - > > > > * The sw_sync file was moved from /dev/sw_sync to /sync/sw_sync. > > No > > other change. > > > > Kernel API changes > > -- > > > > * struct sync_timeline is now struct fence_timeline > > * sync_timeline_ops is now fence_timeline_ops and they now carry struct > > fence as parameter instead of struct sync_pt > > * a .cleanup() fence op was added to allow sync_fence to run a cleanup when > > the fence_timeline is destroyed > > * added fence_add_used_data() to pass a private point to struct fence. This > > pointer is sent back on the .cleanup op. > > * The sync timeline function were moved to be fence_timeline functions: > > - sync_timeline_create() -> fence_timeline_create() > > - sync_timeline_get() -> fence_timeline_get() > > - sync_timeline_put() -> fence_timeline_put() > > - sync_timeline_destroy() -> fence_timeline_destroy() > > - sync_timeline_signal() -> fence_timeline_signal() > > > > * sync_pt_create() was replaced be fence_create_on_timeline() > > > > Internal changes > > > > > > * fence_timeline_ops was removed in favor of direct use fence_ops > > * fence default functions were created for fence_ops > > * removed structs sync_pt, sw_sync_timeline and sw_sync_pt > > Bunch of fairly random comments all over: > > - include/uapi/linux/sw_sync.h imo should be dropped, it's just a private > debugfs interface between fence fds and the testsuite. Since the plan is > to have the testcases integrated into the kernel tree too we don't need > a public header. > > - similar for include/linux/sw_sync.h Imo that should all be moved into > sync_debug.c. Same for sw_sync.c, that should all land in sync_debug > imo, and made optional with a Kconfig option. At least we should reuse > CONFIG_DEBUGFS. > > - fence_context and fence_timeline are really the same. timeline has some > super-basic support for doing sw-only fence timelines, but imo that's > not really worth keeping (and if so better to keep seperate in a > sw-fence.c or similar, like seqno-fence.c). The other main thing > timeline provides is support to clean up fences on a timeline. And imo > that cleanup should be done by the core fence support, not by the add-on > stuff. > > Interlude about fence cleanup on driver unload: > > Working drivers imo should never call timeline_destroy when there's still > an unsignalled fence around for that timeline/context. That just means > they're broken and failed to clean up all the pending work. So the problem > really is only what to do with fences where the driver disappeared, and > for that we essentially need a fence_revoke() function (which could be > called internally from timeline_free). So here's what I think > timeline_free should do: > > for_each_fence_on_timel() { > WARN_ON(!fence_is_signalled()); > > fence_revoke(fence); > } > > Implementing fence_revoke is a bit tricky since we need to make sure the > memory contained ->ops and similar stuff doesn't disappear. Simplest > option might be to grab a temporary reference (using > kref_get_unless_zero), and then exchange ->ops with one that has only a > release function. We don't need anything else as long as all fence_* > functions the kernel might call check for signalling correctly first > (fence_wait is broken at least). > > Or we just give up (for now) and declare module unload as slightly racy. > dma-buf is similar. An intermediate option might be to at least add a > THIS_MODULE reference to each fence (but that's a bit expensive ...). > > - back to timeline vs. context: I have no idea how to best clean up this > mess, but least painful option long-term is probably to switch over all > current users of fence_context_alloc to timelines and remove the plain > context interface. > > - Imo the interface in include/linux/sync.h is duplicating too much of > fence.h. I think the only bits we need are the refcounting, creating, > fd-install and that's it. Plus a macro to loop over all the fences in a > sync_fence. With that drivers will only ever deal with a pile of > struct fence, making implicit fencing (using the fence list in dma-buf) > and explicit fencing (using the fence list in sync_fence) much more > similar. > > And we can easily do that since no internal users ;-) > > - get_timeline_name and get_driver_name are imo too much indirection, just > add ->(drv_)name field to eac
Re: [RFC 00/29] De-stage android's sync framework
On Tue, Jan 19, 2016 at 06:10:40PM -0200, Gustavo Padovan wrote: > 2016-01-19 Daniel Vetter : > > - get_timeline_name and get_driver_name are imo too much indirection, just > > add ->(drv_)name field to each of these. > > I don't think is a good idea to change that now as there are other fence > users in the kernel using get_timeline_name and get_driver_name. What I > propose is try get rid of this when moving ops from fences to > fence_timeline. Makes sense. And yeah I only realized after sending that this wasn't added by your patches, just that your patches added the (core) users for it. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: goldfish: Add DMA support using dma_alloc_coherent
> Yes I will free it using dma_free_coherent. Why should devm_kzalloc > be > replaced with dma_alloc_coherent ? I was trying to replace _pa() Why keep allocating and freeing a buffer rather than having a single buffer allocated once (as it is in the old driver). Alan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] android: binder: Sanity check at binder ioctl
On Tue, 19 Jan 2016, Chen Feng wrote: > When a process fork a child process, we should not allow the > child process use the binder which opened by parent process. > > But if the binder-object creater is a thread of one process who exit, > the other thread can also use this binder-object normally. > We can distinguish this by the member proc->tsk->mm. > If the thread exit the tsk->mm will be NULL. > Why does exit_mm(), the point where tsk->mm == NULL, signify the point at which the binder can now be used by other threads? > proc->tsk->mm != current->mm && proc->tsk->mm > > So only allow the shared mm_struct to use the same binder-object and > check the existence of mm_struct. > > V2: Fix compile error for error commit > > Signed-off-by: Chen Feng > Signed-off-by: Wei Dong > Signed-off-by: Junmin Zhao > Reviewed-by: Zhuangluan Su > --- > drivers/android/binder.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > index a39e85f..279063c 100644 > --- a/drivers/android/binder.c > +++ b/drivers/android/binder.c > @@ -2736,6 +2736,8 @@ static long binder_ioctl(struct file *filp, unsigned > int cmd, unsigned long arg) > > /*pr_info("binder_ioctl: %d:%d %x %lx\n", > proc->pid, current->pid, cmd, arg);*/ > + if (unlikely(proc->tsk->mm != current->mm && proc->tsk->mm)) > + return -EINVAL; > > trace_binder_ioctl(cmd, arg); > I would imagine that you would want to do READ_ONCE(proc->tsk->mm) so you are guaranteed to be testing the same value. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8712: Remove unnecessary cast on void pointer
The conversion from void pointer to any other pointer type is guaranteed by the C programming language. The semantic patch used to find this: @r@ expression x; void* e; type T; identifier f; @@ ( *((T *)e) | ((T *)x)[...] | ((T *)x)->f | - (T *) e ) Signed-off-by: Lucas Tanure --- drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 45 ++--- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c index 7c346a4..c7f2e51 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c @@ -49,8 +49,7 @@ uint oid_rt_get_signal_quality_hdl(struct oid_par_priv *poid_par_priv) uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv) { - struct _adapter *padapter = (struct _adapter *) - (poid_par_priv->adapter_context); + struct _adapter *padapter = poid_par_priv->adapter_context; if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; @@ -66,8 +65,7 @@ uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv) uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv) { - struct _adapter *padapter = (struct _adapter *) - (poid_par_priv->adapter_context); + struct _adapter *padapter = poid_par_priv->adapter_context; if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; @@ -83,8 +81,7 @@ uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv) uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv) { - struct _adapter *padapter = (struct _adapter *) - (poid_par_priv->adapter_context); + struct _adapter *padapter = poid_par_priv->adapter_context; if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; @@ -115,8 +112,7 @@ uint oid_rt_get_rx_retry_hdl(struct oid_par_priv *poid_par_priv) uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv) { - struct _adapter *padapter = (struct _adapter *) - (poid_par_priv->adapter_context); + struct _adapter *padapter = poid_par_priv->adapter_context; if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; @@ -147,8 +143,7 @@ uint oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv *poid_par_priv) uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv) { - struct _adapter *padapter = (struct _adapter *) - (poid_par_priv->adapter_context); + struct _adapter *padapter = poid_par_priv->adapter_context; if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; @@ -172,8 +167,7 @@ uint oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv uint oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv) { - struct _adapter *padapter = (struct _adapter *) - (poid_par_priv->adapter_context); + struct _adapter *padapter = poid_par_priv->adapter_context; u32 preamblemode = 0; if (poid_par_priv->type_of_oid != QUERY_OID) @@ -202,8 +196,7 @@ uint oid_rt_get_ap_ip_hdl(struct oid_par_priv *poid_par_priv) uint oid_rt_get_channelplan_hdl(struct oid_par_priv *poid_par_priv) { - struct _adapter *padapter = (struct _adapter *) - (poid_par_priv->adapter_context); + struct _adapter *padapter = poid_par_priv->adapter_context; struct eeprom_priv *peeprompriv = &padapter->eeprompriv; if (poid_par_priv->type_of_oid != QUERY_OID) @@ -216,8 +209,7 @@ uint oid_rt_get_channelplan_hdl(struct oid_par_priv *poid_par_priv) uint oid_rt_set_channelplan_hdl(struct oid_par_priv *poid_par_priv) { - struct _adapter *padapter = (struct _adapter *) - (poid_par_priv->adapter_context); + struct _adapter *padapter = poid_par_priv->adapter_context; struct eeprom_priv *peeprompriv = &padapter->eeprompriv; if (poid_par_priv->type_of_oid != SET_OID) @@ -229,8 +221,7 @@ uint oid_rt_set_channelplan_hdl(struct oid_par_priv uint oid_rt_set_preamble_mode_hdl(struct oid_par_priv *poid_par_priv) { - struct _adapter *padapter = (struct _adapter *) - (poid_par_priv->adapter_context); + struct _adapter *padapter = poid_par_priv->adapter_context; u32 preamblemode = 0; if (poid_par_priv->type_of_oid != SET_OID) @@ -267,8 +258,7 @@ uint oid_rt_dedicate_probe_hdl(struct oid_par_priv uint oid_rt_get_total_tx_bytes_hdl(struct oid_p
Re: [PATCH] Staging: goldfish: Add DMA support using dma_alloc_coherent
On Tue, 19 Jan 2016, Alan Cox wrote: Yes I will free it using dma_free_coherent. Why should devm_kzalloc be replaced with dma_alloc_coherent ? I was trying to replace _pa() Why keep allocating and freeing a buffer rather than having a single buffer allocated once (as it is in the old driver). Yes I was planning to use dmam_alloc_coherent which will replace the combination of devm_kzalloc and _pa(). I also don't have to worry about freeing it later. Thanks, Shraddha Alan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wilc1000: remove redundant check in wilc_mq_recv
At the beginning of wilc_mq_recv, it is checked if pHandle->bExiting is false or true. There is no need to check it again at the middle of this function. So just remove it. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/wilc_msgqueue.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c index 098390c..abc780c 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.c +++ b/drivers/staging/wilc1000/wilc_msgqueue.c @@ -133,12 +133,6 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle, spin_unlock_irqrestore(&pHandle->strCriticalSection, flags); down(&pHandle->hSem); - - if (pHandle->bExiting) { - PRINT_ER("pHandle fail\n"); - return -EFAULT; - } - spin_lock_irqsave(&pHandle->strCriticalSection, flags); pstrMessage = pHandle->pstrMessageList; -- 2.6.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel