public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: pm80xx: Set phy_attached to zero when device is gone
@ 2023-05-16 17:57 Pranav Prasad
  2023-05-17 13:21 ` John Garry
  0 siblings, 1 reply; 4+ messages in thread
From: Pranav Prasad @ 2023-05-16 17:57 UTC (permalink / raw)
  To: Jack Wang, James E . J . Bottomley, Martin K . Petersen
  Cc: linux-scsi, linux-kernel, Igor Pylypiv, Pranav Prasad

From: Igor Pylypiv <ipylypiv@google.com>

Set phy_attached to zero when device is gone.

Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Pranav Prasad <pranavpp@google.com>
---
 drivers/scsi/pm8001/pm8001_sas.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index e5673c774f66..c57fc671509d 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -706,6 +706,7 @@ static void pm8001_dev_gone_notify(struct domain_device *dev)
 			spin_lock_irqsave(&pm8001_ha->lock, flags);
 		}
 		PM8001_CHIP_DISP->dereg_dev_req(pm8001_ha, device_id);
+		pm8001_ha->phy[pm8001_dev->attached_phy].phy_attached = 0;
 		pm8001_free_dev(pm8001_dev);
 	} else {
 		pm8001_dbg(pm8001_ha, DISC, "Found dev has gone.\n");
-- 
2.40.1.606.ga4b1b128d6-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: pm80xx: Set phy_attached to zero when device is gone
  2023-05-16 17:57 [PATCH] scsi: pm80xx: Set phy_attached to zero when device is gone Pranav Prasad
@ 2023-05-17 13:21 ` John Garry
  0 siblings, 0 replies; 4+ messages in thread
From: John Garry @ 2023-05-17 13:21 UTC (permalink / raw)
  To: Pranav Prasad, Jack Wang, James E . J . Bottomley,
	Martin K . Petersen
  Cc: linux-scsi, linux-kernel, Igor Pylypiv

On 16/05/2023 18:57, Pranav Prasad wrote:
> From: Igor Pylypiv <ipylypiv@google.com>
> 
> Set phy_attached to zero when device is gone.
> 
> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
> Signed-off-by: Pranav Prasad <pranavpp@google.com>
> ---
>   drivers/scsi/pm8001/pm8001_sas.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index e5673c774f66..c57fc671509d 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -706,6 +706,7 @@ static void pm8001_dev_gone_notify(struct domain_device *dev)
>   			spin_lock_irqsave(&pm8001_ha->lock, flags);
>   		}
>   		PM8001_CHIP_DISP->dereg_dev_req(pm8001_ha, device_id);
> +		pm8001_ha->phy[pm8001_dev->attached_phy].phy_attached = 0;

Can you factor stuff like this out, so that maintaining these values is 
easier and less error prone?

Check this:
~/linux/drivers/scsi/pm8001> git grep "phy_attached = 0" | wc -l
21


>   		pm8001_free_dev(pm8001_dev);
>   	} else {
>   		pm8001_dbg(pm8001_ha, DISC, "Found dev has gone.\n");


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] scsi: pm80xx: Set phy_attached to zero when device is gone
@ 2025-03-19 23:03 Salomon Dushimirimana
  2025-04-03 14:06 ` Martin K. Petersen
  0 siblings, 1 reply; 4+ messages in thread
From: Salomon Dushimirimana @ 2025-03-19 23:03 UTC (permalink / raw)
  To: Jack Wang, James E . J . Bottomley, Martin K . Petersen
  Cc: linux-scsi, linux-kernel, Igor Pylypiv, Salomon Dushimirimana

From: Igor Pylypiv <ipylypiv@google.com>

When a fatal error occurs, a phy down event may not be received to set
phy->phy_attached to zero.

Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Salomon Dushimirimana <salomondush@google.com>
---
 drivers/scsi/pm8001/pm8001_sas.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 183ce00aa671..f7067878b34f 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -766,6 +766,7 @@ static void pm8001_dev_gone_notify(struct domain_device *dev)
 			spin_lock_irqsave(&pm8001_ha->lock, flags);
 		}
 		PM8001_CHIP_DISP->dereg_dev_req(pm8001_ha, device_id);
+		pm8001_ha->phy[pm8001_dev->attached_phy].phy_attached = 0;
 		pm8001_free_dev(pm8001_dev);
 	} else {
 		pm8001_dbg(pm8001_ha, DISC, "Found dev has gone.\n");
-- 
2.49.0.rc1.451.g8f38331e32-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: pm80xx: Set phy_attached to zero when device is gone
  2025-03-19 23:03 Salomon Dushimirimana
@ 2025-04-03 14:06 ` Martin K. Petersen
  0 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-04-03 14:06 UTC (permalink / raw)
  To: Salomon Dushimirimana
  Cc: Jack Wang, James E . J . Bottomley, Martin K . Petersen,
	linux-scsi, linux-kernel, Igor Pylypiv


Salomon,

> When a fatal error occurs, a phy down event may not be received to set
> phy->phy_attached to zero.

Applied to 6.15/scsi-staging, thanks!

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-03 14:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-16 17:57 [PATCH] scsi: pm80xx: Set phy_attached to zero when device is gone Pranav Prasad
2023-05-17 13:21 ` John Garry
  -- strict thread matches above, loose matches on Subject: below --
2025-03-19 23:03 Salomon Dushimirimana
2025-04-03 14:06 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox