linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amit Virdi <amit.virdi@st.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
	"wg@grandegger.com" <wg@grandegger.com>,
	Bhupesh SHARMA <bhupesh.sharma@st.com>,
	"anilkumar@ti.com" <anilkumar@ti.com>,
	spear-devel <spear-devel@list.st.com>
Subject: Re: [PATCH 3/3] can: c_can: Enable clock before first use
Date: Wed, 16 Jan 2013 13:33:27 +0530	[thread overview]
Message-ID: <50F65ECF.6070802@st.com> (raw)
In-Reply-To: <50D31B96.8010501@pengutronix.de>

On 12/20/2012 7:37 PM, Marc Kleine-Budde wrote:
> On 12/20/2012 11:05 AM, Amit Virdi wrote:
>> Current implementation assumes clock to be always enabled. Instead,
>> explicitly enable device clock before usage.
>>
>> Signed-off-by: Amit Virdi<amit.virdi@st.com>
>> Reviewed-by: Shiraz Hashim<shiraz.hashim@st.com>
>> ---
>>   drivers/net/can/c_can/c_can_platform.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
>> index 6e8dc56..d0bd6e6 100644
>> --- a/drivers/net/can/c_can/c_can_platform.c
>> +++ b/drivers/net/can/c_can/c_can_platform.c
>> @@ -194,6 +194,12 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
>>   		goto exit;
>>   	}
>>
>> +	ret = clk_prepare_enable(clk);
>> +	if (ret) {
>> +		dev_err(&pdev->dev, "could not prepare CAN clock\n");
>> +		goto exit_no_clk_en;
>> +	}
>> +
>>   	/* get the platform data */
>>   	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>   	irq = platform_get_irq(pdev, 0);
>> @@ -295,6 +301,8 @@ exit_iounmap:
>>   exit_release_mem:
>>   	release_mem_region(mem->start, resource_size(mem));
>>   exit_free_clk:
>> +	clk_disable_unprepare(clk);
>> +exit_no_clk_en:
>>   	clk_put(clk);
>>   exit:
>>   	dev_err(&pdev->dev, "probe failed\n");
>
> Why do you have to enable the clock if the driver is loaded? What about
> disabling the clock on driver unload. The clock should be enabled on
> open and disabled on close if the network interface. If you need to
> access the registers of your hardware, you should enable the clock
> before accessing the regs and disable the clock when finished.
>

Okay, I would take care of it in V2.

Regards
Amit Virdi

  reply	other threads:[~2013-01-16  8:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-20 10:05 [PATCH 0/3] c_can: Update can support Amit Virdi
2012-12-20 10:05 ` [PATCH 1/3] can: c_can: Correct register alignment info passing through DT Amit Virdi
2012-12-20 13:59   ` Marc Kleine-Budde
2013-01-16  7:40     ` Amit Virdi
2012-12-20 10:05 ` [PATCH 2/3] can: c_can: Provide generic interface to configure c-can message objects Amit Virdi
2012-12-20 10:26   ` Wolfgang Grandegger
2012-12-20 10:53     ` Amit Virdi
2012-12-20 11:06       ` Bhupesh SHARMA
2012-12-20 11:12         ` Wolfgang Grandegger
2012-12-20 11:18           ` Amit Virdi
2012-12-20 12:20             ` Wolfgang Grandegger
2012-12-20 14:04   ` Marc Kleine-Budde
2012-12-20 20:13     ` Wolfgang Grandegger
2013-01-16  7:45       ` Amit Virdi
2013-01-16  8:25         ` Bhupesh SHARMA
2013-01-16  9:01           ` Wolfgang Grandegger
2013-01-16  9:03         ` Wolfgang Grandegger
2013-01-16  9:11           ` Amit Virdi
2012-12-20 10:05 ` [PATCH 3/3] can: c_can: Enable clock before first use Amit Virdi
2012-12-20 14:07   ` Marc Kleine-Budde
2013-01-16  8:03     ` Amit Virdi [this message]
2013-01-16  9:54       ` AnilKumar, Chimata
2013-01-16 13:53         ` Rafael J. Wysocki
2012-12-20 13:57 ` [PATCH 0/3] c_can: Update can support Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50F65ECF.6070802@st.com \
    --to=amit.virdi@st.com \
    --cc=anilkumar@ti.com \
    --cc=bhupesh.sharma@st.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=spear-devel@list.st.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).