linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mkl@pengutronix.de (Marc Kleine-Budde)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 3/4] can: flexcan: switch on clocks before accessing ecr register
Date: Tue, 15 Jul 2014 15:57:46 +0200	[thread overview]
Message-ID: <53C5335A.8000000@pengutronix.de> (raw)
In-Reply-To: <20140715155426.3c03f0d8@ipc1.ka-ro>

On 07/15/2014 03:54 PM, Lothar Wa?mann wrote:
> Hi,
> 
> Stefan Agner wrote:
>> Reported-by: Ashutosh Singh <ashuleapyear@gmail.com>
>> Suggested-by: Marc Kleine-Budde <mkl@pengutronix.de>
>> [stefan at agner.ch: added return check for clk_enable_prepare]
>>
>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>> ---
>>  drivers/net/can/flexcan.c | 18 ++++++++++++++++--
>>  1 file changed, 16 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
>> index f425ec2..89745aa 100644
>> --- a/drivers/net/can/flexcan.c
>> +++ b/drivers/net/can/flexcan.c
>> @@ -383,12 +383,26 @@ static int flexcan_get_berr_counter(const struct net_device *dev,
>>  {
>>  	const struct flexcan_priv *priv = netdev_priv(dev);
>>  	struct flexcan_regs __iomem *regs = priv->base;
>> -	u32 reg = flexcan_read(&regs->ecr);
>> +	u32 reg, err;
>> +
>> +	err = clk_prepare_enable(priv->clk_ipg);
>> +	if (err)
>> +		return err;
>> +
>> +	err = clk_prepare_enable(priv->clk_per);
>> +	if (err)
>> +		goto out_disable_ipg;
>> +
>> +	reg = flexcan_read(&regs->ecr);
>>  
> flexcan_get_berr_counter() may be called from interrupt context and
> thus must not call any functions that can sleep.
> Compiling the driver with CONFIG_DEBUG_ATOMIC_SLEEP would catch this!

It's called from the NAPI softirq. I'll prepare a patch.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 242 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140715/00bbeec8/attachment-0001.sig>

  reply	other threads:[~2014-07-15 13:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-15 12:56 [PATCH v3 0/4] ARM: vf610: add FlexCAN support Stefan Agner
2014-07-15 12:56 ` [PATCH v3 1/4] ARM: dts: vf610: add FlexCAN node Stefan Agner
2014-07-15 12:56 ` [PATCH v3 2/4] ARM: imx: clk-vf610: fix FlexCAN clock gating Stefan Agner
2014-07-15 12:56 ` [PATCH v3 3/4] can: flexcan: switch on clocks before accessing ecr register Stefan Agner
2014-07-15 13:54   ` Lothar Waßmann
2014-07-15 13:57     ` Marc Kleine-Budde [this message]
2014-07-15 12:56 ` [PATCH v3 4/4] can: flexcan: add vf610 support for FlexCAN Stefan Agner
2014-07-15 14:24   ` Marc Kleine-Budde
2014-07-16  6:43     ` Stefan Agner
2014-07-25 10:50       ` Stefan Agner
2014-07-25 13:33         ` Marc Kleine-Budde
2014-07-28 16:20           ` Stefan Agner
2014-07-28 16:28             ` Marc Kleine-Budde
2014-07-29  7:29               ` Stefan Agner
2014-07-30 11:47                 ` Marc Kleine-Budde
2014-08-04 13:43                   ` Stefan Agner
2014-08-04 14:27                     ` Marc Kleine-Budde
2014-08-04 16:01                       ` Stefan Agner
2014-08-05  9:52                         ` Marc Kleine-Budde
2014-08-05 12:38                           ` Stefan Agner
2014-08-14 10:38                         ` Marc Kleine-Budde
2014-07-28 16:31             ` Marc Kleine-Budde
2014-07-15 13:54 ` [PATCH v3 0/4] ARM: vf610: add FlexCAN support Marc Kleine-Budde
2014-08-14 10:04   ` Marc Kleine-Budde
2014-07-16  6:11 ` Shawn Guo

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=53C5335A.8000000@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).