From patchwork Fri Feb 11 22:32:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 542009 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 7DB6CC4332F for ; Fri, 11 Feb 2022 22:34:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354170AbiBKWev (ORCPT ); Fri, 11 Feb 2022 17:34:51 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354163AbiBKWel (ORCPT ); Fri, 11 Feb 2022 17:34:41 -0500 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31AECD54 for ; Fri, 11 Feb 2022 14:34:40 -0800 (PST) Received: by mail-pf1-f175.google.com with SMTP id 9so15764672pfx.12 for ; Fri, 11 Feb 2022 14:34:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pnNf2VjhuumTX82Rj4aqfhA6PYW6ngKJyQvWPbUR7rY=; b=NrhIY9MdKPEgEFPGe+Zi/crcah0TWUKcdlMg994DMjXWKGqLvj9VL0ELrPWwhIEmva EepGeuChOMD/iA2mx54i6BF3HIhyFj7s6QXz4zy5FWhRPDb+AppOBqy4hFWkQVdLEmMz 6mo892JrpOJg9P0Dp9kmhHKscXuc8Bz06gSDcufbBYYV0QQjE6dOBuwMoX4r+nU9waQJ YCXPkEwx6hyoNl7kcam6O7gvxRPAmNS9eP5gRK4xArJ/jIXm7Ysh8e9uhaiWTdofBUvm InOk6nlk+nocHi580aysb/97cbKwahZQZzP8OLJPeAix+LV0eUnq4wpctOLZVBXq3sYD OvZg== X-Gm-Message-State: AOAM533/7hkwM4rIUAqHqzaK5NPm4RJCrxd5Kty9Ll6gX4guL4xHsf9m iERVS08Vg7M9U+ekjZAH8ZE= X-Google-Smtp-Source: ABdhPJww4v0KarZiEDdaxfOrag3zWps2LeESXxIHnjZI2OdEWlytGG8bQ5Gu2Q0AAUtAOMbSunNCWQ== X-Received: by 2002:aa7:8b08:: with SMTP id f8mr3696361pfd.47.1644618879603; Fri, 11 Feb 2022 14:34:39 -0800 (PST) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:feaa:14ff:fe9d:6dbd]) by smtp.gmail.com with ESMTPSA id n13sm6296733pjq.13.2022.02.11.14.34.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 14:34:38 -0800 (PST) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Ondrej Zary , Christoph Hellwig , Johannes Thumshirn , Hannes Reinecke , Himanshu Madhani , "James E.J. Bottomley" Subject: [PATCH v3 45/48] scsi: wd719x: Stop using the SCSI pointer Date: Fri, 11 Feb 2022 14:32:44 -0800 Message-Id: <20220211223247.14369-46-bvanassche@acm.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220211223247.14369-1-bvanassche@acm.org> References: <20220211223247.14369-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Move the DMA handle into the per-command private data instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd. Cc: Ondrej Zary Cc: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Hannes Reinecke Reviewed-by: Himanshu Madhani Signed-off-by: Bart Van Assche --- drivers/scsi/wd719x.c | 12 ++++++------ drivers/scsi/wd719x.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c index 1a7947554581..f341b79d8036 100644 --- a/drivers/scsi/wd719x.c +++ b/drivers/scsi/wd719x.c @@ -196,7 +196,7 @@ static void wd719x_finish_cmd(struct wd719x_scb *scb, int result) dma_unmap_single(&wd->pdev->dev, scb->phys, sizeof(struct wd719x_scb), DMA_BIDIRECTIONAL); scsi_dma_unmap(cmd); - dma_unmap_single(&wd->pdev->dev, cmd->SCp.dma_handle, + dma_unmap_single(&wd->pdev->dev, scb->dma_handle, SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); cmd->result = result << 16; @@ -229,11 +229,11 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd) /* map sense buffer */ scb->sense_buf_length = SCSI_SENSE_BUFFERSIZE; - cmd->SCp.dma_handle = dma_map_single(&wd->pdev->dev, cmd->sense_buffer, - SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); - if (dma_mapping_error(&wd->pdev->dev, cmd->SCp.dma_handle)) + scb->dma_handle = dma_map_single(&wd->pdev->dev, cmd->sense_buffer, + SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); + if (dma_mapping_error(&wd->pdev->dev, scb->dma_handle)) goto out_unmap_scb; - scb->sense_buf = cpu_to_le32(cmd->SCp.dma_handle); + scb->sense_buf = cpu_to_le32(scb->dma_handle); /* request autosense */ scb->SCB_options |= WD719X_SCB_FLAGS_AUTO_REQUEST_SENSE; @@ -288,7 +288,7 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd) return 0; out_unmap_sense: - dma_unmap_single(&wd->pdev->dev, cmd->SCp.dma_handle, + dma_unmap_single(&wd->pdev->dev, scb->dma_handle, SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); out_unmap_scb: dma_unmap_single(&wd->pdev->dev, scb->phys, sizeof(*scb), diff --git a/drivers/scsi/wd719x.h b/drivers/scsi/wd719x.h index abaabd419a54..966ab0fb4621 100644 --- a/drivers/scsi/wd719x.h +++ b/drivers/scsi/wd719x.h @@ -56,6 +56,7 @@ struct wd719x_scb { u8 flags[2]; /* 62-63 SCB specific flags (local to each thread) */ /* everything below is for driver use (not used by card) */ dma_addr_t phys; /* bus address of the SCB */ + dma_addr_t dma_handle; struct scsi_cmnd *cmd; /* a copy of the pointer we were passed */ struct list_head list; struct wd719x_sglist sg_list[WD719X_SG] __aligned(8); /* SG list */