diff mbox series

[v2,20/44] hptiop: Stop using the SCSI pointer

Message ID 20220208172514.3481-21-bvanassche@acm.org
State Superseded
Headers show
Series Remove the SCSI pointer from struct scsi_cmnd | expand

Commit Message

Bart Van Assche Feb. 8, 2022, 5:24 p.m. UTC
Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/hptiop.c | 1 +
 drivers/scsi/hptiop.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Hannes Reinecke Feb. 9, 2022, 7:57 a.m. UTC | #1
On 2/8/22 18:24, Bart Van Assche wrote:
> Set .cmd_size in the SCSI host template instead of using the SCSI pointer
> from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
> from struct scsi_cmnd.
> 
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>   drivers/scsi/hptiop.c | 1 +
>   drivers/scsi/hptiop.h | 4 ++--
>   2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
> index d04245e379d7..f18b770626e6 100644
> --- a/drivers/scsi/hptiop.c
> +++ b/drivers/scsi/hptiop.c
> @@ -1174,6 +1174,7 @@ static struct scsi_host_template driver_template = {
>   	.slave_configure            = hptiop_slave_config,
>   	.this_id                    = -1,
>   	.change_queue_depth         = hptiop_adjust_disk_queue_depth,
> +	.cmd_size		    = sizeof(struct hpt_cmd_priv),
>   };
>   
>   static int hptiop_internal_memalloc_itl(struct hptiop_hba *hba)
> diff --git a/drivers/scsi/hptiop.h b/drivers/scsi/hptiop.h
> index 35184c2008af..363d5a16243f 100644
> --- a/drivers/scsi/hptiop.h
> +++ b/drivers/scsi/hptiop.h
> @@ -251,13 +251,13 @@ struct hptiop_request {
>   	int                   index;
>   };
>   
> -struct hpt_scsi_pointer {
> +struct hpt_cmd_priv {

Why not keep the name? You have been using 'struct scsi_pointer' with 
all the other drivers ...

>   	int mapped;
>   	int sgcnt;
>   	dma_addr_t dma_handle;
>   };
>   
> -#define HPT_SCP(scp) ((struct hpt_scsi_pointer *)&(scp)->SCp)
> +#define HPT_SCP(scp) ((struct hpt_cmd_priv *)scsi_cmd_priv(scp))
>   
>   enum hptiop_family {
>   	UNKNOWN_BASED_IOP,

Cheers,

Hannes
Himanshu Madhani Feb. 9, 2022, 6:18 p.m. UTC | #2
> On Feb 8, 2022, at 9:24 AM, Bart Van Assche <bvanassche@acm.org> wrote:
> 
> Set .cmd_size in the SCSI host template instead of using the SCSI pointer
> from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
> from struct scsi_cmnd.
> 
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/hptiop.c | 1 +
> drivers/scsi/hptiop.h | 4 ++--
> 2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
> index d04245e379d7..f18b770626e6 100644
> --- a/drivers/scsi/hptiop.c
> +++ b/drivers/scsi/hptiop.c
> @@ -1174,6 +1174,7 @@ static struct scsi_host_template driver_template = {
> 	.slave_configure            = hptiop_slave_config,
> 	.this_id                    = -1,
> 	.change_queue_depth         = hptiop_adjust_disk_queue_depth,
> +	.cmd_size		    = sizeof(struct hpt_cmd_priv),
> };
> 
> static int hptiop_internal_memalloc_itl(struct hptiop_hba *hba)
> diff --git a/drivers/scsi/hptiop.h b/drivers/scsi/hptiop.h
> index 35184c2008af..363d5a16243f 100644
> --- a/drivers/scsi/hptiop.h
> +++ b/drivers/scsi/hptiop.h
> @@ -251,13 +251,13 @@ struct hptiop_request {
> 	int                   index;
> };
> 
> -struct hpt_scsi_pointer {
> +struct hpt_cmd_priv {
> 	int mapped;
> 	int sgcnt;
> 	dma_addr_t dma_handle;
> };
> 
> -#define HPT_SCP(scp) ((struct hpt_scsi_pointer *)&(scp)->SCp)
> +#define HPT_SCP(scp) ((struct hpt_cmd_priv *)scsi_cmd_priv(scp))
> 
> enum hptiop_family {
> 	UNKNOWN_BASED_IOP,

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

--
Himanshu Madhani	 Oracle Linux Engineering
Bart Van Assche Feb. 9, 2022, 6:24 p.m. UTC | #3
On 2/8/22 23:57, Hannes Reinecke wrote:
> On 2/8/22 18:24, Bart Van Assche wrote:
>> -struct hpt_scsi_pointer {
>> +struct hpt_cmd_priv {
> 
> Why not keep the name? You have been using 'struct scsi_pointer' with 
> all the other drivers ...

I assume that "SCSI pointer" refers to a section in the SCSI II 
specification with the same title. The hptiop private data is not 
related to the SCSI II "SCSI pointer" section. Hence the renaming of 
this data structure.

Thanks,

Bart.
Hannes Reinecke Feb. 10, 2022, 7:32 a.m. UTC | #4
On 2/9/22 19:24, Bart Van Assche wrote:
> On 2/8/22 23:57, Hannes Reinecke wrote:
>> On 2/8/22 18:24, Bart Van Assche wrote:
>>> -struct hpt_scsi_pointer {
>>> +struct hpt_cmd_priv {
>>
>> Why not keep the name? You have been using 'struct scsi_pointer' with 
>> all the other drivers ...
> 
> I assume that "SCSI pointer" refers to a section in the SCSI II 
> specification with the same title. The hptiop private data is not 
> related to the SCSI II "SCSI pointer" section. Hence the renaming of 
> this data structure.
> 
Ah, right. Misread the patch.

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index d04245e379d7..f18b770626e6 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1174,6 +1174,7 @@  static struct scsi_host_template driver_template = {
 	.slave_configure            = hptiop_slave_config,
 	.this_id                    = -1,
 	.change_queue_depth         = hptiop_adjust_disk_queue_depth,
+	.cmd_size		    = sizeof(struct hpt_cmd_priv),
 };
 
 static int hptiop_internal_memalloc_itl(struct hptiop_hba *hba)
diff --git a/drivers/scsi/hptiop.h b/drivers/scsi/hptiop.h
index 35184c2008af..363d5a16243f 100644
--- a/drivers/scsi/hptiop.h
+++ b/drivers/scsi/hptiop.h
@@ -251,13 +251,13 @@  struct hptiop_request {
 	int                   index;
 };
 
-struct hpt_scsi_pointer {
+struct hpt_cmd_priv {
 	int mapped;
 	int sgcnt;
 	dma_addr_t dma_handle;
 };
 
-#define HPT_SCP(scp) ((struct hpt_scsi_pointer *)&(scp)->SCp)
+#define HPT_SCP(scp) ((struct hpt_cmd_priv *)scsi_cmd_priv(scp))
 
 enum hptiop_family {
 	UNKNOWN_BASED_IOP,