public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: Clean up some rpm/spm level SysFS nodes upon remove
@ 2017-05-12  6:36 Michal Potomski
  2017-05-18 17:54 ` Subhash Jadavani
  2017-05-19  1:31 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Potomski @ 2017-05-12  6:36 UTC (permalink / raw)
  To: linux-scsi
  Cc: vinholikatti, martin.petersen, jejb, subhashj,
	Michał Potomski

From: Michał Potomski <michalx.potomski@intel.com>

When reloading module these two attributes aren't
cleaned up properly and they persist causing warnings
when trying to load module again. Additionally they are
not recreated properly due to that.

Signed-off-by: Michał Potomski <michalx.potomski@intel.com>
---
 drivers/scsi/ufs/ufshcd.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index abc7e87..ffe8d86 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -7698,6 +7698,12 @@ static inline void ufshcd_add_sysfs_nodes(struct ufs_hba *hba)
 	ufshcd_add_spm_lvl_sysfs_nodes(hba);
 }
 
+static inline void ufshcd_remove_sysfs_nodes(struct ufs_hba *hba)
+{
+	device_remove_file(hba->dev, &hba->rpm_lvl_attr);
+	device_remove_file(hba->dev, &hba->spm_lvl_attr);
+}
+
 /**
  * ufshcd_shutdown - shutdown routine
  * @hba: per adapter instance
@@ -7735,6 +7741,7 @@ int ufshcd_shutdown(struct ufs_hba *hba)
  */
 void ufshcd_remove(struct ufs_hba *hba)
 {
+	ufshcd_remove_sysfs_nodes(hba);
 	scsi_remove_host(hba->host);
 	/* disable interrupts */
 	ufshcd_disable_intr(hba, hba->intr_mask);
-- 
1.9.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.

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

* Re: [PATCH] scsi: ufs: Clean up some rpm/spm level SysFS nodes upon remove
  2017-05-12  6:36 [PATCH] scsi: ufs: Clean up some rpm/spm level SysFS nodes upon remove Michal Potomski
@ 2017-05-18 17:54 ` Subhash Jadavani
  2017-05-19  1:31 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Subhash Jadavani @ 2017-05-18 17:54 UTC (permalink / raw)
  To: Michal Potomski; +Cc: linux-scsi, vinholikatti, martin.petersen, jejb

On 2017-05-11 23:36, Michal Potomski wrote:
> From: Michał Potomski <michalx.potomski@intel.com>
> 
> When reloading module these two attributes aren't
> cleaned up properly and they persist causing warnings
> when trying to load module again. Additionally they are
> not recreated properly due to that.
> 
> Signed-off-by: Michał Potomski <michalx.potomski@intel.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index abc7e87..ffe8d86 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -7698,6 +7698,12 @@ static inline void
> ufshcd_add_sysfs_nodes(struct ufs_hba *hba)
>  	ufshcd_add_spm_lvl_sysfs_nodes(hba);
>  }
> 
> +static inline void ufshcd_remove_sysfs_nodes(struct ufs_hba *hba)
> +{
> +	device_remove_file(hba->dev, &hba->rpm_lvl_attr);
> +	device_remove_file(hba->dev, &hba->spm_lvl_attr);
> +}
> +
>  /**
>   * ufshcd_shutdown - shutdown routine
>   * @hba: per adapter instance
> @@ -7735,6 +7741,7 @@ int ufshcd_shutdown(struct ufs_hba *hba)
>   */
>  void ufshcd_remove(struct ufs_hba *hba)
>  {
> +	ufshcd_remove_sysfs_nodes(hba);
>  	scsi_remove_host(hba->host);
>  	/* disable interrupts */
>  	ufshcd_disable_intr(hba, hba->intr_mask);


Looks good to me.
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>


-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH] scsi: ufs: Clean up some rpm/spm level SysFS nodes upon remove
  2017-05-12  6:36 [PATCH] scsi: ufs: Clean up some rpm/spm level SysFS nodes upon remove Michal Potomski
  2017-05-18 17:54 ` Subhash Jadavani
@ 2017-05-19  1:31 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2017-05-19  1:31 UTC (permalink / raw)
  To: Michal Potomski; +Cc: linux-scsi, vinholikatti, martin.petersen, jejb, subhashj


Michal,

> When reloading module these two attributes aren't cleaned up properly
> and they persist causing warnings when trying to load module
> again. Additionally they are not recreated properly due to that.

Applied to 4.12/scsi-fixes, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2017-05-19  1:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-12  6:36 [PATCH] scsi: ufs: Clean up some rpm/spm level SysFS nodes upon remove Michal Potomski
2017-05-18 17:54 ` Subhash Jadavani
2017-05-19  1:31 ` 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