From: Marc Kleine-Budde <mkl@pengutronix.de>
To: linux-can@vger.kernel.org
Cc: andreas@gaisler.com, kernel@pengutronix.de, wg@grandegger.com,
Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [RFC: PATCH 4/5] can: sja1000_platform: factor out initialization from platform data
Date: Fri, 5 Oct 2012 16:39:06 +0200 [thread overview]
Message-ID: <1349447947-18451-5-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1349447947-18451-1-git-send-email-mkl@pengutronix.de>
This patch moves the initialization from the "sp_probe()" function into a
seperate function. This prepares the driver for the device tree bindings coming
in the next patch.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/sja1000/sja1000_platform.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c
index b0ce5ef..6260209 100644
--- a/drivers/net/can/sja1000/sja1000_platform.c
+++ b/drivers/net/can/sja1000/sja1000_platform.c
@@ -64,6 +64,14 @@ static void sp_write_reg32(const struct sja1000_priv *priv, int reg, u8 val)
iowrite8(val, priv->reg_base + reg * 4);
}
+static void __devinit sp_probe_pdata(struct sja1000_priv *priv, const struct sja1000_platform_data *pdata)
+{
+ /* The CAN clock frequency is half the oscillator clock frequency */
+ priv->can.clock.freq = pdata->osc_freq / 2;
+ priv->ocr = pdata->ocr;
+ priv->cdr = pdata->cdr;
+}
+
static int __devinit sp_probe(struct platform_device *pdev)
{
int err;
@@ -71,7 +79,7 @@ static int __devinit sp_probe(struct platform_device *pdev)
struct net_device *dev;
struct sja1000_priv *priv;
struct resource *res_mem, *res_irq;
- struct sja1000_platform_data *pdata;
+ const struct sja1000_platform_data *pdata;
pdata = pdev->dev.platform_data;
if (!pdata) {
@@ -105,10 +113,8 @@ static int __devinit sp_probe(struct platform_device *pdev)
if (res_irq->flags & IORESOURCE_IRQ_SHAREABLE)
priv->irq_flags |= IRQF_SHARED;
priv->reg_base = addr;
- /* The CAN clock frequency is half the oscillator clock frequency */
- priv->can.clock.freq = pdata->osc_freq / 2;
- priv->ocr = pdata->ocr;
- priv->cdr = pdata->cdr;
+
+ sp_probe_pdata(priv, pdata);
switch (res_mem->flags & IORESOURCE_MEM_TYPE_MASK) {
case IORESOURCE_MEM_32BIT:
--
1.7.10
next prev parent reply other threads:[~2012-10-05 14:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 14:39 [RFC: PATCH 1/5] can: sja1000_platform Marc Kleine-Budde
2012-10-05 14:39 ` [RFC: PATCH 1/5] can: sja1000_platform: add __dev{init,exit} annotations Marc Kleine-Budde
2012-10-05 14:39 ` [RFC: PATCH 2/5] can: sja1000_platform: convert ioremap_nocache to devm_request_and_ioremap Marc Kleine-Budde
2012-10-05 14:39 ` [RFC: PATCH 3/5] can: sja1000_platform: replace DRV_NAME by KBUILD_MODNAME Marc Kleine-Budde
2012-10-05 14:39 ` Marc Kleine-Budde [this message]
2012-10-05 14:39 ` [RFC: PATCH 5/5] can: sja1000_platform: add device tree bindings Marc Kleine-Budde
2012-10-05 15:47 ` Wolfgang Grandegger
2012-10-05 16:42 ` Marc Kleine-Budde
2012-10-05 16:58 ` Wolfgang Grandegger
2012-10-08 9:16 ` [RFC: PATCH 1/5] can: sja1000_platform Andreas Larsson
2012-10-08 12:19 ` Marc Kleine-Budde
2012-10-08 12:50 ` Andreas Larsson
2012-10-09 13:30 ` Andreas Larsson
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=1349447947-18451-5-git-send-email-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=andreas@gaisler.com \
--cc=kernel@pengutronix.de \
--cc=linux-can@vger.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).