hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/scsi/scsi_transport_sas.c
....@@ -1,6 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2005-2006 Dell Inc.
3
- * Released under GPL v2.
44 *
55 * Serial Attached SCSI (SAS) transport class.
66 *
....@@ -198,7 +198,7 @@
198198
199199 if (rphy) {
200200 q = bsg_setup_queue(&rphy->dev, dev_name(&rphy->dev),
201
- sas_smp_dispatch, 0);
201
+ sas_smp_dispatch, NULL, 0);
202202 if (IS_ERR(q))
203203 return PTR_ERR(q);
204204 rphy->q = q;
....@@ -207,13 +207,12 @@
207207
208208 snprintf(name, sizeof(name), "sas_host%d", shost->host_no);
209209 q = bsg_setup_queue(&shost->shost_gendev, name,
210
- sas_smp_dispatch, 0);
210
+ sas_smp_dispatch, NULL, 0);
211211 if (IS_ERR(q))
212212 return PTR_ERR(q);
213213 to_sas_host_attrs(shost)->q = q;
214214 }
215215
216
- blk_queue_flag_set(QUEUE_FLAG_BIDI, q);
217216 return 0;
218217 }
219218
....@@ -246,11 +245,7 @@
246245 struct Scsi_Host *shost = dev_to_shost(dev);
247246 struct request_queue *q = to_sas_host_attrs(shost)->q;
248247
249
- if (q) {
250
- bsg_unregister_queue(q);
251
- blk_cleanup_queue(q);
252
- }
253
-
248
+ bsg_remove_queue(q);
254249 return 0;
255250 }
256251
....@@ -568,7 +563,7 @@
568563 {
569564 struct sas_phy *phy = transport_class_to_phy(dev);
570565
571
- return snprintf(buf, 20, "%d", phy->enabled);
566
+ return snprintf(buf, 20, "%d\n", phy->enabled);
572567 }
573568
574569 static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_sas_phy_enable,
....@@ -612,7 +607,6 @@
612607 sas_phy_simple_attr(identify.sas_address, sas_address, "0x%016llx\n",
613608 unsigned long long);
614609 sas_phy_simple_attr(identify.phy_identifier, phy_identifier, "%d\n", u8);
615
-//sas_phy_simple_attr(port_identifier, port_identifier, "%d\n", int);
616610 sas_phy_linkspeed_attr(negotiated_linkrate);
617611 sas_phy_linkspeed_attr(minimum_linkrate_hw);
618612 sas_phy_linkspeed_rw_attr(minimum_linkrate);
....@@ -722,12 +716,17 @@
722716 int error;
723717
724718 error = device_add(&phy->dev);
725
- if (!error) {
726
- transport_add_device(&phy->dev);
727
- transport_configure_device(&phy->dev);
728
- }
719
+ if (error)
720
+ return error;
729721
730
- return error;
722
+ error = transport_add_device(&phy->dev);
723
+ if (error) {
724
+ device_del(&phy->dev);
725
+ return error;
726
+ }
727
+ transport_configure_device(&phy->dev);
728
+
729
+ return 0;
731730 }
732731 EXPORT_SYMBOL(sas_phy_add);
733732
....@@ -1235,16 +1234,15 @@
12351234 char *buffer = kzalloc(BUF_SIZE, GFP_KERNEL), *msdata;
12361235 struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);
12371236 struct scsi_mode_data mode_data;
1238
- int res, error;
1237
+ int error;
12391238
12401239 if (!buffer)
12411240 return -ENOMEM;
12421241
1243
- res = scsi_mode_sense(sdev, 1, 0x19, buffer, BUF_SIZE, 30*HZ, 3,
1244
- &mode_data, NULL);
1242
+ error = scsi_mode_sense(sdev, 1, 0x19, buffer, BUF_SIZE, 30*HZ, 3,
1243
+ &mode_data, NULL);
12451244
1246
- error = -EINVAL;
1247
- if (!scsi_status_is_good(res))
1245
+ if (error)
12481246 goto out;
12491247
12501248 msdata = buffer + mode_data.header_length +
....@@ -1397,9 +1395,6 @@
13971395 struct sas_rphy *rphy = dev_to_rphy(dev);
13981396 struct sas_expander_device *edev = rphy_to_expander_device(rphy);
13991397
1400
- if (rphy->q)
1401
- blk_cleanup_queue(rphy->q);
1402
-
14031398 put_device(dev->parent);
14041399 kfree(edev);
14051400 }
....@@ -1408,9 +1403,6 @@
14081403 {
14091404 struct sas_rphy *rphy = dev_to_rphy(dev);
14101405 struct sas_end_device *edev = rphy_to_end_device(rphy);
1411
-
1412
- if (rphy->q)
1413
- blk_cleanup_queue(rphy->q);
14141406
14151407 put_device(dev->parent);
14161408 kfree(edev);
....@@ -1538,7 +1530,7 @@
15381530 list_add_tail(&rphy->list, &sas_host->rphy_list);
15391531 if (identify->device_type == SAS_END_DEVICE &&
15401532 (identify->target_port_protocols &
1541
- (SAS_PROTOCOL_SSP|SAS_PROTOCOL_STP|SAS_PROTOCOL_SATA)))
1533
+ (SAS_PROTOCOL_SSP | SAS_PROTOCOL_STP | SAS_PROTOCOL_SATA)))
15421534 rphy->scsi_target_id = sas_host->next_target_id++;
15431535 else if (identify->device_type == SAS_END_DEVICE)
15441536 rphy->scsi_target_id = -1;
....@@ -1640,8 +1632,7 @@
16401632 }
16411633
16421634 sas_rphy_unlink(rphy);
1643
- if (rphy->q)
1644
- bsg_unregister_queue(rphy->q);
1635
+ bsg_remove_queue(rphy->q);
16451636 transport_remove_device(dev);
16461637 device_del(dev);
16471638 }
....@@ -1802,7 +1793,6 @@
18021793 SETUP_PHY_ATTRIBUTE(device_type);
18031794 SETUP_PHY_ATTRIBUTE(sas_address);
18041795 SETUP_PHY_ATTRIBUTE(phy_identifier);
1805
- //SETUP_PHY_ATTRIBUTE(port_identifier);
18061796 SETUP_PHY_ATTRIBUTE(negotiated_linkrate);
18071797 SETUP_PHY_ATTRIBUTE(minimum_linkrate_hw);
18081798 SETUP_PHY_ATTRIBUTE_RW(minimum_linkrate);