diff mbox series

[2/2] scsi: hpsa: Simplify {clear|set}_bit() parameters

Message ID c3429a22023f58e5e5cc65d6cd7e83fb2bd9b870.1658340442.git.christophe.jaillet@wanadoo.fr
State New
Headers show
Series [1/2] scsi: hpsa: Use the bitmap API to allocate bitmaps | expand

Commit Message

Christophe JAILLET July 20, 2022, 6:14 p.m. UTC
{clear|set}_bit() can take an almost arbitrarily large bit number, so there
is no need to manually compute addresses. This is just redundant.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/scsi/hpsa.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Don Brace Aug. 2, 2022, 8:56 p.m. UTC | #1
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Sent: Wednesday, July 20, 2022 1:14 PM
To: Don Brace - C33706 <Don.Brace@microchip.com>; James E.J. Bottomley <jejb@linux.ibm.com>; Martin K. Petersen <martin.petersen@oracle.com>
Cc: linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>; kernel-janitors@vger.kernel.org <kernel-janitors@vger.kernel.org>; Christophe JAILLET <christophe.jaillet@wanadoo.fr>; storagedev <storagedev@microchip.com>; linux-scsi@vger.kernel.org <linux-scsi@vger.kernel.org>
Subject: [PATCH 2/2] scsi: hpsa: Simplify {clear|set}_bit() parameters 
 
[Some people who received this message don't often get email from christophe.jaillet@wanadoo.fr. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

{clear|set}_bit() can take an almost arbitrarily large bit number, so there
is no need to manually compute addresses. This is just redundant.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Don Brace <don.brace@microchip.com>
Tested-by: Don Brace <don.brace@microchip.com>

We normally do not make changes to this driver anymore. But the change looks good.
Thanks for your patch. No cover letter to Ack both at the same time.

Don
---
 drivers/scsi/hpsa.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 0612ca681200..f8e832b1bc46 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -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);
        }
 }

--
2.34.1
diff mbox series

Patch

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 0612ca681200..f8e832b1bc46 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -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);
 	}
 }