Re: [PATCH 15/40] mfd: ti_am335x_tscadc: Simplify divisor calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 25 Aug 2021 17:24:53 +0200
Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:

> Let's rewrite this on a single line, it does not hurt the readability
> and saves a useless temporary variable.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>

> ---
>  drivers/mfd/ti_am335x_tscadc.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index d27f8917272d..3231ccbbad02 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -122,7 +122,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  	struct clk *clk;
>  	u32 val;
>  	int tsc_wires = 0, adc_channels = 0, readouts = 0;
> -	int total_channels, clock_rate, ctrl, err;
> +	int total_channels, ctrl, err;
>  
>  	/* Allocate memory for device */
>  	tscadc = devm_kzalloc(&pdev->dev, sizeof(*tscadc), GFP_KERNEL);
> @@ -208,11 +208,8 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  		err = PTR_ERR(clk);
>  		goto err_disable_clk;
>  	}
> -	clock_rate = clk_get_rate(clk);
> -	tscadc->clk_div = clock_rate / ADC_CLK;
>  
> -	/* TSCADC_CLKDIV needs to be configured to the value minus 1 */
> -	tscadc->clk_div--;
> +	tscadc->clk_div = (clk_get_rate(clk) / ADC_CLK) - 1;
>  	regmap_write(tscadc->regmap, REG_CLKDIV, tscadc->clk_div);
>  
>  	/* Set the control register bits */




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux