From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Kedareswara rao Appana <appana.durga.rao@xilinx.com>,
wg@grandegger.com, michal.simek@xilinx.com,
grant.likely@linaro.org, robh+dt@kernel.org,
linux-can@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Kedareswara rao Appana <appanad@xilinx.com>
Subject: Re: [PATCH] can: xilinx CAN controller support.
Date: Mon, 17 Feb 2014 10:42:46 +0100 [thread overview]
Message-ID: <5301D996.6040704@pengutronix.de> (raw)
In-Reply-To: <93c7272e-d8bf-43af-b39b-aaa0e0b70b6f@TX2EHSMHS036.ehs.local>
[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]
On 02/17/2014 10:23 AM, Kedareswara rao Appana wrote:
> +/**
> + * xcan_get_berr_counter - error counter routine
> + * @ndev: Pointer to net_device structure
> + * @bec: Pointer to can_berr_counter structure
> + *
> + * This is the driver error counter routine.
> + * Return: 0 always
> + */
> +static int xcan_get_berr_counter(const struct net_device *ndev,
> + struct can_berr_counter *bec)
> +{
> + struct xcan_priv *priv = netdev_priv(ndev);
> + int ret;
> +
> + ret = clk_prepare_enable(priv->devclk);
> + if (ret)
> + goto err;
> +
> + ret = clk_prepare_enable(priv->aperclk);
> + if (ret)
> + goto err_clk;
> +
> + bec->txerr = priv->read_reg(priv, XCAN_ECR_OFFSET) & XCAN_ECR_TEC_MASK;
> + bec->rxerr = ((priv->read_reg(priv, XCAN_ECR_OFFSET) &
> + XCAN_ECR_REC_MASK) >> XCAN_ESR_REC_SHIFT);
You have to disable the clock when leaving this function. Otherwise the
clocks will be unbalanced.
> + return 0;
> +
> +err_clk:
> + clk_disable_unprepare(priv->devclk);
> +err:
> + return ret;
> +}
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 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
next prev parent reply other threads:[~2014-02-17 9:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 9:23 [PATCH] can: xilinx CAN controller support Kedareswara rao Appana
2014-02-17 9:37 ` Marc Kleine-Budde
2014-02-17 9:42 ` Marc Kleine-Budde [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-02-06 10:19 Kedareswara rao Appana
2014-02-06 12:40 ` Marc Kleine-Budde
2014-02-07 8:42 ` Appana Durga Kedareswara Rao
2014-02-07 9:37 ` Marc Kleine-Budde
2014-02-11 11:45 ` Michal Simek
2014-02-11 12:35 ` Marc Kleine-Budde
2014-02-11 13:22 ` Michal Simek
2014-02-11 14:12 ` Arnd Bergmann
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=5301D996.6040704@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=appana.durga.rao@xilinx.com \
--cc=appanad@xilinx.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
--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).