]> www.infradead.org Git - users/hch/misc.git/commitdiff
scsi: hisi_sas: Use dev_parent_is_expander() helper
authorNiklas Cassel <cassel@kernel.org>
Thu, 14 Aug 2025 17:32:19 +0000 (19:32 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 19 Aug 2025 02:08:30 +0000 (22:08 -0400)
Make use of the dev_parent_is_expander() helper.

Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-16-cassel@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_main.c
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

index d1a4cc69d408f86517c1685ef642b119b12b085f..30a9c66126513aa01e9f0f2a6b0e24ebd1dfde97 100644 (file)
@@ -876,7 +876,7 @@ static int hisi_sas_dev_found(struct domain_device *device)
        device->lldd_dev = sas_dev;
        hisi_hba->hw->setup_itct(hisi_hba, sas_dev);
 
-       if (parent_dev && dev_is_expander(parent_dev->dev_type)) {
+       if (dev_parent_is_expander(device)) {
                int phy_no;
 
                phy_no = sas_find_attached_phy_id(&parent_dev->ex_dev, device);
index 4431698a5d78c2431fb967d8ef71c18be5e8a9be..f3516a0611dde0ee2dd2c9ca279c3de8091668a6 100644 (file)
@@ -925,7 +925,6 @@ static void setup_itct_v2_hw(struct hisi_hba *hisi_hba,
        struct device *dev = hisi_hba->dev;
        u64 qw0, device_id = sas_dev->device_id;
        struct hisi_sas_itct *itct = &hisi_hba->itct[device_id];
-       struct domain_device *parent_dev = device->parent;
        struct asd_sas_port *sas_port = device->port;
        struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
        u64 sas_addr;
@@ -942,7 +941,7 @@ static void setup_itct_v2_hw(struct hisi_hba *hisi_hba,
                break;
        case SAS_SATA_DEV:
        case SAS_SATA_PENDING:
-               if (parent_dev && dev_is_expander(parent_dev->dev_type))
+               if (dev_parent_is_expander(device))
                        qw0 = HISI_SAS_DEV_TYPE_STP << ITCT_HDR_DEV_TYPE_OFF;
                else
                        qw0 = HISI_SAS_DEV_TYPE_SATA << ITCT_HDR_DEV_TYPE_OFF;
@@ -2494,7 +2493,6 @@ static void prep_ata_v2_hw(struct hisi_hba *hisi_hba,
 {
        struct sas_task *task = slot->task;
        struct domain_device *device = task->dev;
-       struct domain_device *parent_dev = device->parent;
        struct hisi_sas_device *sas_dev = device->lldd_dev;
        struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr;
        struct asd_sas_port *sas_port = device->port;
@@ -2509,7 +2507,7 @@ static void prep_ata_v2_hw(struct hisi_hba *hisi_hba,
        /* create header */
        /* dw0 */
        dw0 = port->id << CMD_HDR_PORT_OFF;
-       if (parent_dev && dev_is_expander(parent_dev->dev_type)) {
+       if (dev_parent_is_expander(device)) {
                dw0 |= 3 << CMD_HDR_CMD_OFF;
        } else {
                phy_id = device->phy->identify.phy_identifier;
index 2f3d61abab3a66bf0b40a27b9411dc2cab1c44fc..2f9e01717ef38971703b6e34d2655db35ccf09a6 100644 (file)
@@ -874,7 +874,6 @@ static void setup_itct_v3_hw(struct hisi_hba *hisi_hba,
        struct device *dev = hisi_hba->dev;
        u64 qw0, device_id = sas_dev->device_id;
        struct hisi_sas_itct *itct = &hisi_hba->itct[device_id];
-       struct domain_device *parent_dev = device->parent;
        struct asd_sas_port *sas_port = device->port;
        struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
        u64 sas_addr;
@@ -891,7 +890,7 @@ static void setup_itct_v3_hw(struct hisi_hba *hisi_hba,
                break;
        case SAS_SATA_DEV:
        case SAS_SATA_PENDING:
-               if (parent_dev && dev_is_expander(parent_dev->dev_type))
+               if (dev_parent_is_expander(device))
                        qw0 = HISI_SAS_DEV_TYPE_STP << ITCT_HDR_DEV_TYPE_OFF;
                else
                        qw0 = HISI_SAS_DEV_TYPE_SATA << ITCT_HDR_DEV_TYPE_OFF;
@@ -1476,7 +1475,6 @@ static void prep_ata_v3_hw(struct hisi_hba *hisi_hba,
 {
        struct sas_task *task = slot->task;
        struct domain_device *device = task->dev;
-       struct domain_device *parent_dev = device->parent;
        struct hisi_sas_device *sas_dev = device->lldd_dev;
        struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr;
        struct asd_sas_port *sas_port = device->port;
@@ -1487,7 +1485,7 @@ static void prep_ata_v3_hw(struct hisi_hba *hisi_hba,
        u32 dw1 = 0, dw2 = 0;
 
        hdr->dw0 = cpu_to_le32(port->id << CMD_HDR_PORT_OFF);
-       if (parent_dev && dev_is_expander(parent_dev->dev_type)) {
+       if (dev_parent_is_expander(device)) {
                hdr->dw0 |= cpu_to_le32(3 << CMD_HDR_CMD_OFF);
        } else {
                phy_id = device->phy->identify.phy_identifier;