scsi: libsas: Delete struct scsi_core
authorJohn Garry <john.g.garry@oracle.com>
Tue, 15 Aug 2023 11:51:50 +0000 (11:51 +0000)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 21 Aug 2023 21:50:58 +0000 (17:50 -0400)
Since commit 79855d178557 ("libsas: remove task_collector mode"), struct
scsi_core only contains a reference to the shost. struct scsi_core is only
used in sas_ha_struct.core, so delete scsi_core and replace with a
reference to the shost there.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20230815115156.343535-5-john.g.garry@oracle.com
Reviewed-by: Jason Yan <yanaijie@huawei.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
17 files changed:
drivers/scsi/aic94xx/aic94xx_hwi.c
drivers/scsi/aic94xx/aic94xx_init.c
drivers/scsi/hisi_sas/hisi_sas_main.c
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
drivers/scsi/isci/host.h
drivers/scsi/isci/init.c
drivers/scsi/libsas/sas_ata.c
drivers/scsi/libsas/sas_discover.c
drivers/scsi/libsas/sas_expander.c
drivers/scsi/libsas/sas_host_smp.c
drivers/scsi/libsas/sas_init.c
drivers/scsi/libsas/sas_phy.c
drivers/scsi/libsas/sas_port.c
drivers/scsi/libsas/sas_scsi_host.c
drivers/scsi/mvsas/mv_init.c
drivers/scsi/pm8001/pm8001_init.c
include/scsi/libsas.h

index 75848de..9dda296 100644 (file)
@@ -28,7 +28,7 @@ static int asd_get_user_sas_addr(struct asd_ha_struct *asd_ha)
        if (asd_ha->hw_prof.sas_addr[0])
                return 0;
 
-       return sas_request_addr(asd_ha->sas_ha.core.shost,
+       return sas_request_addr(asd_ha->sas_ha.shost,
                                asd_ha->hw_prof.sas_addr);
 }
 
index 6603e91..8a3340d 100644 (file)
@@ -687,8 +687,8 @@ static int asd_unregister_sas_ha(struct asd_ha_struct *asd_ha)
 
        err = sas_unregister_ha(&asd_ha->sas_ha);
 
-       sas_remove_host(asd_ha->sas_ha.core.shost);
-       scsi_host_put(asd_ha->sas_ha.core.shost);
+       sas_remove_host(asd_ha->sas_ha.shost);
+       scsi_host_put(asd_ha->sas_ha.shost);
 
        kfree(asd_ha->sas_ha.sas_phy);
        kfree(asd_ha->sas_ha.sas_port);
@@ -738,7 +738,7 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
        asd_printk("found %s, device %s\n", asd_ha->name, pci_name(dev));
 
        SHOST_TO_SAS_HA(shost) = &asd_ha->sas_ha;
-       asd_ha->sas_ha.core.shost = shost;
+       asd_ha->sas_ha.shost = shost;
        shost->transportt = aic94xx_transport_template;
        shost->max_id = ~0;
        shost->max_lun = ~0;
