Merge patch series "Add LIBSAS_SHT_BASE for libsas"
authorMartin K. Petersen <martin.petersen@oracle.com>
Mon, 25 Mar 2024 20:09:36 +0000 (16:09 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 25 Mar 2024 20:09:36 +0000 (16:09 -0400)
John Garry <john.g.garry@oracle.com> says:

There is much duplication in the scsi_host_template structure for the
drivers which use libsas.

Similar to how a standard template is used in libata with
__ATA_BASE_SHT, create a standard template in LIBSAS_SHT_BASE.

Link: https://lore.kernel.org/r/20240308114339.1340549-1-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1  2 
drivers/scsi/aic94xx/aic94xx_init.c
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
drivers/scsi/isci/init.c
drivers/scsi/mvsas/mv_init.c
drivers/scsi/pm8001/pm8001_init.c

index ccccd0eb627530ebd34bee1ca14f71d4ca1f2ac5,53fe68124ff496e6b4f459f99c366b9f974e8a05..538a5867e8ab460fbe76ae14003a53b969626570
@@@ -35,34 -35,14 +36,16 @@@ MODULE_PARM_DESC(use_msi, "\n
  static struct scsi_transport_template *aic94xx_transport_template;
  static int asd_scan_finished(struct Scsi_Host *, unsigned long);
  static void asd_scan_start(struct Scsi_Host *);
 +static const struct attribute_group *asd_sdev_groups[];
  
  static const struct scsi_host_template aic94xx_sht = {
-       .module                 = THIS_MODULE,
-       /* .name is initialized */
-       .name                   = "aic94xx",
-       .queuecommand           = sas_queuecommand,
-       .dma_need_drain         = ata_scsi_dma_need_drain,
-       .target_alloc           = sas_target_alloc,
-       .slave_configure        = sas_slave_configure,
+       LIBSAS_SHT_BASE
        .scan_finished          = asd_scan_finished,
        .scan_start             = asd_scan_start,
-       .change_queue_depth     = sas_change_queue_depth,
-       .bios_param             = sas_bios_param,
        .can_queue              = 1,
-       .this_id                = -1,
        .sg_tablesize           = SG_ALL,
-       .max_sectors            = SCSI_DEFAULT_MAX_SECTORS,
-       .eh_device_reset_handler        = sas_eh_device_reset_handler,
-       .eh_target_reset_handler        = sas_eh_target_reset_handler,
-       .slave_alloc            = sas_slave_alloc,
-       .target_destroy         = sas_target_destroy,
-       .ioctl                  = sas_ioctl,
- #ifdef CONFIG_COMPAT
-       .compat_ioctl           = sas_ioctl,
- #endif
        .track_queue_depth      = 1,
 +      .sdev_groups            = asd_sdev_groups,
  };
  
  static int asd_map_memio(struct asd_ha_struct *asd_ha)
index b5d379ebe05d64d69c4c75271f662d61ee6e4211,b8646f6e4c6dec026134dc00c2b85bc942ca986b..d89e97e8f5c2c260752271020d11707ad8db119f
@@@ -3576,21 -3566,9 +3571,10 @@@ static const struct scsi_host_template 
        .slave_configure        = hisi_sas_slave_configure,
        .scan_finished          = hisi_sas_scan_finished,
        .scan_start             = hisi_sas_scan_start,
-       .change_queue_depth     = sas_change_queue_depth,
-       .bios_param             = sas_bios_param,
-       .this_id                = -1,
        .sg_tablesize           = HISI_SAS_SGE_PAGE_CNT,
-       .max_sectors            = SCSI_DEFAULT_MAX_SECTORS,
-       .eh_device_reset_handler = sas_eh_device_reset_handler,
-       .eh_target_reset_handler = sas_eh_target_reset_handler,
        .slave_alloc            = hisi_sas_slave_alloc,
-       .target_destroy         = sas_target_destroy,
-       .ioctl                  = sas_ioctl,
- #ifdef CONFIG_COMPAT
-       .compat_ioctl           = sas_ioctl,
- #endif
        .shost_groups           = host_v2_hw_groups,
 +      .sdev_groups            = sdev_groups_v2_hw,
        .host_reset             = hisi_sas_host_reset,
        .map_queues             = map_queues_v2_hw,
        .host_tagset            = 1,
index ebdfb7e7c88d502a4f279d57902d287177103f68,16ef89002fd494e92aa1ce6b66c96e4a14188f83..756660588a1e88cd637192e15470b908cc4de5d9
@@@ -3330,22 -3320,10 +3325,11 @@@ static const struct scsi_host_template 
        .scan_finished          = hisi_sas_scan_finished,
        .scan_start             = hisi_sas_scan_start,
        .map_queues             = hisi_sas_map_queues,
-       .change_queue_depth     = sas_change_queue_depth,
-       .bios_param             = sas_bios_param,
-       .this_id                = -1,
        .sg_tablesize           = HISI_SAS_SGE_PAGE_CNT,
        .sg_prot_tablesize      = HISI_SAS_SGE_PAGE_CNT,
-       .max_sectors            = SCSI_DEFAULT_MAX_SECTORS,
-       .eh_device_reset_handler = sas_eh_device_reset_handler,
-       .eh_target_reset_handler = sas_eh_target_reset_handler,
        .slave_alloc            = hisi_sas_slave_alloc,
-       .target_destroy         = sas_target_destroy,
-       .ioctl                  = sas_ioctl,
- #ifdef CONFIG_COMPAT
-       .compat_ioctl           = sas_ioctl,
- #endif
        .shost_groups           = host_v3_hw_groups,
 +      .sdev_groups            = sdev_groups_v3_hw,
        .tag_alloc_policy       = BLK_TAG_ALLOC_RR,
        .host_reset             = hisi_sas_host_reset,
        .host_tagset            = 1,
index d0a23ce4afba33866d6119bd1e49c9575482cd44,2b29e850598745903fd951804fe7388da8f5a1c1..de2aefcf20892aed98d09aec1591a89bc7331a00
@@@ -149,39 -149,14 +149,20 @@@ static struct attribute *isci_host_attr
  
  ATTRIBUTE_GROUPS(isci_host);
  
 +static const struct attribute_group *isci_sdev_groups[] = {
 +      &sas_ata_sdev_attr_group,
 +      NULL
 +};
 +
  static const struct scsi_host_template isci_sht = {
-       .module                         = THIS_MODULE,
-       .name                           = DRV_NAME,
-       .proc_name                      = DRV_NAME,
-       .queuecommand                   = sas_queuecommand,
-       .dma_need_drain                 = ata_scsi_dma_need_drain,
-       .target_alloc                   = sas_target_alloc,
-       .slave_configure                = sas_slave_configure,
+       LIBSAS_SHT_BASE
        .scan_finished                  = isci_host_scan_finished,
        .scan_start                     = isci_host_start,
-       .change_queue_depth             = sas_change_queue_depth,
-       .bios_param                     = sas_bios_param,
        .can_queue                      = ISCI_CAN_QUEUE_VAL,
-       .this_id                        = -1,
        .sg_tablesize                   = SG_ALL,
-       .max_sectors                    = SCSI_DEFAULT_MAX_SECTORS,
-       .eh_abort_handler               = sas_eh_abort_handler,
-       .eh_device_reset_handler        = sas_eh_device_reset_handler,
-       .eh_target_reset_handler        = sas_eh_target_reset_handler,
-       .slave_alloc                    = sas_slave_alloc,
-       .target_destroy                 = sas_target_destroy,
-       .ioctl                          = sas_ioctl,
- #ifdef CONFIG_COMPAT
-       .compat_ioctl                   = sas_ioctl,
- #endif
+       .eh_abort_handler               = sas_eh_abort_handler,
        .shost_groups                   = isci_host_groups,
 +      .sdev_groups                    = isci_sdev_groups,
        .track_queue_depth              = 1,
  };
  
index f1090bb5f2c9333bc971d84650a5ae2f51c6b72e,fb81d267c9cc487de976a33be195c107cddc8fea..c792e4486e54dfa145ea16bef44a3608f540fb47
@@@ -31,30 -30,12 +31,13 @@@ static const struct attribute_group *mv
  #define SOC_SAS_NUM 2
  
  static const struct scsi_host_template mvs_sht = {
-       .module                 = THIS_MODULE,
-       .name                   = DRV_NAME,
-       .queuecommand           = sas_queuecommand,
-       .dma_need_drain         = ata_scsi_dma_need_drain,
-       .target_alloc           = sas_target_alloc,
-       .slave_configure        = sas_slave_configure,
+       LIBSAS_SHT_BASE
        .scan_finished          = mvs_scan_finished,
        .scan_start             = mvs_scan_start,
-       .change_queue_depth     = sas_change_queue_depth,
-       .bios_param             = sas_bios_param,
        .can_queue              = 1,
-       .this_id                = -1,
        .sg_tablesize           = SG_ALL,
-       .max_sectors            = SCSI_DEFAULT_MAX_SECTORS,
-       .eh_device_reset_handler = sas_eh_device_reset_handler,
-       .eh_target_reset_handler = sas_eh_target_reset_handler,
-       .slave_alloc            = sas_slave_alloc,
-       .target_destroy         = sas_target_destroy,
-       .ioctl                  = sas_ioctl,
- #ifdef CONFIG_COMPAT
-       .compat_ioctl           = sas_ioctl,
- #endif
        .shost_groups           = mvst_host_groups,
 +      .sdev_groups            = mvst_sdev_groups,
        .track_queue_depth      = 1,
  };
  
index e6b1108f611733b8f625d1a2700da5fb7c8d59ba,2ba320ff0d50270fabd7d29163a6c5cab1ec1d51..1e63cb6cd8e327b265ae389a2df79aa4c7751e43
@@@ -110,31 -110,12 +110,13 @@@ static void pm8001_map_queues(struct Sc
   * The main structure which LLDD must register for scsi core.
   */
  static const struct scsi_host_template pm8001_sht = {
-       .module                 = THIS_MODULE,
-       .name                   = DRV_NAME,
-       .proc_name              = DRV_NAME,
-       .queuecommand           = sas_queuecommand,
-       .dma_need_drain         = ata_scsi_dma_need_drain,
-       .target_alloc           = sas_target_alloc,
-       .slave_configure        = sas_slave_configure,
+       LIBSAS_SHT_BASE
        .scan_finished          = pm8001_scan_finished,
        .scan_start             = pm8001_scan_start,
-       .change_queue_depth     = sas_change_queue_depth,
-       .bios_param             = sas_bios_param,
        .can_queue              = 1,
-       .this_id                = -1,
        .sg_tablesize           = PM8001_MAX_DMA_SG,
-       .max_sectors            = SCSI_DEFAULT_MAX_SECTORS,
-       .eh_device_reset_handler = sas_eh_device_reset_handler,
-       .eh_target_reset_handler = sas_eh_target_reset_handler,
-       .slave_alloc            = sas_slave_alloc,
-       .target_destroy         = sas_target_destroy,
-       .ioctl                  = sas_ioctl,
- #ifdef CONFIG_COMPAT
-       .compat_ioctl           = sas_ioctl,
- #endif
        .shost_groups           = pm8001_host_groups,
 +      .sdev_groups            = pm8001_sdev_groups,
        .track_queue_depth      = 1,
        .cmd_per_lun            = 32,
        .map_queues             = pm8001_map_queues,