aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher R. Baker <cbaker@rec.ri.cmu.edu>2014-03-08 11:00:20 -0500
committerMarc Kleine-Budde <mkl@pengutronix.de>2014-03-17 04:20:16 -0400
commit3e66d0138c05d9792f458b96581afdb314bc66d6 (patch)
tree9e45bff1aba06c0d039d603d361d8a37963b6f2b
parentc971fa2ae42e73e9ccc2f5e93f268c8742da4c5d (diff)
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>
-rw-r--r--drivers/net/can/sja1000/ems_pci.c1
-rw-r--r--drivers/net/can/sja1000/ems_pcmcia.c1
-rw-r--r--drivers/net/can/sja1000/kvaser_pci.c1
-rw-r--r--drivers/net/can/sja1000/peak_pci.c1
-rw-r--r--drivers/net/can/sja1000/peak_pcmcia.c1
-rw-r--r--drivers/net/can/sja1000/plx_pci.c1
-rw-r--r--drivers/net/can/softing/softing_main.c1
-rw-r--r--drivers/net/can/usb/esd_usb2.c1
-rw-r--r--drivers/net/can/usb/kvaser_usb.c1
-rw-r--r--drivers/net/can/usb/peak_usb/pcan_usb_core.c1
10 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/can/sja1000/ems_pci.c b/drivers/net/can/sja1000/ems_pci.c
index d790b874ca79..fd13dbf07d9c 100644
--- a/drivers/net/can/sja1000/ems_pci.c
+++ b/drivers/net/can/sja1000/ems_pci.c
@@ -323,6 +323,7 @@ static int ems_pci_add_card(struct pci_dev *pdev,
323 priv->cdr = EMS_PCI_CDR; 323 priv->cdr = EMS_PCI_CDR;
324 324
325 SET_NETDEV_DEV(dev, &pdev->dev); 325 SET_NETDEV_DEV(dev, &pdev->dev);
326 dev->dev_id = i;
326 327
327 if (card->version == 1) 328 if (card->version == 1)
328 /* reset int flag of pita */ 329 /* reset int flag of pita */
diff --git a/drivers/net/can/sja1000/ems_pcmcia.c b/drivers/net/can/sja1000/ems_pcmcia.c
index 9e535f2ef52b..381de998d2f1 100644
--- a/drivers/net/can/sja1000/ems_pcmcia.c
+++ b/drivers/net/can/sja1000/ems_pcmcia.c
@@ -211,6 +211,7 @@ static int ems_pcmcia_add_card(struct pcmcia_device *pdev, unsigned long base)
211 priv = netdev_priv(dev); 211 priv = netdev_priv(dev);
212 priv->priv = card; 212 priv->priv = card;
213 SET_NETDEV_DEV(dev, &pdev->dev); 213 SET_NETDEV_DEV(dev, &pdev->dev);
214 dev->dev_id = i;
214 215
215 priv->irq_flags = IRQF_SHARED; 216 priv->irq_flags = IRQF_SHARED;
216 dev->irq = pdev->irq; 217 dev->irq = pdev->irq;
diff --git a/drivers/net/can/sja1000/kvaser_pci.c b/drivers/net/can/sja1000/kvaser_pci.c
index c96eb14699d5..23b8e1324e25 100644
--- a/drivers/net/can/sja1000/kvaser_pci.c
+++ b/drivers/net/can/sja1000/kvaser_pci.c
@@ -270,6 +270,7 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
270 priv->reg_base, board->conf_addr, dev->irq); 270 priv->reg_base, board->conf_addr, dev->irq);
271 271
272 SET_NETDEV_DEV(dev, &pdev->dev); 272 SET_NETDEV_DEV(dev, &pdev->dev);
273 dev->dev_id = channel;
273 274
274 /* Register SJA1000 device */ 275 /* Register SJA1000 device */
275 err = register_sja1000dev(dev); 276 err = register_sja1000dev(dev);
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)
642 icr |= chan->icr_mask; 642 icr |= chan->icr_mask;
643 643
644 SET_NETDEV_DEV(dev, &pdev->dev); 644 SET_NETDEV_DEV(dev, &pdev->dev);
645 dev->dev_id = i;
645 646
646 /* Create chain of SJA1000 devices */ 647 /* Create chain of SJA1000 devices */
647 chan->prev_dev = pci_get_drvdata(pdev); 648 chan->prev_dev = pci_get_drvdata(pdev);
diff --git a/drivers/net/can/sja1000/peak_pcmcia.c b/drivers/net/can/sja1000/peak_pcmcia.c
index f7ad754dd2aa..dd56133cc461 100644
--- a/drivers/net/can/sja1000/peak_pcmcia.c
+++ b/drivers/net/can/sja1000/peak_pcmcia.c
@@ -550,6 +550,7 @@ static int pcan_add_channels(struct pcan_pccard *card)
550 priv = netdev_priv(netdev); 550 priv = netdev_priv(netdev);
551 priv->priv = card; 551 priv->priv = card;
552 SET_NETDEV_DEV(netdev, &pdev->dev); 552 SET_NETDEV_DEV(netdev, &pdev->dev);
553 netdev->dev_id = i;
553 554
554 priv->irq_flags = IRQF_SHARED; 555 priv->irq_flags = IRQF_SHARED;
555 netdev->irq = pdev->irq; 556 netdev->irq = pdev->irq;
diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c
index fbb61a0d901f..ec39b7cb2287 100644
--- a/drivers/net/can/sja1000/plx_pci.c
+++ b/drivers/net/can/sja1000/plx_pci.c
@@ -587,6 +587,7 @@ static int plx_pci_add_card(struct pci_dev *pdev,
587 priv->cdr = ci->cdr; 587 priv->cdr = ci->cdr;
588 588
589 SET_NETDEV_DEV(dev, &pdev->dev); 589 SET_NETDEV_DEV(dev, &pdev->dev);
590 dev->dev_id = i;
590 591
591 /* Register SJA1000 device */ 592 /* Register SJA1000 device */
592 err = register_sja1000dev(dev); 593 err = register_sja1000dev(dev);
diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
index 3766bd90f3ed..7d8c8f3672dd 100644
--- a/drivers/net/can/softing/softing_main.c
+++ b/drivers/net/can/softing/softing_main.c
@@ -833,6 +833,7 @@ static int softing_pdev_probe(struct platform_device *pdev)
833 ret = -ENOMEM; 833 ret = -ENOMEM;
834 goto netdev_failed; 834 goto netdev_failed;
835 } 835 }
836 netdev->dev_id = j;
836 priv = netdev_priv(card->net[j]); 837 priv = netdev_priv(card->net[j]);
837 priv->index = j; 838 priv->index = j;
838 ret = softing_netdev_register(netdev); 839 ret = softing_netdev_register(netdev);
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index 1f8ce91adbd3..b7c9e8b11460 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -1025,6 +1025,7 @@ static int esd_usb2_probe_one_net(struct usb_interface *intf, int index)
1025 netdev->netdev_ops = &esd_usb2_netdev_ops; 1025 netdev->netdev_ops = &esd_usb2_netdev_ops;
1026 1026
1027 SET_NETDEV_DEV(netdev, &intf->dev); 1027 SET_NETDEV_DEV(netdev, &intf->dev);
1028 netdev->dev_id = index;
1028 1029
1029 err = register_candev(netdev); 1030 err = register_candev(netdev);
1030 if (err) { 1031 if (err) {
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index ea596b53a5ae..4ca46edc061d 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -1530,6 +1530,7 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
1530 netdev->netdev_ops = &kvaser_usb_netdev_ops; 1530 netdev->netdev_ops = &kvaser_usb_netdev_ops;
1531 1531
1532 SET_NETDEV_DEV(netdev, &intf->dev); 1532 SET_NETDEV_DEV(netdev, &intf->dev);
1533 netdev->dev_id = channel;
1533 1534
1534 dev->nets[channel] = priv; 1535 dev->nets[channel] = priv;
1535 1536
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index 93e4a55a6c23..644e6ab8a489 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -770,6 +770,7 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter,
770 usb_set_intfdata(intf, dev); 770 usb_set_intfdata(intf, dev);
771 771
772 SET_NETDEV_DEV(netdev, &intf->dev); 772 SET_NETDEV_DEV(netdev, &intf->dev);
773 netdev->dev_id = ctrl_idx;
773 774
774 err = register_candev(netdev); 775 err = register_candev(netdev);
775 if (err) { 776 if (err) {