mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4] pata_pdc2027x: Fix pdc_adjust_pll() to return the error value
@ 2017-12-05 18:50 Arvind Yadav
  2017-12-06  9:41 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2017-12-05 18:50 UTC (permalink / raw)
  To: b.zolnierkie, tj; +Cc: linux-kernel, linux-ide

This change is to ensure that function pdc_adjust_pll() returns the
error value to avoid the unnecessary error check for pdc_hardware_init()
in pdc2027x_reinit_one().

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
changes in v2 :
               Make function return type 'void' instead of 'int.
               Add sapce between ':'.
changes in v3 :
               Fix the checkpatch.pl errors in a sperate patch.
changes in v4 : 
               return the error value from pdc_adjust_pll()

 drivers/ata/pata_pdc2027x.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index 82bfd51..eca16b0 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -515,7 +515,7 @@ static long pdc_read_counter(struct ata_host *host)
  * @host: target ATA host
  * @pll_clock: The input of PLL in HZ
  */
-static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int board_idx)
+static int pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int board_idx)
 {
 	void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR];
 	u16 pll_ctl;
@@ -527,7 +527,7 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 	/* Sanity check */
 	if (unlikely(pll_clock_khz < 5000L || pll_clock_khz > 70000L)) {
 		printk(KERN_ERR DRV_NAME ": Invalid PLL input clock %ldkHz, give up!\n", pll_clock_khz);
-		return;
+		return -EINVAL;
 	}
 
 #ifdef PDC_DEBUG
@@ -559,7 +559,7 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 	} else {
 		/* Invalid ratio */
 		printk(KERN_ERR DRV_NAME ": Invalid ratio %ld, give up!\n", ratio);
-		return;
+		return -EINVAL;
 	}
 
 	F = (ratio * (R+2)) / 1000 - 2;
@@ -567,7 +567,7 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 	if (unlikely(F < 0 || F > 127)) {
 		/* Invalid F */
 		printk(KERN_ERR DRV_NAME ": F[%d] invalid!\n", F);
-		return;
+		return -EINVAL;
 	}
 
 	PDPRINTK("F[%d] R[%d] ratio*1000[%ld]\n", F, R, ratio);
@@ -592,7 +592,7 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 	PDPRINTK("pll_ctl[%X]\n", pll_ctl);
 #endif
 
-	return;
+	return 0;
 }
 
 /**
@@ -664,9 +664,8 @@ static int pdc_hardware_init(struct ata_host *host, unsigned int board_idx)
 	dev_info(host->dev, "PLL input clock %ld kHz\n", pll_clock/1000);
 
 	/* Adjust PLL control register */
-	pdc_adjust_pll(host, pll_clock, board_idx);
+	return pdc_adjust_pll(host, pll_clock, board_idx);
 
-	return 0;
 }
 
 /**
-- 
2.7.4

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

* Re: [PATCH v4] pata_pdc2027x: Fix pdc_adjust_pll() to return the error value
  2017-12-05 18:50 [PATCH v4] pata_pdc2027x: Fix pdc_adjust_pll() to return the error value Arvind Yadav
@ 2017-12-06  9:41 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2017-12-06  9:41 UTC (permalink / raw)
  To: Arvind Yadav, b.zolnierkie, tj; +Cc: linux-kernel, linux-ide

Hello!

On 12/5/2017 9:50 PM, Arvind Yadav wrote:

> This change is to ensure that function pdc_adjust_pll() returns the
> error value to avoid the unnecessary error check for pdc_hardware_init()
> in pdc2027x_reinit_one().
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> changes in v2 :
>                 Make function return type 'void' instead of 'int.
>                 Add sapce between ':'.
> changes in v3 :
>                 Fix the checkpatch.pl errors in a sperate patch.
> changes in v4 :
>                 return the error value from pdc_adjust_pll()
> 
>   drivers/ata/pata_pdc2027x.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
> index 82bfd51..eca16b0 100644
> --- a/drivers/ata/pata_pdc2027x.c
> +++ b/drivers/ata/pata_pdc2027x.c
[...]
> @@ -664,9 +664,8 @@ static int pdc_hardware_init(struct ata_host *host, unsigned int board_idx)
>   	dev_info(host->dev, "PLL input clock %ld kHz\n", pll_clock/1000);
>   
>   	/* Adjust PLL control register */
> -	pdc_adjust_pll(host, pll_clock, board_idx);
> +	return pdc_adjust_pll(host, pll_clock, board_idx);
>   

    Please also remove this empty line (between *return* and }).

> -	return 0;
>   }
>   
>   /**

MBR, Sergei

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

end of thread, other threads:[~2017-12-06  9:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05 18:50 [PATCH v4] pata_pdc2027x: Fix pdc_adjust_pll() to return the error value Arvind Yadav
2017-12-06  9:41 ` Sergei Shtylyov

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

all inboxes | Powered by JetHome®