Skip to content

Commit 1451455

Browse files
Merge patch series "libsas: Some tidy-up"
John Garry <[email protected]> says: This series tidies-up libsas a bit, including: - delete structure(s) with only one member - delete structure members which are only ever set - delete structure members which are never set and code which relies on that member being set This conflicts with the following series: https://lore.kernel.org/linux-scsi/[email protected]/ Any conflict should be trivial to resolve. Based on mkp-scsi staging at a18e81d ("scsi: ufs: ufs-pci: Add support for QEMU") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents ef5d681 + 8634449 commit 1451455

25 files changed

+59
-131
lines changed

drivers/scsi/aic94xx/aic94xx_hwi.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static int asd_get_user_sas_addr(struct asd_ha_struct *asd_ha)
2828
if (asd_ha->hw_prof.sas_addr[0])
2929
return 0;
3030

31-
return sas_request_addr(asd_ha->sas_ha.core.shost,
31+
return sas_request_addr(asd_ha->sas_ha.shost,
3232
asd_ha->hw_prof.sas_addr);
3333
}
3434

@@ -72,10 +72,8 @@ static int asd_init_phy(struct asd_phy *phy)
7272
struct asd_sas_phy *sas_phy = &phy->sas_phy;
7373

7474
sas_phy->enabled = 1;
75-
sas_phy->class = SAS;
7675
sas_phy->iproto = SAS_PROTOCOL_ALL;
7776
sas_phy->tproto = 0;
78-
sas_phy->type = PHY_TYPE_PHYSICAL;
7977
sas_phy->role = PHY_ROLE_INITIATOR;
8078
sas_phy->oob_mode = OOB_NOT_CONNECTED;
8179
sas_phy->linkrate = SAS_LINK_RATE_UNKNOWN;

drivers/scsi/aic94xx/aic94xx_init.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,6 @@ static int asd_register_sas_ha(struct asd_ha_struct *asd_ha)
667667
}
668668

669669
asd_ha->sas_ha.sas_ha_name = (char *) asd_ha->name;
670-
asd_ha->sas_ha.lldd_module = THIS_MODULE;
671670
asd_ha->sas_ha.sas_addr = &asd_ha->hw_prof.sas_addr[0];
672671

