summaryrefslogtreecommitdiff
path: root/drivers/fims
diff options
context:
space:
mode:
authorHector Palacios <hector.palacios@digi.com>2011-02-28 17:52:34 +0100
committerHector Palacios <hector.palacios@digi.com>2011-02-28 17:59:21 +0100
commit17b98d3668553c1a448f68b47ec42d82eebe294f (patch)
tree6b8a2c7228ab350d2f7c1a3b6c99bbd50742a008 /drivers/fims
parentea3fe9a359750860546ea0dd85d877e985cb6b9a (diff)
fim_can: use SET_NETDEV_DEV macro to set dev parent
The net device dev parent was not set and therefore any debug or error message that referred to it to print the driver name was failing with a NULL pointer. Fix tested with cross-compiled version of ip (iproute2 suite) when setting the bitrate with: ip link set can0 type can bitrate 125000 Signed-off-by: Hector Palacios <hector.palacios@digi.com>
Diffstat (limited to 'drivers/fims')
-rwxr-xr-xdrivers/fims/can/fim_can.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/fims/can/fim_can.c b/drivers/fims/can/fim_can.c
index eff15eac044c..039a0bb8e13a 100755
--- a/drivers/fims/can/fim_can.c
+++ b/drivers/fims/can/fim_can.c
@@ -1350,7 +1350,7 @@ static const struct net_device_ops fim_can_netdev_ops = {
* IMPORTANT: First register the FIM-driver, and at last the CAN-device, then
* it will automatically start with the bit time configuration.
*/
-static int register_fim_can(struct device *devi, int picnr, struct fim_gpio_t gpios[],
+static int register_fim_can(struct platform_device *pdev, int picnr, struct fim_gpio_t gpios[],
int bitrate)
{
int retval, cnt;
@@ -1369,7 +1369,6 @@ static int register_fim_can(struct device *devi, int picnr, struct fim_gpio_t gp
/* Set our port structure as private data */
port = netdev_priv(dev);
port->dev = dev;
-
/* Get a reference to the SYS clock for setting the baudrate */
if (IS_ERR(port->cpu_clk = clk_get(&dev->dev, "systemclock"))) {
printk_err("Couldn't get the SYS clock.\n");
@@ -1471,7 +1470,8 @@ static int register_fim_can(struct device *devi, int picnr, struct fim_gpio_t gp
port->dev = dev;
memcpy(port->gpios, gpios, sizeof(struct fim_gpio_t) * FIM_CAN_MAX_GPIOS);
port->reg = 1;
- dev_set_drvdata(devi, port);
+ dev_set_drvdata(&pdev->dev, port);
+ SET_NETDEV_DEV(dev, &pdev->dev);
return 0;
@@ -1541,7 +1541,7 @@ static __devinit int fim_can_probe(struct platform_device *pdev)
gpios[0].nr, gpios[1].nr );
/* XXX SDIO code approach */
- retval = register_fim_can(&pdev->dev, pdata->fim_nr, gpios, bitrate);
+ retval = register_fim_can(pdev, pdata->fim_nr, gpios, bitrate);
return retval;
}