8975a96e1816ca99c39442219c63fd8c856c234f
[openwrt/openwrt.git] /
1 From 40985902afd8f4eb0bd7aa4238c7d458282af948 Mon Sep 17 00:00:00 2001
2 From: Jan Kiszka <jan.kiszka@siemens.com>
3 Date: Wed, 21 Dec 2016 08:20:18 +0100
4 Subject: [PATCH] ivshmem-net: Improve identification of resources
5
6 Pass a device name consisting of driver name and PCI ID to request_irq
7 and alloc_ordered_workqueue. This helps correlating resources with
8 devices in case there are multiple of them.
9
10 Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
11 (cherry picked from commit 43e2ff78b89cbdfaecba54601d85f3d40349a9b5)
12 ---
13 drivers/net/ivshmem-net.c | 10 +++++++---
14 1 file changed, 7 insertions(+), 3 deletions(-)
15
16 --- a/drivers/net/ivshmem-net.c
17 +++ b/drivers/net/ivshmem-net.c
18 @@ -762,6 +762,7 @@ static int ivshm_net_probe(struct pci_de
19 resource_size_t shmaddr;
20 resource_size_t shmlen;
21 int interrupt;
22 + char *device_name;
23 void *shm;
24 u32 ivpos;
25 int err;
26 @@ -814,7 +815,10 @@ static int ivshm_net_probe(struct pci_de
27 return -EINVAL;
28 }
29
30 - dev_info(&pdev->dev, "shared memory size %pa\n", &shmlen);
31 + device_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s[%s]", DRV_NAME,
32 + dev_name(&pdev->dev));
33 + if (!device_name)
34 + return -ENOMEM;
35
36 ndev = alloc_etherdev(sizeof(*in));
37 if (!ndev)
38 @@ -837,7 +841,7 @@ static int ivshm_net_probe(struct pci_de
39 if (err)
40 goto err_free;
41
42 - in->state_wq = alloc_ordered_workqueue(DRV_NAME, 0);
43 + in->state_wq = alloc_ordered_workqueue(device_name, 0);
44 if (!in->state_wq)
45 goto err_free;
46
47 @@ -866,7 +870,7 @@ static int ivshm_net_probe(struct pci_de
48 in->using_msix = false;
49 }
50
51 - err = request_irq(interrupt, ivshm_net_int, 0, DRV_NAME, ndev);
52 + err = request_irq(interrupt, ivshm_net_int, 0, device_name, ndev);
53 if (err)
54 goto err_int;
55