Re: [PATCH v3 1/3] staging: rtl8723bs: Resolve checkpatch error "that open brace { should be on the previous line" in the rtl8723 driver
On Sun, Jun 16, 2019 at 09:19:49AM -0700, Shobhit Kukreti wrote: > Cleaned up the code from the following files to get rid of > check patch error "that open brace { should be on the previous line" > > drivers/staging/rtl8723bs/os_dep/mlme_linux.c > drivers/staging/rtl8723bs/os_dep/recv_linux.c > drivers/staging/rtl8723bs/os_dep/rtw_proc.c > drivers/staging/rtl8723bs/os_dep/sdio_intf.c > drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c > > Signed-off-by: Shobhit Kukreti > --- > drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 15 +++-- > drivers/staging/rtl8723bs/os_dep/recv_linux.c | 77 > --- > drivers/staging/rtl8723bs/os_dep/rtw_proc.c | 6 +- > drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 15 ++--- > drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c | 24 +++ > 5 files changed, 49 insertions(+), 88 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c > b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c > index aa2499f..4631b68 100644 > --- a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c > +++ b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c > @@ -46,8 +46,7 @@ void rtw_os_indicate_connect(struct adapter *adapter) > struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); > > if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || > - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) > - { > + (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) { > rtw_cfg80211_ibss_indicate_connect(adapter); > } > else > @@ -77,8 +76,8 @@ void rtw_reset_securitypriv(struct adapter *adapter) > > spin_lock_bh(&adapter->security_key_mutex); > > - if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)/* > 802.1x */ > - { > + if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) { > /* 802.1x */ > + Why the blank line? And don't keep the comment on the right side, that's just a pain to work with. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC PATCH 0/8] staging: erofs: decompression inplace approach
On Tue, Jun 18, 2019 at 02:52:21PM +0800, Gao Xiang wrote: > > > On 2019/6/18 14:45, Greg Kroah-Hartman wrote: > > On Tue, Jun 18, 2019 at 02:18:00PM +0800, Gao Xiang wrote: > >> > >> > >> On 2019/6/18 13:47, Greg Kroah-Hartman wrote: > >>> On Tue, Jun 18, 2019 at 09:47:08AM +0800, Gao Xiang wrote: > > > On 2019/6/18 4:36, Greg Kroah-Hartman wrote: > > On Sat, Jun 15, 2019 at 02:16:11AM +0800, Gao Xiang wrote: > >> At last, this is RFC patch v1, which means it is not suitable for > >> merging soon... I'm still working on it, testing its stability > >> these days and hope these patches get merged for 5.3 LTS > >> (if 5.3 is a LTS version). > > > > Why would 5.3 be a LTS kernel? > > > > curious as to how you came up with that :) > > My personal thought is about one LTS kernel one year... > Usually 5 versions after the previous kernel...(4.4 -> 4.9 -> 4.14 -> > 4.19), > which is not suitable for all historical LTSs...just prepare for 5.3... > >>> > >>> I try to pick the "last" kernel that is released each year, which > >>> sometimes is 5 kernels, sometimes 4, sometimes 6, depending on the > >>> release cycle. > >>> > >>> So odds are it will be 5.4 for the next LTS kernel, but we will not know > >>> more until it gets closer to release time. > >> > >> Thanks for kindly explanation :) > >> > >> Anyway, I will test these patches, land to our commerical products and try > >> the best > >> efforts on making it more stable for Linux upstream to merge. > > > > Sounds great. > > > > But why do you need to add compression to get this code out of staging? > > Why not move it out now and then add compression and other new features > > to it then? > > Move out of staging could be over several linux versions since I'd like to get > majority fs people agreed to this. You never know until you try :) > Decompression inplace is an important part of erofs to show its performance > benefits over existed compress filesystems and I tend to merge it in advance. There is no requirement to show benefits over other filesystems in order to get it merged, but I understand the feeling. That's fine, we can wait, we are not going anywhere... thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC PATCH 0/8] staging: erofs: decompression inplace approach
On 2019/6/18 15:05, Greg Kroah-Hartman wrote: > On Tue, Jun 18, 2019 at 02:52:21PM +0800, Gao Xiang wrote: >> >> >> On 2019/6/18 14:45, Greg Kroah-Hartman wrote: >>> On Tue, Jun 18, 2019 at 02:18:00PM +0800, Gao Xiang wrote: On 2019/6/18 13:47, Greg Kroah-Hartman wrote: > On Tue, Jun 18, 2019 at 09:47:08AM +0800, Gao Xiang wrote: >> >> >> On 2019/6/18 4:36, Greg Kroah-Hartman wrote: >>> On Sat, Jun 15, 2019 at 02:16:11AM +0800, Gao Xiang wrote: At last, this is RFC patch v1, which means it is not suitable for merging soon... I'm still working on it, testing its stability these days and hope these patches get merged for 5.3 LTS (if 5.3 is a LTS version). >>> >>> Why would 5.3 be a LTS kernel? >>> >>> curious as to how you came up with that :) >> >> My personal thought is about one LTS kernel one year... >> Usually 5 versions after the previous kernel...(4.4 -> 4.9 -> 4.14 -> >> 4.19), >> which is not suitable for all historical LTSs...just prepare for 5.3... > > I try to pick the "last" kernel that is released each year, which > sometimes is 5 kernels, sometimes 4, sometimes 6, depending on the > release cycle. > > So odds are it will be 5.4 for the next LTS kernel, but we will not know > more until it gets closer to release time. Thanks for kindly explanation :) Anyway, I will test these patches, land to our commerical products and try the best efforts on making it more stable for Linux upstream to merge. >>> >>> Sounds great. >>> >>> But why do you need to add compression to get this code out of staging? >>> Why not move it out now and then add compression and other new features >>> to it then? >> >> Move out of staging could be over several linux versions since I'd like to >> get >> majority fs people agreed to this. > > You never know until you try :) Thanks for your encouragement :) Actually, I personally gave a brief talk on this year LSF/MM 2019 but since I cannot speak English well so the entire effect is not good enough :(... I will personally contact with important people ... to get their agreements on this file system soon. > >> Decompression inplace is an important part of erofs to show its performance >> benefits over existed compress filesystems and I tend to merge it in advance. > > There is no requirement to show benefits over other filesystems in order > to get it merged, but I understand the feeling. That's fine, we can > wait, we are not going anywhere... Thanks again. I am just proving that the erofs solution may be one of the best compression solutions in performance first scenerio :) Thanks, Gao Xiang > > thanks, > > greg k-h > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Patch v2] staging: rtl8723bs: os_dep: ioctl_linux: make use of kzalloc
On Tue, Jun 18, 2019 at 07:14:10AM +0530, Hariprasad Kelam wrote: > kmalloc with memset can be replaced with kzalloc. > > Signed-off-by: Hariprasad Kelam > - > changes in v2: Replace rtw_zmalloc with kzalloc > --- > --- The changelog should say something like: This patch is a cleanup which replaces rtw_malloc(wep_total_len) with kzalloc() and removes the memset(). The rtw_malloc() does GFP_ATOMIC allocations when in_atomic() is true. But as the comments for in_atomic() describe, the in_atomic() check should not be used in driver code. The in_atomic() check is not accurate when preempt is disabled. In this code we are not in IRQ context and we are not holding any spin_locks so GFP_KERNEL is safe. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: kpc2000: fix integer overflow with left shifts
From: Colin Ian King Currently there are several left shifts that are assigned to 64 bit unsigned longs where a signed int 1 is being shifted, resulting in an integer overflow. Fix this bit using the BIT_ULL macro to perform a 64 bit shift. Also clean up an overly long statement. Addresses-Coverity: ("Unintentional integer overflow") Fixes: 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics drivers") Signed-off-by: Colin Ian King --- drivers/staging/kpc2000/kpc2000/cell_probe.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c index 138d16bcf6e1..c124a836db27 100644 --- a/drivers/staging/kpc2000/kpc2000/cell_probe.c +++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c @@ -238,7 +238,7 @@ int kp2000_check_uio_irq(struct kp2000_device *pcard, u32 irq_num) { u64 interrupt_active = readq(pcard->sysinfo_regs_base + REG_INTERRUPT_ACTIVE); u64 interrupt_mask_inv = ~readq(pcard->sysinfo_regs_base + REG_INTERRUPT_MASK); - u64 irq_check_mask = (1 << irq_num); + u64 irq_check_mask = BIT_ULL(irq_num); if (interrupt_active & irq_check_mask) { // if it's active (interrupt pending) if (interrupt_mask_inv & irq_check_mask) {// and if it's not masked off @@ -257,7 +257,9 @@ irqreturn_t kuio_handler(int irq, struct uio_info *uioinfo) return IRQ_NONE; if (kp2000_check_uio_irq(kudev->pcard, kudev->cte.irq_base_num)) { - writeq((1 << kudev->cte.irq_base_num), kudev->pcard->sysinfo_regs_base + REG_INTERRUPT_ACTIVE); // Clear the active flag + /* Clear the active flag */ + writeq(BIT_ULL(kudev->cte.irq_base_num), + kudev->pcard->sysinfo_regs_base + REG_INTERRUPT_ACTIVE); return IRQ_HANDLED; } return IRQ_NONE; @@ -273,9 +275,9 @@ int kuio_irqcontrol(struct uio_info *uioinfo, s32 irq_on) mutex_lock(&pcard->sem); mask = readq(pcard->sysinfo_regs_base + REG_INTERRUPT_MASK); if (irq_on) - mask &= ~(1 << (kudev->cte.irq_base_num)); + mask &= ~(BIT_ULL(kudev->cte.irq_base_num)); else - mask |= (1 << (kudev->cte.irq_base_num)); + mask |= BIT_ULL(kudev->cte.irq_base_num); writeq(mask, pcard->sysinfo_regs_base + REG_INTERRUPT_MASK); mutex_unlock(&pcard->sem); -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
kernel BUG at drivers/android/binder_alloc.c:LINE! (4)
Hello, syzbot found the following crash on: HEAD commit:9e0babf2 Linux 5.2-rc5 git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=159e6121a0 kernel config: https://syzkaller.appspot.com/x/.config?x=d16883d6c7f0d717 dashboard link: https://syzkaller.appspot.com/bug?extid=3ae18325f96190606754 compiler: gcc (GCC) 9.0.0 20181231 (experimental) syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1119e431a0 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10f028c9a0 The bug was bisected to: commit bde4a19fc04f5f46298c86b1acb7a4af1d5f138d Author: Todd Kjos Date: Fri Feb 8 18:35:20 2019 + binder: use userspace pointer as base of buffer space bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=177250c9a0 final crash:https://syzkaller.appspot.com/x/report.txt?x=14f250c9a0 console output: https://syzkaller.appspot.com/x/log.txt?x=10f250c9a0 IMPORTANT: if you fix the bug, please add the following tag to the commit: Reported-by: syzbot+3ae18325f96190606...@syzkaller.appspotmail.com Fixes: bde4a19fc04f ("binder: use userspace pointer as base of buffer space") [ cut here ] kernel BUG at drivers/android/binder_alloc.c:1130! invalid opcode: [#1] PREEMPT SMP KASAN CPU: 0 PID: 8920 Comm: syz-executor933 Not tainted 5.2.0-rc5 #54 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:binder_alloc_do_buffer_copy+0xd6/0x510 drivers/android/binder_alloc.c:1130 Code: 02 00 0f 85 20 04 00 00 4d 8b 64 24 58 49 29 dc e8 bf 9d 1c fc 4c 89 e6 4c 89 ef e8 d4 9e 1c fc 4d 39 e5 76 07 e8 aa 9d 1c fc <0f> 0b e8 a3 9d 1c fc 4c 8b 75 d0 4d 29 ec 4c 89 e6 4c 89 f7 e8 b1 RSP: 0018:88808b91f4e0 EFLAGS: 00010293 RAX: 88809296c200 RBX: 20001000 RCX: 855423cf RDX: RSI: 855423b6 RDI: 0006 RBP: 88808b91f560 R08: 88809296c200 R09: 0008 R10: ed1011723f15 R11: 88808b91f8af R12: 0078 R13: 0008 R14: 00e8 R15: FS: 556e5940() GS:8880ae80() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: CR3: 8bd57000 CR4: 001406f0 DR0: DR1: DR2: DR3: DR6: fffe0ff0 DR7: 0400 Call Trace: binder_alloc_copy_from_buffer+0x37/0x42 drivers/android/binder_alloc.c:1176 binder_validate_ptr+0xcc/0x1d0 drivers/android/binder.c:2124 binder_transaction+0x2c9c/0x6620 drivers/android/binder.c:3308 binder_thread_write+0x64a/0x2820 drivers/android/binder.c:3794 binder_ioctl_write_read drivers/android/binder.c:4827 [inline] binder_ioctl+0x102f/0x1833 drivers/android/binder.c:5004 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x444a29 Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b d8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:7ffcbcd0fc28 EFLAGS: 0246 ORIG_RAX: 0010 RAX: ffda RBX: 7ffcbcd0fc30 RCX: 00444a29 RDX: 2440 RSI: c0306201 RDI: 0003 RBP: R08: R09: 00401310 R10: R11: 0246 R12: 00402730 R13: 004027c0 R14: R15: Modules linked in: ---[ end trace 3626e6aef2ad2274 ]--- RIP: 0010:binder_alloc_do_buffer_copy+0xd6/0x510 drivers/android/binder_alloc.c:1130 Code: 02 00 0f 85 20 04 00 00 4d 8b 64 24 58 49 29 dc e8 bf 9d 1c fc 4c 89 e6 4c 89 ef e8 d4 9e 1c fc 4d 39 e5 76 07 e8 aa 9d 1c fc <0f> 0b e8 a3 9d 1c fc 4c 8b 75 d0 4d 29 ec 4c 89 e6 4c 89 f7 e8 b1 RSP: 0018:88808b91f4e0 EFLAGS: 00010293 RAX: 88809296c200 RBX: 20001000 RCX: 855423cf RDX: RSI: 855423b6 RDI: 0006 RBP: 88808b91f560 R08: 88809296c200 R09: 0008 R10: ed1011723f15 R11: 88808b91f8af R12: 0078 R13: 0008 R14: 00e8 R15: FS: 556e5940() GS:8880ae80() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: CR3: 8bd57000 CR4: 001406f0 DR0: DR1: DR2: DR3: DR6: fffe0ff0 DR7: 0400 --- This bug is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more i
Re: kernel BUG at drivers/android/binder_alloc.c:LINE! (4)
It's weird that that binder_alloc_copy_from_buffer() is a void function. It would be easier to do the error handling at that point, instead of in the callers. It feels like we keep hitting similar bugs to this. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] ARM: tegra: Enable Tegra VDE driver in tegra_defconfig
The video decoder driver was tested by time and works absolutely fine. The reason why it is in staging is because it doesn't provide common V4L interface yet, this shouldn't stop driver enabling in the defconfig since our userspace (libvdpau-tegra) provides combined acceleration of decoding and displaying without use of V4L. Signed-off-by: Dmitry Osipenko --- arch/arm/configs/tegra_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig index 8f5c6a5b444c..a27592d3b1fa 100644 --- a/arch/arm/configs/tegra_defconfig +++ b/arch/arm/configs/tegra_defconfig @@ -250,6 +250,8 @@ CONFIG_KEYBOARD_NVEC=y CONFIG_SERIO_NVEC_PS2=y CONFIG_NVEC_POWER=y CONFIG_NVEC_PAZ00=y +CONFIG_STAGING_MEDIA=y +CONFIG_TEGRA_VDE=y CONFIG_TEGRA_IOMMU_GART=y CONFIG_TEGRA_IOMMU_SMMU=y CONFIG_ARCH_TEGRA_2x_SOC=y -- 2.22.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] ARM: dts: tegra30: Connect SMMU with Video Decoder Engine
Enable IOMMU support for the video decoder. Signed-off-by: Dmitry Osipenko --- arch/arm/boot/dts/tegra30.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi index 934caa83c8db..ce162125e7bf 100644 --- a/arch/arm/boot/dts/tegra30.dtsi +++ b/arch/arm/boot/dts/tegra30.dtsi @@ -424,6 +424,7 @@ clocks = <&tegra_car TEGRA30_CLK_VDE>; reset-names = "vde", "mc"; resets = <&tegra_car 61>, <&mc TEGRA30_MC_RESET_VDE>; + iommus = <&mc TEGRA_SWGROUP_VDE>; }; apbmisc@7800 { -- 2.22.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/4] staging: media: tegra-vde: Remove BIT() macro from UAPI header
The BIT macro isn't available in userspace. Checkpatch complains about shifts being used instead of the macro and people are starting to send patches without realizing that it's a UAPI header file. Hence let's replace the BIT macro with a hex values to make everyone happy. Signed-off-by: Dmitry Osipenko --- drivers/staging/media/tegra-vde/uapi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/tegra-vde/uapi.h b/drivers/staging/media/tegra-vde/uapi.h index a0dad1ed94ef..dd3e4a8c9f7e 100644 --- a/drivers/staging/media/tegra-vde/uapi.h +++ b/drivers/staging/media/tegra-vde/uapi.h @@ -6,8 +6,8 @@ #include #include -#define FLAG_B_FRAME BIT(0) -#define FLAG_REFERENCE BIT(1) +#define FLAG_B_FRAME 0x1 +#define FLAG_REFERENCE 0x2 struct tegra_vde_h264_frame { __s32 y_fd; -- 2.22.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] media: dt: bindings: tegra-vde: Document new optional IOMMU property
All NVIDIA Tegra SoC generations provide IOMMU support for the video decoder engine. Document new optional device-tree property that connects VDE with the IOMMU provider. Signed-off-by: Dmitry Osipenko --- Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt b/Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt index 7302e949e662..602169b8aa19 100644 --- a/Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt +++ b/Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt @@ -35,6 +35,7 @@ Optional properties: - resets : Must contain an entry for each entry in reset-names. - reset-names : Must include the following entries: - mc +- iommus: Must contain phandle to the IOMMU device node. Example: @@ -59,4 +60,5 @@ video-codec@6001a000 { clocks = <&tegra_car TEGRA20_CLK_VDE>; reset-names = "vde", "mc"; resets = <&tegra_car 61>, <&mc TEGRA20_MC_RESET_VDE>; + iommus = <&mc TEGRA_SWGROUP_VDE>; }; -- 2.22.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 0/4] NVIDIA Tegra Video Decoder driver improvements
Hello, This series cleans up some of minor shortcomings that are caused by checkpatch recommendations that are not very applicable for the driver. Then IOMMU support is added to the driver and now it can handle sparse memory buffers that GPU hands to VDE in a default kernel configuration on Tegra30+. Changelog: v2: - Fixed use-after-free bug and uninitialized-variable warning that were reported by smatch and pointed out by Hans Verkuil in the review comment to v1. - Fixed build failure when CONFIG_ARM_DMA_USE_IOMMU=y and tested this case properly (multi-platform kernel config). - Made some extra minor changes, prettifying code a tad more. Dmitry Osipenko (4): staging: media: tegra-vde: Remove BIT() macro from UAPI header staging: media: tegra-vde: Manually pack UAPI structures staging: media: tegra-vde: Add IOMMU support staging: media: tegra-vde: Defer dmabuf's unmapping drivers/staging/media/tegra-vde/Kconfig | 1 + drivers/staging/media/tegra-vde/Makefile | 1 + .../staging/media/tegra-vde/dmabuf-cache.c| 226 ++ drivers/staging/media/tegra-vde/iommu.c | 149 drivers/staging/media/tegra-vde/trace.h | 2 + drivers/staging/media/tegra-vde/uapi.h| 48 ++-- .../media/tegra-vde/{tegra-vde.c => vde.c}| 212 ++-- drivers/staging/media/tegra-vde/vde.h | 105 8 files changed, 581 insertions(+), 163 deletions(-) create mode 100644 drivers/staging/media/tegra-vde/dmabuf-cache.c create mode 100644 drivers/staging/media/tegra-vde/iommu.c rename drivers/staging/media/tegra-vde/{tegra-vde.c => vde.c} (88%) create mode 100644 drivers/staging/media/tegra-vde/vde.h -- 2.22.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 4/4] staging: media: tegra-vde: Defer dmabuf's unmapping
Frequent IOMMU remappings take about 50% of CPU usage because there is quite a lot to remap. Defer dmabuf's unmapping by 5 seconds in order to mitigate the mapping overhead which goes away completely and driver works as fast as in a case of a disabled IOMMU. The case of a disabled IOMMU should also benefit a tad from the caching since CPU cache maintenance that happens on dmabuf's attaching takes some resources. Signed-off-by: Dmitry Osipenko --- drivers/staging/media/tegra-vde/Makefile | 2 +- .../staging/media/tegra-vde/dmabuf-cache.c| 226 ++ drivers/staging/media/tegra-vde/iommu.c | 2 - drivers/staging/media/tegra-vde/vde.c | 143 +++ drivers/staging/media/tegra-vde/vde.h | 18 +- 5 files changed, 276 insertions(+), 115 deletions(-) create mode 100644 drivers/staging/media/tegra-vde/dmabuf-cache.c diff --git a/drivers/staging/media/tegra-vde/Makefile b/drivers/staging/media/tegra-vde/Makefile index c11867e28233..2827f7601de8 100644 --- a/drivers/staging/media/tegra-vde/Makefile +++ b/drivers/staging/media/tegra-vde/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 -tegra-vde-y := vde.o iommu.o +tegra-vde-y := vde.o iommu.o dmabuf-cache.o obj-$(CONFIG_TEGRA_VDE)+= tegra-vde.o diff --git a/drivers/staging/media/tegra-vde/dmabuf-cache.c b/drivers/staging/media/tegra-vde/dmabuf-cache.c new file mode 100644 index ..a93b317885bf --- /dev/null +++ b/drivers/staging/media/tegra-vde/dmabuf-cache.c @@ -0,0 +1,226 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * NVIDIA Tegra Video decoder driver + * + * Copyright (C) 2016-2019 GRATE-DRIVER project + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "vde.h" + +struct tegra_vde_cache_entry { + enum dma_data_direction dma_dir; + struct dma_buf_attachment *a; + struct delayed_work dwork; + struct tegra_vde *vde; + struct list_head list; + struct sg_table *sgt; + struct iova *iova; + unsigned int refcnt; +}; + +static void tegra_vde_release_entry(struct tegra_vde_cache_entry *entry) +{ + struct dma_buf *dmabuf = entry->a->dmabuf; + + WARN_ON_ONCE(entry->refcnt); + + if (entry->vde->domain) + tegra_vde_iommu_unmap(entry->vde, entry->iova); + + dma_buf_unmap_attachment(entry->a, entry->sgt, entry->dma_dir); + dma_buf_detach(dmabuf, entry->a); + dma_buf_put(dmabuf); + + list_del(&entry->list); + kfree(entry); +} + +static void tegra_vde_delayed_unmap(struct work_struct *work) +{ + struct tegra_vde_cache_entry *entry; + struct tegra_vde *vde; + + entry = container_of(work, struct tegra_vde_cache_entry, +dwork.work); + vde = entry->vde; + + mutex_lock(&vde->map_lock); + tegra_vde_release_entry(entry); + mutex_unlock(&vde->map_lock); +} + +int tegra_vde_dmabuf_cache_map(struct tegra_vde *vde, + struct dma_buf *dmabuf, + enum dma_data_direction dma_dir, + struct dma_buf_attachment **ap, + dma_addr_t *addrp) +{ + struct device *dev = vde->miscdev.parent; + struct dma_buf_attachment *attachment; + struct tegra_vde_cache_entry *entry; + struct sg_table *sgt; + struct iova *iova; + int err; + + mutex_lock(&vde->map_lock); + + list_for_each_entry(entry, &vde->map_list, list) { + if (entry->a->dmabuf != dmabuf) + continue; + + if (!cancel_delayed_work(&entry->dwork)) + continue; + + if (entry->dma_dir != dma_dir) + entry->dma_dir = DMA_BIDIRECTIONAL; + + dma_buf_put(dmabuf); + + if (vde->domain) + *addrp = iova_dma_addr(&vde->iova, entry->iova); + else + *addrp = sg_dma_address(entry->sgt->sgl); + + goto ref; + } + + attachment = dma_buf_attach(dmabuf, dev); + if (IS_ERR(attachment)) { + dev_err(dev, "Failed to attach dmabuf\n"); + err = PTR_ERR(attachment); + goto err_unlock; + } + + sgt = dma_buf_map_attachment(attachment, dma_dir); + if (IS_ERR(sgt)) { + dev_err(dev, "Failed to get dmabufs sg_table\n"); + err = PTR_ERR(sgt); + goto err_detach; + } + + if (!vde->domain && sgt->nents > 1) { + dev_err(dev, "Sparse DMA region is unsupported, please enable IOMMU\n"); + err = -EINVAL; + goto err_unmap; + } + + entry = kzalloc(sizeof(*entry), GFP_KERNEL); + if (!entry) { + err = -ENOMEM; + goto err_unmap; + } + + if (vde->domain) { + err = tegra_vde_iommu_map(
[PATCH v2 2/4] staging: media: tegra-vde: Manually pack UAPI structures
The __packed macro isn't available in userspace with the kernel headers. Checkpatch asks to use the macro, which is unwanted in a case of a UAPI header. There is no much benefit in a tight packing of the structures, hence let's pack them manually to cleanup things a tad. Note that there is no old-stable userspace that will suffer from this change, hence it's fine to change the ABI. In a result also more space is reserved for a possible future expansion of the UAPI as it was already shown that more fields will be needed for a later SoC generations. Suggested-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- drivers/staging/media/tegra-vde/tegra-vde.c | 13 +- drivers/staging/media/tegra-vde/uapi.h | 44 +++-- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c b/drivers/staging/media/tegra-vde/tegra-vde.c index a5020dbf6eef..cc4244da2705 100644 --- a/drivers/staging/media/tegra-vde/tegra-vde.c +++ b/drivers/staging/media/tegra-vde/tegra-vde.c @@ -795,7 +795,7 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde, { struct device *dev = vde->miscdev.parent; struct tegra_vde_h264_decoder_ctx ctx; - struct tegra_vde_h264_frame frames[17]; + struct tegra_vde_h264_frame *frames; struct tegra_vde_h264_frame __user *frames_user; struct video_frame *dpb_frames; struct dma_buf_attachment *bitstream_data_dmabuf_attachment; @@ -830,11 +830,17 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde, if (ret) return ret; + frames = kmalloc_array(ctx.dpb_frames_nb, sizeof(*frames), GFP_KERNEL); + if (!frames) { + ret = -ENOMEM; + goto release_bitstream_dmabuf; + } + dpb_frames = kcalloc(ctx.dpb_frames_nb, sizeof(*dpb_frames), GFP_KERNEL); if (!dpb_frames) { ret = -ENOMEM; - goto release_bitstream_dmabuf; + goto free_frames; } macroblocks_nb = ctx.pic_width_in_mbs * ctx.pic_height_in_mbs; @@ -955,6 +961,9 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde, free_dpb_frames: kfree(dpb_frames); +free_frames: + kfree(frames); + release_bitstream_dmabuf: tegra_vde_detach_and_put_dmabuf(bitstream_data_dmabuf_attachment, bitstream_sgt, DMA_TO_DEVICE); diff --git a/drivers/staging/media/tegra-vde/uapi.h b/drivers/staging/media/tegra-vde/uapi.h index dd3e4a8c9f7e..ffb4983e5bb6 100644 --- a/drivers/staging/media/tegra-vde/uapi.h +++ b/drivers/staging/media/tegra-vde/uapi.h @@ -21,40 +21,42 @@ struct tegra_vde_h264_frame { __u32 frame_num; __u32 flags; - __u32 reserved; -} __attribute__((packed)); + // Must be zero'ed + __u32 reserved[6]; +}; struct tegra_vde_h264_decoder_ctx { __s32 bitstream_data_fd; __u32 bitstream_data_offset; __u64 dpb_frames_ptr; - __u8 dpb_frames_nb; - __u8 dpb_ref_frames_with_earlier_poc_nb; + __u32 dpb_frames_nb; + __u32 dpb_ref_frames_with_earlier_poc_nb; // SPS - __u8 baseline_profile; - __u8 level_idc; - __u8 log2_max_pic_order_cnt_lsb; - __u8 log2_max_frame_num; - __u8 pic_order_cnt_type; - __u8 direct_8x8_inference_flag; - __u8 pic_width_in_mbs; - __u8 pic_height_in_mbs; + __u32 baseline_profile; + __u32 level_idc; + __u32 log2_max_pic_order_cnt_lsb; + __u32 log2_max_frame_num; + __u32 pic_order_cnt_type; + __u32 direct_8x8_inference_flag; + __u32 pic_width_in_mbs; + __u32 pic_height_in_mbs; // PPS - __u8 pic_init_qp; - __u8 deblocking_filter_control_present_flag; - __u8 constrained_intra_pred_flag; - __u8 chroma_qp_index_offset; - __u8 pic_order_present_flag; + __u32 pic_init_qp; + __u32 deblocking_filter_control_present_flag; + __u32 constrained_intra_pred_flag; + __u32 chroma_qp_index_offset; + __u32 pic_order_present_flag; // Slice header - __u8 num_ref_idx_l0_active_minus1; - __u8 num_ref_idx_l1_active_minus1; + __u32 num_ref_idx_l0_active_minus1; + __u32 num_ref_idx_l1_active_minus1; - __u32 reserved; -} __attribute__((packed)); + // Must be zero'ed + __u32 reserved[11]; +}; #define VDE_IOCTL_BASE ('v' + 0x20) -- 2.22.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 3/4] staging: media: tegra-vde: Add IOMMU support
All Tegra's could provide memory isolation for the video decoder hardware using IOMMU, it is also required for Tegra30+ in order to handle sparse dmabuf's which GPU exports in a default kernel configuration. Inspired-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- drivers/staging/media/tegra-vde/Kconfig | 1 + drivers/staging/media/tegra-vde/Makefile | 1 + drivers/staging/media/tegra-vde/iommu.c | 151 ++ drivers/staging/media/tegra-vde/trace.h | 2 + .../media/tegra-vde/{tegra-vde.c => vde.c}| 188 +- drivers/staging/media/tegra-vde/vde.h | 89 + 6 files changed, 339 insertions(+), 93 deletions(-) create mode 100644 drivers/staging/media/tegra-vde/iommu.c rename drivers/staging/media/tegra-vde/{tegra-vde.c => vde.c} (91%) create mode 100644 drivers/staging/media/tegra-vde/vde.h diff --git a/drivers/staging/media/tegra-vde/Kconfig b/drivers/staging/media/tegra-vde/Kconfig index ff8e846cd15d..2e7f644ae591 100644 --- a/drivers/staging/media/tegra-vde/Kconfig +++ b/drivers/staging/media/tegra-vde/Kconfig @@ -3,6 +3,7 @@ config TEGRA_VDE tristate "NVIDIA Tegra Video Decoder Engine driver" depends on ARCH_TEGRA || COMPILE_TEST select DMA_SHARED_BUFFER + select IOMMU_IOVA if IOMMU_SUPPORT select SRAM help Say Y here to enable support for the NVIDIA Tegra video decoder diff --git a/drivers/staging/media/tegra-vde/Makefile b/drivers/staging/media/tegra-vde/Makefile index 7f9020e634f3..c11867e28233 100644 --- a/drivers/staging/media/tegra-vde/Makefile +++ b/drivers/staging/media/tegra-vde/Makefile @@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 +tegra-vde-y := vde.o iommu.o obj-$(CONFIG_TEGRA_VDE)+= tegra-vde.o diff --git a/drivers/staging/media/tegra-vde/iommu.c b/drivers/staging/media/tegra-vde/iommu.c new file mode 100644 index ..ddc281b82e5c --- /dev/null +++ b/drivers/staging/media/tegra-vde/iommu.c @@ -0,0 +1,151 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * NVIDIA Tegra Video decoder driver + * + * Copyright (C) 2016-2019 GRATE-DRIVER project + */ + +#include +#include +#include +#include + +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) +#include +#endif + +#include "vde.h" + +int tegra_vde_iommu_map(struct tegra_vde *vde, + struct sg_table *sgt, + struct iova **iovap, + dma_addr_t *addrp, + size_t size) +{ + struct iova *iova; + unsigned long shift; + unsigned long end; + dma_addr_t addr; + + end = vde->domain->geometry.aperture_end; + size = iova_align(&vde->iova, size); + shift = iova_shift(&vde->iova); + + iova = alloc_iova(&vde->iova, size >> shift, end >> shift, true); + if (!iova) + return -ENOMEM; + + addr = iova_dma_addr(&vde->iova, iova); + + size = iommu_map_sg(vde->domain, addr, sgt->sgl, sgt->nents, + IOMMU_READ | IOMMU_WRITE); + if (!size) { + __free_iova(&vde->iova, iova); + return -ENXIO; + } + + *iovap = iova; + *addrp = addr; + + return 0; +} + +void tegra_vde_iommu_unmap(struct tegra_vde *vde, struct iova *iova) +{ + unsigned long shift = iova_shift(&vde->iova); + unsigned long size = iova_size(iova) << shift; + dma_addr_t addr = iova_dma_addr(&vde->iova, iova); + + iommu_unmap(vde->domain, addr, size); + __free_iova(&vde->iova, iova); +} + +int tegra_vde_iommu_init(struct tegra_vde *vde) +{ + struct device *dev = vde->miscdev.parent; + struct iova *iova; + unsigned long order; + unsigned long shift; + int err; + + vde->group = iommu_group_get(dev); + if (!vde->group) + return 0; + +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) + if (dev->archdata.mapping) { + struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); + + arm_iommu_detach_device(dev); + arm_iommu_release_mapping(mapping); + } +#endif + vde->domain = iommu_domain_alloc(&platform_bus_type); + if (!vde->domain) { + err = -ENOMEM; + goto put_group; + } + + err = iova_cache_get(); + if (err) + goto free_domain; + + order = __ffs(vde->domain->pgsize_bitmap); + init_iova_domain(&vde->iova, 1UL << order, 0); + + err = iommu_attach_group(vde->domain, vde->group); + if (err) + goto put_iova; + + /* +* We're using some static addresses that are not accessible by VDE +* to trap invalid memory accesses. +*/ + shift = iova_shift(&vde->iova); + iova = reserve_iova(&vde->iova, 0x6000 >> shift, + 0x7000 >> shift); + if (!iova) { + err = -ENOMEM; + goto detach_gr
[PATCH] staging: rtl8712: rtl87x_io : make use of kzalloc
kmalloc followed by memset can be replaced with kzalloc. Signed-off-by: Hariprasad Kelam --- drivers/staging/rtl8712/rtl871x_io.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_io.c b/drivers/staging/rtl8712/rtl871x_io.c index 17dafef..87024d6 100644 --- a/drivers/staging/rtl8712/rtl871x_io.c +++ b/drivers/staging/rtl8712/rtl871x_io.c @@ -107,13 +107,11 @@ uint r8712_alloc_io_queue(struct _adapter *adapter) INIT_LIST_HEAD(&pio_queue->processing); INIT_LIST_HEAD(&pio_queue->pending); spin_lock_init(&pio_queue->lock); - pio_queue->pallocated_free_ioreqs_buf = kmalloc(NUM_IOREQ * + pio_queue->pallocated_free_ioreqs_buf = kzalloc(NUM_IOREQ * (sizeof(struct io_req)) + 4, GFP_ATOMIC); if ((pio_queue->pallocated_free_ioreqs_buf) == NULL) goto alloc_io_queue_fail; - memset(pio_queue->pallocated_free_ioreqs_buf, 0, - (NUM_IOREQ * (sizeof(struct io_req)) + 4)); pio_queue->free_ioreqs_buf = pio_queue->pallocated_free_ioreqs_buf + 4 - ((addr_t)(pio_queue->pallocated_free_ioreqs_buf) & 3); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8192u: ieee80211: Remove redundant memset
alloc_etherdev function internally calls kvzalloc . So we may not need explicit memset after this call. Signed-off-by: Hariprasad Kelam --- drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index 3532ea9..4a6c3f6 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -109,7 +109,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv) } ieee = netdev_priv(dev); - memset(ieee, 0, sizeof(struct ieee80211_device) + sizeof_priv); ieee->dev = dev; err = ieee80211_networks_allocate(ieee); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8192e: rtllib_module: Remove redundant memset
alloc_etherdev function internally calls kvzalloc . So we may not need explicit memset after this call. Signed-off-by: Hariprasad Kelam --- drivers/staging/rtl8192e/rtllib_module.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c index bb13b1d..64d9fee 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c @@ -83,7 +83,6 @@ struct net_device *alloc_rtllib(int sizeof_priv) return NULL; } ieee = (struct rtllib_device *)netdev_priv_rsl(dev); - memset(ieee, 0, sizeof(struct rtllib_device) + sizeof_priv); ieee->dev = dev; err = rtllib_networks_allocate(ieee); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wilc1000: Remove redundant memset
alloc_etherdev function internally calls kvzalloc . So we may not need explicit memset after this call. Signed-off-by: Hariprasad Kelam --- drivers/staging/wilc1000/wilc_netdev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_netdev.c b/drivers/staging/wilc1000/wilc_netdev.c index ba78c08..c4efec2 100644 --- a/drivers/staging/wilc1000/wilc_netdev.c +++ b/drivers/staging/wilc1000/wilc_netdev.c @@ -1010,7 +1010,6 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, } vif = netdev_priv(ndev); - memset(vif, 0, sizeof(struct wilc_vif)); if (i == 0) { strcpy(ndev->name, "wlan%d"); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/4] staging: media: tegra-vde: Remove BIT() macro from UAPI header
On Tue, 2019-06-18 at 11:23 -0700, Joe Perches wrote: > > include/uapi/linux/nl80211.h: * bitmask of BIT(NL80211_BAND_*) as described > in %enum > > That's a comment :P johannes ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/4] staging: media: tegra-vde: Remove BIT() macro from UAPI header
On Tue, 2019-06-18 at 20:37 +0200, Johannes Berg wrote: > On Tue, 2019-06-18 at 11:23 -0700, Joe Perches wrote: > > include/uapi/linux/nl80211.h: * bitmask of BIT(NL80211_BAND_*) as described > > in %enum > > > > > That's a comment :P That's true and that's nice. It was a casual grep and the comment should probably be improved anyway. cheers, Joe ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] staging: rtl8723bs: hal: rtl8723b_cmd: fix Comparison to NULL
This patch fixes below issues reported by checkpatch CHECK: Comparison to NULL could be written "psta" CHECK: Comparison to NULL could be written "pmlmepriv->wps_probe_resp_ie" CHECK: Comparison to NULL could be written "psta" Signed-off-by: Hariprasad Kelam --- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index e001d30..ceb317f 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -436,7 +436,7 @@ static void ConstructARPResponse( DBG_871X("%s(): Add MIC\n", __func__); psta = rtw_get_stainfo(&padapter->stapriv, get_my_bssid(&(pmlmeinfo->network))); - if (psta != NULL) { + if (psta) { if (!memcmp(&psta->dot11tkiptxmickey.skey[0], null_key, 16)) { DBG_871X("%s(): STA dot11tkiptxmickey == 0\n", __func__); } @@ -753,7 +753,7 @@ static void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen); /* inerset & update wps_probe_resp_ie */ - if ((pmlmepriv->wps_probe_resp_ie != NULL) && pwps_ie && (wps_ielen > 0)) { + if (pmlmepriv->wps_probe_resp_ie && pwps_ie && (wps_ielen > 0)) { uint wps_offset, remainder_ielen; u8 *premainder_ie; @@ -1316,7 +1316,7 @@ static void rtl8723b_set_FwWoWlanRelated_cmd(struct adapter *padapter, u8 enable if (!(ppwrpriv->wowlan_pno_enable)) { psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); - if (psta != NULL) + if (psta) rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); } else DBG_871X("%s(): Disconnected, no FwMediaStatusRpt CONNECT\n", __func__); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] staging: rtl8723bs: hal: rtl8723b_cmd: fix comparison to true is error prone
this patch fixes below issues reported by checkpatch CHECK: Using comparison to true is error prone CHECK: Using comparison to false is error prone Signed-off-by: Hariprasad Kelam --- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c index ceb317f..48efbfd 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c @@ -73,7 +73,7 @@ s32 FillH2CCmd8723B(struct adapter *padapter, u8 ElementID, u32 CmdLen, u8 *pCmd goto exit; } - if (padapter->bSurpriseRemoved == true) + if (padapter->bSurpriseRemoved) goto exit; /* pay attention to if race condition happened in H2C cmd setting. */ @@ -297,7 +297,7 @@ static void ConstructNullFunctionData( SetSeqNum(pwlanhdr, 0); - if (bQoS == true) { + if (bQoS) { struct ieee80211_qos_hdr *pwlanqoshdr; SetFrameSubType(pframe, WIFI_QOS_DATA_NULL); @@ -1071,7 +1071,7 @@ void rtl8723b_set_FwPwrMode_cmd(struct adapter *padapter, u8 psmode) SET_8723B_H2CCMD_PWRMODE_PARM_PWR_STATE(u1H2CPwrModeParm, PowerState); SET_8723B_H2CCMD_PWRMODE_PARM_BYTE5(u1H2CPwrModeParm, byte5); if (psmode != PS_MODE_ACTIVE) { - if (pmlmeext->adaptive_tsf_done == false && pmlmeext->bcn_cnt > 0) { + if (!pmlmeext->adaptive_tsf_done && pmlmeext->bcn_cnt > 0) { u8 ratio_20_delay, ratio_80_delay; /* byte 6 for adaptive_early_32k */ @@ -1252,7 +1252,7 @@ static void rtl8723b_set_FwRemoteWakeCtrl_Cmd(struct adapter *padapter, u8 benab FillH2CCmd8723B(padapter, H2C_8723B_REMOTE_WAKE_CTRL, H2C_REMOTE_WAKE_CTRL_LEN, u1H2CRemoteWakeCtrlParm); #ifdef CONFIG_PNO_SUPPORT - if (ppwrpriv->wowlan_pno_enable && ppwrpriv->pno_in_resume == false) { + if (ppwrpriv->wowlan_pno_enable && !ppwrpriv->pno_in_resume) { res = rtw_read8(padapter, REG_PNO_STATUS); DBG_871X("cmd: 0x81 REG_PNO_STATUS: 0x%02x\n", res); while (!(res&BIT(7)) && count < 25) { @@ -1671,7 +1671,7 @@ static void rtl8723b_set_FwRsvdPagePkt( #endif /* CONFIG_WOWLAN */ { #ifdef CONFIG_PNO_SUPPORT - if (pwrctl->pno_in_resume == false && pwrctl->pno_inited == true) { + if (!pwrctl->pno_in_resume && pwrctl->pno_inited) { /* Probe Request */ RsvdPageLoc.LocProbePacket = TotalPageNum; ConstructProbeReq( @@ -2119,7 +2119,7 @@ static void ConstructBtNullFunctionData( SetDuration(pwlanhdr, 0); SetSeqNum(pwlanhdr, 0); - if (bQoS == true) { + if (bQoS) { struct ieee80211_qos_hdr *pwlanqoshdr; SetFrameSubType(pframe, WIFI_QOS_DATA_NULL); @@ -2307,7 +2307,7 @@ void rtl8723b_download_BTCoex_AP_mode_rsvd_page(struct adapter *padapter) } while (!bcn_valid && (poll%10) != 0 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); } while (!bcn_valid && (DLBcnCount <= 100) && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); - if (true == bcn_valid) { + if (bcn_valid) { struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); pwrctl->fw_psmode_iface_id = padapter->iface_id; DBG_8192C(ADPT_FMT": DL RSVD page success! DLBcnCount:%d, poll:%d\n", -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[driver-core:debugfs_cleanup 151/155] drivers/gpio/gpio-mockup.c:336:4: error: label 'err' used but not defined
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git debugfs_cleanup head: b1494ab6cdfdf79167ae2e9054d57e86a4130f5f commit: 13e71424e523cd0da6095ac037ed2ecdf0424f68 [151/155] gpio: mockup: no need to check return value of debugfs_create functions config: xtensa-allyesconfig (attached as .config) compiler: xtensa-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 13e71424e523cd0da6095ac037ed2ecdf0424f68 # save the attached .config to linux build tree GCC_VERSION=7.4.0 make.cross ARCH=xtensa If you fix the issue, kindly add following tag Reported-by: kbuild test robot All errors (new ones prefixed by >>): drivers/gpio/gpio-mockup.c: In function 'gpio_mockup_debugfs_setup': >> drivers/gpio/gpio-mockup.c:336:4: error: label 'err' used but not defined goto err; ^~~~ drivers/gpio/gpio-mockup.c:318:17: warning: unused variable 'evfile' [-Wunused-variable] struct dentry *evfile; ^~ vim +/err +336 drivers/gpio/gpio-mockup.c 9202ba23 Bartosz Golaszewski 2017-02-06 313 9202ba23 Bartosz Golaszewski 2017-02-06 314 static void gpio_mockup_debugfs_setup(struct device *dev, 9202ba23 Bartosz Golaszewski 2017-02-06 315 struct gpio_mockup_chip *chip) 9202ba23 Bartosz Golaszewski 2017-02-06 316 { 9202ba23 Bartosz Golaszewski 2017-02-06 317struct gpio_mockup_dbgfs_private *priv; d51ee07a Bartosz Golaszewski 2019-01-17 318struct dentry *evfile; 9202ba23 Bartosz Golaszewski 2017-02-06 319struct gpio_chip *gc; ca8792af Bartosz Golaszewski 2017-11-27 320const char *devname; 9202ba23 Bartosz Golaszewski 2017-02-06 321char *name; 9202ba23 Bartosz Golaszewski 2017-02-06 322int i; 9202ba23 Bartosz Golaszewski 2017-02-06 323 9202ba23 Bartosz Golaszewski 2017-02-06 324gc = &chip->gc; ca8792af Bartosz Golaszewski 2017-11-27 325devname = dev_name(&gc->gpiodev->dev); 9202ba23 Bartosz Golaszewski 2017-02-06 326 ca8792af Bartosz Golaszewski 2017-11-27 327chip->dbg_dir = debugfs_create_dir(devname, gpio_mockup_dbg_dir); 9202ba23 Bartosz Golaszewski 2017-02-06 328 9202ba23 Bartosz Golaszewski 2017-02-06 329for (i = 0; i < gc->ngpio; i++) { 9202ba23 Bartosz Golaszewski 2017-02-06 330name = devm_kasprintf(dev, GFP_KERNEL, "%d", i); 9202ba23 Bartosz Golaszewski 2017-02-06 331if (!name) 9202ba23 Bartosz Golaszewski 2017-02-06 332goto err; 9202ba23 Bartosz Golaszewski 2017-02-06 333 9202ba23 Bartosz Golaszewski 2017-02-06 334priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 9202ba23 Bartosz Golaszewski 2017-02-06 335if (!priv) 9202ba23 Bartosz Golaszewski 2017-02-06 @336goto err; 9202ba23 Bartosz Golaszewski 2017-02-06 337 9202ba23 Bartosz Golaszewski 2017-02-06 338priv->chip = chip; 9202ba23 Bartosz Golaszewski 2017-02-06 339priv->offset = i; 9202ba23 Bartosz Golaszewski 2017-02-06 340priv->desc = &gc->gpiodev->descs[i]; 9202ba23 Bartosz Golaszewski 2017-02-06 341 13e71424 Greg Kroah-Hartman 2019-06-18 342 debugfs_create_file(name, 0200, chip->dbg_dir, priv, 2a9e2740 Bartosz Golaszewski 2019-01-17 343 &gpio_mockup_debugfs_ops); 9202ba23 Bartosz Golaszewski 2017-02-06 344} 9202ba23 Bartosz Golaszewski 2017-02-06 345 9202ba23 Bartosz Golaszewski 2017-02-06 346return; 9202ba23 Bartosz Golaszewski 2017-02-06 347 } 9202ba23 Bartosz Golaszewski 2017-02-06 348 :: The code at line 336 was first introduced by commit :: 9202ba2397d1ded79078606c6921787b27a85e1a gpio: mockup: implement event injecting over debugfs :: TO: Bartosz Golaszewski :: CC: Linus Walleij --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/4] staging: media: tegra-vde: Remove BIT() macro from UAPI header
On Tue, 2019-06-18 at 19:14 +0300, Dmitry Osipenko wrote: > The BIT macro isn't available in userspace. Checkpatch complains about > shifts being used instead of the macro and people are starting to send > patches without realizing that it's a UAPI header file. Hence let's > replace the BIT macro with a hex values to make everyone happy. > > Signed-off-by: Dmitry Osipenko > --- > drivers/staging/media/tegra-vde/uapi.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/media/tegra-vde/uapi.h > b/drivers/staging/media/tegra-vde/uapi.h > index a0dad1ed94ef..dd3e4a8c9f7e 100644 > --- a/drivers/staging/media/tegra-vde/uapi.h > +++ b/drivers/staging/media/tegra-vde/uapi.h > @@ -6,8 +6,8 @@ > #include > #include > > -#define FLAG_B_FRAME BIT(0) > -#define FLAG_REFERENCE BIT(1) > +#define FLAG_B_FRAME 0x1 > +#define FLAG_REFERENCE 0x2 > > struct tegra_vde_h264_frame { > __s32 y_fd; The BIT macro is already used quite a bit in uapi headers. I imagine all those need fixup... $ git grep -P '\bBIT\s*\(' include/uapi include/uapi/linux/bpf.h:#define BPF_FIB_LOOKUP_DIRECT BIT(0) include/uapi/linux/bpf.h:#define BPF_FIB_LOOKUP_OUTPUT BIT(1) include/uapi/linux/coresight-stm.h:#define STM_FLAG_TIMESTAMPED BIT(3) include/uapi/linux/coresight-stm.h:#define STM_FLAG_GUARANTEEDBIT(7) include/uapi/linux/nl80211.h: * bitmask of BIT(NL80211_BAND_*) as described in %enum include/uapi/linux/pkt_sched.h:#define TC_ETF_DEADLINE_MODE_ON BIT(0) include/uapi/linux/pkt_sched.h:#define TC_ETF_OFFLOAD_ONBIT(1) include/uapi/linux/psci.h:#define PSCI_1_0_OS_INITIATED BIT(0) include/uapi/linux/serio.h:#define SERIO_TIMEOUTBIT(0) include/uapi/linux/serio.h:#define SERIO_PARITY BIT(1) include/uapi/linux/serio.h:#define SERIO_FRAME BIT(2) include/uapi/linux/serio.h:#define SERIO_OOB_DATA BIT(3) include/uapi/linux/tc_act/tc_ctinfo.h: CTINFO_MODE_DSCP= BIT(0), include/uapi/linux/tc_act/tc_ctinfo.h: CTINFO_MODE_CPMARK = BIT(1) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V5 00/16] use sg helper to operate scatterlist
Hi Ming, > So convert drivers to use scatterlist helper. I applied this series with a bunch of edits and clarifying comments. It was quite the nightmare to rebase 5.3/scsi-queue to satisfy the ordering requirements, locate the scattered fixes, tweak tags, etc. Hope I got everything right. It was almost at the point where I gave up and postponed everything to 5.4. We're at -rc5 -- it's not exactly a good time to rebase the entire tree. However, I know the static mq allocations are causing headaches for several distro vendors so I begrudgingly bit the bullet. I would have liked to see more reviews from the official driver maintainers but at the same time I didn't want to wait any longer giving this some soak time in linux-next. Thanks for your work on getting all the drivers fixed up! Just goes to show how large the fallout can be from a relatively innocuous core change. Oh, and I held back the rtsx patch due to lack of reviews. But since that driver is in staging I'm not too worried about it. Hope we can get the fix for that reviewed and merged soon. -- Martin K. Petersen Oracle Linux Engineering ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 3/3] staging: rtl8723bs: Fix Indentation Error: code indent should use tabs where possible
Resolve indentation errors which were caused by a mix of space and tabs for indentation. Previous patch to fix if-else brace styles revealed the indentation error Signed-off-by: Shobhit Kukreti --- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 6 ++--- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 36 +-- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index 746f074..643cacc 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -202,9 +202,9 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup) memset(&ev, 0x00, sizeof(ev)); if (bgroup) { - ev.flags |= IW_MICFAILURE_GROUP; + ev.flags |= IW_MICFAILURE_GROUP; } else { - ev.flags |= IW_MICFAILURE_PAIRWISE; + ev.flags |= IW_MICFAILURE_PAIRWISE; } ev.src_addr.sa_family = ARPHRD_ETHER; @@ -297,7 +297,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame RT_TRACE(_module_recv_osdep_c_, _drv_info_, ("\n rtw_recv_indicatepkt :after rtw_os_recv_indicate_pkt\n")); -return _SUCCESS; + return _SUCCESS; _recv_indicatepkt_drop: diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c index 9c408d9..540a7ee 100644 --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c @@ -100,26 +100,26 @@ static int sdio_alloc_irq(struct dvobj_priv *dvobj) static void sdio_free_irq(struct dvobj_priv *dvobj) { -struct sdio_data *psdio_data; -struct sdio_func *func; -int err; - -if (dvobj->irq_alloc) { -psdio_data = &dvobj->intf_data; -func = psdio_data->func; - -if (func) { -sdio_claim_host(func); -err = sdio_release_irq(func); -if (err) { + struct sdio_data *psdio_data; + struct sdio_func *func; + int err; + + if (dvobj->irq_alloc) { + psdio_data = &dvobj->intf_data; + func = psdio_data->func; + + if (func) { + sdio_claim_host(func); + err = sdio_release_irq(func); + if (err) { dvobj->drv_dbg.dbg_sdio_free_irq_error_cnt++; DBG_871X_LEVEL(_drv_err_,"%s: sdio_release_irq FAIL(%d)!\n", __func__, err); -} else - dvobj->drv_dbg.dbg_sdio_free_irq_cnt++; -sdio_release_host(func); -} -dvobj->irq_alloc = 0; -} + } else + dvobj->drv_dbg.dbg_sdio_free_irq_cnt++; + sdio_release_host(func); + } + dvobj->irq_alloc = 0; + } } #ifdef CONFIG_GPIO_WAKEUP -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 0/3] Resolve if/else brace-style errors
This patchset fixes the following errors reported by checkpatch in the staging/rtl8723bs driver. Patch[1/3]: Fix check patch error "that open brace { should be on the previous line" Patch[2/3]: Fix the error else should follow close brace '}' Patch[3/3]: Fix Indentation Error The patch should be applied in the sequence of 1-3. Each patch performs one clean up operation. version 4 changes: - Moved comments to a new line - Removed an extra blank line version 3 changes: - Converted the patch to a patchset - Resolve checkpatch errors: else should follow close brace '}' Fixed Indentation Error to use tabs - Compiles and builds, untested on real hardware. version 2 changes: - Removed Trailing whitespace introduced in the previous patch - Moved comments to a new line in the else statement Shobhit Kukreti (3): staging: rtl8723bs: Resolve checkpatch error "that open brace { should be on the previous line" in the rtl8723 driver staging: rtl8723bs: Resolve the checkpatch error: else should follow close brace '}' staging: rtl8723bs: Fix Indentation Error: code indent should use tabs where possible drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 18 ++--- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 89 --- drivers/staging/rtl8723bs/os_dep/rtw_proc.c | 6 +- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 54 ++ drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c | 24 ++ 5 files changed, 69 insertions(+), 122 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 1/3] staging: rtl8723bs: Resolve checkpatch error "that open brace { should be on the previous line" in the rtl8723 driver
Cleaned up the code from the following files to get rid of check patch error "that open brace { should be on the previous line" drivers/staging/rtl8723bs/os_dep/mlme_linux.c drivers/staging/rtl8723bs/os_dep/recv_linux.c drivers/staging/rtl8723bs/os_dep/rtw_proc.c drivers/staging/rtl8723bs/os_dep/sdio_intf.c drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c Signed-off-by: Shobhit Kukreti --- drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 14 ++--- drivers/staging/rtl8723bs/os_dep/recv_linux.c | 76 --- drivers/staging/rtl8723bs/os_dep/rtw_proc.c | 6 +- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 15 ++--- drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c | 24 +++ 5 files changed, 47 insertions(+), 88 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c index aa2499f..4bccfd6 100644 --- a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c @@ -46,8 +46,7 @@ void rtw_os_indicate_connect(struct adapter *adapter) struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) - { + (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) { rtw_cfg80211_ibss_indicate_connect(adapter); } else @@ -77,8 +76,8 @@ void rtw_reset_securitypriv(struct adapter *adapter) spin_lock_bh(&adapter->security_key_mutex); - if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)/* 802.1x */ - { + if (adapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) { + /* 802.1x */ /* Added by Albert 2009/02/18 */ /* We have to backup the PMK information for WiFi PMK Caching test item. */ /* */ @@ -106,8 +105,8 @@ void rtw_reset_securitypriv(struct adapter *adapter) adapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled; } - else /* reset values in securitypriv */ - { + else { + /* reset values in securitypriv */ /* if (adapter->mlmepriv.fw_state & WIFI_STATION_STATE) */ /* */ struct security_priv *psec_priv = &adapter->securitypriv; @@ -150,8 +149,7 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie) RT_TRACE(_module_mlme_osdep_c_, _drv_info_, ("+rtw_report_sec_ie, authmode =%d\n", authmode)); buff = NULL; - if (authmode == _WPA_IE_ID_) - { + if (authmode == _WPA_IE_ID_) { RT_TRACE(_module_mlme_osdep_c_, _drv_info_, ("rtw_report_sec_ie, authmode =%d\n", authmode)); buff = rtw_zmalloc(IW_CUSTOM_MAX); diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index 3fe9c22..17c5199 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -12,8 +12,7 @@ void rtw_os_free_recvframe(union recv_frame *precvframe) { - if (precvframe->u.hdr.pkt) - { + if (precvframe->u.hdr.pkt) { dev_kfree_skb_any(precvframe->u.hdr.pkt);/* free skb by driver */ precvframe->u.hdr.pkt = NULL; @@ -34,10 +33,8 @@ void rtw_os_recv_resource_free(struct recv_priv *precvpriv) precvframe = (union recv_frame*) precvpriv->precv_frame_buf; - for (i = 0; i < NR_RECVFRAME; i++) - { - if (precvframe->u.hdr.pkt) - { + for (i = 0; i < NR_RECVFRAME; i++) { + if (precvframe->u.hdr.pkt) { dev_kfree_skb_any(precvframe->u.hdr.pkt);/* free skb by driver */ precvframe->u.hdr.pkt = NULL; } @@ -48,8 +45,7 @@ void rtw_os_recv_resource_free(struct recv_priv *precvpriv) /* free os related resource in struct recv_buf */ void rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *precvbuf) { - if (precvbuf->pskb) - { + if (precvbuf->pskb) { dev_kfree_skb_any(precvbuf->pskb); } } @@ -63,22 +59,18 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 pattrib = &prframe->u.hdr.attrib; sub_skb = rtw_skb_alloc(nSubframe_Length + 12); - if (sub_skb) - { + if (sub_skb) { skb_reserve(sub_skb, 12); skb_put_data(sub_skb, (pdata + ETH_HLEN), nSubframe_Length); } - else - { + else { sub_skb = rtw_skb_clone(prframe->u.hdr.pkt); - if (sub_skb) - { + if (sub_skb) { sub_skb->data = pdata + ETH_HLEN; sub_skb->len = nSubframe_Length;
[PATCH v4 2/3] staging: rtl8723bs: Resolve the checkpatch error: else should follow close brace '}'
Cleaned up the code to resolve the checkpatch error else should follow close brace '}' from the following files: mlme_linux.c recv_linux.c sdio_intf.c Signed-off-by: Shobhit Kukreti --- drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 6 ++ drivers/staging/rtl8723bs/os_dep/recv_linux.c | 21 +++-- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 9 +++-- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c index 4bccfd6..52a5b31 100644 --- a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c @@ -48,8 +48,7 @@ void rtw_os_indicate_connect(struct adapter *adapter) if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) { rtw_cfg80211_ibss_indicate_connect(adapter); - } - else + } else rtw_cfg80211_indicate_connect(adapter); rtw_indicate_wx_assoc_event(adapter); @@ -104,8 +103,7 @@ void rtw_reset_securitypriv(struct adapter *adapter) adapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; adapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled; - } - else { + } else { /* reset values in securitypriv */ /* if (adapter->mlmepriv.fw_state & WIFI_STATION_STATE) */ /* */ diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index 17c5199..746f074 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -62,15 +62,13 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 if (sub_skb) { skb_reserve(sub_skb, 12); skb_put_data(sub_skb, (pdata + ETH_HLEN), nSubframe_Length); - } - else { + } else { sub_skb = rtw_skb_clone(prframe->u.hdr.pkt); if (sub_skb) { sub_skb->data = pdata + ETH_HLEN; sub_skb->len = nSubframe_Length; skb_set_tail_pointer(sub_skb, nSubframe_Length); - } - else { + } else { DBG_871X("%s(): rtw_skb_clone() Fail!!!\n", __func__); return NULL; } @@ -142,8 +140,7 @@ void rtw_os_recv_indicate_pkt(struct adapter *padapter, _pkt *pkt, struct rx_pkt return; } } - } - else { + } else { /* to APself */ /* DBG_871X("to APSelf\n"); */ DBG_COUNTER(padapter->rx_logs.os_indicate_ap_self); @@ -182,24 +179,21 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup) if (psecuritypriv->last_mic_err_time == 0) { psecuritypriv->last_mic_err_time = jiffies; - } - else { + } else { cur_time = jiffies; if (cur_time - psecuritypriv->last_mic_err_time < 60*HZ) { psecuritypriv->btkip_countermeasure = true; psecuritypriv->last_mic_err_time = 0; psecuritypriv->btkip_countermeasure_time = cur_time; - } - else { + } else { psecuritypriv->last_mic_err_time = jiffies; } } if (bgroup) { key_type |= NL80211_KEYTYPE_GROUP; - } - else { + } else { key_type |= NL80211_KEYTYPE_PAIRWISE; } @@ -209,8 +203,7 @@ void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup) memset(&ev, 0x00, sizeof(ev)); if (bgroup) { ev.flags |= IW_MICFAILURE_GROUP; - } - else { + } else { ev.flags |= IW_MICFAILURE_PAIRWISE; } diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c index c60f13c..9c408d9 100644 --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c @@ -88,8 +88,7 @@ static int sdio_alloc_irq(struct dvobj_priv *dvobj) if (err) { dvobj->drv_dbg.dbg_sdio_alloc_irq_error_cnt++; printk(KERN_CRIT "%s: sdio_claim_irq FAIL(%d)!\n", __func__, err); - } - else { + } else { dvobj->drv_dbg.dbg_sdio_alloc_irq_cnt++; dvobj->irq_alloc = 1; } @@ -115,8 +114,7 @@ static void sdio_free_irq(struct dvobj_priv *dvobj) if (err) {
[PATCH] staging: rtl8723bs: hal: Remove True/False Comparisons
Removing comparisons to True/False in if statements. Checkpatch reported: CHECK: Using comparison to true is error prone Signed-off-by: Shobhit Kukreti --- drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c index eb6e07e..8e4caee 100644 --- a/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c +++ b/drivers/staging/rtl8723bs/hal/HalBtc8723b1Ant.c @@ -1421,7 +1421,7 @@ static void halbtc8723b1ant_PsTdma( if (bTurnOn) { - if (pBtLinkInfo->bSlaveRole == true) + if (pBtLinkInfo->bSlaveRole) psTdmaByte4Val = psTdmaByte4Val | 0x1; /* 0x778 = 0x1 at wifi slot (no blocking BT Low-Pri pkts) */ @@ -2337,9 +2337,9 @@ static void halbtc8723b1ant_ActionWifiConnected(PBTC_COEXIST pBtCoexist) ); } } else if ( - (pCoexSta->bPanExist == false) && - (pCoexSta->bA2dpExist == false) && - (pCoexSta->bHidExist == false) + (!pCoexSta->bPanExist) && + (!pCoexSta->bA2dpExist) && + (!pCoexSta->bHidExist) ) halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); else -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723bs: hal: Fix Brace Style Issues in if/else statements
Cleaned Up code to fix brace style issues reported by checkpatch: -space required before the open brace '{' -Unbalanced braces around if/else statements Signed-off-by: Shobhit Kukreti --- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c index fd0be52..342ee26 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -112,9 +112,9 @@ void DBG_BT_INFO(u8 *dbgmsg) /* */ static u8 halbtcoutsrc_IsBtCoexistAvailable(PBTC_COEXIST pBtCoexist) { - if (!pBtCoexist->bBinded || !pBtCoexist->Adapter){ + if (!pBtCoexist->bBinded || !pBtCoexist->Adapter) return false; - } + return true; } @@ -256,13 +256,11 @@ static void halbtcoutsrc_AggregationCheck(PBTC_COEXIST pBtCoexist) padapter = pBtCoexist->Adapter; bNeedToAct = false; - if (pBtCoexist->btInfo.bRejectAggPkt) + if (pBtCoexist->btInfo.bRejectAggPkt) { rtw_btcoex_RejectApAggregatedPacket(padapter, true); - else { - + } else { if (pBtCoexist->btInfo.bPreBtCtrlAggBufSize != - pBtCoexist->btInfo.bBtCtrlAggBufSize){ - + pBtCoexist->btInfo.bBtCtrlAggBufSize) { bNeedToAct = true; pBtCoexist->btInfo.bPreBtCtrlAggBufSize = pBtCoexist->btInfo.bBtCtrlAggBufSize; } @@ -816,11 +814,10 @@ static void halbtcoutsrc_WriteLocalReg1Byte(void *pBtcContext, u32 RegAddr, u8 D PBTC_COEXISTpBtCoexist = (PBTC_COEXIST)pBtcContext; struct adapter *Adapter = pBtCoexist->Adapter; - if (BTC_INTF_SDIO == pBtCoexist->chipInterface) { + if (BTC_INTF_SDIO == pBtCoexist->chipInterface) rtw_write8(Adapter, SDIO_LOCAL_BASE | RegAddr, Data); - } else { + else rtw_write8(Adapter, RegAddr, Data); - } } static void halbtcoutsrc_SetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMask, u32 Data) @@ -1196,13 +1193,13 @@ void EXhalbtcoutsrc_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 pktType) if (pBtCoexist->bManualControl) return; - if (PACKET_DHCP == pktType) + if (PACKET_DHCP == pktType) { packetType = BTC_PACKET_DHCP; - else if (PACKET_EAPOL == pktType) + } else if (PACKET_EAPOL == pktType) { packetType = BTC_PACKET_EAPOL; - else if (PACKET_ARP == pktType) + } else if (PACKET_ARP == pktType) { packetType = BTC_PACKET_ARP; - else { + } else { packetType = BTC_PACKET_UNKNOWN; return; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[Patch v3] staging: rtl8723bs: os_dep: ioctl_linux: make use of kzalloc
This patch is a cleanup which replaces rtw_malloc(wep_total_len) with kzalloc() and removes the memset(). The rtw_malloc() does GFP_ATOMIC allocations when in_atomic() is true. But as the comments for in_atomic() describe, the in_atomic() check should not be used in driver code. The in_atomic() check is not accurate when preempt is disabled. In this code we are not in IRQ context and we are not holding any spin_locks so GFP_KERNEL is safe. Signed-off-by: Hariprasad Kelam changes in v2: Replace rtw_zmalloc with kzalloc changes in v3: Add proper changelog --- --- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index ea50ec424..e050f20 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -477,14 +477,12 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, if (wep_key_len > 0) { wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); - pwep = rtw_malloc(wep_total_len); + pwep = kzalloc(wep_total_len, GFP_KERNEL); if (pwep == NULL) { RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, (" wpa_set_encryption: pwep allocate fail !!!\n")); goto exit; } - memset(pwep, 0, wep_total_len); - pwep->KeyLength = wep_key_len; pwep->Length = wep_total_len; @@ -2142,12 +2140,10 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, int ret = 0; param_len = sizeof(struct ieee_param) + pext->key_len; - param = rtw_malloc(param_len); + param = kzalloc(param_len, GFP_KERNEL); if (param == NULL) return -1; - memset(param, 0, param_len); - param->cmd = IEEE_CMD_SET_ENCRYPTION; memset(param->sta_addr, 0xff, ETH_ALEN); @@ -3513,14 +3509,12 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, if (wep_key_len > 0) { wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); - pwep = rtw_malloc(wep_total_len); + pwep = kzalloc(wep_total_len, GFP_KERNEL); if (pwep == NULL) { DBG_871X(" r871x_set_encryption: pwep allocate fail !!!\n"); goto exit; } - memset(pwep, 0, wep_total_len); - pwep->KeyLength = wep_key_len; pwep->Length = wep_total_len; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723bs: hal: odm_RegConfig8723B: fix Lines should not end with a '('
this patch fixes below issue reported by checkpatch.pl CHECK: Lines should not end with a '(' CHECK: Lines should not end with a '(' Signed-off-by: Hariprasad Kelam --- drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h | 61 ++ 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h index 12dfc58..07b5859 100644 --- a/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h +++ b/drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h @@ -7,51 +7,46 @@ #ifndef __INC_ODM_REGCONFIG_H_8723B #define __INC_ODM_REGCONFIG_H_8723B -void odm_ConfigRFReg_8723B( - PDM_ODM_T pDM_Odm, - u32 Addr, - u32 Data, - ODM_RF_RADIO_PATH_E RF_PATH, - u32 RegAddr +void odm_ConfigRFReg_8723B(PDM_ODM_T pDM_Odm, + u32 Addr, + u32 Data, + ODM_RF_RADIO_PATH_E RF_PATH, + u32 RegAddr ); void odm_ConfigRF_RadioA_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u32 Data); void odm_ConfigMAC_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u8 Data); -void odm_ConfigBB_AGC_8723B( - PDM_ODM_T pDM_Odm, - u32 Addr, - u32 Bitmask, - u32 Data +void odm_ConfigBB_AGC_8723B(PDM_ODM_T pDM_Odm, + u32 Addr, + u32 Bitmask, + u32 Data ); -void odm_ConfigBB_PHY_REG_PG_8723B( - PDM_ODM_T pDM_Odm, - u32 Band, - u32 RfPath, - u32 TxNum, - u32 Addr, - u32 Bitmask, - u32 Data +void odm_ConfigBB_PHY_REG_PG_8723B(PDM_ODM_T pDM_Odm, + u32 Band, + u32 RfPath, + u32 TxNum, + u32 Addr, + u32 Bitmask, + u32 Data ); -void odm_ConfigBB_PHY_8723B( - PDM_ODM_T pDM_Odm, - u32 Addr, - u32 Bitmask, - u32 Data +void odm_ConfigBB_PHY_8723B(PDM_ODM_T pDM_Odm, + u32 Addr, + u32 Bitmask, + u32 Data ); -void odm_ConfigBB_TXPWR_LMT_8723B( - PDM_ODM_T pDM_Odm, - u8 *Regulation, - u8 *Band, - u8 *Bandwidth, - u8 *RateSection, - u8 *RfPath, - u8 *Channel, - u8 *PowerLimit +void odm_ConfigBB_TXPWR_LMT_8723B(PDM_ODM_T pDM_Odm, + u8 *Regulation, + u8 *Band, + u8 *Bandwidth, + u8 *RateSection, + u8 *RfPath, + u8 *Channel, + u8 *PowerLimit ); #endif -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function
Hi Brett, Greg, I am a little busy with some work stuff, so sorry for my late response. On Mon, Jun 17, 2019 at 5:57 AM Greg Ungerer wrote: > > Hi Brett, > > On 15/6/19 11:53 pm, Brett Neumeier wrote: > [snip] > > For what it's worth -- possibly nothing? -- I grabbed the most recent six > > versions of the patch from this thread, including the one here, and did > > test boots of all of them on both a GnuBee PC1 and PC2 (based on 5.1.7). > > There were no perfect results, which is probably not surprising. Here I'm > > referring to different versions of the patch based on the date of the email > > where it was attached, I don't know if there's a better approach. > > > > 2019-05-29: 9 success, 1 hang > > 2019-05-31: 8 success, 2 hang > > 2019-06-03: 7 success, 3 hang > > 2019-06-04: 8 success, 2 hang > > 2019-06-05: 6 success, 4 hang > > 2019-06-06: 7 success, 3 hang > Thank you very much for your time in this. > That is valuable feedback, thanks for taking the time to run > through those variations. > > Your results pretty much mirror what I see. Very inconsistent > booting behavior. Sometimes boots, sometimes doesn't. When it > doesn't it is always somewhere in the PCI startup. First I am going to officially send clean patches to achieve only the PERST gpio stuff to get those properly applied in the official trees. In order to try to know what is happening some deeper debugging would be helpful. Does not using gpio descriptor API but accessing memory also sometimes hangs? Does moving pci driver to module_init instead of arch_initcall changes something? Does moving pci phy code into pci driver with arch_initcall changes something? If it is not a reset issue it might be something with the boot order, according to the driver changes with properly working version. > Regards > Gregç Best regards, Sergio Paracuellos > > > > > I've put all the boot message logs (for both successes and hangs) at > > https://repo.freesa.org/gnubee/ in case they are interesting. There are a > > few different common sequences of boot messages before the hangs occur, > > which I'll summarize here: > > > > This happened 10 times: > > > > [9.056069] mt7621-pci 1e14.pcie: Error applying setting, reverse > > things back > > [ 10.187679] mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz > > [ 10.198796] mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 0 > > [ 10.327667] mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz > > [ 10.338771] mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 1 > > [ 10.467668] mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz > > [ 10.480904] mt7621-pci 1e14.pcie: Port 454043648 N_FTS = 2 > > [ 11.556073] mt7621-pci 1e14.pcie: PCIE0 enabled > > [ 11.565784] mt7621-pci 1e14.pcie: PCIE0 enabled > > [ 11.575497] mt7621-pci 1e14.pcie: PCIE0 enabled > > [ 11.585244] mt7621-pci 1e14.pcie: PCI coherence region base: > > 0x6000, mask/settings: 0xf002 > > [ 11.603982] mt7621-pci 1e14.pcie: PCI host bridge to bus :00 > > [ 11.616664] pci_bus :00: root bus resource [io 0x] > > [ 11.628457] pci_bus :00: root bus resource [mem > > 0x6000-0x6fff] > > [ 11.642155] pci_bus :00: root bus resource [bus 00-ff] > > [ 11.655286] pci :00:00.0: bridge configuration invalid ([bus > > 00-00]), reconfiguring > > [ 11.671259] pci :00:01.0: bridge configuration invalid ([bus > > 00-00]), reconfiguring > > [ 11.687206] pci :00:02.0: bridge configuration invalid ([bus > > 00-00]), reconfiguring > > > > This happened 4 times, but only when using the 2019-06-04 and 2019-06-05 > > patches: > > > > [9.071852] mt7621-pci 1e14.pcie: Error applying setting, reverse > > things back > > [ 10.197138] mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz > > [ 10.208254] mt7621-pci 1e14.pcie: Port 0 N_FTS = 1b102800 > > [ 10.337129] mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz > > [ 10.348232] mt7621-pci 1e14.pcie: Port 1 N_FTS = 1b102800 > > [ 10.477129] mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz > > [ 10.490365] mt7621-pci 1e14.pcie: Port 2 N_FTS = 1b102800 > > [ 11.565525] mt7621-pci 1e14.pcie: pcie0 no card, disable it (RST & > > CLK) > > [ 11.579392] mt7621-pci 1e14.pcie: PCIE0 enabled > > [ 11.589105] mt7621-pci 1e14.pcie: PCIE0 enabled > > [ 11.598853] mt7621-pci 1e14.pcie: PCI coherence region base: > > 0x6000, mask/settings: 0xf002 > > [ 11.617590] mt7621-pci 1e14.pcie: PCI host bridge to bus :00 > > [ 11.630266] pci_bus :00: root bus resource [io 0x] > > [ 11.642059] pci_bus :00: root bus resource [mem > > 0x6000-0x6fff] > > [ 11.655757] pci_bus :00: root bus resource [bus 00-ff] > > [ 11.668437] pci :00:00.0: bridge configuration invalid ([bus > > 00-00]), reconfiguring > > [ 11.684402] pci :00:01.0: bridge configuration invalid ([bus > > 00-00]), reconfiguring > > [ 11.70080
[PATCH] staging: kpc2000: simplify error handling in kp2000_pcie_probe
We can get rid of a few iounmaps in the middle of the function by re-ordering the error handling labels and adding two new labels. Signed-off-by: Simon Sandström --- This change has not been tested besides by compiling. It might be good took take an extra look to make sure that I got everything right. Also, this change was proposed by Dan Carpenter. Should I add anything in the commit message to show this? - Simon drivers/staging/kpc2000/kpc2000/core.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c index 610ea549d240..cb05cca687e1 100644 --- a/drivers/staging/kpc2000/kpc2000/core.c +++ b/drivers/staging/kpc2000/kpc2000/core.c @@ -351,12 +351,11 @@ static int kp2000_pcie_probe(struct pci_dev *pdev, err = pci_request_region(pcard->pdev, REG_BAR, KP_DRIVER_NAME_KP2000); if (err) { - iounmap(pcard->regs_bar_base); dev_err(&pcard->pdev->dev, "probe: failed to acquire PCI region (%d)\n", err); err = -ENODEV; - goto err_disable_device; + goto err_unmap_regs; } pcard->regs_base_resource.start = reg_bar_phys_addr; @@ -374,7 +373,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev, dev_err(&pcard->pdev->dev, "probe: DMA_BAR could not remap memory to virtual space\n"); err = -ENODEV; - goto err_unmap_regs; + goto err_release_regs; } dev_dbg(&pcard->pdev->dev, "probe: DMA_BAR virt hardware address start [%p]\n", @@ -384,11 +383,10 @@ static int kp2000_pcie_probe(struct pci_dev *pdev, err = pci_request_region(pcard->pdev, DMA_BAR, "kp2000_pcie"); if (err) { - iounmap(pcard->dma_bar_base); dev_err(&pcard->pdev->dev, "probe: failed to acquire PCI region (%d)\n", err); err = -ENODEV; - goto err_unmap_regs; + goto err_unmap_dma; } pcard->dma_base_resource.start = dma_bar_phys_addr; @@ -400,7 +398,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev, pcard->sysinfo_regs_base = pcard->regs_bar_base; err = read_system_regs(pcard); if (err) - goto err_unmap_dma; + goto err_release_dma; // Disable all "user" interrupts because they're not used yet. writeq(0x, @@ -438,14 +436,14 @@ static int kp2000_pcie_probe(struct pci_dev *pdev, if (err) { dev_err(&pcard->pdev->dev, "CANNOT use DMA mask %0llx\n", DMA_BIT_MASK(64)); - goto err_unmap_dma; + goto err_release_dma; } dev_dbg(&pcard->pdev->dev, "Using DMA mask %0llx\n", dma_get_mask(PCARD_TO_DEV(pcard))); err = pci_enable_msi(pcard->pdev); if (err < 0) - goto err_unmap_dma; + goto err_release_dma; rv = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED, pcard->name, pcard); @@ -478,14 +476,14 @@ static int kp2000_pcie_probe(struct pci_dev *pdev, free_irq(pcard->pdev->irq, pcard); err_disable_msi: pci_disable_msi(pcard->pdev); +err_release_dma: + pci_release_region(pdev, DMA_BAR); err_unmap_dma: iounmap(pcard->dma_bar_base); - pci_release_region(pdev, DMA_BAR); - pcard->dma_bar_base = NULL; +err_release_regs: + pci_release_region(pdev, REG_BAR); err_unmap_regs: iounmap(pcard->regs_bar_base); - pci_release_region(pdev, REG_BAR); - pcard->regs_bar_base = NULL; err_disable_device: pci_disable_device(pcard->pdev); err_remove_ida: -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: kpc2000: simplify error handling in kp2000_pcie_probe
On Wed, Jun 19, 2019 at 08:36:07AM +0200, Simon Sandström wrote: > We can get rid of a few iounmaps in the middle of the function by > re-ordering the error handling labels and adding two new labels. > > Signed-off-by: Simon Sandström > --- > > This change has not been tested besides by compiling. It might be good > took take an extra look to make sure that I got everything right. > You have the right instincts that when something looks really complicated that's probably for a reason. That attitude will serve you well in the future! But in this case it's staging code so the original code is just strange. Reviewed-by: Dan Carpenter > Also, this change was proposed by Dan Carpenter. Should I add anything > in the commit message to show this? There is a Suggested-by: tag for this, but don't resend because I don't care and I've already reviewed this version so I don't want to review the patch again. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel