Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1716964

Re: [PATCH v2 2/3] i2c: davinci: Add PM Runtime Support

From Franklin S Cooper Jr <fcooper@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/3] i2c: davinci: Add PM Runtime Support
Date 2017-08-22 03:30 +0200
Message-ID <uh6b0-3Bo-19@gated-at.bofh.it> (permalink)
References <ufeZ4-4rP-11@gated-at.bofh.it> <ufeZ5-4rP-29@gated-at.bofh.it> <ugQSB-2pE-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 08/21/2017 04:05 AM, Sekhar Nori wrote:
> On Thursday 17 August 2017 03:47 AM, Franklin S Cooper Jr wrote:
> 
>> @@ -802,7 +821,6 @@ static int davinci_i2c_probe(struct platform_device *pdev)
>>  	dev->clk = devm_clk_get(&pdev->dev, NULL);
>>  	if (IS_ERR(dev->clk))
>>  		return PTR_ERR(dev->clk);
>> -	clk_prepare_enable(dev->clk);
>>  
>>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>  	dev->base = devm_ioremap_resource(&pdev->dev, mem);
>> @@ -811,6 +829,18 @@ static int davinci_i2c_probe(struct platform_device *pdev)
>>  		goto err_unuse_clocks;
> 
> This goto is wrong now. There is no need to unwind the pm_runtime setup
> on a devm_ioremap_resource() failure. You can just return error here.

Ok
> 
>>  	}
>>  
>> +	pm_runtime_set_autosuspend_delay(dev->dev,
>> +					 DAVINCI_I2C_PM_TIMEOUT);
>> +	pm_runtime_use_autosuspend(dev->dev);
>> +
>> +	pm_runtime_enable(dev->dev);
>> +
>> +	r = pm_runtime_get_sync(dev->dev);
>> +	if (r < 0) {
>> +		dev_err(dev->dev, "failed to runtime_get device: %d\n", r);
>> +		goto err_unuse_clocks;
>> +	}
>> +
>>  	i2c_davinci_init(dev);
>>  
>>  	r = devm_request_irq(&pdev->dev, dev->irq, i2c_davinci_isr, 0,
>> @@ -849,10 +879,16 @@ static int davinci_i2c_probe(struct platform_device *pdev)
>>  	if (r)
>>  		goto err_unuse_clocks;
>>  
>> +	pm_runtime_mark_last_busy(dev->dev);
>> +	pm_runtime_put_autosuspend(dev->dev);
>> +
>>  	return 0;
>>  
>>  err_unuse_clocks:
>> -	clk_disable_unprepare(dev->clk);
>> +	pm_runtime_dont_use_autosuspend(dev->dev);
>> +	pm_runtime_put_sync(dev->dev);
>> +	pm_runtime_disable(dev->dev);
>> +
>>  	dev->clk = NULL;
> 
> This null setting of clk seems quite bogus and can be cleaned-up.

Do you mean that I should just remove this line?
> 
>>  	return r;
>>  }
> 
> Thanks,
> Sekhar
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/3] ARM: dts: keystone-k2g: Add I2C support for 66AK2G Franklin S Cooper Jr <fcooper@ti.com> - 2017-08-17 00:30 +0200
  [PATCH v2 2/3] i2c: davinci: Add PM Runtime Support Franklin S Cooper Jr <fcooper@ti.com> - 2017-08-17 00:30 +0200
    Re: [PATCH v2 2/3] i2c: davinci: Add PM Runtime Support Wolfram Sang <wsa@the-dreams.de> - 2017-08-17 18:30 +0200
      Re: [PATCH v2 2/3] i2c: davinci: Add PM Runtime Support Sekhar Nori <nsekhar@ti.com> - 2017-08-21 11:20 +0200
    Re: [PATCH v2 2/3] i2c: davinci: Add PM Runtime Support Sekhar Nori <nsekhar@ti.com> - 2017-08-21 11:10 +0200
      Re: [PATCH v2 2/3] i2c: davinci: Add PM Runtime Support Franklin S Cooper Jr <fcooper@ti.com> - 2017-08-22 03:30 +0200
        Re: [PATCH v2 2/3] i2c: davinci: Add PM Runtime Support Sekhar Nori <nsekhar@ti.com> - 2017-08-22 07:30 +0200
  [PATCH v2 1/3] i2c: davinci: Preserve return value of devm_clk_get Franklin S Cooper Jr <fcooper@ti.com> - 2017-08-17 00:30 +0200
    Re: [PATCH v2 1/3] i2c: davinci: Preserve return value of  devm_clk_get Sekhar Nori <nsekhar@ti.com> - 2017-08-21 11:50 +0200

csiph-web