scsi: hpsa: Simplify {clear|set}_bit() parameters
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Wed, 20 Jul 2022 18:14:02 +0000 (20:14 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 1 Sep 2022 04:45:12 +0000 (00:45 -0400)
{clear|set}_bit() can take an almost arbitrarily large bit number, so there
is no need to manually compute addresses. This is just redundant.

Link: https://lore.kernel.org/r/c3429a22023f58e5e5cc65d6cd7e83fb2bd9b870.1658340442.git.christophe.jaillet@wanadoo.fr
Tested-by: Don Brace <don.brace@microchip.com>
Acked-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hpsa.c

index 0612ca6..f8e832b 100644 (file)
@@ -6233,8 +6233,7 @@ static struct CommandList *cmd_alloc(struct ctlr_info *h)
                        offset = (i + 1) % HPSA_NRESERVED_CMDS;
                        continue;
                }
-               set_bit(i & (BITS_PER_LONG - 1),
-                       h->cmd_pool_bits + (i / BITS_PER_LONG));
+               set_bit(i, h->cmd_pool_bits);
                break; /* it's ours now. */
        }
        hpsa_cmd_partial_init(h, i, c);
@@ -6261,8 +6260,7 @@ static void cmd_free(struct ctlr_info *h, struct CommandList *c)
                int i;
 
                i = c - h->cmd_pool;
-               clear_bit(i & (BITS_PER_LONG - 1),
-                         h->cmd_pool_bits + (i / BITS_PER_LONG));
+               clear_bit(i, h->cmd_pool_bits);
        }
 }