All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: gpmi-nand: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
@ 2022-04-18 10:55 ` cgel.zte
  0 siblings, 0 replies; 4+ messages in thread
From: cgel.zte @ 2022-04-18 10:55 UTC (permalink / raw)
  To: han.xu; +Cc: miquel.raynal, linux-mtd, linux-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

Using pm_runtime_resume_and_get is more appropriate
for simplifing code

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
index 44b14c9dc9a7..6e7477aef8a7 100644
--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
@@ -148,11 +148,9 @@ static int gpmi_init(struct gpmi_nand_data *this)
 	struct resources *r = &this->resources;
 	int ret;
 
-	ret = pm_runtime_get_sync(this->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(this->dev);
+	ret = pm_runtime_resume_and_get(this->dev);
+	if (ret < 0)
 		return ret;
-	}
 
 	ret = gpmi_reset_block(r->gpmi_regs, false);
 	if (ret)
@@ -544,11 +542,9 @@ static int bch_set_geometry(struct gpmi_nand_data *this)
 	if (ret)
 		return ret;
 
-	ret = pm_runtime_get_sync(this->dev);
-	if (ret < 0) {
-		pm_runtime_put_autosuspend(this->dev);
+	ret = pm_runtime_resume_and_get(this->dev);
+	if (ret < 0)
 		return ret;
-	}
 
 	/*
 	* Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
@@ -2286,11 +2282,9 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
 	for (i = 0; i < GPMI_MAX_TRANSFERS; i++)
 		this->transfers[i].direction = DMA_NONE;
 
-	ret = pm_runtime_get_sync(this->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(this->dev);
+	ret = pm_runtime_resume_and_get(this->dev);
+	if (ret < 0)
 		return ret;
-	}
 
 	/*
 	 * This driver currently supports only one NAND chip. Plus, dies share
-- 
2.25.1



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

* [PATCH] mtd: nand: gpmi-nand: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
@ 2022-04-18 10:55 ` cgel.zte
  0 siblings, 0 replies; 4+ messages in thread
From: cgel.zte @ 2022-04-18 10:55 UTC (permalink / raw)
  To: han.xu; +Cc: miquel.raynal, linux-mtd, linux-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

Using pm_runtime_resume_and_get is more appropriate
for simplifing code

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
index 44b14c9dc9a7..6e7477aef8a7 100644
--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
@@ -148,11 +148,9 @@ static int gpmi_init(struct gpmi_nand_data *this)
 	struct resources *r = &this->resources;
 	int ret;
 
-	ret = pm_runtime_get_sync(this->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(this->dev);
+	ret = pm_runtime_resume_and_get(this->dev);
+	if (ret < 0)
 		return ret;
-	}
 
 	ret = gpmi_reset_block(r->gpmi_regs, false);
 	if (ret)
@@ -544,11 +542,9 @@ static int bch_set_geometry(struct gpmi_nand_data *this)
 	if (ret)
 		return ret;
 
