From patchwork Mon Oct 2 15:43:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 13406381 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC38BE784BE for ; Mon, 2 Oct 2023 15:43:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238180AbjJBPnv (ORCPT ); Mon, 2 Oct 2023 11:43:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238170AbjJBPnt (ORCPT ); Mon, 2 Oct 2023 11:43:49 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8242EAC for ; Mon, 2 Oct 2023 08:43:45 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 8A3541F855; Mon, 2 Oct 2023 15:43:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1696261423; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BijzAFIdv3B/or7k5Yp/MIqznPkG1YZ1OsQ4f3FlpT0=; b=aR4AAFMSLSsrrHU5NIPmGJQF2t4TqsurntF5aqKZeDssHdcfSLlQAvBawbNJ0Xu73dIzEI Tbzd8NCvMC8zuvXRkb/0Rfb+S2wpcbEPXmYdY/BsYRptgheA5a/mglzLn9oMKaInhSD/Nl Lyn47m03hP1T2N2aKNIGPzJvQUnrAco= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1696261423; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BijzAFIdv3B/or7k5Yp/MIqznPkG1YZ1OsQ4f3FlpT0=; b=Fb67G3ViApbMuy431P+aHzOlK1CBruUbgbzhQt8EMn5XOtu2dBoDXqzTKij4ImBUTR6BcE jjz2FrEpGaRplBAg== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 604FD2C14E; Mon, 2 Oct 2023 15:43:43 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 716C451E7543; Mon, 2 Oct 2023 17:43:43 +0200 (CEST) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , linux-scsi@vger.kernel.org, Christoph Hellwig , Hannes Reinecke , kernel test robot , Johannes Thumshirn Subject: [PATCH 06/18] aic7xxx: make BUILD_SCSIID() a function Date: Mon, 2 Oct 2023 17:43:16 +0200 Message-Id: <20231002154328.43718-7-hare@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231002154328.43718-1-hare@suse.de> References: <20231002154328.43718-1-hare@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Convert BUILD_SCSIID() into a function and add a scsi_device argument. Reported-by: kernel test robot Signed-off-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig --- drivers/scsi/aic7xxx/aic7xxx_osm.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index d3b1082654d5..15e53b33b955 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -798,11 +798,18 @@ struct scsi_host_template aic7xxx_driver_template = { /**************************** Tasklet Handler *********************************/ -/******************************** Macros **************************************/ -#define BUILD_SCSIID(ahc, cmd) \ - ((((cmd)->device->id << TID_SHIFT) & TID) \ - | (((cmd)->device->channel == 0) ? (ahc)->our_id : (ahc)->our_id_b) \ - | (((cmd)->device->channel == 0) ? 0 : TWIN_CHNLB)) + +static inline unsigned int ahc_build_scsiid(struct ahc_softc *ahc, + struct scsi_device *sdev) +{ + unsigned int scsiid = (sdev->id << TID_SHIFT) & TID; + + if (sdev->channel == 0) + scsiid |= ahc->our_id; + else + scsiid |= ahc->our_id_b | TWIN_CHNLB; + return scsiid; +} /******************************** Bus DMA *************************************/ int @@ -1457,7 +1464,7 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev, * Fill out basics of the HSCB. */ hscb->control = 0; - hscb->scsiid = BUILD_SCSIID(ahc, cmd); + hscb->scsiid = ahc_build_scsiid(ahc, cmd->device); hscb->lun = cmd->device->lun; mask = SCB_GET_TARGET_MASK(ahc, scb); tinfo = ahc_fetch_transinfo(ahc, SCB_GET_CHANNEL(ahc, scb),