Re: [PATCH] staging: kpc2000: Fix: fix platform_no_drv_owner.cocci warnings
On Sat, Jun 22, 2019 at 03:04:08AM +0800, kbuild test robot wrote: > From: kbuild test robot > > drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c:200:3-8: No need to set > .owner here. The core will do it. > > Remove .owner field if calls are used which set it automatically > > Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci > > Fixes: abddd78ef465 ("staging: kpc2000: Fix: 'kpc_dma_del_device' and other > symbols were not declared") > CC: Rishiraj Manwatkar > Signed-off-by: kbuild test robot > --- > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > master > head: e2d28c40292bdc35553d599e5bbbeaefbab49416 > commit: abddd78ef465b86fc89a3d9750bb76a138bc0859 [5641/8196] staging: > kpc2000: Fix: 'kpc_dma_del_device' and other symbols were not declared > > kpc_dma_driver.c |1 - > 1 file changed, 1 deletion(-) > > --- a/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c > +++ b/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c > @@ -197,7 +197,6 @@ static struct platform_driver kpc_dma_pl > .remove = kpc_dma_remove, > .driver = { > .name = KP_DRIVER_NAME_DMA_CONTROLLER, > - .owner = THIS_MODULE, > }, > }; Already in my tree, I think you are a bit behind :) thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 2/2][v4.9.y] coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping
This patch is the extension of following upstream commit to fix the race condition between get_task_mm() and core dumping for IB->mlx4 and IB->mlx5 drivers: commit 04f5866e41fb ("coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping")' Thanks to Jason for pointing this. Signed-off-by: Ajay Kaher --- drivers/infiniband/hw/mlx4/main.c | 4 +++- drivers/infiniband/hw/mlx5/main.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 8d59a59..7ccf722 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -1172,6 +1172,8 @@ static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) * mlx4_ib_vma_close(). */ down_write(_mm->mmap_sem); + if (!mmget_still_valid(owning_mm)) + goto skip_mm; for (i = 0; i < HW_BAR_COUNT; i++) { vma = context->hw_bar_info[i].vma; if (!vma) @@ -1190,7 +1192,7 @@ static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) /* context going to be destroyed, should not access ops any more */ context->hw_bar_info[i].vma->vm_ops = NULL; } - +skip_mm: up_write(_mm->mmap_sem); mmput(owning_mm); put_task_struct(owning_process); diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index b1daf5c..f94df0e 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -1307,6 +1307,8 @@ static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) * mlx5_ib_vma_close. */ down_write(_mm->mmap_sem); + if (!mmget_still_valid(owning_mm)) + goto skip_mm; list_for_each_entry_safe(vma_private, n, >vma_private_list, list) { vma = vma_private->vma; @@ -1321,6 +1323,7 @@ static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) list_del(_private->list); kfree(vma_private); } +skip_mm: up_write(_mm->mmap_sem); mmput(owning_mm); put_task_struct(owning_process); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 0/2] [v4.9.y] coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping
coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping [PATCH v3 1/2]: Backporting of commit 04f5866e41fb70690e28397487d8bd8eea7d712a upstream. [PATCH v3 2/2]: Extension of commit 04f5866e41fb to fix the race condition between get_task_mm() and core dumping for IB->mlx4 and IB->mlx5 drivers. [diff from v2]: - moved mmget_still_valid to mm.h in [PATCH v3 1/2] - added binder.c changes in [PATCH v3 1/2] - added [PATCH v3 2/2] ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 1/2] [v4.9.y] coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping
From: Andrea Arcangeli commit 04f5866e41fb70690e28397487d8bd8eea7d712a upstream. The core dumping code has always run without holding the mmap_sem for writing, despite that is the only way to ensure that the entire vma layout will not change from under it. Only using some signal serialization on the processes belonging to the mm is not nearly enough. This was pointed out earlier. For example in Hugh's post from Jul 2017: https://lkml.kernel.org/r/alpine.LSU.2.11.1707191716030.2055@eggly.anvils "Not strictly relevant here, but a related note: I was very surprised to discover, only quite recently, how handle_mm_fault() may be called without down_read(mmap_sem) - when core dumping. That seems a misguided optimization to me, which would also be nice to correct" In particular because the growsdown and growsup can move the vm_start/vm_end the various loops the core dump does around the vma will not be consistent if page faults can happen concurrently. Pretty much all users calling mmget_not_zero()/get_task_mm() and then taking the mmap_sem had the potential to introduce unexpected side effects in the core dumping code. Adding mmap_sem for writing around the ->core_dump invocation is a viable long term fix, but it requires removing all copy user and page faults and to replace them with get_dump_page() for all binary formats which is not suitable as a short term fix. For the time being this solution manually covers the places that can confuse the core dump either by altering the vma layout or the vma flags while it runs. Once ->core_dump runs under mmap_sem for writing the function mmget_still_valid() can be dropped. Allowing mmap_sem protected sections to run in parallel with the coredump provides some minor parallelism advantage to the swapoff code (which seems to be safe enough by never mangling any vma field and can keep doing swapins in parallel to the core dumping) and to some other corner case. In order to facilitate the backporting I added "Fixes: 86039bd3b4e6" however the side effect of this same race condition in /proc/pid/mem should be reproducible since before 2.6.12-rc2 so I couldn't add any other "Fixes:" because there's no hash beyond the git genesis commit. Because find_extend_vma() is the only location outside of the process context that could modify the "mm" structures under mmap_sem for reading, by adding the mmget_still_valid() check to it, all other cases that take the mmap_sem for reading don't need the new check after mmget_not_zero()/get_task_mm(). The expand_stack() in page fault context also doesn't need the new check, because all tasks under core dumping are frozen. Link: http://lkml.kernel.org/r/20190325224949.11068-1-aarca...@redhat.com Fixes: 86039bd3b4e6 ("userfaultfd: add new syscall to provide memory externalization") Signed-off-by: Andrea Arcangeli Reported-by: Jann Horn Suggested-by: Oleg Nesterov Acked-by: Peter Xu Reviewed-by: Mike Rapoport Reviewed-by: Oleg Nesterov Reviewed-by: Jann Horn Acked-by: Jason Gunthorpe Acked-by: Michal Hocko Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman [aka...@vmware.com: stable 4.9 backport - handle binder_update_page_range - mho...@suse.com] Signed-off-by: Ajay Kaher --- drivers/android/binder.c | 6 ++ fs/proc/task_mmu.c | 18 ++ fs/userfaultfd.c | 9 + include/linux/mm.h | 21 + mm/mmap.c| 6 +- 5 files changed, 59 insertions(+), 1 deletion(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 80499f4..f05ab8f 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -581,6 +581,12 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, if (mm) { down_write(>mmap_sem); + if (!mmget_still_valid(mm)) { + if (allocate == 0) + goto free_range; + goto err_no_vma; + } + vma = proc->vma; if (vma && mm != proc->vma_vm_mm) { pr_err("%d: vma mm and task mm mismatch\n", diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 5138e78..4b207b1 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1057,6 +1057,24 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, count = -EINTR; goto out_mm; } + /* +* Avoid to modify vma->vm_flags +* without locked ops while the +* coredump reads the vm_flags. +*/ + if (!mmget_still_valid(mm)) { + /* +
RE: [PATCH v2] PCI: hv: Fix a use-after-free bug in hv_eject_device_work()
From: Dexuan Cui Sent: Friday, June 21, 2019 4:45 PM > > The commit 05f151a73ec2 itself is correct, but it exposes this > use-after-free bug, which is caught by some memory debug options. > > Add a Fixes tag to indicate the dependency. > > Fixes: 05f151a73ec2 ("PCI: hv: Fix a memory leak in hv_eject_device_work()") > Signed-off-by: Dexuan Cui > Cc: sta...@vger.kernel.org > --- > > In v2: > Replaced "hpdev->hbus" with "hbus", since we have the new "hbus" variable. > [Michael > Kelley] > > drivers/pci/controller/pci-hyperv.c | 15 +-- > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/pci/controller/pci-hyperv.c > b/drivers/pci/controller/pci-hyperv.c > index 808a182830e5..5dadc964ad3b 100644 > --- a/drivers/pci/controller/pci-hyperv.c > +++ b/drivers/pci/controller/pci-hyperv.c > @@ -1880,6 +1880,7 @@ static void hv_pci_devices_present(struct > hv_pcibus_device > *hbus, > static void hv_eject_device_work(struct work_struct *work) > { > struct pci_eject_response *ejct_pkt; > + struct hv_pcibus_device *hbus; > struct hv_pci_dev *hpdev; > struct pci_dev *pdev; > unsigned long flags; > @@ -1890,6 +1891,7 @@ static void hv_eject_device_work(struct work_struct > *work) > } ctxt; > > hpdev = container_of(work, struct hv_pci_dev, wrk); > + hbus = hpdev->hbus; > > WARN_ON(hpdev->state != hv_pcichild_ejecting); > > @@ -1900,8 +1902,7 @@ static void hv_eject_device_work(struct work_struct > *work) >* because hbus->pci_bus may not exist yet. >*/ > wslot = wslot_to_devfn(hpdev->desc.win_slot.slot); > - pdev = pci_get_domain_bus_and_slot(hpdev->hbus->sysdata.domain, 0, > -wslot); > + pdev = pci_get_domain_bus_and_slot(hbus->sysdata.domain, 0, wslot); > if (pdev) { > pci_lock_rescan_remove(); > pci_stop_and_remove_bus_device(pdev); > @@ -1909,9 +1910,9 @@ static void hv_eject_device_work(struct work_struct > *work) > pci_unlock_rescan_remove(); > } > > - spin_lock_irqsave(>hbus->device_list_lock, flags); > + spin_lock_irqsave(>device_list_lock, flags); > list_del(>list_entry); > - spin_unlock_irqrestore(>hbus->device_list_lock, flags); > + spin_unlock_irqrestore(>device_list_lock, flags); > > if (hpdev->pci_slot) > pci_destroy_slot(hpdev->pci_slot); > @@ -1920,7 +1921,7 @@ static void hv_eject_device_work(struct work_struct > *work) > ejct_pkt = (struct pci_eject_response *) > ejct_pkt->message_type.type = PCI_EJECTION_COMPLETE; > ejct_pkt->wslot.slot = hpdev->desc.win_slot.slot; > - vmbus_sendpacket(hpdev->hbus->hdev->channel, ejct_pkt, > + vmbus_sendpacket(hbus->hdev->channel, ejct_pkt, >sizeof(*ejct_pkt), (unsigned long), >VM_PKT_DATA_INBAND, 0); > > @@ -1929,7 +1930,9 @@ static void hv_eject_device_work(struct work_struct > *work) > /* For the two refs got in new_pcichild_device() */ > put_pcichild(hpdev); > put_pcichild(hpdev); > - put_hvpcibus(hpdev->hbus); > + /* hpdev has been freed. Do not use it any more. */ > + > + put_hvpcibus(hbus); > } > > /** > -- > 2.17.1 Reviewed-by: Michael Kelley ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] PCI: hv: Fix a use-after-free bug in hv_eject_device_work()
The commit 05f151a73ec2 itself is correct, but it exposes this use-after-free bug, which is caught by some memory debug options. Add a Fixes tag to indicate the dependency. Fixes: 05f151a73ec2 ("PCI: hv: Fix a memory leak in hv_eject_device_work()") Signed-off-by: Dexuan Cui Cc: sta...@vger.kernel.org --- In v2: Replaced "hpdev->hbus" with "hbus", since we have the new "hbus" variable. [Michael Kelley] drivers/pci/controller/pci-hyperv.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 808a182830e5..5dadc964ad3b 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1880,6 +1880,7 @@ static void hv_pci_devices_present(struct hv_pcibus_device *hbus, static void hv_eject_device_work(struct work_struct *work) { struct pci_eject_response *ejct_pkt; + struct hv_pcibus_device *hbus; struct hv_pci_dev *hpdev; struct pci_dev *pdev; unsigned long flags; @@ -1890,6 +1891,7 @@ static void hv_eject_device_work(struct work_struct *work) } ctxt; hpdev = container_of(work, struct hv_pci_dev, wrk); + hbus = hpdev->hbus; WARN_ON(hpdev->state != hv_pcichild_ejecting); @@ -1900,8 +1902,7 @@ static void hv_eject_device_work(struct work_struct *work) * because hbus->pci_bus may not exist yet. */ wslot = wslot_to_devfn(hpdev->desc.win_slot.slot); - pdev = pci_get_domain_bus_and_slot(hpdev->hbus->sysdata.domain, 0, - wslot); + pdev = pci_get_domain_bus_and_slot(hbus->sysdata.domain, 0, wslot); if (pdev) { pci_lock_rescan_remove(); pci_stop_and_remove_bus_device(pdev); @@ -1909,9 +1910,9 @@ static void hv_eject_device_work(struct work_struct *work) pci_unlock_rescan_remove(); } - spin_lock_irqsave(>hbus->device_list_lock, flags); + spin_lock_irqsave(>device_list_lock, flags); list_del(>list_entry); - spin_unlock_irqrestore(>hbus->device_list_lock, flags); + spin_unlock_irqrestore(>device_list_lock, flags); if (hpdev->pci_slot) pci_destroy_slot(hpdev->pci_slot); @@ -1920,7 +1921,7 @@ static void hv_eject_device_work(struct work_struct *work) ejct_pkt = (struct pci_eject_response *) ejct_pkt->message_type.type = PCI_EJECTION_COMPLETE; ejct_pkt->wslot.slot = hpdev->desc.win_slot.slot; - vmbus_sendpacket(hpdev->hbus->hdev->channel, ejct_pkt, + vmbus_sendpacket(hbus->hdev->channel, ejct_pkt, sizeof(*ejct_pkt), (unsigned long), VM_PKT_DATA_INBAND, 0); @@ -1929,7 +1930,9 @@ static void hv_eject_device_work(struct work_struct *work) /* For the two refs got in new_pcichild_device() */ put_pcichild(hpdev); put_pcichild(hpdev); - put_hvpcibus(hpdev->hbus); + /* hpdev has been freed. Do not use it any more. */ + + put_hvpcibus(hbus); } /** -- 2.17.1
RE: [PATCH] PCI: hv: Fix a use-after-free bug in hv_eject_device_work()
> From: Michael Kelley > > @@ -1880,6 +1880,7 @@ static void hv_pci_devices_present(struct > hv_pcibus_device > > *hbus, > > static void hv_eject_device_work(struct work_struct *work) > > { > > struct pci_eject_response *ejct_pkt; > > + struct hv_pcibus_device *hbus; > > struct hv_pci_dev *hpdev; > > struct pci_dev *pdev; > > unsigned long flags; > > @@ -1890,6 +1891,7 @@ static void hv_eject_device_work(struct > work_struct *work) > > } ctxt; > > > > hpdev = container_of(work, struct hv_pci_dev, wrk); > > + hbus = hpdev->hbus; > > In the lines of code following this new assignment, there are four uses of > hpdev->hbus besides the one at the bottom of the function that causes the > use-after-free error. With 'hbus' now available as a local variable, it looks > rather strange to have those other places still using hpdev->hbus. I'm > thinking > they should be shortened to just 'hbus' for consistency, even though such > changes aren't directly related to fixing the bug. > > Michael Ok, let me post a v2 for this. Thanks, Dexuan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] PCI: hv: Fix a use-after-free bug in hv_eject_device_work()
From: Dexuan Cui Sent: Friday, June 21, 2019 12:02 PM > > The commit 05f151a73ec2 itself is correct, but it exposes this > use-after-free bug, which is caught by some memory debug options. > > Add the Fixes tag to indicate the dependency. > > Fixes: 05f151a73ec2 ("PCI: hv: Fix a memory leak in hv_eject_device_work()") > Signed-off-by: Dexuan Cui > Cc: sta...@vger.kernel.org > --- > Sorry for not spotting the bug when sending 05f151a73ec2. > > Now I have enabled the mm debug options to help catch such mistakes in future. > > drivers/pci/controller/pci-hyperv.c | 6 +- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/pci-hyperv.c > b/drivers/pci/controller/pci-hyperv.c > index 808a182830e5..42ace1a690f9 100644 > --- a/drivers/pci/controller/pci-hyperv.c > +++ b/drivers/pci/controller/pci-hyperv.c > @@ -1880,6 +1880,7 @@ static void hv_pci_devices_present(struct > hv_pcibus_device > *hbus, > static void hv_eject_device_work(struct work_struct *work) > { > struct pci_eject_response *ejct_pkt; > + struct hv_pcibus_device *hbus; > struct hv_pci_dev *hpdev; > struct pci_dev *pdev; > unsigned long flags; > @@ -1890,6 +1891,7 @@ static void hv_eject_device_work(struct work_struct > *work) > } ctxt; > > hpdev = container_of(work, struct hv_pci_dev, wrk); > + hbus = hpdev->hbus; In the lines of code following this new assignment, there are four uses of hpdev->hbus besides the one at the bottom of the function that causes the use-after-free error. With 'hbus' now available as a local variable, it looks rather strange to have those other places still using hpdev->hbus. I'm thinking they should be shortened to just 'hbus' for consistency, even though such changes aren't directly related to fixing the bug. Michael > > WARN_ON(hpdev->state != hv_pcichild_ejecting); > > @@ -1929,7 +1931,9 @@ static void hv_eject_device_work(struct work_struct > *work) > /* For the two refs got in new_pcichild_device() */ > put_pcichild(hpdev); > put_pcichild(hpdev); > - put_hvpcibus(hpdev->hbus); > + /* hpdev has been freed. Do not use it any more. */ > + > + put_hvpcibus(hbus); > } > > /** > -- > 2.17.1
[PATCH] staging: kpc2000: Fix: fix platform_no_drv_owner.cocci warnings
From: kbuild test robot drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c:200:3-8: No need to set .owner here. The core will do it. Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci Fixes: abddd78ef465 ("staging: kpc2000: Fix: 'kpc_dma_del_device' and other symbols were not declared") CC: Rishiraj Manwatkar Signed-off-by: kbuild test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: e2d28c40292bdc35553d599e5bbbeaefbab49416 commit: abddd78ef465b86fc89a3d9750bb76a138bc0859 [5641/8196] staging: kpc2000: Fix: 'kpc_dma_del_device' and other symbols were not declared kpc_dma_driver.c |1 - 1 file changed, 1 deletion(-) --- a/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c +++ b/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c @@ -197,7 +197,6 @@ static struct platform_driver kpc_dma_pl .remove = kpc_dma_remove, .driver = { .name = KP_DRIVER_NAME_DMA_CONTROLLER, - .owner = THIS_MODULE, }, }; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] PCI: hv: Fix a use-after-free bug in hv_eject_device_work()
The commit 05f151a73ec2 itself is correct, but it exposes this use-after-free bug, which is caught by some memory debug options. Add the Fixes tag to indicate the dependency. Fixes: 05f151a73ec2 ("PCI: hv: Fix a memory leak in hv_eject_device_work()") Signed-off-by: Dexuan Cui Cc: sta...@vger.kernel.org --- Sorry for not spotting the bug when sending 05f151a73ec2. Now I have enabled the mm debug options to help catch such mistakes in future. drivers/pci/controller/pci-hyperv.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 808a182830e5..42ace1a690f9 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1880,6 +1880,7 @@ static void hv_pci_devices_present(struct hv_pcibus_device *hbus, static void hv_eject_device_work(struct work_struct *work) { struct pci_eject_response *ejct_pkt; + struct hv_pcibus_device *hbus; struct hv_pci_dev *hpdev; struct pci_dev *pdev; unsigned long flags; @@ -1890,6 +1891,7 @@ static void hv_eject_device_work(struct work_struct *work) } ctxt; hpdev = container_of(work, struct hv_pci_dev, wrk); + hbus = hpdev->hbus; WARN_ON(hpdev->state != hv_pcichild_ejecting); @@ -1929,7 +1931,9 @@ static void hv_eject_device_work(struct work_struct *work) /* For the two refs got in new_pcichild_device() */ put_pcichild(hpdev); put_pcichild(hpdev); - put_hvpcibus(hpdev->hbus); + /* hpdev has been freed. Do not use it any more. */ + + put_hvpcibus(hbus); } /** -- 2.17.1
[PATCH] binder: fix memory leak in error path
syzkallar found a 32-byte memory leak in a rarely executed error case. The transaction complete work item was not freed if put_user() failed when writing the BR_TRANSACTION_COMPLETE to the user command buffer. Fixed by freeing it before put_user() is called. Reported-by: syzbot+182ce46596c3f2e1e...@syzkaller.appspotmail.com Signed-off-by: Todd Kjos --- drivers/android/binder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index bc26b5511f0a9..8bf039fdeb918 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -4268,6 +4268,8 @@ static int binder_thread_read(struct binder_proc *proc, case BINDER_WORK_TRANSACTION_COMPLETE: { binder_inner_proc_unlock(proc); cmd = BR_TRANSACTION_COMPLETE; + kfree(w); + binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE); if (put_user(cmd, (uint32_t __user *)ptr)) return -EFAULT; ptr += sizeof(uint32_t); @@ -4276,8 +4278,6 @@ static int binder_thread_read(struct binder_proc *proc, binder_debug(BINDER_DEBUG_TRANSACTION_COMPLETE, "%d:%d BR_TRANSACTION_COMPLETE\n", proc->pid, thread->pid); - kfree(w); - binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE); } break; case BINDER_WORK_NODE: { struct binder_node *node = container_of(w, struct binder_node, work); -- 2.22.0.410.gd8fdbe21b5-goog ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: memory leak in binder_transaction
On Thu, Jun 13, 2019 at 2:56 PM syzbot wrote: > > Hello, > > syzbot found the following crash on: > > HEAD commit:d1fdb6d8 Linux 5.2-rc4 > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=15e5ce1ea0 > kernel config: https://syzkaller.appspot.com/x/.config?x=cb38d33cd06d8d48 > dashboard link: https://syzkaller.appspot.com/bug?extid=182ce46596c3f2e1eb24 > compiler: gcc (GCC) 9.0.0 20181231 (experimental) > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1181703ea0 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14e14392a0 > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > Reported-by: syzbot+182ce46596c3f2e1e...@syzkaller.appspotmail.com > > -executor774" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 > tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=binder > permissive=1 > BUG: memory leak Fix sent: https://lore.kernel.org/patchwork/patch/1092398/ > > unreferenced object 0x888123934800 (size 32): >comm "syz-executor774", pid 7083, jiffies 4294941834 (age 7.970s) >hex dump (first 32 bytes): > 00 48 93 23 81 88 ff ff 00 48 93 23 81 88 ff ff .H.#.H.# > 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >backtrace: > [<38ba7202>] kmemleak_alloc_recursive > include/linux/kmemleak.h:43 [inline] > [<38ba7202>] slab_post_alloc_hook mm/slab.h:439 [inline] > [<38ba7202>] slab_alloc mm/slab.c:3326 [inline] > [<38ba7202>] kmem_cache_alloc_trace+0x13d/0x280 mm/slab.c:3553 > [<04e63839>] kmalloc include/linux/slab.h:547 [inline] > [<04e63839>] kzalloc include/linux/slab.h:742 [inline] > [<04e63839>] binder_transaction+0x28b/0x2eb0 > drivers/android/binder.c:3072 > [<50997ec4>] binder_thread_write+0x357/0x1430 > drivers/android/binder.c:3794 > [] binder_ioctl_write_read > drivers/android/binder.c:4827 [inline] > [ ] binder_ioctl+0x8bc/0xbb4 > drivers/android/binder.c:5004 > [<2eec2b63>] vfs_ioctl fs/ioctl.c:46 [inline] > [<2eec2b63>] file_ioctl fs/ioctl.c:509 [inline] > [<2eec2b63>] do_vfs_ioctl+0x62a/0x810 fs/ioctl.c:696 > [<48cfc9e6>] ksys_ioctl+0x86/0xb0 fs/ioctl.c:713 > [<30bf392d>] __do_sys_ioctl fs/ioctl.c:720 [inline] > [<30bf392d>] __se_sys_ioctl fs/ioctl.c:718 [inline] > [<30bf392d>] __x64_sys_ioctl+0x1e/0x30 fs/ioctl.c:718 > [<7dec438c>] do_syscall_64+0x76/0x1a0 > arch/x86/entry/common.c:301 > [ ] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > > > --- > This bug is generated by a bot. It may contain errors. > See https://goo.gl/tpsmEJ for more information about syzbot. > syzbot engineers can be reached at syzkal...@googlegroups.com. > > syzbot will keep track of this bug report. See: > https://goo.gl/tpsmEJ#status for how to communicate with syzbot. > syzbot can test patches for this bug, for details see: > https://goo.gl/tpsmEJ#testing-patches ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [GIT PULL] Staging/IIO driver fixes for 5.2-rc6
The pull request you sent on Fri, 21 Jun 2019 10:11:02 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git > tags/staging-5.2-rc6 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/db54615e21419c3cb4d699a0b0aa16cc44d0e9da Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: most: Fix error path of audio_init
If most_register_configfs_subsys fails, call most_deregister_component to clean up. Fixes: 919c03ae11b9 ("staging: most: enable configfs support") Signed-off-by: YueHaibing --- drivers/staging/most/sound/sound.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c index 342f390..05996a5 100644 --- a/drivers/staging/most/sound/sound.c +++ b/drivers/staging/most/sound/sound.c @@ -799,11 +799,17 @@ static int __init audio_init(void) INIT_LIST_HEAD(_list); ret = most_register_component(); - if (ret) + if (ret) { pr_err("Failed to register %s\n", comp.name); + return ret; + } + ret = most_register_configfs_subsys(); - if (ret) + if (ret) { pr_err("Failed to register %s configfs subsys\n", comp.name); + most_deregister_component(); + } + return ret; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/4] staging: mt7621-pci: Handle minor issues
Hi Greg, On Fri, Jun 21, 2019 at 2:35 PM Greg Ungerer wrote: > > Hi Sergio, > > On 21/6/19 4:15 pm, Sergio Paracuellos wrote: > > This patch series properly handle minor issues in this driver. These are: > > * Disable pcie port clock on pci dirver instead of doing it in the phy > >driver. The pci driver is the correct place to do this. > > * Add a missing call to phy_exit function to properly handle the function > >'mt7621_pcie_init_port' error path. > > * Move driver to init in a later stage using 'module_init' instead of using > >'arch_initcall'. > > > > Patches are only compile-tested. It would be awasome to be tested before > > applied > > them (mainly the change to 'module_init' stuff). > > Quick test - not though or extensive. > On 3 boots it successfully booted for me twice with: > > rt2880-pinmux pinctrl: pcie is already enabled > mt7621-pci 1e14.pcie: Error applying setting, reverse things back > mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz > mt7621-pci 1e14.pcie: Port 0 N_FTS = 1b102800 > mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz > mt7621-pci 1e14.pcie: Port 1 N_FTS = 1b102800 > mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz > mt7621-pci 1e14.pcie: Port 2 N_FTS = 1b102800 > mt7621-pci 1e14.pcie: pcie1 no card, disable it (RST & CLK) > mt7621-pci 1e14.pcie: pcie2 no card, disable it (RST & CLK) > mt7621-pci 1e14.pcie: PCIE0 enabled > mt7621-pci 1e14.pcie: PCI coherence region base: 0x6000, > mask/settings: 0xf002 > mt7621-pci 1e14.pcie: PCI host bridge to bus :00 > pci_bus :00: root bus resource [io 0x] > pci_bus :00: root bus resource [mem 0x6000-0x6fff] > pci_bus :00: root bus resource [bus 00-ff] > pci :00:00.0: [0e8d:0801] type 01 class 0x060400 > pci :00:00.0: reg 0x10: [mem 0x-0x7fff] > pci :00:00.0: reg 0x14: [mem 0x-0x] > pci :00:00.0: supports D1 > pci :00:00.0: PME# supported from D0 D1 D3hot > pci :00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring > pci :01:00.0: [168c:003c] type 00 class 0x028000 > pci :01:00.0: reg 0x10: [mem 0x-0x001f 64bit] > pci :01:00.0: reg 0x30: [mem 0x-0x pref] > pci :01:00.0: supports D1 D2 > pci :00:00.0: PCI bridge to [bus 01-ff] > pci :00:00.0: bridge window [io 0x-0x0fff] > pci :00:00.0: bridge window [mem 0x-0x000f] > pci :00:00.0: bridge window [mem 0x-0x000f pref] > pci_bus :01: busn_res: [bus 01-ff] end is updated to 01 > pci :00:00.0: BAR 0: no space for [mem size 0x8000] > pci :00:00.0: BAR 0: failed to assign [mem size 0x8000] > pci :00:00.0: BAR 8: assigned [mem 0x6000-0x601f] > pci :00:00.0: BAR 9: assigned [mem 0x6020-0x602f pref] > pci :00:00.0: BAR 1: assigned [mem 0x6030-0x6030] > pci :00:00.0: BAR 7: no space for [io size 0x1000] > pci :00:00.0: BAR 7: failed to assign [io size 0x1000] > pci :01:00.0: BAR 0: assigned [mem 0x6000-0x601f 64bit] > pci :01:00.0: BAR 6: assigned [mem 0x6020-0x6020 pref] > pci :00:00.0: PCI bridge to [bus 01] > pci :00:00.0: bridge window [mem 0x6000-0x601f] > pci :00:00.0: bridge window [mem 0x6020-0x602f pref] > pcieport :00:00.0: of_irq_parse_pci: failed with rc=-22 > pcieport :00:00.0: enabling device (0004 -> 0006) > > PCI devices worked ok on the 2 good boots. Perfect, thanks for testing this. > > Regards > Greg Best regards, Sergio Paracuellos > > > > > Hope this helps. > > > > Best regards, > > Sergio Paracuellos > > > > Sergio Paracuellos (4): > >staging: mt7621-pci: disable pcie port clock if there is no pcie link > >staging: mt7621-pci: add phy exit call if phy_power_on call fails > >staging: mt7621-pci-phy: remove disable clock from the phy exit > > function > >staging: mt7621-pci: use 'module_init' instead of 'arch_initcall' > > > > drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c | 8 > > drivers/staging/mt7621-pci/pci-mt7621.c | 10 +- > > 2 files changed, 9 insertions(+), 9 deletions(-) > > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 4/4] rts5208: Fix usleep range is preferred over udelay
Am 21.06.2019 um 13:04 schrieb Pavel Machek: On Wed 2019-06-19 17:46:48, Lukas Schneider wrote: This patch fixes the issue reported by checkpatch: CHECK: usleep_range is preferred over udelay; see Doucmentation/timers/timers-howto.txt It's save to sleep here instead of using busy waiting, because we are not in an atomic context. Is it good idea? How can the system really sleep for 50 usec? Pavel According to Doucmentation/timers/timers-howto.txt, usleep_range should be used for sleep times between 10us and 20ms, so it is the correct function for 50us. Lukas @@ -865,7 +865,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) PHASE_CHANGE); if (retval) return retval; - udelay(50); + usleep_range(50, 60); retval = rtsx_write_register(chip, SD_VP_CTL, 0xFF, PHASE_CHANGE | PHASE_NOT_RESET | @@ -877,14 +877,14 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) CHANGE_CLK, CHANGE_CLK); if (retval) return retval; - udelay(50); + usleep_range(50, 60); retval = rtsx_write_register(chip, SD_VP_CTL, 0xFF, PHASE_NOT_RESET | sample_point); if (retval) return retval; } - udelay(100); + usleep_range(100, 110); rtsx_init_cmd(chip); rtsx_add_cmd(chip, WRITE_REG_CMD, SD_DCMPS_CTL, DCMPS_CHANGE, @@ -918,7 +918,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) return retval; } - udelay(50); + usleep_range(50, 60); } retval = rtsx_write_register(chip, SD_CFG1, SD_ASYNC_FIFO_NOT_RST, 0); @@ -1416,7 +1416,7 @@ static int sd_wait_data_idle(struct rtsx_chip *chip) retval = STATUS_SUCCESS; break; } - udelay(100); + usleep_range(100, 110); } dev_dbg(rtsx_dev(chip), "SD_DATA_STATE: 0x%02x\n", val); ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/4] staging: mt7621-pci: Handle minor issues
Hi Sergio, On 21/6/19 4:15 pm, Sergio Paracuellos wrote: This patch series properly handle minor issues in this driver. These are: * Disable pcie port clock on pci dirver instead of doing it in the phy driver. The pci driver is the correct place to do this. * Add a missing call to phy_exit function to properly handle the function 'mt7621_pcie_init_port' error path. * Move driver to init in a later stage using 'module_init' instead of using 'arch_initcall'. Patches are only compile-tested. It would be awasome to be tested before applied them (mainly the change to 'module_init' stuff). Quick test - not though or extensive. On 3 boots it successfully booted for me twice with: rt2880-pinmux pinctrl: pcie is already enabled mt7621-pci 1e14.pcie: Error applying setting, reverse things back mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz mt7621-pci 1e14.pcie: Port 0 N_FTS = 1b102800 mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz mt7621-pci 1e14.pcie: Port 1 N_FTS = 1b102800 mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz mt7621-pci 1e14.pcie: Port 2 N_FTS = 1b102800 mt7621-pci 1e14.pcie: pcie1 no card, disable it (RST & CLK) mt7621-pci 1e14.pcie: pcie2 no card, disable it (RST & CLK) mt7621-pci 1e14.pcie: PCIE0 enabled mt7621-pci 1e14.pcie: PCI coherence region base: 0x6000, mask/settings: 0xf002 mt7621-pci 1e14.pcie: PCI host bridge to bus :00 pci_bus :00: root bus resource [io 0x] pci_bus :00: root bus resource [mem 0x6000-0x6fff] pci_bus :00: root bus resource [bus 00-ff] pci :00:00.0: [0e8d:0801] type 01 class 0x060400 pci :00:00.0: reg 0x10: [mem 0x-0x7fff] pci :00:00.0: reg 0x14: [mem 0x-0x] pci :00:00.0: supports D1 pci :00:00.0: PME# supported from D0 D1 D3hot pci :00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring pci :01:00.0: [168c:003c] type 00 class 0x028000 pci :01:00.0: reg 0x10: [mem 0x-0x001f 64bit] pci :01:00.0: reg 0x30: [mem 0x-0x pref] pci :01:00.0: supports D1 D2 pci :00:00.0: PCI bridge to [bus 01-ff] pci :00:00.0: bridge window [io 0x-0x0fff] pci :00:00.0: bridge window [mem 0x-0x000f] pci :00:00.0: bridge window [mem 0x-0x000f pref] pci_bus :01: busn_res: [bus 01-ff] end is updated to 01 pci :00:00.0: BAR 0: no space for [mem size 0x8000] pci :00:00.0: BAR 0: failed to assign [mem size 0x8000] pci :00:00.0: BAR 8: assigned [mem 0x6000-0x601f] pci :00:00.0: BAR 9: assigned [mem 0x6020-0x602f pref] pci :00:00.0: BAR 1: assigned [mem 0x6030-0x6030] pci :00:00.0: BAR 7: no space for [io size 0x1000] pci :00:00.0: BAR 7: failed to assign [io size 0x1000] pci :01:00.0: BAR 0: assigned [mem 0x6000-0x601f 64bit] pci :01:00.0: BAR 6: assigned [mem 0x6020-0x6020 pref] pci :00:00.0: PCI bridge to [bus 01] pci :00:00.0: bridge window [mem 0x6000-0x601f] pci :00:00.0: bridge window [mem 0x6020-0x602f pref] pcieport :00:00.0: of_irq_parse_pci: failed with rc=-22 pcieport :00:00.0: enabling device (0004 -> 0006) PCI devices worked ok on the 2 good boots. Regards Greg Hope this helps. Best regards, Sergio Paracuellos Sergio Paracuellos (4): staging: mt7621-pci: disable pcie port clock if there is no pcie link staging: mt7621-pci: add phy exit call if phy_power_on call fails staging: mt7621-pci-phy: remove disable clock from the phy exit function staging: mt7621-pci: use 'module_init' instead of 'arch_initcall' drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c | 8 drivers/staging/mt7621-pci/pci-mt7621.c | 10 +- 2 files changed, 9 insertions(+), 9 deletions(-) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 4/4] rts5208: Fix usleep range is preferred over udelay
On Wed 2019-06-19 17:46:48, Lukas Schneider wrote: > This patch fixes the issue reported by checkpatch: > > CHECK: usleep_range is preferred over udelay; > see Doucmentation/timers/timers-howto.txt > > It's save to sleep here instead of using busy waiting, > because we are not in an atomic context. Is it good idea? How can the system really sleep for 50 usec? Pavel > @@ -865,7 +865,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 > sample_point, u8 tune_dir) >PHASE_CHANGE); > if (retval) > return retval; > - udelay(50); > + usleep_range(50, 60); > retval = rtsx_write_register(chip, SD_VP_CTL, 0xFF, >PHASE_CHANGE | >PHASE_NOT_RESET | > @@ -877,14 +877,14 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 > sample_point, u8 tune_dir) >CHANGE_CLK, CHANGE_CLK); > if (retval) > return retval; > - udelay(50); > + usleep_range(50, 60); > retval = rtsx_write_register(chip, SD_VP_CTL, 0xFF, >PHASE_NOT_RESET | >sample_point); > if (retval) > return retval; > } > - udelay(100); > + usleep_range(100, 110); > > rtsx_init_cmd(chip); > rtsx_add_cmd(chip, WRITE_REG_CMD, SD_DCMPS_CTL, DCMPS_CHANGE, > @@ -918,7 +918,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 > sample_point, u8 tune_dir) > return retval; > } > > - udelay(50); > + usleep_range(50, 60); > } > > retval = rtsx_write_register(chip, SD_CFG1, SD_ASYNC_FIFO_NOT_RST, 0); > @@ -1416,7 +1416,7 @@ static int sd_wait_data_idle(struct rtsx_chip *chip) > retval = STATUS_SUCCESS; > break; > } > - udelay(100); > + usleep_range(100, 110); > } > dev_dbg(rtsx_dev(chip), "SD_DATA_STATE: 0x%02x\n", val); > -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html signature.asc Description: Digital signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 5/8] staging: erofs: introduce generic decompression backend
Hi Chao, On 2019/6/21 17:46, Chao Yu wrote: > On 2019/6/21 0:07, Gao Xiang wrote: >> This patch adds a new generic decompression framework >> in order to replace the old LZ4-specific decompression code. >> >> Even though LZ4 is still the only supported algorithm, yet >> it is more cleaner and easy to integrate new algorithm than >> the old almost hard-coded decompression backend. >> >> Signed-off-by: Gao Xiang >> --- >> drivers/staging/erofs/Makefile | 2 +- >> drivers/staging/erofs/compress.h | 21 ++ >> drivers/staging/erofs/decompressor.c | 307 +++ >> 3 files changed, 329 insertions(+), 1 deletion(-) >> create mode 100644 drivers/staging/erofs/decompressor.c >> >> diff --git a/drivers/staging/erofs/Makefile b/drivers/staging/erofs/Makefile >> index 84b412c7a991..adeb5d6e2668 100644 >> --- a/drivers/staging/erofs/Makefile >> +++ b/drivers/staging/erofs/Makefile >> @@ -9,5 +9,5 @@ obj-$(CONFIG_EROFS_FS) += erofs.o >> ccflags-y += -I $(srctree)/$(src)/include >> erofs-objs := super.o inode.o data.o namei.o dir.o utils.o >> erofs-$(CONFIG_EROFS_FS_XATTR) += xattr.o >> -erofs-$(CONFIG_EROFS_FS_ZIP) += unzip_vle.o unzip_vle_lz4.o zmap.o >> +erofs-$(CONFIG_EROFS_FS_ZIP) += unzip_vle.o unzip_vle_lz4.o zmap.o >> decompressor.o >> >> diff --git a/drivers/staging/erofs/compress.h >> b/drivers/staging/erofs/compress.h >> index 1dcfc3b35118..ebeccb1f4eae 100644 >> --- a/drivers/staging/erofs/compress.h >> +++ b/drivers/staging/erofs/compress.h >> @@ -9,6 +9,24 @@ >> #ifndef __EROFS_FS_COMPRESS_H >> #define __EROFS_FS_COMPRESS_H >> >> +#include "internal.h" >> + >> +enum { >> +Z_EROFS_COMPRESSION_SHIFTED = Z_EROFS_COMPRESSION_MAX, >> +Z_EROFS_COMPRESSION_RUNTIME_MAX >> +}; >> + >> +struct z_erofs_decompress_req { >> +struct page **in, **out; >> + >> +unsigned short pageofs_out; >> +unsigned int inputsize, outputsize; >> + >> +/* indicate the algorithm will be used for decompression */ >> +unsigned int alg; >> +bool inplace_io, partial_decoding; >> +}; >> + >> /* >> * - 0x5A110C8D ('sallocated', Z_EROFS_MAPPING_STAGING) - >> * used to mark temporary allocated pages from other >> @@ -36,5 +54,8 @@ static inline bool z_erofs_put_stagingpage(struct >> list_head *pagepool, >> return true; >> } >> >> +int z_erofs_decompress(struct z_erofs_decompress_req *rq, >> + struct list_head *pagepool); >> + >> #endif >> >> diff --git a/drivers/staging/erofs/decompressor.c >> b/drivers/staging/erofs/decompressor.c >> new file mode 100644 >> index ..c68d17b579e0 >> --- /dev/null >> +++ b/drivers/staging/erofs/decompressor.c >> @@ -0,0 +1,307 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * linux/drivers/staging/erofs/decompressor.c >> + * >> + * Copyright (C) 2019 HUAWEI, Inc. >> + * http://www.huawei.com/ >> + * Created by Gao Xiang >> + */ >> +#include "compress.h" >> +#include >> + >> +#ifndef LZ4_DISTANCE_MAX/* history window size */ >> +#define LZ4_DISTANCE_MAX 65535 /* set to maximum value by default */ >> +#endif >> + >> +#define LZ4_MAX_DISTANCE_PAGES DIV_ROUND_UP(LZ4_DISTANCE_MAX, >> PAGE_SIZE) >> + >> +struct z_erofs_decompressor { >> +/* >> + * if destpages have sparsed pages, fill them with bounce pages. >> + * it also check whether destpages indicate continuous physical memory. >> + */ >> +int (*prepare_destpages)(struct z_erofs_decompress_req *rq, >> + struct list_head *pagepool); >> +int (*decompress)(struct z_erofs_decompress_req *rq, u8 *out); >> +char *name; >> +}; >> + >> +static int lz4_prepare_destpages(struct z_erofs_decompress_req *rq, >> + struct list_head *pagepool) >> +{ >> +const unsigned int nr = >> +PAGE_ALIGN(rq->pageofs_out + rq->outputsize) >> PAGE_SHIFT; >> +struct page *availables[LZ4_MAX_DISTANCE_PAGES] = { NULL }; >> +unsigned long unused[DIV_ROUND_UP(LZ4_MAX_DISTANCE_PAGES, >> + BITS_PER_LONG)] = { 0 }; >> +void *kaddr = NULL; >> +unsigned int i, j, k; >> + >> +for (i = 0; i < nr; ++i) { >> +struct page *const page = rq->out[i]; >> + >> +j = i & (LZ4_MAX_DISTANCE_PAGES - 1); >> +if (availables[j]) >> +__set_bit(j, unused); >> + >> +if (page) { >> +if (kaddr) { >> +if (kaddr + PAGE_SIZE == page_address(page)) >> +kaddr += PAGE_SIZE; >> +else >> +kaddr = NULL; >> +} else if (!i) { >> +kaddr = page_address(page); >> +} >> +continue; >> +} >> +kaddr = NULL; >> + >> +k = find_first_bit(unused, LZ4_MAX_DISTANCE_PAGES); >> +if (k <
Re: [PATCH v2 7/8] staging: erofs: switch to new decompression backend
On 2019/6/21 0:07, Gao Xiang wrote: > This patch integrates new decompression framework to > erofs decompression path, and remove the old > decompression implementation as well. > > On kirin980 platform, sequential read is slightly > improved to 778MiB/s after the new decompression > backend is used. > > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 8/8] staging: erofs: integrate decompression inplace
On 2019/6/21 0:07, Gao Xiang wrote: > Decompressor needs to know whether it's a partial > or full decompression since only full decompression > can be decompressed in-place. > > On kirin980 platform, sequential read is finally > increased to 812MiB/s after decompression inplace > is enabled. > > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 6/8] staging: erofs: introduce LZ4 decompression inplace
On 2019/6/21 0:07, Gao Xiang wrote: > compressed data will be usually loaded into last pages of > the extent (the last page for 4k) for in-place decompression > (more specifically, in-place IO), as ilustration below, > > start of compressed logical extent >| end of this logical extent >| | > __v___v > ... | page 6 | page 7 | page 8 | page 9 | ... > |__|__|__|__| >. ^ .^ >. |compressed| >. | data | >. .. >|< dstsize>|| >oend iend >opip > > Therefore, it's possible to do decompression inplace (thus no > memcpy at all) if the margin is sufficient and safe enough [1], > and it can be implemented only for fixed-size output compression > compared with fixed-size input compression. > > No memcpy for most of in-place IO (about 99% of enwik9) after > decompression inplace is implemented and sequential read will > be improved of course (see the following patches for test results). > > [1] https://github.com/lz4/lz4/commit/b17f578a919b7e6b078cede2d52be29dd48c8e8c > https://github.com/lz4/lz4/commit/5997e139f53169fa3a1c1b4418d2452a90b01602 > > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 5/8] staging: erofs: introduce generic decompression backend
On 2019/6/21 0:07, Gao Xiang wrote: > This patch adds a new generic decompression framework > in order to replace the old LZ4-specific decompression code. > > Even though LZ4 is still the only supported algorithm, yet > it is more cleaner and easy to integrate new algorithm than > the old almost hard-coded decompression backend. > > Signed-off-by: Gao Xiang > --- > drivers/staging/erofs/Makefile | 2 +- > drivers/staging/erofs/compress.h | 21 ++ > drivers/staging/erofs/decompressor.c | 307 +++ > 3 files changed, 329 insertions(+), 1 deletion(-) > create mode 100644 drivers/staging/erofs/decompressor.c > > diff --git a/drivers/staging/erofs/Makefile b/drivers/staging/erofs/Makefile > index 84b412c7a991..adeb5d6e2668 100644 > --- a/drivers/staging/erofs/Makefile > +++ b/drivers/staging/erofs/Makefile > @@ -9,5 +9,5 @@ obj-$(CONFIG_EROFS_FS) += erofs.o > ccflags-y += -I $(srctree)/$(src)/include > erofs-objs := super.o inode.o data.o namei.o dir.o utils.o > erofs-$(CONFIG_EROFS_FS_XATTR) += xattr.o > -erofs-$(CONFIG_EROFS_FS_ZIP) += unzip_vle.o unzip_vle_lz4.o zmap.o > +erofs-$(CONFIG_EROFS_FS_ZIP) += unzip_vle.o unzip_vle_lz4.o zmap.o > decompressor.o > > diff --git a/drivers/staging/erofs/compress.h > b/drivers/staging/erofs/compress.h > index 1dcfc3b35118..ebeccb1f4eae 100644 > --- a/drivers/staging/erofs/compress.h > +++ b/drivers/staging/erofs/compress.h > @@ -9,6 +9,24 @@ > #ifndef __EROFS_FS_COMPRESS_H > #define __EROFS_FS_COMPRESS_H > > +#include "internal.h" > + > +enum { > + Z_EROFS_COMPRESSION_SHIFTED = Z_EROFS_COMPRESSION_MAX, > + Z_EROFS_COMPRESSION_RUNTIME_MAX > +}; > + > +struct z_erofs_decompress_req { > + struct page **in, **out; > + > + unsigned short pageofs_out; > + unsigned int inputsize, outputsize; > + > + /* indicate the algorithm will be used for decompression */ > + unsigned int alg; > + bool inplace_io, partial_decoding; > +}; > + > /* > * - 0x5A110C8D ('sallocated', Z_EROFS_MAPPING_STAGING) - > * used to mark temporary allocated pages from other > @@ -36,5 +54,8 @@ static inline bool z_erofs_put_stagingpage(struct list_head > *pagepool, > return true; > } > > +int z_erofs_decompress(struct z_erofs_decompress_req *rq, > +struct list_head *pagepool); > + > #endif > > diff --git a/drivers/staging/erofs/decompressor.c > b/drivers/staging/erofs/decompressor.c > new file mode 100644 > index ..c68d17b579e0 > --- /dev/null > +++ b/drivers/staging/erofs/decompressor.c > @@ -0,0 +1,307 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * linux/drivers/staging/erofs/decompressor.c > + * > + * Copyright (C) 2019 HUAWEI, Inc. > + * http://www.huawei.com/ > + * Created by Gao Xiang > + */ > +#include "compress.h" > +#include > + > +#ifndef LZ4_DISTANCE_MAX /* history window size */ > +#define LZ4_DISTANCE_MAX 65535 /* set to maximum value by default */ > +#endif > + > +#define LZ4_MAX_DISTANCE_PAGES DIV_ROUND_UP(LZ4_DISTANCE_MAX, > PAGE_SIZE) > + > +struct z_erofs_decompressor { > + /* > + * if destpages have sparsed pages, fill them with bounce pages. > + * it also check whether destpages indicate continuous physical memory. > + */ > + int (*prepare_destpages)(struct z_erofs_decompress_req *rq, > + struct list_head *pagepool); > + int (*decompress)(struct z_erofs_decompress_req *rq, u8 *out); > + char *name; > +}; > + > +static int lz4_prepare_destpages(struct z_erofs_decompress_req *rq, > + struct list_head *pagepool) > +{ > + const unsigned int nr = > + PAGE_ALIGN(rq->pageofs_out + rq->outputsize) >> PAGE_SHIFT; > + struct page *availables[LZ4_MAX_DISTANCE_PAGES] = { NULL }; > + unsigned long unused[DIV_ROUND_UP(LZ4_MAX_DISTANCE_PAGES, > + BITS_PER_LONG)] = { 0 }; > + void *kaddr = NULL; > + unsigned int i, j, k; > + > + for (i = 0; i < nr; ++i) { > + struct page *const page = rq->out[i]; > + > + j = i & (LZ4_MAX_DISTANCE_PAGES - 1); > + if (availables[j]) > + __set_bit(j, unused); > + > + if (page) { > + if (kaddr) { > + if (kaddr + PAGE_SIZE == page_address(page)) > + kaddr += PAGE_SIZE; > + else > + kaddr = NULL; > + } else if (!i) { > + kaddr = page_address(page); > + } > + continue; > + } > + kaddr = NULL; > + > + k = find_first_bit(unused, LZ4_MAX_DISTANCE_PAGES); > + if (k < LZ4_MAX_DISTANCE_PAGES) { > + j = k; > + get_page(availables[j]); > + } else { > +
Re: [PATCH v2 3/8] staging: erofs: move per-CPU buffers implementation to utils.c
Hi Chao, On 2019/6/21 15:57, Chao Yu wrote: > On 2019/6/21 0:07, Gao Xiang wrote: >> +static inline void *erofs_get_pcpubuf(unsigned int pagenr) >> +{ >> +return ERR_PTR(-ENOTSUPP); >> +} > > [snip] > >> +percpu_data = erofs_get_pcpubuf(0); > > If erofs_get_pcpubuf may return error once EROFS_PCPUBUF_NR_PAGES equals to > zero, we'd better to check the error number here. decompressor.c will be built-in only when decompression is enabled and if decompression is enabled EROFS_PCPUBUF_NR_PAGES is not zero. But I think introducing some error handling logic is not bad as well. Will fix in the next version. Thanks, Gao Xiang > > Thanks, > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[GIT PULL] Staging/IIO driver fixes for 5.2-rc6
The following changes since commit f2c7c76c5d0a443053e94adb9f0918fa2fb85c3a: Linux 5.2-rc3 (2019-06-02 13:55:33 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git tags/staging-5.2-rc6 for you to fetch changes up to 9b9410766f5422d1e736783dc0c3a053eefedac4: Merge branch 'erofs_fix' into staging-linus (2019-06-17 22:59:28 +0200) Staging/IIO/Counter fixes for 5.2-rc6 Here are some small driver bugfixes for some staging/iio/counter drivers. Staging and IIO have been lumped together for a while, as those subsystems cross the areas a log, and counter is used by IIO, so that's why they are all in one pull request here. These are small fixes for reported issues in some iio drivers, the erofs filesystem, and a build issue for counter code. All have been in linux-next with no reported issues. Signed-off-by: Greg Kroah-Hartman Crt Mori (1): iio: temperature: mlx90632 Relax the compatibility check Fabio Estevam (1): staging: iio: adt7316: Fix build errors when GPIOLIB is not set Gao Xiang (1): staging: erofs: add requirements field in superblock Greg Kroah-Hartman (2): Merge tag 'iio-fixes-for-5.2b' of git://git.kernel.org/.../jic23/iio into staging-linus Merge branch 'erofs_fix' into staging-linus Lorenzo Bianconi (1): iio: imu: st_lsm6dsx: fix PM support for st_lsm6dsx i2c controller Melissa Wen (1): staging:iio:ad7150: fix threshold mode config bit Patrick Havelange (1): counter/ftm-quaddec: Add missing dependencies in Kconfig drivers/counter/Kconfig | 1 + drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 2 ++ drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 25 + drivers/iio/temperature/mlx90632.c | 9 +++-- drivers/staging/erofs/erofs_fs.h | 13 ++--- drivers/staging/erofs/internal.h | 2 ++ drivers/staging/erofs/super.c| 19 +++ drivers/staging/iio/addac/adt7316.c | 3 ++- drivers/staging/iio/cdc/ad7150.c | 19 +++ 9 files changed, 71 insertions(+), 22 deletions(-) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 2/8] staging: erofs: add compacted compression indexes support
On 2019/6/21 15:53, Chao Yu wrote: > On 2019/6/21 0:07, Gao Xiang wrote: >> This patch aims at compacted compression indexes: >> 1) cleanup z_erofs_map_blocks_iter and move into zmap.c; >> 2) add compacted 4/2B decoding support. >> >> On kirin980 platform, sequential read is increased about >> 6% (725MiB/s -> 770MiB/s) on enwik9 dataset if compacted 2B >> feature is enabled. >> >> Signed-off-by: Gao Xiang > > Reviewed-by: Chao Yu > >> +static int vle_legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m, >> + unsigned long lcn) >> +{ >> +struct inode *const inode = m->inode; >> +struct erofs_vnode *const vi = EROFS_V(inode); >> +const erofs_off_t ibase = iloc(EROFS_I_SB(inode), vi->nid); >> +const erofs_off_t pos = Z_EROFS_VLE_EXTENT_ALIGN(ibase + >> + vi->inode_isize + >> + vi->xattr_isize) + >> +16 + lcn * sizeof(struct z_erofs_vle_decompressed_index); > > use macro instead of raw number? OK, I will wrap it up in patch v3 too. Thanks, Gao Xiang > > Thanks, > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/8] staging: erofs: add compacted ondisk compression indexes
Hi Chao, On 2019/6/21 15:46, Chao Yu wrote: > On 2019/6/21 0:07, Gao Xiang wrote: >> This patch introduces new compacted compression indexes. >> >> In contract to legacy compression indexes that >>each 4k logical cluster has an 8-byte index, >> compacted ondisk compression indexes will have >>amortized 2 bytes for each 4k logical cluster (compacted 2B) >>amortized 4 bytes for each 4k logical cluster (compacted 4B) >> >> In detail, several continuous clusters will be encoded in >> a compacted pack with cluster types, offsets, and one blkaddr >> at the end of the pack to leave 4-byte margin for better >> decoding performance, as illustrated below: >>_ >> |___@_ encoded bits __|_ blkaddr _| >> 0 . amortized * vcnt >> . . >> . . amortized * vcnt - 4 >> .. >> .___. >> |_type_|_clusterofs_| >> >> Note that compacted 2 / 4B should be aligned with 32 / 8 bytes >> in order to avoid each pack crossing page boundary. >> >> Signed-off-by: Gao Xiang >> --- >> drivers/staging/erofs/data.c | 4 +-- >> drivers/staging/erofs/erofs_fs.h | 57 +-- >> drivers/staging/erofs/inode.c | 5 +-- >> drivers/staging/erofs/internal.h | 11 ++ >> drivers/staging/erofs/unzip_vle.c | 8 ++--- >> 5 files changed, 56 insertions(+), 29 deletions(-) >> >> diff --git a/drivers/staging/erofs/data.c b/drivers/staging/erofs/data.c >> index 746685f90564..cc31c3e5984c 100644 >> --- a/drivers/staging/erofs/data.c >> +++ b/drivers/staging/erofs/data.c >> @@ -124,7 +124,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode, >> trace_erofs_map_blocks_flatmode_enter(inode, map, flags); >> >> nblocks = DIV_ROUND_UP(inode->i_size, PAGE_SIZE); >> -lastblk = nblocks - is_inode_layout_inline(inode); >> +lastblk = nblocks - is_inode_flat_inline(inode); >> >> if (unlikely(offset >= inode->i_size)) { >> /* leave out-of-bound access unmapped */ >> @@ -139,7 +139,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode, >> if (offset < blknr_to_addr(lastblk)) { >> map->m_pa = blknr_to_addr(vi->raw_blkaddr) + map->m_la; >> map->m_plen = blknr_to_addr(lastblk) - offset; >> -} else if (is_inode_layout_inline(inode)) { >> +} else if (is_inode_flat_inline(inode)) { >> /* 2 - inode inline B: inode, [xattrs], inline last blk... */ >> struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb); >> >> diff --git a/drivers/staging/erofs/erofs_fs.h >> b/drivers/staging/erofs/erofs_fs.h >> index 8ddb2b3e7d39..a05139f1df60 100644 >> --- a/drivers/staging/erofs/erofs_fs.h >> +++ b/drivers/staging/erofs/erofs_fs.h >> @@ -49,19 +49,29 @@ struct erofs_super_block { >> * erofs inode data mapping: >> * 0 - inode plain without inline data A: >> * inode, [xattrs], ... | ... | no-holed data >> - * 1 - inode VLE compression B: >> + * 1 - inode VLE compression B (legacy): >> * inode, [xattrs], extents ... | ... >> * 2 - inode plain with inline data C: >> * inode, [xattrs], last_inline_data, ... | ... | no-holed data >> - * 3~7 - reserved >> + * 3 - inode compression D: >> + * inode, [xattrs], map_header, extents ... | ... >> + * 4~7 - reserved >> */ >> enum { >> -EROFS_INODE_LAYOUT_PLAIN, >> -EROFS_INODE_LAYOUT_COMPRESSION, >> -EROFS_INODE_LAYOUT_INLINE, >> +EROFS_INODE_FLAT_PLAIN, >> +EROFS_INODE_FLAT_COMPRESSION_LEGACY, >> +EROFS_INODE_FLAT_INLINE, >> +EROFS_INODE_FLAT_COMPRESSION, >> EROFS_INODE_LAYOUT_MAX >> }; >> >> +static bool erofs_inode_is_data_compressed(unsigned int datamode) >> +{ >> +if (datamode == EROFS_INODE_FLAT_COMPRESSION) >> +return true; >> +return datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY; >> +} >> + >> /* bit definitions of inode i_advise */ >> #define EROFS_I_VERSION_BITS1 >> #define EROFS_I_DATA_MAPPING_BITS 3 >> @@ -176,11 +186,37 @@ struct erofs_xattr_entry { >> sizeof(struct erofs_xattr_entry) + \ >> (entry)->e_name_len + le16_to_cpu((entry)->e_value_size)) >> >> -/* have to be aligned with 8 bytes on disk */ >> -struct erofs_extent_header { >> -__le32 eh_checksum; >> -__le32 eh_reserved[3]; >> -} __packed; >> +/* available compression algorithm types */ >> +enum { >> +Z_EROFS_COMPRESSION_LZ4, >> +Z_EROFS_COMPRESSION_MAX >> +}; >> + >> +/* >> + * bit 0 : COMPACTED_2B indexes (0 - off; 1 - on) >> + * e.g. for 4k logical cluster size, 4Bif compacted 2B is off; >> + * (4B) + 2B + (4B) if compacted 2B is on. >> + */ >> +#define Z_EROFS_ADVISE_COMPACTED_2B_BIT 0 >> + >> +#define Z_EROFS_ADVISE_COMPACTED_2B (1 << >> Z_EROFS_ADVISE_COMPACTED_2B_BIT) >> + >> +struct z_erofs_map_header { >> +__le32 h_reserved1; >> +__le16
Re: [PATCH v2 4/8] staging: erofs: move stagingpage operations to compress.h
On 2019/6/21 0:07, Gao Xiang wrote: > stagingpages are behaved as bounce pages for temporary use. > Move to compress.h since the upcoming decompressor will > allocate stagingpages as well. > > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks, ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 3/8] staging: erofs: move per-CPU buffers implementation to utils.c
On 2019/6/21 0:07, Gao Xiang wrote: > +static inline void *erofs_get_pcpubuf(unsigned int pagenr) > +{ > + return ERR_PTR(-ENOTSUPP); > +} [snip] > + percpu_data = erofs_get_pcpubuf(0); If erofs_get_pcpubuf may return error once EROFS_PCPUBUF_NR_PAGES equals to zero, we'd better to check the error number here. Thanks, ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 2/8] staging: erofs: add compacted compression indexes support
On 2019/6/21 0:07, Gao Xiang wrote: > This patch aims at compacted compression indexes: > 1) cleanup z_erofs_map_blocks_iter and move into zmap.c; > 2) add compacted 4/2B decoding support. > > On kirin980 platform, sequential read is increased about > 6% (725MiB/s -> 770MiB/s) on enwik9 dataset if compacted 2B > feature is enabled. > > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu > +static int vle_legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m, > + unsigned long lcn) > +{ > + struct inode *const inode = m->inode; > + struct erofs_vnode *const vi = EROFS_V(inode); > + const erofs_off_t ibase = iloc(EROFS_I_SB(inode), vi->nid); > + const erofs_off_t pos = Z_EROFS_VLE_EXTENT_ALIGN(ibase + > + vi->inode_isize + > + vi->xattr_isize) + > + 16 + lcn * sizeof(struct z_erofs_vle_decompressed_index); use macro instead of raw number? Thanks, ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/8] staging: erofs: add compacted ondisk compression indexes
On 2019/6/21 0:07, Gao Xiang wrote: > This patch introduces new compacted compression indexes. > > In contract to legacy compression indexes that >each 4k logical cluster has an 8-byte index, > compacted ondisk compression indexes will have >amortized 2 bytes for each 4k logical cluster (compacted 2B) >amortized 4 bytes for each 4k logical cluster (compacted 4B) > > In detail, several continuous clusters will be encoded in > a compacted pack with cluster types, offsets, and one blkaddr > at the end of the pack to leave 4-byte margin for better > decoding performance, as illustrated below: >_ > |___@_ encoded bits __|_ blkaddr _| > 0 . amortized * vcnt > . . > . . amortized * vcnt - 4 > .. > .___. > |_type_|_clusterofs_| > > Note that compacted 2 / 4B should be aligned with 32 / 8 bytes > in order to avoid each pack crossing page boundary. > > Signed-off-by: Gao Xiang > --- > drivers/staging/erofs/data.c | 4 +-- > drivers/staging/erofs/erofs_fs.h | 57 +-- > drivers/staging/erofs/inode.c | 5 +-- > drivers/staging/erofs/internal.h | 11 ++ > drivers/staging/erofs/unzip_vle.c | 8 ++--- > 5 files changed, 56 insertions(+), 29 deletions(-) > > diff --git a/drivers/staging/erofs/data.c b/drivers/staging/erofs/data.c > index 746685f90564..cc31c3e5984c 100644 > --- a/drivers/staging/erofs/data.c > +++ b/drivers/staging/erofs/data.c > @@ -124,7 +124,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode, > trace_erofs_map_blocks_flatmode_enter(inode, map, flags); > > nblocks = DIV_ROUND_UP(inode->i_size, PAGE_SIZE); > - lastblk = nblocks - is_inode_layout_inline(inode); > + lastblk = nblocks - is_inode_flat_inline(inode); > > if (unlikely(offset >= inode->i_size)) { > /* leave out-of-bound access unmapped */ > @@ -139,7 +139,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode, > if (offset < blknr_to_addr(lastblk)) { > map->m_pa = blknr_to_addr(vi->raw_blkaddr) + map->m_la; > map->m_plen = blknr_to_addr(lastblk) - offset; > - } else if (is_inode_layout_inline(inode)) { > + } else if (is_inode_flat_inline(inode)) { > /* 2 - inode inline B: inode, [xattrs], inline last blk... */ > struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb); > > diff --git a/drivers/staging/erofs/erofs_fs.h > b/drivers/staging/erofs/erofs_fs.h > index 8ddb2b3e7d39..a05139f1df60 100644 > --- a/drivers/staging/erofs/erofs_fs.h > +++ b/drivers/staging/erofs/erofs_fs.h > @@ -49,19 +49,29 @@ struct erofs_super_block { > * erofs inode data mapping: > * 0 - inode plain without inline data A: > * inode, [xattrs], ... | ... | no-holed data > - * 1 - inode VLE compression B: > + * 1 - inode VLE compression B (legacy): > * inode, [xattrs], extents ... | ... > * 2 - inode plain with inline data C: > * inode, [xattrs], last_inline_data, ... | ... | no-holed data > - * 3~7 - reserved > + * 3 - inode compression D: > + * inode, [xattrs], map_header, extents ... | ... > + * 4~7 - reserved > */ > enum { > - EROFS_INODE_LAYOUT_PLAIN, > - EROFS_INODE_LAYOUT_COMPRESSION, > - EROFS_INODE_LAYOUT_INLINE, > + EROFS_INODE_FLAT_PLAIN, > + EROFS_INODE_FLAT_COMPRESSION_LEGACY, > + EROFS_INODE_FLAT_INLINE, > + EROFS_INODE_FLAT_COMPRESSION, > EROFS_INODE_LAYOUT_MAX > }; > > +static bool erofs_inode_is_data_compressed(unsigned int datamode) > +{ > + if (datamode == EROFS_INODE_FLAT_COMPRESSION) > + return true; > + return datamode == EROFS_INODE_FLAT_COMPRESSION_LEGACY; > +} > + > /* bit definitions of inode i_advise */ > #define EROFS_I_VERSION_BITS1 > #define EROFS_I_DATA_MAPPING_BITS 3 > @@ -176,11 +186,37 @@ struct erofs_xattr_entry { > sizeof(struct erofs_xattr_entry) + \ > (entry)->e_name_len + le16_to_cpu((entry)->e_value_size)) > > -/* have to be aligned with 8 bytes on disk */ > -struct erofs_extent_header { > - __le32 eh_checksum; > - __le32 eh_reserved[3]; > -} __packed; > +/* available compression algorithm types */ > +enum { > + Z_EROFS_COMPRESSION_LZ4, > + Z_EROFS_COMPRESSION_MAX > +}; > + > +/* > + * bit 0 : COMPACTED_2B indexes (0 - off; 1 - on) > + * e.g. for 4k logical cluster size, 4Bif compacted 2B is off; > + * (4B) + 2B + (4B) if compacted 2B is on. > + */ > +#define Z_EROFS_ADVISE_COMPACTED_2B_BIT 0 > + > +#define Z_EROFS_ADVISE_COMPACTED_2B (1 << > Z_EROFS_ADVISE_COMPACTED_2B_BIT) > + > +struct z_erofs_map_header { > + __le32 h_reserved1; > + __le16 h_advise; > + /* > + * bit 0-3 : algorithm type of head 1 (logical cluster type 01); > + * bit 4-7 : algorithm type of
[PATCH v2] staging: ks7010: Fix build error
when CRYPTO is m and KS7010 is y, building fails: drivers/staging/ks7010/ks_hostif.o: In function `michael_mic.constprop.13': ks_hostif.c:(.text+0x560): undefined reference to `crypto_alloc_shash' ks_hostif.c:(.text+0x580): undefined reference to `crypto_shash_setkey' ks_hostif.c:(.text+0x5e0): undefined reference to `crypto_destroy_tfm' ks_hostif.c:(.text+0x614): undefined reference to `crypto_shash_update' ks_hostif.c:(.text+0x62c): undefined reference to `crypto_shash_update' ks_hostif.c:(.text+0x648): undefined reference to `crypto_shash_finup' Add CRYPTO and CRYPTO_HASH dependencies to fix this. Reported-by: Hulk Robot Fixes: 8b523f20417d ("staging: ks7010: removed custom Michael MIC implementation.") Signed-off-by: YueHaibing --- v2: use 'depends on' instead of 'select' --- drivers/staging/ks7010/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/ks7010/Kconfig b/drivers/staging/ks7010/Kconfig index 0987fdc..9d7cbc8 100644 --- a/drivers/staging/ks7010/Kconfig +++ b/drivers/staging/ks7010/Kconfig @@ -5,6 +5,7 @@ config KS7010 select WIRELESS_EXT select WEXT_PRIV select FW_LOADER + depends on CRYPTO && CRYPTO_HASH help This is a driver for KeyStream KS7010 based SDIO WIFI cards. It is found on at least later Spectec SDW-821 (FCC-ID "S2Y-WLAN-11G-K" only, -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: ks7010: Fix build error
On Fri, Jun 21, 2019 at 11:42:21AM +0800, YueHaibing wrote: > when CRYPTO is m and KS7010 is y, building fails: > > drivers/staging/ks7010/ks_hostif.o: In function `michael_mic.constprop.13': > ks_hostif.c:(.text+0x560): undefined reference to `crypto_alloc_shash' > ks_hostif.c:(.text+0x580): undefined reference to `crypto_shash_setkey' > ks_hostif.c:(.text+0x5e0): undefined reference to `crypto_destroy_tfm' > ks_hostif.c:(.text+0x614): undefined reference to `crypto_shash_update' > ks_hostif.c:(.text+0x62c): undefined reference to `crypto_shash_update' > ks_hostif.c:(.text+0x648): undefined reference to `crypto_shash_finup' > > select CRYPTO and CRYPTO_HASH to fix this. > > Reported-by: Hulk Robot > Fixes: 8b523f20417d ("staging: ks7010: removed custom Michael MIC > implementation.") > Signed-off-by: YueHaibing > --- > drivers/staging/ks7010/Kconfig | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/staging/ks7010/Kconfig b/drivers/staging/ks7010/Kconfig > index 0987fdc..6a20e64 100644 > --- a/drivers/staging/ks7010/Kconfig > +++ b/drivers/staging/ks7010/Kconfig > @@ -5,6 +5,8 @@ config KS7010 > select WIRELESS_EXT > select WEXT_PRIV > select FW_LOADER > + select CRYPTO > + select CRYPTO_HASH selects are horrible. can we do a depends on instead? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] staging: media: fix style problem
From: Aliasgar Surti checkpatch reported "WARNING: line over 80 characters". This patch fixes the warning for file soc_camera/soc_ov5642.c Signed-off-by: Aliasgar Surti --- drivers/staging/media/soc_camera/soc_ov5642.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/soc_camera/soc_ov5642.c b/drivers/staging/media/soc_camera/soc_ov5642.c index 94696d7..39ae24dc 100644 --- a/drivers/staging/media/soc_camera/soc_ov5642.c +++ b/drivers/staging/media/soc_camera/soc_ov5642.c @@ -687,7 +687,8 @@ static int reg_write16(struct i2c_client *client, u16 reg, u16 val16) } #ifdef CONFIG_VIDEO_ADV_DEBUG -static int ov5642_get_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) +static int ov5642_get_register(struct v4l2_subdev *sd, + struct v4l2_dbg_register *reg) { struct i2c_client *client = v4l2_get_subdevdata(sd); int ret; @@ -705,7 +706,8 @@ static int ov5642_get_register(struct v4l2_subdev *sd, struct v4l2_dbg_register return ret; } -static int ov5642_set_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) +static int ov5642_set_register(struct v4l2_subdev *sd, + const struct v4l2_dbg_register *reg) { struct i2c_client *client = v4l2_get_subdevdata(sd); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] staging: mt7621-pci-phy: remove disable clock from the phy exit function
The clock which has been used here is not about the phy but the pcie port. It has been properly handled into host pcie driver code. Hence, remove it from here which is the correct thing to do. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c b/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c index 2576f179e30a..d2a07f145143 100644 --- a/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c +++ b/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c @@ -16,10 +16,6 @@ #include #include -#define RALINK_CLKCFG1 0x30 - -#define PCIE_PORT_CLK_EN(x)BIT(24 + (x)) - #define RG_PE1_PIPE_REG0x02c #define RG_PE1_PIPE_RSTBIT(12) #define RG_PE1_PIPE_CMD_FRCBIT(4) @@ -286,10 +282,6 @@ static int mt7621_pci_phy_power_off(struct phy *phy) static int mt7621_pci_phy_exit(struct phy *phy) { - struct mt7621_pci_phy_instance *instance = phy_get_drvdata(phy); - - rt_sysc_m32(PCIE_PORT_CLK_EN(instance->index), 0, RALINK_CLKCFG1); - return 0; } -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging: mt7621-pci: use 'module_init' instead of 'arch_initcall'
This driver has dependencies on mt7621-gpio and mt7621-pci-phy which are init in later stages. Hence, when this driver is probed it is always returning 'EPROBE_DEFER' and being initialized afterwards. Use function 'module_init' to just initialize later. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index da2e180f8d19..a981f4f0ed03 100644 --- a/drivers/staging/mt7621-pci/pci-mt7621.c +++ b/drivers/staging/mt7621-pci/pci-mt7621.c @@ -727,4 +727,4 @@ static int __init mt7621_pci_init(void) return platform_driver_register(_pci_driver); } -arch_initcall(mt7621_pci_init); +module_init(mt7621_pci_init); -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] staging: mt7621-pci: add phy exit call if phy_power_on call fails
Add missing call to 'phy_exit' function if the phy_power_on call fails. With this call added the error path is properly handled. Fixes: 07420a02b003 ("staging: mt7621-pci: use gpio perst instead of builtin behaviour") Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index f6b91b29fb9c..da2e180f8d19 100644 --- a/drivers/staging/mt7621-pci/pci-mt7621.c +++ b/drivers/staging/mt7621-pci/pci-mt7621.c @@ -436,6 +436,7 @@ static int mt7621_pcie_init_port(struct mt7621_pcie_port *port) err = phy_power_on(port->phy); if (err) { dev_err(dev, "failed to power on port%d phy\n", slot); + phy_exit(port->phy); return err; } -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging: mt7621-pci: disable pcie port clock if there is no pcie link
When there is no pcie link detected we have to properly disable the port pcie clock. Signed-off-by: Sergio Paracuellos --- drivers/staging/mt7621-pci/pci-mt7621.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index de09bda0b4cd..f6b91b29fb9c 100644 --- a/drivers/staging/mt7621-pci/pci-mt7621.c +++ b/drivers/staging/mt7621-pci/pci-mt7621.c @@ -45,6 +45,7 @@ #define PCIE_FTS_NUM_L0(x) ((x) & 0xff << 8) /* rt_sysc_membase relative registers */ +#define RALINK_CLKCFG1 0x30 #define RALINK_PCIE_CLK_GEN0x7c #define RALINK_PCIE_CLK_GEN1 0x80 @@ -221,6 +222,11 @@ static inline bool mt7621_pcie_port_is_linkup(struct mt7621_pcie_port *port) return (pcie_port_read(port, RALINK_PCI_STATUS) & PCIE_PORT_LINKUP) != 0; } +static inline void mt7621_pcie_port_clk_disable(struct mt7621_pcie_port *port) +{ + rt_sysc_m32(PCIE_PORT_CLK_EN(port->slot), 0, RALINK_CLKCFG1); +} + static inline void mt7621_control_assert(struct mt7621_pcie_port *port) { u32 chip_rev_id = rt_sysc_r32(MT7621_CHIP_REV_ID); @@ -475,6 +481,7 @@ static void mt7621_pcie_init_ports(struct mt7621_pcie *pcie) slot); phy_power_off(port->phy); mt7621_control_assert(port); + mt7621_pcie_port_clk_disable(port); port->enabled = false; } } -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/4] staging: mt7621-pci: Handle minor issues
This patch series properly handle minor issues in this driver. These are: * Disable pcie port clock on pci dirver instead of doing it in the phy driver. The pci driver is the correct place to do this. * Add a missing call to phy_exit function to properly handle the function 'mt7621_pcie_init_port' error path. * Move driver to init in a later stage using 'module_init' instead of using 'arch_initcall'. Patches are only compile-tested. It would be awasome to be tested before applied them (mainly the change to 'module_init' stuff). Hope this helps. Best regards, Sergio Paracuellos Sergio Paracuellos (4): staging: mt7621-pci: disable pcie port clock if there is no pcie link staging: mt7621-pci: add phy exit call if phy_power_on call fails staging: mt7621-pci-phy: remove disable clock from the phy exit function staging: mt7621-pci: use 'module_init' instead of 'arch_initcall' drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c | 8 drivers/staging/mt7621-pci/pci-mt7621.c | 10 +- 2 files changed, 9 insertions(+), 9 deletions(-) -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/10] staging: rtl8712: Remove function r8712_setfwdig_cmd()
Remove unused function r8712_setfwdig_cmd(). Signed-off-by: Nishka Dasgupta --- drivers/staging/rtl8712/rtl871x_cmd.c | 20 drivers/staging/rtl8712/rtl871x_cmd.h | 1 - 2 files changed, 21 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index f3ecd4332dca..65f37cd0ebb7 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -279,26 +279,6 @@ void r8712_set_chplan_cmd(struct _adapter *padapter, int chplan) r8712_enqueue_cmd(pcmdpriv, ph2c); } -u8 r8712_setfwdig_cmd(struct _adapter *padapter, u8 type) -{ - struct cmd_obj *ph2c; - struct writePTM_parm *pwriteptmparm; - struct cmd_priv *pcmdpriv = >cmdpriv; - - ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC); - if (!ph2c) - return _FAIL; - pwriteptmparm = kmalloc(sizeof(*pwriteptmparm), GFP_ATOMIC); - if (!pwriteptmparm) { - kfree(ph2c); - return _FAIL; - } - init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetDIG)); - pwriteptmparm->type = type; - r8712_enqueue_cmd(pcmdpriv, ph2c); - return _SUCCESS; -} - u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type) { struct cmd_obj *ph2c; diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h index d029097f3684..5a3ef023d38f 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.h +++ b/drivers/staging/rtl8712/rtl871x_cmd.h @@ -726,7 +726,6 @@ u8 r8712_setrfintfs_cmd(struct _adapter *padapter, u8 mode); u8 r8712_setrfreg_cmd(struct _adapter *padapter, u8 offset, u32 val); u8 r8712_setrttbl_cmd(struct _adapter *padapter, struct setratable_parm *prate_table); -u8 r8712_setfwdig_cmd(struct _adapter *padapter, u8 type); u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type); void r8712_addbareq_cmd(struct _adapter *padapter, u8 tid); void r8712_wdg_wk_cmd(struct _adapter *padapter); -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/10] staging: rtl8712: Remove function r8712_setfwra_cmd()
Remove unused function r8712_setfwra_cmd. Signed-off-by: Nishka Dasgupta --- drivers/staging/rtl8712/rtl871x_cmd.c | 20 drivers/staging/rtl8712/rtl871x_cmd.h | 1 - 2 files changed, 21 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 65f37cd0ebb7..ba30294f8813 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -279,26 +279,6 @@ void r8712_set_chplan_cmd(struct _adapter *padapter, int chplan) r8712_enqueue_cmd(pcmdpriv, ph2c); } -u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type) -{ - struct cmd_obj *ph2c; - struct writePTM_parm *pwriteptmparm; - struct cmd_priv *pcmdpriv = >cmdpriv; - - ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC); - if (!ph2c) - return _FAIL; - pwriteptmparm = kmalloc(sizeof(*pwriteptmparm), GFP_ATOMIC); - if (!pwriteptmparm) { - kfree(ph2c); - return _FAIL; - } - init_h2fwcmd_w_parm_no_rsp(ph2c, pwriteptmparm, GEN_CMD_CODE(_SetRA)); - pwriteptmparm->type = type; - r8712_enqueue_cmd(pcmdpriv, ph2c); - return _SUCCESS; -} - u8 r8712_setrfreg_cmd(struct _adapter *padapter, u8 offset, u32 val) { struct cmd_obj *ph2c; diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h index 5a3ef023d38f..803727b499b7 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.h +++ b/drivers/staging/rtl8712/rtl871x_cmd.h @@ -726,7 +726,6 @@ u8 r8712_setrfintfs_cmd(struct _adapter *padapter, u8 mode); u8 r8712_setrfreg_cmd(struct _adapter *padapter, u8 offset, u32 val); u8 r8712_setrttbl_cmd(struct _adapter *padapter, struct setratable_parm *prate_table); -u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type); void r8712_addbareq_cmd(struct _adapter *padapter, u8 tid); void r8712_wdg_wk_cmd(struct _adapter *padapter); void r8712_survey_cmd_callback(struct _adapter *padapter, -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/10] staging: rtl8712: Remove function r8712_setbasicrate_cmd
Remove unused function r8712_setbasicrate_cmd. Signed-off-by: Nishka Dasgupta --- drivers/staging/rtl8712/rtl871x_cmd.c | 21 - drivers/staging/rtl8712/rtl871x_cmd.h | 1 - 2 files changed, 22 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 66c2f4750497..f3ecd4332dca 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -279,27 +279,6 @@ void r8712_set_chplan_cmd(struct _adapter *padapter, int chplan) r8712_enqueue_cmd(pcmdpriv, ph2c); } -u8 r8712_setbasicrate_cmd(struct _adapter *padapter, u8 *rateset) -{ - struct cmd_obj *ph2c; - struct setbasicrate_parm *pssetbasicratepara; - struct cmd_priv *pcmdpriv = >cmdpriv; - - ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC); - if (!ph2c) - return _FAIL; - pssetbasicratepara = kmalloc(sizeof(*pssetbasicratepara), GFP_ATOMIC); - if (!pssetbasicratepara) { - kfree(ph2c); - return _FAIL; - } - init_h2fwcmd_w_parm_no_rsp(ph2c, pssetbasicratepara, - _SetBasicRate_CMD_); - memcpy(pssetbasicratepara->basicrates, rateset, NumRates); - r8712_enqueue_cmd(pcmdpriv, ph2c); - return _SUCCESS; -} - u8 r8712_setfwdig_cmd(struct _adapter *padapter, u8 type) { struct cmd_obj *ph2c; diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h index 0817d126254f..d029097f3684 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.h +++ b/drivers/staging/rtl8712/rtl871x_cmd.h @@ -721,7 +721,6 @@ void r8712_setopmode_cmd(struct _adapter *padapter, enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype); int r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset); void r8712_set_chplan_cmd(struct _adapter *padapter, int chplan); -u8 r8712_setbasicrate_cmd(struct _adapter *padapter, u8 *rateset); u8 r8712_getrfreg_cmd(struct _adapter *padapter, u8 offset, u8 *pval); u8 r8712_setrfintfs_cmd(struct _adapter *padapter, u8 mode); u8 r8712_setrfreg_cmd(struct _adapter *padapter, u8 offset, u32 val); -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/10] staging: rtl8712: Replace function r8712_init_cmd_priv()
Remove function r8712_init_cmd_priv as all it does is call _init_cmd_priv. Rename _init_cmd_priv to r8712_init_cmd_priv to maintain compatibility with call sites. Change type of new r8712_init_cmd_priv from static to non-static as original r8712_init_cmd_priv was non-static. Change return type of new r8712_init_cmd_priv to int as original had return type u32 but new (formerly _init_cmd_priv) had return type sint. Signed-off-by: Nishka Dasgupta --- drivers/staging/rtl8712/rtl871x_cmd.c | 7 +-- drivers/staging/rtl8712/rtl871x_cmd.h | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 752418692be0..c6643c371271 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -43,7 +43,7 @@ * No irqsave is necessary. */ -static sint _init_cmd_priv(struct cmd_priv *pcmdpriv) +int r8712_init_cmd_priv(struct cmd_priv *pcmdpriv) { init_completion(>cmd_queue_comp); init_completion(>terminate_cmdthread_comp); @@ -135,11 +135,6 @@ static struct cmd_obj *_dequeue_cmd(struct __queue *queue) return obj; } -u32 r8712_init_cmd_priv(struct cmd_priv *pcmdpriv) -{ - return _init_cmd_priv(pcmdpriv); -} - u32 r8712_init_evt_priv(struct evt_priv *pevtpriv) { return _init_evt_priv(pevtpriv); diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h index efca88b4ea99..0203037adb7f 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.h +++ b/drivers/staging/rtl8712/rtl871x_cmd.h @@ -84,7 +84,7 @@ void r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj); struct cmd_obj *r8712_dequeue_cmd(struct __queue *queue); void r8712_free_cmd_obj(struct cmd_obj *pcmd); int r8712_cmd_thread(void *context); -u32 r8712_init_cmd_priv(struct cmd_priv *pcmdpriv); +int r8712_init_cmd_priv(struct cmd_priv *pcmdpriv); void r8712_free_cmd_priv(struct cmd_priv *pcmdpriv); u32 r8712_init_evt_priv(struct evt_priv *pevtpriv); void r8712_free_evt_priv(struct evt_priv *pevtpriv); -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/10] staging: rtl8712: r8712_wdg_timeout_handler: Remove function
Remove function _r8712_wdg_timeout_handler as all it does is call r8712_wdg_wk_cmd. Modify call site of _r8712_wdg_timeout_handler to call r8712_wdg_wk_cmd instead. Signed-off-by: Nishka Dasgupta --- drivers/staging/rtl8712/mlme_linux.c | 2 +- drivers/staging/rtl8712/rtl871x_mlme.c | 5 - drivers/staging/rtl8712/rtl871x_mlme.h | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/rtl8712/mlme_linux.c b/drivers/staging/rtl8712/mlme_linux.c index 23b87ccf4d07..b9f5104f3bf7 100644 --- a/drivers/staging/rtl8712/mlme_linux.c +++ b/drivers/staging/rtl8712/mlme_linux.c @@ -60,7 +60,7 @@ static void wdg_timeout_handler (struct timer_list *t) struct _adapter *adapter = from_timer(adapter, t, mlmepriv.wdg_timer); - _r8712_wdg_timeout_handler(adapter); + r8712_wdg_wk_cmd(adapter); mod_timer(>mlmepriv.wdg_timer, jiffies + msecs_to_jiffies(2000)); diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index b260c29ea4bd..c5546d42 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -1079,11 +1079,6 @@ void _r8712_dhcp_timeout_handler (struct _adapter *adapter) adapter->registrypriv.smart_ps); } -void _r8712_wdg_timeout_handler(struct _adapter *adapter) -{ - r8712_wdg_wk_cmd(adapter); -} - int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv) { struct list_head *phead; diff --git a/drivers/staging/rtl8712/rtl871x_mlme.h b/drivers/staging/rtl8712/rtl871x_mlme.h index 9e8343139414..a160107e9801 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.h +++ b/drivers/staging/rtl8712/rtl871x_mlme.h @@ -195,7 +195,6 @@ void _r8712_sitesurvey_ctrl_handler(struct _adapter *adapter); void _r8712_join_timeout_handler(struct _adapter *adapter); void r8712_scan_timeout_handler(struct _adapter *adapter); void _r8712_dhcp_timeout_handler(struct _adapter *adapter); -void _r8712_wdg_timeout_handler(struct _adapter *adapter); struct wlan_network *_r8712_alloc_network(struct mlme_priv *pmlmepriv); sint r8712_if_up(struct _adapter *padapter); void r8712_joinbss_reset(struct _adapter *padapter); -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/10] staging: rtl8712: r8712_wdg_wk_cmd(): Change return type
Change return type of function r8712_wdg_wk_cmd from u8 to void as its return value is never stored, checked or otherwise used. Modify its return statements accordingly. Signed-off-by: Nishka Dasgupta --- drivers/staging/rtl8712/rtl871x_cmd.c | 7 +++ drivers/staging/rtl8712/rtl871x_cmd.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 516047a074d6..163eadba789c 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -759,7 +759,7 @@ void r8712_addbareq_cmd(struct _adapter *padapter, u8 tid) r8712_enqueue_cmd_ex(pcmdpriv, ph2c); } -u8 r8712_wdg_wk_cmd(struct _adapter *padapter) +void r8712_wdg_wk_cmd(struct _adapter *padapter) { struct cmd_obj *ph2c; struct drvint_cmd_parm *pdrvintcmd_param; @@ -767,18 +767,17 @@ u8 r8712_wdg_wk_cmd(struct _adapter *padapter) ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC); if (!ph2c) - return _FAIL; + return; pdrvintcmd_param = kmalloc(sizeof(*pdrvintcmd_param), GFP_ATOMIC); if (!pdrvintcmd_param) { kfree(ph2c); - return _FAIL; + return; } pdrvintcmd_param->i_cid = WDG_WK_CID; pdrvintcmd_param->sz = 0; pdrvintcmd_param->pbuf = NULL; init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvintcmd_param, _DRV_INT_CMD_); r8712_enqueue_cmd_ex(pcmdpriv, ph2c); - return _SUCCESS; } void r8712_survey_cmd_callback(struct _adapter *padapter, struct cmd_obj *pcmd) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h index 2aa50e6f1297..5d0a8568003f 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.h +++ b/drivers/staging/rtl8712/rtl871x_cmd.h @@ -730,7 +730,7 @@ u8 r8712_setrttbl_cmd(struct _adapter *padapter, u8 r8712_setfwdig_cmd(struct _adapter *padapter, u8 type); u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type); void r8712_addbareq_cmd(struct _adapter *padapter, u8 tid); -u8 r8712_wdg_wk_cmd(struct _adapter *padapter); +void r8712_wdg_wk_cmd(struct _adapter *padapter); void r8712_survey_cmd_callback(struct _adapter *padapter, struct cmd_obj *pcmd); void r8712_disassoc_cmd_callback(struct _adapter *padapter, -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/10] staging: rtl8712: r8712_addbareq_cmd(): Change return type
Change return type of the function r8712_addbareq_cmd from u8 to void as its return value is not stored, checked or otherwise used. Also modify its return statements accordingly. Signed-off-by: Nishka Dasgupta --- drivers/staging/rtl8712/rtl871x_cmd.c | 7 +++ drivers/staging/rtl8712/rtl871x_cmd.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index cc55fa5bd494..8d110cc23b9a 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -739,7 +739,7 @@ u8 r8712_setassocsta_cmd(struct _adapter *padapter, u8 *mac_addr) return _SUCCESS; } -u8 r8712_addbareq_cmd(struct _adapter *padapter, u8 tid) +void r8712_addbareq_cmd(struct _adapter *padapter, u8 tid) { struct cmd_priv *pcmdpriv = >cmdpriv; struct cmd_obj *ph2c; @@ -747,17 +747,16 @@ u8 r8712_addbareq_cmd(struct _adapter *padapter, u8 tid) ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC); if (!ph2c) - return _FAIL; + return; paddbareq_parm = kmalloc(sizeof(*paddbareq_parm), GFP_ATOMIC); if (!paddbareq_parm) { kfree(ph2c); - return _FAIL; + return; } paddbareq_parm->tid = tid; init_h2fwcmd_w_parm_no_rsp(ph2c, paddbareq_parm, GEN_CMD_CODE(_AddBAReq)); r8712_enqueue_cmd_ex(pcmdpriv, ph2c); - return _SUCCESS; } u8 r8712_wdg_wk_cmd(struct _adapter *padapter) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h index d9aab41c0299..8448dd05fa4c 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.h +++ b/drivers/staging/rtl8712/rtl871x_cmd.h @@ -729,7 +729,7 @@ u8 r8712_setrttbl_cmd(struct _adapter *padapter, struct setratable_parm *prate_table); u8 r8712_setfwdig_cmd(struct _adapter *padapter, u8 type); u8 r8712_setfwra_cmd(struct _adapter *padapter, u8 type); -u8 r8712_addbareq_cmd(struct _adapter *padapter, u8 tid); +void r8712_addbareq_cmd(struct _adapter *padapter, u8 tid); u8 r8712_wdg_wk_cmd(struct _adapter *padapter); void r8712_survey_cmd_callback(struct _adapter *padapter, struct cmd_obj *pcmd); -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/10] staging: rtl8712: Remove function r8712_setrfintfs_cmd()
Remove unused function r8712_setrfintfs_cmd. Signed-off-by: Nishka Dasgupta --- drivers/staging/rtl8712/rtl871x_cmd.c | 21 - drivers/staging/rtl8712/rtl871x_cmd.h | 1 - 2 files changed, 22 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index ba30294f8813..752418692be0 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -585,27 +585,6 @@ void r8712_setstakey_cmd(struct _adapter *padapter, u8 *psta, u8 unicast_key) r8712_enqueue_cmd(pcmdpriv, ph2c); } -u8 r8712_setrfintfs_cmd(struct _adapter *padapter, u8 mode) -{ - struct cmd_obj *ph2c; - struct setrfintfs_parm *psetrfintfsparm; - struct cmd_priv *pcmdpriv = >cmdpriv; - - ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC); - if (!ph2c) - return _FAIL; - psetrfintfsparm = kmalloc(sizeof(*psetrfintfsparm), GFP_ATOMIC); - if (!psetrfintfsparm) { - kfree(ph2c); - return _FAIL; - } - init_h2fwcmd_w_parm_no_rsp(ph2c, psetrfintfsparm, - GEN_CMD_CODE(_SetRFIntFs)); - psetrfintfsparm->rfintfs = mode; - r8712_enqueue_cmd(pcmdpriv, ph2c); - return _SUCCESS; -} - u8 r8712_setrttbl_cmd(struct _adapter *padapter, struct setratable_parm *prate_table) { diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h index 803727b499b7..efca88b4ea99 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.h +++ b/drivers/staging/rtl8712/rtl871x_cmd.h @@ -722,7 +722,6 @@ void r8712_setopmode_cmd(struct _adapter *padapter, int r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset); void r8712_set_chplan_cmd(struct _adapter *padapter, int chplan); u8 r8712_getrfreg_cmd(struct _adapter *padapter, u8 offset, u8 *pval); -u8 r8712_setrfintfs_cmd(struct _adapter *padapter, u8 mode); u8 r8712_setrfreg_cmd(struct _adapter *padapter, u8 offset, u32 val); u8 r8712_setrttbl_cmd(struct _adapter *padapter, struct setratable_parm *prate_table); -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/10] staging: rtl8712: r8712_disconnectCtrlEx_cmd(): Change return type
Change return type of function r8712_disconnectCtrlEx_cmd from u8 to void as its return value is never stored, checked or otherwise used. Modify its return statements accordingly. Signed-off-by: Nishka Dasgupta --- drivers/staging/rtl8712/rtl871x_cmd.c | 7 +++ drivers/staging/rtl8712/rtl871x_cmd.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 8d110cc23b9a..516047a074d6 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -935,7 +935,7 @@ void r8712_setassocsta_cmdrsp_callback(struct _adapter *padapter, r8712_free_cmd_obj(pcmd); } -u8 r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, +void r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, u32 tryPktCnt, u32 tryPktInterval, u32 firstStageTO) { struct cmd_obj *ph2c; @@ -944,11 +944,11 @@ u8 r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC); if (!ph2c) - return _FAIL; + return; param = kzalloc(sizeof(*param), GFP_ATOMIC); if (!param) { kfree(ph2c); - return _FAIL; + return; } param->EnableDrvCtrl = (unsigned char)enableDrvCtrl; @@ -959,5 +959,4 @@ u8 r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, init_h2fwcmd_w_parm_no_rsp(ph2c, param, GEN_CMD_CODE(_DisconnectCtrlEx)); r8712_enqueue_cmd(pcmdpriv, ph2c); - return _SUCCESS; } diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h index 8448dd05fa4c..2aa50e6f1297 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.h +++ b/drivers/staging/rtl8712/rtl871x_cmd.h @@ -747,7 +747,7 @@ void r8712_setstaKey_cmdrsp_callback(struct _adapter *padapter, struct cmd_obj *pcmd); void r8712_setassocsta_cmdrsp_callback(struct _adapter *padapter, struct cmd_obj *pcmd); -u8 r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, +void r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, u32 tryPktCnt, u32 tryPktInterval, u32 firstStageTO); struct _cmd_callback { -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/10] staging: rtl8712: r8712_enqueue_cmd_ex(): Change return type
Change return type of function r8712_enqueue_cmd_ex from u8 to void as its return value is never stored, checked or otherwise used. Modify return statements accordingly. Signed-off-by: Nishka Dasgupta --- drivers/staging/rtl8712/rtl871x_cmd.c | 7 +++ drivers/staging/rtl8712/rtl871x_cmd.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 163eadba789c..66c2f4750497 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -163,21 +163,20 @@ void r8712_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj) complete(>cmd_queue_comp); } -u32 r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj) +void r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj) { unsigned long irqL; struct __queue *queue; if (!obj) - return _SUCCESS; + return; if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag) - return _FAIL; + return; queue = >cmd_queue; spin_lock_irqsave(>lock, irqL); list_add_tail(>list, >queue); spin_unlock_irqrestore(>lock, irqL); complete(>cmd_queue_comp); - return _SUCCESS; } struct cmd_obj *r8712_dequeue_cmd(struct __queue *queue) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h index 5d0a8568003f..0817d126254f 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.h +++ b/drivers/staging/rtl8712/rtl871x_cmd.h @@ -80,7 +80,7 @@ do {\ } while (0) void r8712_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj); -u32 r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj); +void r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj); struct cmd_obj *r8712_dequeue_cmd(struct __queue *queue); void r8712_free_cmd_obj(struct cmd_obj *pcmd); int r8712_cmd_thread(void *context); -- 2.19.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel