Re: [PATCH 01/81] scsi: qla2xxx: Refer directly to the qla2xxx_driver_template

John Garry
2023-03-06T13:11:27Z

On 04/03/2023 00:29, Bart Van Assche wrote:
> Access the qla2xxx_driver_template data structure directly instead of via
> the host pointer. This patch prepares for declaring the 'hostt' pointer
> const.
>
> Cc: Nilesh Javali <njavali@marvell.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/qla2xxx/qla_target.c | 4 ++--

Hi Bart,

> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index aa0cf5ca6c1c..8d9a6aa3ea61 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -6395,8 +6395,8 @@ int qlt_add_target(struct qla_hw_data *ha, struct scsi_qla_host *base_vha)
> return -ENOMEM;
> }
>
> - if (!(base_vha->host->hostt->supported_mode & MODE_TARGET))
> - base_vha->host->hostt->supported_mode |= MODE_TARGET;
> + if (!(qla2xxx_driver_template.supported_mode & MODE_TARGET))
> + qla2xxx_driver_template.supported_mode |= MODE_TARGET;

So we're saying if that MODE_TARGET bit is not set, then set it. It
would be neater to just always set it, right?

Apart from that, I will say that I haven't studied the driver in detail,
but my impression is that we should just set this flag per-shost in
base_vha->host.active_mode, and not the host template supported_mode
member. Indeed, we don't even seem to be making this driver
scsi_host_template as const in this series, which I thought was the aim
(and I assume because of this).

Thanks,
John

>
> rc = btree_init64(&tgt->lun_qpair_map);
> if (rc) {