index fb596ec..acc3807 100644 (file)
@@ -2519,7 +2519,7 @@ int hisi_sas_probe(struct platform_device *pdev,
        sha->dev = hisi_hba->dev;
        sha->sas_addr = &hisi_hba->sas_addr[0];
        sha->num_phys = hisi_hba->n_phy;
-       sha->core.shost = hisi_hba->shost;
+       sha->shost = hisi_hba->shost;
 
        for (i = 0; i < hisi_hba->n_phy; i++) {
                sha->sas_phy[i] = &hisi_hba->phy[i].sas_phy;
@@ -2561,12 +2561,12 @@ void hisi_sas_remove(struct platform_device *pdev)
 {
        struct sas_ha_struct *sha = platform_get_drvdata(pdev);
        struct hisi_hba *hisi_hba = sha->lldd_ha;
-       struct Scsi_Host *shost = sha->core.shost;
+       struct Scsi_Host *shost = sha->shost;
 
        del_timer_sync(&hisi_hba->timer);
 
        sas_unregister_ha(sha);
-       sas_remove_host(sha->core.shost);
+       sas_remove_host(shost);
 
        hisi_sas_free(hisi_hba);
        scsi_host_put(shost);
index 3206ee3..6a0aed9 100644 (file)
@@ -4950,7 +4950,7 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        sha->sas_phy = arr_phy;
        sha->sas_port = arr_port;
-       sha->core.shost = shost;
+       sha->shost = shost;
        sha->lldd_ha = hisi_hba;
 
        shost->transportt = hisi_sas_stt;
@@ -5054,14 +5054,14 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
        struct device *dev = &pdev->dev;
        struct sas_ha_struct *sha = dev_get_drvdata(dev);
        struct hisi_hba *hisi_hba = sha->lldd_ha;
-       struct Scsi_Host *shost = sha->core.shost;
+       struct Scsi_Host *shost = sha->shost;
 
        pm_runtime_get_noresume(dev);
        del_timer_sync(&hisi_hba->timer);
 
        sas_unregister_ha(sha);
        flush_workqueue(hisi_hba->wq);
-       sas_remove_host(sha->core.shost);
+       sas_remove_host(shost);
 
        hisi_sas_v3_destroy_irqs(pdev, hisi_hba);
        hisi_sas_free(hisi_hba);
index 6bc3f02..5238837 100644 (file)
@@ -306,7 +306,7 @@ static inline struct isci_pci_info *to_pci_info(struct pci_dev *pdev)
 
 static inline struct Scsi_Host *to_shost(struct isci_host *ihost)
 {
-       return ihost->sas_ha.core.shost;
+       return ihost->sas_ha.shost;
 }
 
 #define for_each_isci_host(id, ihost, pdev) \
index c370420..db4784c 100644 (file)
@@ -574,7 +574,7 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id)
                goto err_shost;
 
        SHOST_TO_SAS_HA(shost) = &ihost->sas_ha;
-       ihost->sas_ha.core.shost = shost;
+       ihost->sas_ha.shost = shost;
        shost->transportt = isci_transport_template;
 
        shost->max_id = ~0;
@@ -729,7 +729,7 @@ static int isci_resume(struct device *dev)
                sas_prep_resume_ha(&ihost->sas_ha);
 
                isci_host_init(ihost);
-               isci_host_start(ihost->sas_ha.core.shost);
+               isci_host_start(ihost->sas_ha.shost);
                wait_for_start(ihost);
 
                sas_resume_ha(&ihost->sas_ha);
index 77714a4..2d29154 100644 (file)
@@ -162,7 +162,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
        struct ata_port *ap = qc->ap;
        struct domain_device *dev = ap->private_data;
        struct sas_ha_struct *sas_ha = dev->port->ha;
-       struct Scsi_Host *host = sas_ha->core.shost;
+       struct Scsi_Host *host = sas_ha->shost;
        struct sas_internal *i = to_sas_internal(host->transportt);
 
        /* TODO: we should try to remove that unlock */
@@ -235,7 +235,7 @@ static void sas_ata_qc_fill_rtf(struct ata_queued_cmd *qc)
 
 static struct sas_internal *dev_to_sas_internal(struct domain_device *dev)
 {
-       return to_sas_internal(dev->port->ha->core.shost->transportt);
+       return to_sas_internal(dev->port->ha->shost->transportt);
 }
 
 static int sas_get_ata_command_set(struct domain_device *dev)
@@ -584,7 +584,7 @@ static struct ata_port_info sata_port_info = {
 int sas_ata_init(struct domain_device *found_dev)
 {
        struct sas_ha_struct *ha = found_dev->port->ha;
-       struct Scsi_Host *shost = ha->core.shost;
+       struct Scsi_Host *shost = ha->shost;
        struct ata_host *ata_host;
        struct ata_port *ap;
        int rc;
@@ -822,7 +822,7 @@ static void async_sas_ata_eh(void *data, async_cookie_t cookie)
        struct sas_ha_struct *ha = dev->port->ha;
 
        sas_ata_printk(KERN_DEBUG, dev, "dev error handler\n");
-       ata_scsi_port_error_handler(ha->core.shost, ap);
+       ata_scsi_port_error_handler(ha->shost, ap);
        sas_put_device(dev);
 }
 
index 8c6afe7..15cb996 100644 (file)
@@ -170,7 +170,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
 {
        int res = 0;
        struct sas_ha_struct *sas_ha = dev->port->ha;
-       struct Scsi_Host *shost = sas_ha->core.shost;
+       struct Scsi_Host *shost = sas_ha->shost;
        struct sas_internal *i = to_sas_internal(shost->transportt);
 
        if (!i->dft->lldd_dev_found)
@@ -192,7 +192,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
 void sas_notify_lldd_dev_gone(struct domain_device *dev)
 {
        struct sas_ha_struct *sas_ha = dev->port->ha;
-       struct Scsi_Host *shost = sas_ha->core.shost;
+       struct Scsi_Host *shost = sas_ha->shost;
        struct sas_internal *i = to_sas_internal(shost->transportt);
 
        if (!i->dft->lldd_dev_gone)
@@ -234,7 +234,7 @@ static void sas_suspend_devices(struct work_struct *work)
        struct domain_device *dev;
        struct sas_discovery_event *ev = to_sas_discovery_event(work);
        struct asd_sas_port *port = ev->port;
-       struct Scsi_Host *shost = port->ha->core.shost;
+       struct Scsi_Host *shost = port->ha->shost;
        struct sas_internal *si = to_sas_internal(shost->transportt);
 
        clear_bit(DISCE_SUSPEND, &port->disc.pending);
@@ -373,7 +373,7 @@ static bool sas_abort_cmd(struct request *req, void *data)
 static void sas_abort_device_scsi_cmds(struct domain_device *dev)
 {
        struct sas_ha_struct *sas_ha = dev->port->ha;
-       struct Scsi_Host *shost = sas_ha->core.shost;
+       struct Scsi_Host *shost = sas_ha->shost;
 
        if (dev_is_expander(dev->dev_type))
                return;
index adcac57..a220467 100644 (file)
@@ -37,7 +37,7 @@ static int smp_execute_task_sg(struct domain_device *dev,
        int res, retry;
        struct sas_task *task = NULL;
        struct sas_internal *i =
-               to_sas_internal(dev->port->ha->core.shost->transportt);
+               to_sas_internal(dev->port->ha->shost->transportt);
        struct sas_ha_struct *ha = dev->port->ha;
 
        pm_runtime_get_sync(ha->dev);
index 32cdc96..2ecb853 100644 (file)
@@ -114,7 +114,7 @@ static int sas_host_smp_write_gpio(struct sas_ha_struct *sas_ha, u8 *resp_data,
                                   u8 reg_type, u8 reg_index, u8 reg_count,
                                   u8 *req_data)
 {
-       struct sas_internal *i = to_sas_internal(sas_ha->core.shost->transportt);
+       struct sas_internal *i = to_sas_internal(sas_ha->shost->transportt);
        int written;
 
        if (i->dft->lldd_write_gpio == NULL) {
@@ -182,7 +182,7 @@ static void sas_phy_control(struct sas_ha_struct *sas_ha, u8 phy_id,
                            enum sas_linkrate max, u8 *resp_data)
 {
        struct sas_internal *i =
-               to_sas_internal(sas_ha->core.shost->transportt);
+               to_sas_internal(sas_ha->shost->transportt);
        struct sas_phy_linkrates rates;
        struct asd_sas_phy *asd_phy;
 
index f2c05eb..8586dc7 100644 (file)
@@ -183,7 +183,7 @@ static int sas_get_linkerrors(struct sas_phy *phy)
                struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
                struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
                struct sas_internal *i =
-                       to_sas_internal(sas_ha->core.shost->transportt);
+                       to_sas_internal(sas_ha->shost->transportt);
 
                return i->dft->lldd_control_phy(asd_phy, PHY_FUNC_GET_EVENTS, NULL);
        }
@@ -232,7 +232,7 @@ static int transport_sas_phy_reset(struct sas_phy *phy, int hard_reset)
                struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
                struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
                struct sas_internal *i =
-                       to_sas_internal(sas_ha->core.shost->transportt);
+                       to_sas_internal(sas_ha->shost->transportt);
 
                if (!hard_reset && sas_try_ata_reset(asd_phy) == 0)
                        return 0;
@@ -266,7 +266,7 @@ int sas_phy_enable(struct sas_phy *phy, int enable)
                struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
                struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
                struct sas_internal *i =
-                       to_sas_internal(sas_ha->core.shost->transportt);
+                       to_sas_internal(sas_ha->shost->transportt);
 
                if (enable)
                        ret = transport_sas_phy_reset(phy, 0);
@@ -303,7 +303,7 @@ int sas_phy_reset(struct sas_phy *phy, int hard_reset)
                struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
                struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
                struct sas_internal *i =
-                       to_sas_internal(sas_ha->core.shost->transportt);
+                       to_sas_internal(sas_ha->shost->transportt);
 
                ret = i->dft->lldd_control_phy(asd_phy, reset_type, NULL);
        } else {
@@ -339,7 +339,7 @@ int sas_set_phy_speed(struct sas_phy *phy,
                struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
                struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
                struct sas_internal *i =
-                       to_sas_internal(sas_ha->core.shost->transportt);
+                       to_sas_internal(sas_ha->shost->transportt);
 
                ret = i->dft->lldd_control_phy(asd_phy, PHY_FUNC_SET_LINK_RATE,
                                               rates);
@@ -438,7 +438,7 @@ static void _sas_resume_ha(struct sas_ha_struct *ha, bool drain)
        /* all phys are back up or timed out, turn on i/o so we can
         * flush out disks that did not return
         */
-       scsi_unblock_requests(ha->core.shost);
+       scsi_unblock_requests(ha->shost);
        if (drain)
                sas_drain_work(ha);
        clear_bit(SAS_HA_RESUMING, &ha->state);
@@ -468,7 +468,7 @@ void sas_suspend_ha(struct sas_ha_struct *ha)
        int i;
 
        sas_disable_events(ha);
-       scsi_block_requests(ha->core.shost);
+       scsi_block_requests(ha->shost);
        for (i = 0; i < ha->num_phys; i++) {
                struct asd_sas_port *port = ha->sas_port[i];
 
@@ -641,7 +641,7 @@ struct asd_sas_event *sas_alloc_event(struct asd_sas_phy *phy,
        struct asd_sas_event *event;
        struct sas_ha_struct *sas_ha = phy->ha;
        struct sas_internal *i =
-               to_sas_internal(sas_ha->core.shost->transportt);
+               to_sas_internal(sas_ha->shost->transportt);
 
        event = kmem_cache_zalloc(sas_event_cache, gfp_flags);
        if (!event)
index a0d592d..57494ac 100644 (file)
@@ -38,7 +38,7 @@ static void sas_phye_oob_error(struct work_struct *work)
        struct sas_ha_struct *sas_ha = phy->ha;
        struct asd_sas_port *port = phy->port;
        struct sas_internal *i =
-               to_sas_internal(sas_ha->core.shost->transportt);
+               to_sas_internal(sas_ha->shost->transportt);
 
        sas_deform_port(phy, 1);
 
@@ -66,7 +66,7 @@ static void sas_phye_spinup_hold(struct work_struct *work)
        struct asd_sas_phy *phy = ev->phy;
        struct sas_ha_struct *sas_ha = phy->ha;
        struct sas_internal *i =
-               to_sas_internal(sas_ha->core.shost->transportt);
+               to_sas_internal(sas_ha->shost->transportt);
 
        phy->error = 0;
        i->dft->lldd_control_phy(phy, PHY_FUNC_RELEASE_SPINUP_HOLD, NULL);
@@ -95,7 +95,7 @@ static void sas_phye_shutdown(struct work_struct *work)
        struct asd_sas_phy *phy = ev->phy;
        struct sas_ha_struct *sas_ha = phy->ha;
        struct sas_internal *i =
-               to_sas_internal(sas_ha->core.shost->transportt);
+               to_sas_internal(sas_ha->shost->transportt);
 
        if (phy->enabled) {
                int ret;
@@ -131,7 +131,7 @@ int sas_register_phys(struct sas_ha_struct *sas_ha)
                spin_lock_init(&phy->sas_prim_lock);
                phy->frame_rcvd_size = 0;
 
-               phy->phy = sas_phy_alloc(&sas_ha->core.shost->shost_gendev, i);
+               phy->phy = sas_phy_alloc(&sas_ha->shost->shost_gendev, i);
                if (!phy->phy)
                        return -ENOMEM;
 
index 7893c46..e3f2ed9 100644 (file)
@@ -28,7 +28,7 @@ static void sas_resume_port(struct asd_sas_phy *phy)
        struct domain_device *dev, *n;
        struct asd_sas_port *port = phy->port;
        struct sas_ha_struct *sas_ha = phy->ha;
-       struct sas_internal *si = to_sas_internal(sas_ha->core.shost->transportt);
+       struct sas_internal *si = to_sas_internal(sas_ha->shost->transportt);
 
        if (si->dft->lldd_port_formed)
                si->dft->lldd_port_formed(phy);
@@ -108,7 +108,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
        struct asd_sas_port *port = phy->port;
        struct domain_device *port_dev = NULL;
        struct sas_internal *si =
-               to_sas_internal(sas_ha->core.shost->transportt);
+               to_sas_internal(sas_ha->shost->transportt);
        unsigned long flags;
 
        if (port) {
@@ -211,7 +211,7 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone)
        struct sas_ha_struct *sas_ha = phy->ha;
        struct asd_sas_port *port = phy->port;
        struct sas_internal *si =
-               to_sas_internal(sas_ha->core.shost->transportt);
+               to_sas_internal(sas_ha->shost->transportt);
        struct domain_device *dev;
        unsigned long flags;
 
index 94c5f14..86b5d6b 100644 (file)
@@ -279,7 +279,7 @@ static enum task_disposition sas_scsi_find_task(struct sas_task *task)
        unsigned long flags;
        int i, res;
        struct sas_internal *si =
-               to_sas_internal(task->dev->port->ha->core.shost->transportt);
+               to_sas_internal(task->dev->port->ha->shost->transportt);
 
        for (i = 0; i < 5; i++) {
                pr_notice("%s: aborting task 0x%p\n", __func__, task);
@@ -327,7 +327,7 @@ static int sas_recover_lu(struct domain_device *dev, struct scsi_cmnd *cmd)
        int res = TMF_RESP_FUNC_FAILED;
        struct scsi_lun lun;
        struct sas_internal *i =
-               to_sas_internal(dev->port->ha->core.shost->transportt);
+               to_sas_internal(dev->port->ha->shost->transportt);
 
        int_to_scsilun(cmd->device->lun, &lun);
 
@@ -355,7 +355,7 @@ static int sas_recover_I_T(struct domain_device *dev)
 {
        int res = TMF_RESP_FUNC_FAILED;
        struct sas_internal *i =
-               to_sas_internal(dev->port->ha->core.shost->transportt);
+               to_sas_internal(dev->port->ha->shost->transportt);
 
        pr_notice("I_T nexus reset for dev %016llx\n",
                  SAS_ADDR(dev->sas_addr));
@@ -410,7 +410,7 @@ static void sas_wait_eh(struct domain_device *dev)
        spin_unlock_irq(&ha->lock);
 
        /* make sure SCSI EH is complete */
-       if (scsi_host_in_recovery(ha->core.shost)) {
+       if (scsi_host_in_recovery(ha->shost)) {
                msleep(10);
                goto retry;
        }
@@ -440,7 +440,7 @@ static int sas_queue_reset(struct domain_device *dev, int reset_type,
                        set_bit(SAS_DEV_EH_PENDING, &dev->state);
                        set_bit(reset_type, &dev->state);
                        int_to_scsilun(lun, &dev->ssp_dev.reset_lun);
-                       scsi_schedule_eh(ha->core.shost);
+                       scsi_schedule_eh(ha->shost);
                }
                spin_unlock_irq(&ha->lock);
 
@@ -925,7 +925,7 @@ static int sas_execute_internal_abort(struct domain_device *device,
                                      unsigned int qid, void *data)
 {
        struct sas_ha_struct *ha = device->port->ha;
-       struct sas_internal *i = to_sas_internal(ha->core.shost->transportt);
+       struct sas_internal *i = to_sas_internal(ha->shost->transportt);
        struct sas_task *task = NULL;
        int res, retry;
 
@@ -1015,7 +1015,7 @@ int sas_execute_tmf(struct domain_device *device, void *parameter,
 {
        struct sas_task *task;
        struct sas_internal *i =
-               to_sas_internal(device->port->ha->core.shost->transportt);
+               to_sas_internal(device->port->ha->shost->transportt);
        int res, retry;
 
        for (retry = 0; retry < TASK_RETRY; retry++) {
index d5cf563..43ebb33 100644 (file)
@@ -414,7 +414,7 @@ static int mvs_prep_sas_ha_init(struct Scsi_Host *shost,
 
        sha->sas_phy = arr_phy;
        sha->sas_port = arr_port;
-       sha->core.shost = shost;
+       sha->shost = shost;
 
        sha->lldd_ha = kzalloc(sizeof(struct mvs_prv_info), GFP_KERNEL);
        if (!sha->lldd_ha)
@@ -470,7 +470,7 @@ static void  mvs_post_sas_ha_init(struct Scsi_Host *shost,
        shost->sg_tablesize = min_t(u16, SG_ALL, MVS_MAX_SG);
        shost->can_queue = can_queue;
        mvi->shost->cmd_per_lun = MVS_QUEUE_SIZE;
-       sha->core.shost = mvi->shost;
+       sha->shost = mvi->shost;
 }
 
 static void mvs_init_sas_add(struct mvs_info *mvi)
index 0ffde0b..8ed3bb1 100644 (file)
@@ -654,7 +654,7 @@ static void  pm8001_post_sas_ha_init(struct Scsi_Host *shost,
        sha->strict_wide_ports = 1;
        sha->sas_addr = &pm8001_ha->sas_addr[0];
        sha->num_phys = chip_info->n_phy;
-       sha->core.shost = shost;
+       sha->shost = shost;
 }
 
 /**
index e54bcdc..d42bfdf 100644 (file)
@@ -333,11 +333,6 @@ struct asd_sas_phy {
        void *lldd_phy;           /* not touched by the sas_class_code */
 };
 
-struct scsi_core {
-       struct Scsi_Host *shost;
-
-};
-
 enum sas_ha_state {
        SAS_HA_REGISTERED,
        SAS_HA_DRAINING,
@@ -358,7 +353,7 @@ struct sas_ha_struct {
 
        struct mutex disco_mutex;
 
-       struct scsi_core core;
+       struct Scsi_Host *shost;
 
 /* public: */
        char *sas_ha_name;