673672
for (i = 0; i < ASD_MAX_PHYS; i++) {
@@ -688,8 +687,8 @@ static int asd_unregister_sas_ha(struct asd_ha_struct *asd_ha)
688687

689688
err = sas_unregister_ha(&asd_ha->sas_ha);
690689

691-
sas_remove_host(asd_ha->sas_ha.core.shost);
692-
scsi_host_put(asd_ha->sas_ha.core.shost);
690+
sas_remove_host(asd_ha->sas_ha.shost);
691+
scsi_host_put(asd_ha->sas_ha.shost);
693692

694693
kfree(asd_ha->sas_ha.sas_phy);
695694
kfree(asd_ha->sas_ha.sas_port);
@@ -739,7 +738,7 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
739738
asd_printk("found %s, device %s\n", asd_ha->name, pci_name(dev));
740739

741740
SHOST_TO_SAS_HA(shost) = &asd_ha->sas_ha;
742-
asd_ha->sas_ha.core.shost = shost;
741+
asd_ha->sas_ha.shost = shost;
743742
shost->transportt = aic94xx_transport_template;
744743
shost->max_id = ~0;
745744
shost->max_lun = ~0;

drivers/scsi/aic94xx/aic94xx_task.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,9 @@ static int asd_build_ata_ascb(struct asd_ascb *ascb, struct sas_task *task,
388388
flags |= data_dir_flags[task->data_dir];
389389
scb->ata_task.ata_flags = flags;
390390

391-
scb->ata_task.retry_count = task->ata_task.retry_count;
391+
scb->ata_task.retry_count = 0;
392392

393-
flags = 0;
394-
if (task->ata_task.set_affil_pol)
395-
flags |= SET_AFFIL_POLICY;
396-
if (task->ata_task.stp_affil_pol)
397-
flags |= STP_AFFIL_POLICY;
398-
scb->ata_task.flags = flags;
393+
scb->ata_task.flags = 0;
399394
}
400395
ascb->tasklet_complete = asd_task_tasklet_complete;
401396

@@ -485,9 +480,6 @@ static int asd_build_ssp_ascb(struct asd_ascb *ascb, struct sas_task *task,
485480
scb->ssp_task.ssp_frame.tptt = cpu_to_be16(0xFFFF);
486481

487482
memcpy(scb->ssp_task.ssp_cmd.lun, task->ssp_task.LUN, 8);
488-
if (task->ssp_task.enable_first_burst)
489-
scb->ssp_task.ssp_cmd.efb_prio_attr |= EFB_MASK;
490-
scb->ssp_task.ssp_cmd.efb_prio_attr |= (task->ssp_task.task_prio << 3);
491483
scb->ssp_task.ssp_cmd.efb_prio_attr |= (task->ssp_task.task_attr & 7);
492484
memcpy(scb->ssp_task.ssp_cmd.cdb, task->ssp_task.cmd->cmnd,
493485
task->ssp_task.cmd->cmd_len);

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,10 +1018,8 @@ static void hisi_sas_phy_init(struct hisi_hba *hisi_hba, int phy_no)
10181018
phy->minimum_linkrate = SAS_LINK_RATE_1_5_GBPS;
10191019
phy->maximum_linkrate = hisi_hba->hw->phy_get_max_linkrate();
10201020
sas_phy->enabled = (phy_no < hisi_hba->n_phy) ? 1 : 0;
1021-
sas_phy->class = SAS;
10221021
sas_phy->iproto = SAS_PROTOCOL_ALL;
10231022
sas_phy->tproto = 0;
1024-
sas_phy->type = PHY_TYPE_PHYSICAL;
10251023
sas_phy->role = PHY_ROLE_INITIATOR;
10261024
sas_phy->oob_mode = OOB_NOT_CONNECTED;
10271025
sas_phy->linkrate = SAS_LINK_RATE_UNKNOWN;
@@ -2514,10 +2512,9 @@ int hisi_sas_probe(struct platform_device *pdev,
25142512

25152513
sha->sas_ha_name = DRV_NAME;
25162514
sha->dev = hisi_hba->dev;
2517-
sha->lldd_module = THIS_MODULE;
25182515
sha->sas_addr = &hisi_hba->sas_addr[0];
25192516
sha->num_phys = hisi_hba->n_phy;
2520-
sha->core.shost = hisi_hba->shost;
2517+
sha->shost = hisi_hba->shost;
25212518

25222519
for (i = 0; i < hisi_hba->n_phy; i++) {
25232520
sha->sas_phy[i] = &hisi_hba->phy[i].sas_phy;
@@ -2559,12 +2556,12 @@ void hisi_sas_remove(struct platform_device *pdev)
25592556
{
25602557
struct sas_ha_struct *sha = platform_get_drvdata(pdev);
25612558
struct hisi_hba *hisi_hba = sha->lldd_ha;
2562-
struct Scsi_Host *shost = sha->core.shost;
2559+
struct Scsi_Host *shost = sha->shost;
25632560

25642561
del_timer_sync(&hisi_hba->timer);
25652562

25662563
sas_unregister_ha(sha);
2567-
sas_remove_host(sha->core.shost);
2564+
sas_remove_host(shost);
25682565

25692566
hisi_sas_free(hisi_hba);
25702567
scsi_host_put(shost);

drivers/scsi/hisi_sas/hisi_sas_v1_hw.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ static void prep_ssp_v1_hw(struct hisi_hba *hisi_hba,
960960
struct scsi_cmnd *scsi_cmnd = ssp_task->cmd;
961961
struct sas_tmf_task *tmf = slot->tmf;
962962
int has_data = 0, priority = !!tmf;
963-
u8 *buf_cmd, fburst = 0;
963+
u8 *buf_cmd;
964964
u32 dw1, dw2;
965965

966966
/* create header */
@@ -1018,16 +1018,11 @@ static void prep_ssp_v1_hw(struct hisi_hba *hisi_hba,
10181018

10191019
buf_cmd = hisi_sas_cmd_hdr_addr_mem(slot) +
10201020
sizeof(struct ssp_frame_hdr);
1021-
if (task->ssp_task.enable_first_burst) {
1022-
fburst = (1 << 7);
1023-
dw2 |= 1 << CMD_HDR_FIRST_BURST_OFF;
1024-
}
10251021
hdr->dw2 = cpu_to_le32(dw2);
10261022

10271023
memcpy(buf_cmd, &task->ssp_task.LUN, 8);
10281024
if (!tmf) {
1029-
buf_cmd[9] = fburst | task->ssp_task.task_attr |
1030-
(task->ssp_task.task_prio << 3);
1025+
buf_cmd[9] = task->ssp_task.task_attr;
10311026
memcpy(buf_cmd + 12, task->ssp_task.cmd->cmnd,
10321027
task->ssp_task.cmd->cmd_len);
10331028
} else {

drivers/scsi/hisi_sas/hisi_sas_v2_hw.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,8 +1798,7 @@ static void prep_ssp_v2_hw(struct hisi_hba *hisi_hba,
17981798

17991799
memcpy(buf_cmd, &task->ssp_task.LUN, 8);
18001800
if (!tmf) {
1801-
buf_cmd[9] = task->ssp_task.task_attr |
1802-
(task->ssp_task.task_prio << 3);
1801+
buf_cmd[9] = task->ssp_task.task_attr;
18031802
memcpy(buf_cmd + 12, task->ssp_task.cmd->cmnd,
18041803
task->ssp_task.cmd->cmd_len);
18051804
} else {

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ static void prep_ssp_v3_hw(struct hisi_hba *hisi_hba,
13261326

13271327
memcpy(buf_cmd, &task->ssp_task.LUN, 8);
13281328
if (!tmf) {
1329-
buf_cmd[9] = ssp_task->task_attr | (ssp_task->task_prio << 3);
1329+
buf_cmd[9] = ssp_task->task_attr;
13301330
memcpy(buf_cmd + 12, scsi_cmnd->cmnd, scsi_cmnd->cmd_len);
13311331
} else {
13321332
buf_cmd[10] = tmf->tmf;
@@ -4956,7 +4956,7 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
49564956

49574957
sha->sas_phy = arr_phy;
49584958
sha->sas_port = arr_port;
4959-
sha->core.shost = shost;
4959+
sha->shost = shost;
49604960
sha->lldd_ha = hisi_hba;
49614961

49624962
shost->transportt = hisi_sas_stt;
@@ -4973,7 +4973,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
49734973

49744974
sha->sas_ha_name = DRV_NAME;
49754975
sha->dev = dev;
4976-
sha->lldd_module = THIS_MODULE;
49774976
sha->sas_addr = &hisi_hba->sas_addr[0];
49784977
sha->num_phys = hisi_hba->n_phy;
49794978

@@ -5061,14 +5060,14 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
50615060
struct device *dev = &pdev->dev;
50625061
struct sas_ha_struct *sha = dev_get_drvdata(dev);
50635062
struct hisi_hba *hisi_hba = sha->lldd_ha;
5064-
struct Scsi_Host *shost = sha->core.shost;
5063+
struct Scsi_Host *shost = sha->shost;
50655064

50665065
pm_runtime_get_noresume(dev);
50675066
del_timer_sync(&hisi_hba->timer);
50685067

50695068
sas_unregister_ha(sha);
50705069
flush_workqueue(hisi_hba->wq);
5071-
sas_remove_host(sha->core.shost);
5070+
sas_remove_host(shost);
50725071

50735072
hisi_sas_v3_destroy_irqs(pdev, hisi_hba);
50745073
hisi_sas_free(hisi_hba);

drivers/scsi/isci/host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ static inline struct isci_pci_info *to_pci_info(struct pci_dev *pdev)
306306

307307
static inline struct Scsi_Host *to_shost(struct isci_host *ihost)
308308
{
309-
return ihost->sas_ha.core.shost;
309+
return ihost->sas_ha.shost;
310310
}
311311

312312
#define for_each_isci_host(id, ihost, pdev) \

drivers/scsi/isci/init.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ static int isci_register_sas_ha(struct isci_host *isci_host)
250250
return -ENOMEM;
251251

252252
sas_ha->sas_ha_name = DRV_NAME;
253-
sas_ha->lldd_module = THIS_MODULE;
254253
sas_ha->sas_addr = &isci_host->phys[0].sas_addr[0];
255254

256255
for (i = 0; i < SCI_MAX_PHYS; i++) {
@@ -573,7 +572,7 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id)
573572
goto err_shost;
574573

575574
SHOST_TO_SAS_HA(shost) = &ihost->sas_ha;
576-
ihost->sas_ha.core.shost = shost;
575+
ihost->sas_ha.shost = shost;
577576
shost->transportt = isci_transport_template;
578577

579578
shost->max_id = ~0;
@@ -728,7 +727,7 @@ static int isci_resume(struct device *dev)
728727
sas_prep_resume_ha(&ihost->sas_ha);
729728

730729
isci_host_init(ihost);
731-
isci_host_start(ihost->sas_ha.core.shost);
730+
isci_host_start(ihost->sas_ha.shost);
732731
wait_for_start(ihost);
733732

734733
sas_resume_ha(&ihost->sas_ha);

drivers/scsi/isci/phy.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,10 +1404,8 @@ void isci_phy_init(struct isci_phy *iphy, struct isci_host *ihost, int index)
14041404
iphy->sas_phy.ha = &ihost->sas_ha;
14051405
iphy->sas_phy.lldd_phy = iphy;
14061406
iphy->sas_phy.enabled = 1;
1407-
iphy->sas_phy.class = SAS;
14081407
iphy->sas_phy.iproto = SAS_PROTOCOL_ALL;
14091408
iphy->sas_phy.tproto = 0;
1410-
iphy->sas_phy.type = PHY_TYPE_PHYSICAL;
14111409
iphy->sas_phy.role = PHY_ROLE_INITIATOR;
14121410
iphy->sas_phy.oob_mode = OOB_NOT_CONNECTED;
14131411
iphy->sas_phy.linkrate = SAS_LINK_RATE_UNKNOWN;

drivers/scsi/isci/request.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static void sci_io_request_build_ssp_command_iu(struct isci_request *ireq)
180180
cmd_iu->_r_a = 0;
181181
cmd_iu->_r_b = 0;
182182
cmd_iu->en_fburst = 0; /* unsupported */
183-
cmd_iu->task_prio = task->ssp_task.task_prio;
183+
cmd_iu->task_prio = 0;
184184
cmd_iu->task_attr = task->ssp_task.task_attr;
185185
cmd_iu->_r_c = 0;
186186

drivers/scsi/libsas/sas_ata.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
162162
struct ata_port *ap = qc->ap;
163163
struct domain_device *dev = ap->private_data;
164164
struct sas_ha_struct *sas_ha = dev->port->ha;
165-
struct Scsi_Host *host = sas_ha->core.shost;
165+
struct Scsi_Host *host = sas_ha->shost;
166166
struct sas_internal *i = to_sas_internal(host->transportt);
167167

168168
/* TODO: we should try to remove that unlock */
@@ -201,7 +201,6 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
201201
task->data_dir = qc->dma_dir;
202202
}
203203
task->scatter = qc->sg;
204-
task->ata_task.retry_count = 1;
205204
qc->lldd_task = task;
206205

207206
task->ata_task.use_ncq = ata_is_ncq(qc->tf.protocol);
@@ -238,7 +237,7 @@ static void sas_ata_qc_fill_rtf(struct ata_queued_cmd *qc)
238237

239238
static struct sas_internal *dev_to_sas_internal(struct domain_device *dev)
240239
{
241-
return to_sas_internal(dev->port->ha->core.shost->transportt);
240+
return to_sas_internal(dev->port->ha->shost->transportt);
242241
}
243242

244243
static int sas_get_ata_command_set(struct domain_device *dev)
@@ -587,7 +586,7 @@ static struct ata_port_info sata_port_info = {
587586
int sas_ata_init(struct domain_device *found_dev)
588587
{
589588
struct sas_ha_struct *ha = found_dev->port->ha;
590-
struct Scsi_Host *shost = ha->core.shost;
589+
struct Scsi_Host *shost = ha->shost;
591590
struct ata_host *ata_host;
592591
struct ata_port *ap;
593592
int rc;
@@ -825,7 +824,7 @@ static void async_sas_ata_eh(void *data, async_cookie_t cookie)
825824
struct sas_ha_struct *ha = dev->port->ha;
826825

827826
sas_ata_printk(KERN_DEBUG, dev, "dev error handler\n");
828-
ata_scsi_port_error_handler(ha->core.shost, ap);
827+
ata_scsi_port_error_handler(ha->shost, ap);
829828
sas_put_device(dev);
830829
}
831830

drivers/scsi/libsas/sas_discover.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
170170
{
171171
int res = 0;
172172
struct sas_ha_struct *sas_ha = dev->port->ha;
173-
struct Scsi_Host *shost = sas_ha->core.shost;
173+
struct Scsi_Host *shost = sas_ha->shost;
174174
struct sas_internal *i = to_sas_internal(shost->transportt);
175175

176176
if (!i->dft->lldd_dev_found)
@@ -192,7 +192,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
192192
void sas_notify_lldd_dev_gone(struct domain_device *dev)
193193
{
194194
struct sas_ha_struct *sas_ha = dev->port->ha;
195-
struct Scsi_Host *shost = sas_ha->core.shost;
195+
struct Scsi_Host *shost = sas_ha->shost;
196196
struct sas_internal *i = to_sas_internal(shost->transportt);
197197

198198
if (!i->dft->lldd_dev_gone)
@@ -234,7 +234,7 @@ static void sas_suspend_devices(struct work_struct *work)
234234
struct domain_device *dev;
235235
struct sas_discovery_event *ev = to_sas_discovery_event(work);
236236
struct asd_sas_port *port = ev->port;
237-
struct Scsi_Host *shost = port->ha->core.shost;
237+
struct Scsi_Host *shost = port->ha->shost;
238238
struct sas_internal *si = to_sas_internal(shost->transportt);
239239

240240
clear_bit(DISCE_SUSPEND, &port->disc.pending);
@@ -373,7 +373,7 @@ static bool sas_abort_cmd(struct request *req, void *data)
373373
static void sas_abort_device_scsi_cmds(struct domain_device *dev)
374374
{
375375
struct sas_ha_struct *sas_ha = dev->port->ha;
376-
struct Scsi_Host *shost = sas_ha->core.shost;
376+
struct Scsi_Host *shost = sas_ha->shost;
377377

378378
if (dev_is_expander(dev->dev_type))
379379
return;

drivers/scsi/libsas/sas_expander.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static int smp_execute_task_sg(struct domain_device *dev,
3737
int res, retry;
3838
struct sas_task *task = NULL;
3939
struct sas_internal *i =
40-
to_sas_internal(dev->port->ha->core.shost->transportt);
40+
to_sas_internal(dev->port->ha->shost->transportt);
4141
struct sas_ha_struct *ha = dev->port->ha;
4242

4343
pm_runtime_get_sync(ha->dev);

drivers/scsi/libsas/sas_host_smp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static int sas_host_smp_write_gpio(struct sas_ha_struct *sas_ha, u8 *resp_data,
114114
u8 reg_type, u8 reg_index, u8 reg_count,
115115
u8 *req_data)
116116
{
117-
struct sas_internal *i = to_sas_internal(sas_ha->core.shost->transportt);
117+
struct sas_internal *i = to_sas_internal(sas_ha->shost->transportt);
118118
int written;
119119

120120
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,
182182
enum sas_linkrate max, u8 *resp_data)
183183
{
184184
struct sas_internal *i =
185-
to_sas_internal(sas_ha->core.shost->transportt);
185+
to_sas_internal(sas_ha->shost->transportt);
186186
struct sas_phy_linkrates rates;
187187
struct asd_sas_phy *asd_phy;
188188

0 commit comments

Comments
 (0)