Re: [RFC PATCH 02/13] scsi: ufshpb: Init part I - Read HPB config
From: Bart Van Assche
Date: Fri May 15 2020 - 21:57:08 EST
On 2020-05-15 03:30, Avri Altman wrote:
> +struct ufshpb_lun_config *ufshpb_luns_conf;
> +struct ufshpb_lun *ufshpb_luns;
> +static unsigned long ufshpb_lun_map[BITS_TO_LONGS(UFSHPB_MAX_LUNS)];
> +static u8 ufshpb_lun_lookup[UFSHPB_MAX_LUNS];
> +
> +/**
> + * ufshpb_remove - ufshpb cleanup
> + *
> + * Should be called when unloading the driver.
> + */
> +void ufshpb_remove(struct ufs_hba *hba)
> +{
> + kfree(ufshpb_conf);
> + kfree(ufshpb_luns_conf);
> + kfree(ufshpb_luns);
> + ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_SET_FLAG,
> + QUERY_FLAG_IDN_HPB_RESET, 0, NULL);
> +}
> +
> +static int ufshpb_hpb_init(void)
> +{
> + u8 num_hpb_luns = ufshpb_conf->num_hpb_luns;
> + int i;
> +
> + ufshpb_luns = kcalloc(num_hpb_luns, sizeof(*ufshpb_luns), GFP_KERNEL);
> + if (!ufshpb_luns)
> + return -ENOMEM;
> +
> + for (i = 0; i < num_hpb_luns; i++) {
> + struct ufshpb_lun *hpb = ufshpb_luns + i;
> +
> + hpb->lun = (ufshpb_luns_conf + i)->lun;
> + }
> +
> + return 0;
> +}
Do the ufshpb_lun... data structures perhaps duplicate SCSI core data
structures? If so, please don't introduce duplicates of SCSI core data
structures.
Thanks,
Bart.