diff options
author | Jinjie Ruan <ruanjinjie@huawei.com> | 2023-08-23 10:14:37 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-09-13 11:35:08 +0300 |
commit | 4c5ba1d7a93e098aececbf93afbdd7add98ec6f3 (patch) | |
tree | f4197dc549b779a297790ae99d03530ab84800b9 /drivers/staging/vme_user | |
parent | 18c258e42b5059ffb1c97b18ce7ea517bc901019 (diff) | |
download | linux-4c5ba1d7a93e098aececbf93afbdd7add98ec6f3.tar.xz |
staging: vme_user: Use list_for_each_entry() helper
Convert list_for_each() to list_for_each_entry() so that the
slave/master/dma/handler/lm_pos list_head pointer and list_entry()
call are no longer needed, which can reduce a few lines
of code. No functional changed.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20230823071437.450460-1-ruanjinjie@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vme_user')
-rw-r--r-- | drivers/staging/vme_user/vme.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/drivers/staging/vme_user/vme.c b/drivers/staging/vme_user/vme.c index d0366dd3f2b1..5960562dcd96 100644 --- a/drivers/staging/vme_user/vme.c +++ b/drivers/staging/vme_user/vme.c @@ -282,7 +282,6 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address, u32 cycle) { struct vme_bridge *bridge; - struct list_head *slave_pos = NULL; struct vme_slave_resource *allocated_image = NULL; struct vme_slave_resource *slave_image = NULL; struct vme_resource *resource = NULL; @@ -294,10 +293,7 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address, } /* Loop through slave resources */ - list_for_each(slave_pos, &bridge->slave_resources) { - slave_image = list_entry(slave_pos, - struct vme_slave_resource, list); - + list_for_each_entry(slave_image, &bridge->slave_resources, list) { if (!slave_image) { printk(KERN_ERR "Registered NULL Slave resource\n"); continue; @@ -482,7 +478,6 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address, u32 cycle, u32 dwidth) { struct vme_bridge *bridge; - struct list_head *master_pos = NULL; struct vme_master_resource *allocated_image = NULL; struct vme_master_resource *master_image = NULL; struct vme_resource *resource = NULL; @@ -494,10 +489,7 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address, } /* Loop through master resources */ - list_for_each(master_pos, &bridge->master_resources) { - master_image = list_entry(master_pos, - struct vme_master_resource, list); - + list_for_each_entry(master_image, &bridge->master_resources, list) { if (!master_image) { printk(KERN_WARNING "Registered NULL master resource\n"); continue; @@ -857,7 +849,6 @@ EXPORT_SYMBOL(vme_master_free); struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route) { struct vme_bridge *bridge; - struct list_head *dma_pos = NULL; struct vme_dma_resource *allocated_ctrlr = NULL; struct vme_dma_resource *dma_ctrlr = NULL; struct vme_resource *resource = NULL; @@ -872,9 +863,7 @@ struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route) } /* Loop through DMA resources */ - list_for_each(dma_pos, &bridge->dma_resources) { - dma_ctrlr = list_entry(dma_pos, - struct vme_dma_resource, list); + list_for_each_entry(dma_ctrlr, &bridge->dma_resources, list) { if (!dma_ctrlr) { printk(KERN_ERR "Registered NULL DMA resource\n"); continue; @@ -1241,14 +1230,11 @@ EXPORT_SYMBOL(vme_dma_free); void vme_bus_error_handler(struct vme_bridge *bridge, unsigned long long address, int am) { - struct list_head *handler_pos = NULL; struct vme_error_handler *handler; int handler_triggered = 0; u32 aspace = vme_get_aspace(am); - list_for_each(handler_pos, &bridge->vme_error_handlers) { - handler = list_entry(handler_pos, struct vme_error_handler, - list); + list_for_each_entry(handler, &bridge->vme_error_handlers, list) { if ((aspace == handler->aspace) && (address >= handler->start) && (address < handler->end)) { @@ -1460,7 +1446,6 @@ EXPORT_SYMBOL(vme_irq_generate); struct vme_resource *vme_lm_request(struct vme_dev *vdev) { struct vme_bridge *bridge; - struct list_head *lm_pos = NULL; struct vme_lm_resource *allocated_lm = NULL; struct vme_lm_resource *lm = NULL; struct vme_resource *resource = NULL; @@ -1472,9 +1457,7 @@ struct vme_resource *vme_lm_request(struct vme_dev *vdev) } /* Loop through LM resources */ - list_for_each(lm_pos, &bridge->lm_resources) { - lm = list_entry(lm_pos, - struct vme_lm_resource, list); + list_for_each_entry(lm, &bridge->lm_resources, list) { if (!lm) { printk(KERN_ERR "Registered NULL Location Monitor resource\n"); continue; |