-	ret = pm_runtime_get_sync(this->dev);
-	if (ret < 0) {
-		pm_runtime_put_autosuspend(this->dev);
+	ret = pm_runtime_resume_and_get(this->dev);
+	if (ret < 0)
 		return ret;
-	}
 
 	/*
 	* Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
@@ -2286,11 +2282,9 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
 	for (i = 0; i < GPMI_MAX_TRANSFERS; i++)
 		this->transfers[i].direction = DMA_NONE;
 
-	ret = pm_runtime_get_sync(this->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(this->dev);
+	ret = pm_runtime_resume_and_get(this->dev);
+	if (ret < 0)
 		return ret;
-	}
 
 	/*
 	 * This driver currently supports only one NAND chip. Plus, dies share
-- 
2.25.1



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH] mtd: nand: gpmi-nand: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
  2022-04-18 10:55 ` cgel.zte
@ 2022-04-19  7:40   ` Miquel Raynal
  -1 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2022-04-19  7:40 UTC (permalink / raw)
  To: cgel.zte; +Cc: han.xu, linux-mtd, linux-kernel, Minghao Chi, Zeal Robot

Hello,

cgel.zte@gmail.com wrote on Mon, 18 Apr 2022 10:55:49 +0000:

> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Using pm_runtime_resume_and_get is more appropriate
> for simplifing code

Would you mind reducing a little bit the title of the commit? Othewise
fine by me.

> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> index 44b14c9dc9a7..6e7477aef8a7 100644
> --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> @@ -148,11 +148,9 @@ static int gpmi_init(struct gpmi_nand_data *this)
>  	struct resources *r = &this->resources;
>  	int ret;
>  
> -	ret = pm_runtime_get_sync(this->dev);
> -	if (ret < 0) {
> -		pm_runtime_put_noidle(this->dev);
> +	ret = pm_runtime_resume_and_get(this->dev);
> +	if (ret < 0)
>  		return ret;
> -	}
>  
>  	ret = gpmi_reset_block(r->gpmi_regs, false);
>  	if (ret)
> @@ -544,11 +542,9 @@ static int bch_set_geometry(struct gpmi_nand_data *this)
>  	if (ret)
>  		return ret;
>  
> -	ret = pm_runtime_get_sync(this->dev);
> -	if (ret < 0) {
> -		pm_runtime_put_autosuspend(this->dev);
> +	ret = pm_runtime_resume_and_get(this->dev);
> +	if (ret < 0)
>  		return ret;
> -	}
>  
>  	/*
>  	* Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
> @@ -2286,11 +2282,9 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
>  	for (i = 0; i < GPMI_MAX_TRANSFERS; i++)
>  		this->transfers[i].direction = DMA_NONE;
>  
> -	ret = pm_runtime_get_sync(this->dev);
> -	if (ret < 0) {
> -		pm_runtime_put_noidle(this->dev);
> +	ret = pm_runtime_resume_and_get(this->dev);
> +	if (ret < 0)
>  		return ret;
> -	}
>  
>  	/*
>  	 * This driver currently supports only one NAND chip. Plus, dies share


Thanks,
Miquèl

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

* Re: [PATCH] mtd: nand: gpmi-nand: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
@ 2022-04-19  7:40   ` Miquel Raynal
  0 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2022-04-19  7:40 UTC (permalink / raw)
  To: cgel.zte; +Cc: han.xu, linux-mtd, linux-kernel, Minghao Chi, Zeal Robot

Hello,

cgel.zte@gmail.com wrote on Mon, 18 Apr 2022 10:55:49 +0000:

> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Using pm_runtime_resume_and_get is more appropriate
> for simplifing code

Would you mind reducing a little bit the title of the commit? Othewise
fine by me.

> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> index 44b14c9dc9a7..6e7477aef8a7 100644
> --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> @@ -148,11 +148,9 @@ static int gpmi_init(struct gpmi_nand_data *this)
>  	struct resources *r = &this->resources;
>  	int ret;
>  
> -	ret = pm_runtime_get_sync(this->dev);
> -	if (ret < 0) {
> -		pm_runtime_put_noidle(this->dev);
> +	ret = pm_runtime_resume_and_get(this->dev);
> +	if (ret < 0)
>  		return ret;
> -	}
>  
>  	ret = gpmi_reset_block(r->gpmi_regs, false);
>  	if (ret)
> @@ -544,11 +542,9 @@ static int bch_set_geometry(struct gpmi_nand_data *this)
>  	if (ret)
>  		return ret;
>  
> -	ret = pm_runtime_get_sync(this->dev);
> -	if (ret < 0) {
> -		pm_runtime_put_autosuspend(this->dev);
> +	ret = pm_runtime_resume_and_get(this->dev);
> +	if (ret < 0)
>  		return ret;
> -	}
>  
>  	/*
>  	* Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
> @@ -2286,11 +2282,9 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
>  	for (i = 0; i < GPMI_MAX_TRANSFERS; i++)
>  		this->transfers[i].direction = DMA_NONE;
>  
> -	ret = pm_runtime_get_sync(this->dev);
> -	if (ret < 0) {
> -		pm_runtime_put_noidle(this->dev);
> +	ret = pm_runtime_resume_and_get(this->dev);
> +	if (ret < 0)
>  		return ret;
> -	}
>  
>  	/*
>  	 * This driver currently supports only one NAND chip. Plus, dies share


Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2022-04-19  7:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 10:55 [PATCH] mtd: nand: gpmi-nand: using pm_runtime_resume_and_get instead of pm_runtime_get_sync cgel.zte
2022-04-18 10:55 ` cgel.zte
2022-04-19  7:40 ` Miquel Raynal
2022-04-19  7:40   ` Miquel Raynal

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.