From: Niklas Cassel <cassel@kernel.org>
To: Jack Wang <jinpu.wang@cloud.ionos.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Niklas Cassel <cassel@kernel.org>, linux-scsi@vger.kernel.org
Subject: [PATCH v2 07/10] scsi: pm80xx: Use dev_parent_is_expander() helper
Date: Thu, 14 Aug 2025 19:32:22 +0200 [thread overview]
Message-ID: <20250814173215.1765055-19-cassel@kernel.org> (raw)
In-Reply-To: <20250814173215.1765055-12-cassel@kernel.org>
Make use of the dev_parent_is_expander() helper.
Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
drivers/scsi/pm8001/pm8001_hwi.c | 8 +++-----
drivers/scsi/pm8001/pm8001_sas.c | 5 ++---
drivers/scsi/pm8001/pm80xx_hwi.c | 8 +++-----
3 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 42a4eeac24c9..fb4913547b00 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -2163,8 +2163,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
/* Print sas address of IO failed device */
if ((status != IO_SUCCESS) && (status != IO_OVERFLOW) &&
(status != IO_UNDERFLOW)) {
- if (!((t->dev->parent) &&
- (dev_is_expander(t->dev->parent->dev_type)))) {
+ if (!dev_parent_is_expander(t->dev)) {
for (i = 0, j = 4; j <= 7 && i <= 3; i++, j++)
sata_addr_low[i] = pm8001_ha->sas_addr[j];
for (i = 0, j = 0; j <= 3 && i <= 3; i++, j++)
@@ -4168,7 +4167,6 @@ static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
u16 firstBurstSize = 0;
u16 ITNT = 2000;
struct domain_device *dev = pm8001_dev->sas_device;
- struct domain_device *parent_dev = dev->parent;
struct pm8001_port *port = dev->port->lldd_port;
memset(&payload, 0, sizeof(payload));
@@ -4186,8 +4184,8 @@ static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
dev_is_expander(pm8001_dev->dev_type))
stp_sspsmp_sata = 0x01; /*ssp or smp*/
}
- if (parent_dev && dev_is_expander(parent_dev->dev_type))
- phy_id = parent_dev->ex_dev.ex_phy->phy_id;
+ if (dev_parent_is_expander(dev))
+ phy_id = dev->parent->ex_dev.ex_phy->phy_id;
else
phy_id = pm8001_dev->attached_phy;
opc = OPC_INB_REG_DEV;
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 3e1dac4b820f..2bdeace6c6bf 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -700,7 +700,7 @@ static int pm8001_dev_found_notify(struct domain_device *dev)
dev->lldd_dev = pm8001_device;
pm8001_device->dev_type = dev->dev_type;
pm8001_device->dcompletion = &completion;
- if (parent_dev && dev_is_expander(parent_dev->dev_type)) {
+ if (dev_parent_is_expander(dev)) {
int phy_id;
phy_id = sas_find_attached_phy_id(&parent_dev->ex_dev, dev);
@@ -749,7 +749,6 @@ static void pm8001_dev_gone_notify(struct domain_device *dev)
unsigned long flags = 0;
struct pm8001_hba_info *pm8001_ha;
struct pm8001_device *pm8001_dev = dev->lldd_dev;
- struct domain_device *parent_dev = dev->parent;
pm8001_ha = pm8001_find_ha_by_dev(dev);
spin_lock_irqsave(&pm8001_ha->lock, flags);
@@ -771,7 +770,7 @@ static void pm8001_dev_gone_notify(struct domain_device *dev)
* The phy array only contains local phys. Thus, we cannot clear
* phy_attached for a device behind an expander.
*/
- if (!(parent_dev && dev_is_expander(parent_dev->dev_type)))
+ if (!dev_parent_is_expander(dev))
pm8001_ha->phy[pm8001_dev->attached_phy].phy_attached = 0;
pm8001_free_dev(pm8001_dev);
} else {
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index c1bae995a412..546d0d26f7a1 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -2340,8 +2340,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha,
/* Print sas address of IO failed device */
if ((status != IO_SUCCESS) && (status != IO_OVERFLOW) &&
(status != IO_UNDERFLOW)) {
- if (!((t->dev->parent) &&
- (dev_is_expander(t->dev->parent->dev_type)))) {
+ if (!dev_parent_is_expander(t->dev)) {
for (i = 0, j = 4; i <= 3 && j <= 7; i++, j++)
sata_addr_low[i] = pm8001_ha->sas_addr[j];
for (i = 0, j = 0; i <= 3 && j <= 3; i++, j++)
@@ -4780,7 +4779,6 @@ static int pm80xx_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
u16 firstBurstSize = 0;
u16 ITNT = 2000;
struct domain_device *dev = pm8001_dev->sas_device;
- struct domain_device *parent_dev = dev->parent;
struct pm8001_port *port = dev->port->lldd_port;
memset(&payload, 0, sizeof(payload));
@@ -4799,8 +4797,8 @@ static int pm80xx_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
dev_is_expander(pm8001_dev->dev_type))
stp_sspsmp_sata = 0x01; /*ssp or smp*/
}
- if (parent_dev && dev_is_expander(parent_dev->dev_type))
- phy_id = parent_dev->ex_dev.ex_phy->phy_id;
+ if (dev_parent_is_expander(dev))
+ phy_id = dev->parent->ex_dev.ex_phy->phy_id;
else
phy_id = pm8001_dev->attached_phy;
--
2.50.1
next prev parent reply other threads:[~2025-08-14 17:32 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 17:32 [PATCH v2 00/10] scsi: pm80xx: Fix expander support Niklas Cassel
2025-08-14 17:32 ` [PATCH v2 01/10] scsi: pm80xx: Restore support for expanders Niklas Cassel
2025-08-15 2:30 ` Damien Le Moal
2025-08-14 17:32 ` [PATCH v2 02/10] scsi: pm80xx: Fix array-index-out-of-of-bounds on rmmod Niklas Cassel
2025-08-15 2:30 ` Damien Le Moal
2025-08-14 17:32 ` [PATCH v2 03/10] scsi: libsas: Add dev_parent_is_expander() helper Niklas Cassel
2025-08-15 2:31 ` Damien Le Moal
2025-08-15 7:07 ` John Garry
2025-08-15 8:42 ` John Garry
2025-08-18 3:07 ` Jason Yan
2025-08-14 17:32 ` [PATCH v2 04/10] scsi: hisi_sas: Use " Niklas Cassel
2025-08-15 2:31 ` Damien Le Moal
2025-08-15 8:32 ` John Garry
2025-08-14 17:32 ` [PATCH v2 05/10] scsi: isci: " Niklas Cassel
2025-08-15 2:32 ` Damien Le Moal
2025-08-15 8:33 ` John Garry
2025-08-14 17:32 ` [PATCH v2 06/10] scsi: mvsas: " Niklas Cassel
2025-08-15 2:32 ` Damien Le Moal
2025-08-15 8:33 ` John Garry
2025-08-14 17:32 ` Niklas Cassel [this message]
2025-08-15 2:33 ` [PATCH v2 07/10] scsi: pm80xx: " Damien Le Moal
2025-08-15 8:34 ` John Garry
2025-08-15 16:39 ` Igor Pylypiv
2025-08-18 7:45 ` Jinpu Wang
2025-08-14 17:32 ` [PATCH v2 08/10] scsi: pm80xx: Add helper function to get the local phy id Niklas Cassel
2025-08-15 2:34 ` Damien Le Moal
2025-08-14 17:32 ` [PATCH v2 09/10] scsi: pm80xx: Fix pm8001_abort_task() for chip_8006 when using an expander Niklas Cassel
2025-08-15 2:35 ` Damien Le Moal
2025-08-14 17:32 ` [PATCH v2 10/10] scsi: pm80xx: Use pm80xx_get_local_phy_id() to access phy array Niklas Cassel
2025-08-15 2:36 ` Damien Le Moal
2025-08-15 16:40 ` Igor Pylypiv
2025-08-18 7:46 ` Jinpu Wang
2025-08-19 2:10 ` [PATCH v2 00/10] scsi: pm80xx: Fix expander support Martin K. Petersen
2025-08-26 2:33 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250814173215.1765055-19-cassel@kernel.org \
--to=cassel@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=jinpu.wang@cloud.ionos.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.