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
This commit is contained in:
Terje Bergstrom
2016-05-03 15:05:28 -07:00
parent 93678f571c
commit eac46a64c0

View File

@@ -21,7 +21,7 @@
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#define PCI_INTERFACE_NAME "nvgpu-pci%s"
#define PCI_INTERFACE_NAME "nvgpu-pci-%s%%s"
static int nvgpu_pci_tegra_probe(struct device *dev)
{
@@ -138,6 +138,7 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
struct gk20a_platform *platform = &nvgpu_pci_device;
struct gk20a *g;
int err;
char *nodefmt;
pci_set_drvdata(pdev, platform);
@@ -174,7 +175,18 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
}
disable_irq(g->irq_stall);
err = gk20a_user_init(&pdev->dev, PCI_INTERFACE_NAME);
if (strchr(dev_name(&pdev->dev), '%')) {
gk20a_err(&pdev->dev, "illegal character in device name");
return -EINVAL;
}
nodefmt = kasprintf(GFP_KERNEL, PCI_INTERFACE_NAME, dev_name(&pdev->dev));
if (!nodefmt)
return -ENOMEM;
err = gk20a_user_init(&pdev->dev, nodefmt);
kfree(nodefmt);
nodefmt = NULL;
if (err)
return err;