[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231103182542.97589-2-pstanner@redhat.com>
Date: Fri, 3 Nov 2023 19:25:43 +0100
From: Philipp Stanner <pstanner@...hat.com>
To: Dave Airlie <airlied@...hat.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
Jocelyn Falempe <jfalempe@...hat.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Philipp Stanner <pstanner@...hat.com>
Subject: [PATCH v2] drm/ast: use managed devres functions
Currently, tha ast-driver just maps the PCI-dev's regions with
pcim_iomap(). It does not actually reserve the regions exclusively
with, e.g., pci_request_regions().
Replace the calls to pcim_iomap() with ones to pcim_iomap_regions() to
reserve and map the regions simultaneously.
Suggested-by: Thomas Zimmermann <tzimmermann@...e.de>
Signed-off-by: Philipp Stanner <pstanner@...hat.com>
---
Changes in v2:
- Remove unnecessary return code checks for pcim_iomap_regions()
(Jocelyn)
Thx Jocelyn for the kind review
---
drivers/gpu/drm/ast/ast_main.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index dae365ed3969..8b714b99f9d6 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -444,9 +444,11 @@ struct ast_device *ast_device_create(const struct drm_driver *drv,
if (ret)
return ERR_PTR(ret);
- ast->regs = pcim_iomap(pdev, 1, 0);
- if (!ast->regs)
- return ERR_PTR(-EIO);
+ ret = pcim_iomap_regions(pdev, BIT(1), 0);
+ if (ret)
+ return ERR_PTR(ret);
+
+ ast->regs = pcim_iomap_table(pdev)[1];
/*
* After AST2500, MMIO is enabled by default, and it should be adopted
@@ -461,9 +463,10 @@ struct ast_device *ast_device_create(const struct drm_driver *drv,
/* "map" IO regs if the above hasn't done so already */
if (!ast->ioregs) {
- ast->ioregs = pcim_iomap(pdev, 2, 0);
- if (!ast->ioregs)
- return ERR_PTR(-EIO);
+ ret = pcim_iomap_regions(pdev, BIT(2), 0);
+ if (ret)
+ return ERR_PTR(ret);
+ ast->ioregs = pcim_iomap_table(pdev)[2];
}
if (!ast_is_vga_enabled(dev)) {
--
2.41.0
Powered by blists - more mailing lists