Skip to content

Commit cebaa38

Browse files
glneoandersson
authored andcommitted
hwspinlock: omap: Use index to get hwspinlock pointer
For loops with multiple initializers and increments are hard to read and reason about, simplify this by using the looping index to index into the hwspinlock array. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240208165114.63148-4-afd@ti.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
1 parent 8781ec8 commit cebaa38

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/hwspinlock/omap_hwspinlock.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ static const struct hwspinlock_ops omap_hwspinlock_ops = {
7575
static int omap_hwspinlock_probe(struct platform_device *pdev)
7676
{
7777
struct hwspinlock_device *bank;
78-
struct hwspinlock *hwlock;
7978
void __iomem *io_base;
8079
int num_locks, i, ret;
8180
/* Only a single hwspinlock block device is supported */
@@ -117,8 +116,8 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
117116
if (!bank)
118117
return -ENOMEM;
119118

120-
for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++)
121-
hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i;
119+
for (i = 0; i < num_locks; i++)
120+
bank->lock[i].priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i;
122121

123122
return devm_hwspin_lock_register(&pdev->dev, bank, &omap_hwspinlock_ops,
124123
base_id, num_locks);

0 commit comments

Comments
 (0)