Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314520
b: refs/heads/master
c: 1aa2d1d
h: refs/heads/master
v: v3
  • Loading branch information
Marc Kleine-Budde authored and David S. Miller committed Jun 20, 2012
1 parent 7f9b2d9 commit db338ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 41063e9dd11956f2d285e12e4342e1d232ba0ea2
refs/heads/master: 1aa2d1daf067c8c9e625449e2e6f54caa3e34023
29 changes: 7 additions & 22 deletions trunk/drivers/net/can/c_can/c_can_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/clk.h>
#include <linux/pci.h>

#include <linux/can/dev.h>
Expand All @@ -30,7 +29,7 @@ struct c_can_pci_data {
enum c_can_dev_id type;
/* Set the register alignment in the memory */
enum c_can_pci_reg_align reg_align;
/* Set the frequency if clk is not usable */
/* Set the frequency */
unsigned int freq;
};

Expand Down Expand Up @@ -71,7 +70,6 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
struct c_can_priv *priv;
struct net_device *dev;
void __iomem *addr;
struct clk *clk;
int ret;

ret = pci_enable_device(pdev);
Expand Down Expand Up @@ -113,18 +111,11 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
priv->base = addr;

if (!c_can_pci_data->freq) {
/* get the appropriate clk */
clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "no clock defined\n");
ret = -ENODEV;
goto out_free_c_can;
}
priv->can.clock.freq = clk_get_rate(clk);
priv->priv = clk;
dev_err(&pdev->dev, "no clock frequency defined\n");
ret = -ENODEV;
goto out_free_c_can;
} else {
priv->can.clock.freq = c_can_pci_data->freq;
priv->priv = NULL;
}

/* Configure CAN type */
Expand All @@ -138,7 +129,7 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
break;
default:
ret = -EINVAL;
goto out_free_clock;
goto out_free_c_can;
}

/* Configure access to registers */
Expand All @@ -153,24 +144,21 @@ static int __devinit c_can_pci_probe(struct pci_dev *pdev,
break;
default:
ret = -EINVAL;
goto out_free_clock;
goto out_free_c_can;
}

ret = register_c_can_dev(dev);
if (ret) {
dev_err(&pdev->dev, "registering %s failed (err=%d)\n",
KBUILD_MODNAME, ret);
goto out_free_clock;
goto out_free_c_can;
}

dev_dbg(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
KBUILD_MODNAME, priv->regs, dev->irq);

return 0;

out_free_clock:
if (priv->priv)
clk_put(priv->priv);
out_free_c_can:
pci_set_drvdata(pdev, NULL);
free_c_can_dev(dev);
Expand All @@ -193,9 +181,6 @@ static void __devexit c_can_pci_remove(struct pci_dev *pdev)

unregister_c_can_dev(dev);

if (priv->priv)
clk_put(priv->priv);

pci_set_drvdata(pdev, NULL);
free_c_can_dev(dev);

Expand Down

0 comments on commit db338ac

Please sign in to comment.