summaryrefslogtreecommitdiff
path: root/drivers/net/can/sja1000/peak_pci.c
diff options
context:
space:
mode:
authorChristopher R. Baker <cbaker@rec.ri.cmu.edu>2014-03-08 20:00:20 +0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2014-03-17 12:20:16 +0400
commit3e66d0138c05d9792f458b96581afdb314bc66d6 (patch)
tree9e45bff1aba06c0d039d603d361d8a37963b6f2b /drivers/net/can/sja1000/peak_pci.c
parentc971fa2ae42e73e9ccc2f5e93f268c8742da4c5d (diff)
downloadlinux-3e66d0138c05d9792f458b96581afdb314bc66d6.tar.xz
can: populate netdev::dev_id for udev discrimination
My objective is to be able to totally discriminate CAN ports on multi-port cards via udev so as to rename them to semantically interesting/unique names for my system (e.g., "ecuCAN" and "auxCAN" instead of "can0" and "can1"). The following patch assigns the dev_id field to match the channel number on all multi-channel devices. I can only test my two-port Peak PCI card, but it works as expected: ATTRS{dev_id} now expresses the port number and my udev rules now unambiguously pick out and rename my individual CAN ports. Signed-off-by: Christopher R. Baker <cbaker@rec.ri.cmu.edu> Tested-by: Oliver Hartkopp <socketcan@hartkopp.net> [PEAK PCAN-USB pro and EMS PCMCIA] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/sja1000/peak_pci.c')
-rw-r--r--drivers/net/can/sja1000/peak_pci.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c
index 065ca49eb45e..c540e3d12e3d 100644
--- a/drivers/net/can/sja1000/peak_pci.c
+++ b/drivers/net/can/sja1000/peak_pci.c
@@ -642,6 +642,7 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
icr |= chan->icr_mask;
SET_NETDEV_DEV(dev, &pdev->dev);
+ dev->dev_id = i;
/* Create chain of SJA1000 devices */
chan->prev_dev = pci_get_drvdata(pdev);