| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2005-2006 Dell Inc. |
|---|
| 3 | | - * Released under GPL v2. |
|---|
| 4 | 4 | * |
|---|
| 5 | 5 | * Serial Attached SCSI (SAS) transport class. |
|---|
| 6 | 6 | * |
|---|
| .. | .. |
|---|
| 198 | 198 | |
|---|
| 199 | 199 | if (rphy) { |
|---|
| 200 | 200 | q = bsg_setup_queue(&rphy->dev, dev_name(&rphy->dev), |
|---|
| 201 | | - sas_smp_dispatch, 0); |
|---|
| 201 | + sas_smp_dispatch, NULL, 0); |
|---|
| 202 | 202 | if (IS_ERR(q)) |
|---|
| 203 | 203 | return PTR_ERR(q); |
|---|
| 204 | 204 | rphy->q = q; |
|---|
| .. | .. |
|---|
| 207 | 207 | |
|---|
| 208 | 208 | snprintf(name, sizeof(name), "sas_host%d", shost->host_no); |
|---|
| 209 | 209 | q = bsg_setup_queue(&shost->shost_gendev, name, |
|---|
| 210 | | - sas_smp_dispatch, 0); |
|---|
| 210 | + sas_smp_dispatch, NULL, 0); |
|---|
| 211 | 211 | if (IS_ERR(q)) |
|---|
| 212 | 212 | return PTR_ERR(q); |
|---|
| 213 | 213 | to_sas_host_attrs(shost)->q = q; |
|---|
| 214 | 214 | } |
|---|
| 215 | 215 | |
|---|
| 216 | | - blk_queue_flag_set(QUEUE_FLAG_BIDI, q); |
|---|
| 217 | 216 | return 0; |
|---|
| 218 | 217 | } |
|---|
| 219 | 218 | |
|---|
| .. | .. |
|---|
| 246 | 245 | struct Scsi_Host *shost = dev_to_shost(dev); |
|---|
| 247 | 246 | struct request_queue *q = to_sas_host_attrs(shost)->q; |
|---|
| 248 | 247 | |
|---|
| 249 | | - if (q) { |
|---|
| 250 | | - bsg_unregister_queue(q); |
|---|
| 251 | | - blk_cleanup_queue(q); |
|---|
| 252 | | - } |
|---|
| 253 | | - |
|---|
| 248 | + bsg_remove_queue(q); |
|---|
| 254 | 249 | return 0; |
|---|
| 255 | 250 | } |
|---|
| 256 | 251 | |
|---|
| .. | .. |
|---|
| 568 | 563 | { |
|---|
| 569 | 564 | struct sas_phy *phy = transport_class_to_phy(dev); |
|---|
| 570 | 565 | |
|---|
| 571 | | - return snprintf(buf, 20, "%d", phy->enabled); |
|---|
| 566 | + return snprintf(buf, 20, "%d\n", phy->enabled); |
|---|
| 572 | 567 | } |
|---|
| 573 | 568 | |
|---|
| 574 | 569 | static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_sas_phy_enable, |
|---|
| .. | .. |
|---|
| 612 | 607 | sas_phy_simple_attr(identify.sas_address, sas_address, "0x%016llx\n", |
|---|
| 613 | 608 | unsigned long long); |
|---|
| 614 | 609 | sas_phy_simple_attr(identify.phy_identifier, phy_identifier, "%d\n", u8); |
|---|
| 615 | | -//sas_phy_simple_attr(port_identifier, port_identifier, "%d\n", int); |
|---|
| 616 | 610 | sas_phy_linkspeed_attr(negotiated_linkrate); |
|---|
| 617 | 611 | sas_phy_linkspeed_attr(minimum_linkrate_hw); |
|---|
| 618 | 612 | sas_phy_linkspeed_rw_attr(minimum_linkrate); |
|---|
| .. | .. |
|---|
| 722 | 716 | int error; |
|---|
| 723 | 717 | |
|---|
| 724 | 718 | 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; |
|---|
| 729 | 721 | |
|---|
| 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; |
|---|
| 731 | 730 | } |
|---|
| 732 | 731 | EXPORT_SYMBOL(sas_phy_add); |
|---|
| 733 | 732 | |
|---|
| .. | .. |
|---|
| 1235 | 1234 | char *buffer = kzalloc(BUF_SIZE, GFP_KERNEL), *msdata; |
|---|
| 1236 | 1235 | struct sas_end_device *rdev = sas_sdev_to_rdev(sdev); |
|---|
| 1237 | 1236 | struct scsi_mode_data mode_data; |
|---|
| 1238 | | - int res, error; |
|---|
| 1237 | + int error; |
|---|
| 1239 | 1238 | |
|---|
| 1240 | 1239 | if (!buffer) |
|---|
| 1241 | 1240 | return -ENOMEM; |
|---|
| 1242 | 1241 | |
|---|
| 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); |
|---|
| 1245 | 1244 | |
|---|
| 1246 | | - error = -EINVAL; |
|---|
| 1247 | | - if (!scsi_status_is_good(res)) |
|---|
| 1245 | + if (error) |
|---|
| 1248 | 1246 | goto out; |
|---|
| 1249 | 1247 | |
|---|
| 1250 | 1248 | msdata = buffer + mode_data.header_length + |
|---|
| .. | .. |
|---|
| 1397 | 1395 | struct sas_rphy *rphy = dev_to_rphy(dev); |
|---|
| 1398 | 1396 | struct sas_expander_device *edev = rphy_to_expander_device(rphy); |
|---|
| 1399 | 1397 | |
|---|
| 1400 | | - if (rphy->q) |
|---|
| 1401 | | - blk_cleanup_queue(rphy->q); |
|---|
| 1402 | | - |
|---|
| 1403 | 1398 | put_device(dev->parent); |
|---|
| 1404 | 1399 | kfree(edev); |
|---|
| 1405 | 1400 | } |
|---|
| .. | .. |
|---|
| 1408 | 1403 | { |
|---|
| 1409 | 1404 | struct sas_rphy *rphy = dev_to_rphy(dev); |
|---|
| 1410 | 1405 | struct sas_end_device *edev = rphy_to_end_device(rphy); |
|---|
| 1411 | | - |
|---|
| 1412 | | - if (rphy->q) |
|---|
| 1413 | | - blk_cleanup_queue(rphy->q); |
|---|
| 1414 | 1406 | |
|---|
| 1415 | 1407 | put_device(dev->parent); |
|---|
| 1416 | 1408 | kfree(edev); |
|---|
| .. | .. |
|---|
| 1538 | 1530 | list_add_tail(&rphy->list, &sas_host->rphy_list); |
|---|
| 1539 | 1531 | if (identify->device_type == SAS_END_DEVICE && |
|---|
| 1540 | 1532 | (identify->target_port_protocols & |
|---|
| 1541 | | - (SAS_PROTOCOL_SSP|SAS_PROTOCOL_STP|SAS_PROTOCOL_SATA))) |
|---|
| 1533 | + (SAS_PROTOCOL_SSP | SAS_PROTOCOL_STP | SAS_PROTOCOL_SATA))) |
|---|
| 1542 | 1534 | rphy->scsi_target_id = sas_host->next_target_id++; |
|---|
| 1543 | 1535 | else if (identify->device_type == SAS_END_DEVICE) |
|---|
| 1544 | 1536 | rphy->scsi_target_id = -1; |
|---|
| .. | .. |
|---|
| 1640 | 1632 | } |
|---|
| 1641 | 1633 | |
|---|
| 1642 | 1634 | sas_rphy_unlink(rphy); |
|---|
| 1643 | | - if (rphy->q) |
|---|
| 1644 | | - bsg_unregister_queue(rphy->q); |
|---|
| 1635 | + bsg_remove_queue(rphy->q); |
|---|
| 1645 | 1636 | transport_remove_device(dev); |
|---|
| 1646 | 1637 | device_del(dev); |
|---|
| 1647 | 1638 | } |
|---|
| .. | .. |
|---|
| 1802 | 1793 | SETUP_PHY_ATTRIBUTE(device_type); |
|---|
| 1803 | 1794 | SETUP_PHY_ATTRIBUTE(sas_address); |
|---|
| 1804 | 1795 | SETUP_PHY_ATTRIBUTE(phy_identifier); |
|---|
| 1805 | | - //SETUP_PHY_ATTRIBUTE(port_identifier); |
|---|
| 1806 | 1796 | SETUP_PHY_ATTRIBUTE(negotiated_linkrate); |
|---|
| 1807 | 1797 | SETUP_PHY_ATTRIBUTE(minimum_linkrate_hw); |
|---|
| 1808 | 1798 | SETUP_PHY_ATTRIBUTE_RW(minimum_linkrate); |
|---|