diff options
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/pci.c')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/pci.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/pci.c b/drivers/gpu/nvgpu/os/linux/pci.c index f62dacab..dba8a5df 100644 --- a/drivers/gpu/nvgpu/os/linux/pci.c +++ b/drivers/gpu/nvgpu/os/linux/pci.c | |||
@@ -525,17 +525,18 @@ static int nvgpu_pci_init_support(struct pci_dev *pdev) | |||
525 | int err = 0; | 525 | int err = 0; |
526 | struct gk20a *g = get_gk20a(&pdev->dev); | 526 | struct gk20a *g = get_gk20a(&pdev->dev); |
527 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | 527 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); |
528 | struct device *dev = &pdev->dev; | ||
528 | 529 | ||
529 | l->regs = ioremap(pci_resource_start(pdev, 0), | 530 | l->regs = nvgpu_devm_ioremap(dev, pci_resource_start(pdev, 0), |
530 | pci_resource_len(pdev, 0)); | 531 | pci_resource_len(pdev, 0)); |
531 | if (IS_ERR(l->regs)) { | 532 | if (IS_ERR(l->regs)) { |
532 | nvgpu_err(g, "failed to remap gk20a registers"); | 533 | nvgpu_err(g, "failed to remap gk20a registers"); |
533 | err = PTR_ERR(l->regs); | 534 | err = PTR_ERR(l->regs); |
534 | goto fail; | 535 | goto fail; |
535 | } | 536 | } |
536 | 537 | ||
537 | l->bar1 = ioremap(pci_resource_start(pdev, 1), | 538 | l->bar1 = nvgpu_devm_ioremap(dev, pci_resource_start(pdev, 1), |
538 | pci_resource_len(pdev, 1)); | 539 | pci_resource_len(pdev, 1)); |
539 | if (IS_ERR(l->bar1)) { | 540 | if (IS_ERR(l->bar1)) { |
540 | nvgpu_err(g, "failed to remap gk20a bar1"); | 541 | nvgpu_err(g, "failed to remap gk20a bar1"); |
541 | err = PTR_ERR(l->bar1); | 542 | err = PTR_ERR(l->bar1); |
@@ -556,14 +557,11 @@ static int nvgpu_pci_init_support(struct pci_dev *pdev) | |||
556 | fail_sim: | 557 | fail_sim: |
557 | nvgpu_remove_sim_support_linux_pci(g); | 558 | nvgpu_remove_sim_support_linux_pci(g); |
558 | fail: | 559 | fail: |
559 | if (l->regs) { | 560 | if (l->regs) |
560 | iounmap(l->regs); | ||
561 | l->regs = NULL; | 561 | l->regs = NULL; |
562 | } | 562 | |
563 | if (l->bar1) { | 563 | if (l->bar1) |
564 | iounmap(l->bar1); | ||
565 | l->bar1 = NULL; | 564 | l->bar1 = NULL; |
566 | } | ||
567 | 565 | ||
568 | return err; | 566 | return err; |
569 | } | 567 | } |