summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/pci.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2016-05-03 18:05:28 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2016-05-05 16:03:55 -0400
commiteac46a64c0c78d87c51330809b196b3e92c92c9e (patch)
tree3e1767e74769a6f831475d03dfdd81c1fca5af9b /drivers/gpu/nvgpu/pci.c
parent93678f571c323861458992de16d552ea7313e831 (diff)
gpu: nvgpu: Add PCIe id to device node name
Use device name to distinguish between different instances of PCIe devices. JIRA DNVGPU-7 Change-Id: Ice0a9dae41396c8faada1815afd1237907896036 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1140685 Reviewed-by: Sami Kiminki <skiminki@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/pci.c')
-rw-r--r--drivers/gpu/nvgpu/pci.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/pci.c b/drivers/gpu/nvgpu/pci.c
index bc8cb510..38a4ad10 100644
--- a/drivers/gpu/nvgpu/pci.c
+++ b/drivers/gpu/nvgpu/pci.c
@@ -21,7 +21,7 @@
21#include "gk20a/gk20a.h" 21#include "gk20a/gk20a.h"
22#include "gk20a/platform_gk20a.h" 22#include "gk20a/platform_gk20a.h"
23 23
24#define PCI_INTERFACE_NAME "nvgpu-pci%s" 24#define PCI_INTERFACE_NAME "nvgpu-pci-%s%%s"
25 25
26static int nvgpu_pci_tegra_probe(struct device *dev) 26static int nvgpu_pci_tegra_probe(struct device *dev)
27{ 27{
@@ -138,6 +138,7 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
138 struct gk20a_platform *platform = &nvgpu_pci_device; 138 struct gk20a_platform *platform = &nvgpu_pci_device;
139 struct gk20a *g; 139 struct gk20a *g;
140 int err; 140 int err;
141 char *nodefmt;
141 142
142 pci_set_drvdata(pdev, platform); 143 pci_set_drvdata(pdev, platform);
143 144
@@ -174,7 +175,18 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
174 } 175 }
175 disable_irq(g->irq_stall); 176 disable_irq(g->irq_stall);
176 177
177 err = gk20a_user_init(&pdev->dev, PCI_INTERFACE_NAME); 178 if (strchr(dev_name(&pdev->dev), '%')) {
179 gk20a_err(&pdev->dev, "illegal character in device name");
180 return -EINVAL;
181 }
182
183 nodefmt = kasprintf(GFP_KERNEL, PCI_INTERFACE_NAME, dev_name(&pdev->dev));
184 if (!nodefmt)
185 return -ENOMEM;
186
187 err = gk20a_user_init(&pdev->dev, nodefmt);
188 kfree(nodefmt);
189 nodefmt = NULL;
178 if (err) 190 if (err)
179 return err; 191 return err;
180 192