diff mbox series

[14/24] aic79xx: make BUILD_SCSIID() a function

Message ID 20220502213820.3187-15-hare@suse.de (mailing list archive)
State Superseded
Headers show
Series scsi: EH rework prep patches, part 1 | expand

Commit Message

Hannes Reinecke May 2, 2022, 9:38 p.m. UTC
Convert BUILD_SCSIID() into a function and add a scsi_device argument.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/aic7xxx/aic79xx_osm.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Christoph Hellwig May 3, 2022, 2:13 p.m. UTC | #1
On Mon, May 02, 2022 at 11:38:10PM +0200, Hannes Reinecke wrote:
> +{
> +	unsigned int scsiid =
> +		((sdev_id(sdev) << TID_SHIFT) & TID) | (ahd)->our_id;
> +
> +	return scsiid;

	return ((sdev_id(sdev) << TID_SHIFT) & TID) | ahd->our_id;
Hannes Reinecke May 3, 2022, 2:19 p.m. UTC | #2
On 5/3/22 07:13, Christoph Hellwig wrote:
> On Mon, May 02, 2022 at 11:38:10PM +0200, Hannes Reinecke wrote:
>> +{
>> +	unsigned int scsiid =
>> +		((sdev_id(sdev) << TID_SHIFT) & TID) | (ahd)->our_id;
>> +
>> +	return scsiid;
> 
> 	return ((sdev_id(sdev) << TID_SHIFT) & TID) | ahd->our_id;
Yep.

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 928099163f0f..b9b214ef5a2a 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -541,8 +541,14 @@  ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb)
 }
 
 /******************************** Macros **************************************/
-#define BUILD_SCSIID(ahd, cmd)						\
-	(((scmd_id(cmd) << TID_SHIFT) & TID) | (ahd)->our_id)
+static inline unsigned int ahd_build_scsiid(struct ahd_softc *ahd,
+					    struct scsi_device *sdev)
+{
+	unsigned int scsiid =
+		((sdev_id(sdev) << TID_SHIFT) & TID) | (ahd)->our_id;
+
+	return scsiid;
+}
 
 /*
  * Return a string describing the driver.
@@ -818,7 +824,7 @@  ahd_linux_dev_reset(struct scsi_cmnd *cmd)
 	ahd_set_sense_residual(reset_scb, 0);
 	reset_scb->platform_data->xfer_len = 0;
 	reset_scb->hscb->control = 0;
-	reset_scb->hscb->scsiid = BUILD_SCSIID(ahd,cmd);
+	reset_scb->hscb->scsiid = ahd_build_scsiid(ahd, cmd->device);
 	reset_scb->hscb->lun = cmd->device->lun;
 	reset_scb->hscb->cdb_len = 0;
 	reset_scb->hscb->task_management = SIU_TASKMGMT_LUN_RESET;
@@ -1577,7 +1583,7 @@  ahd_linux_run_command(struct ahd_softc *ahd, struct ahd_linux_device *dev,
 	 * Fill out basics of the HSCB.
 	 */
 	hscb->control = 0;
-	hscb->scsiid = BUILD_SCSIID(ahd, cmd);
+	hscb->scsiid = ahd_build_scsiid(ahd, cmd->device);
 	hscb->lun = cmd->device->lun;
 	scb->hscb->task_management = 0;
 	mask = SCB_GET_TARGET_MASK(ahd, scb);