From: Amin GATTOUT <amin.gattout@gmail.com>
To: Sui Jingfeng <suijingfeng@loongson.cn>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Amin GATTOUT <amin.gattout@gmail.com>
Subject: [PATCH] drm/loongson: use drm_gem_ttm_dumb_map_offset()
Date: Sun, 08 Mar 2026 11:15:57 +0100 [thread overview]
Message-ID: <20260308-master-v1-1-af32d71c8a1d@gmail.com> (raw)
Replace the open-coded lsdc_dumb_map_offset() with the generic
drm_gem_ttm_dumb_map_offset() helper, which is functionally identical.
This removes unnecessary boilerplate and aligns with the DRM convention
for TTM-based drivers.
Signed-off-by: Amin GATTOUT <amin.gattout@gmail.com>
---
drivers/gpu/drm/loongson/lsdc_drv.c | 3 ++-
drivers/gpu/drm/loongson/lsdc_gem.c | 15 ---------------
drivers/gpu/drm/loongson/lsdc_gem.h | 4 ----
3 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
index abf5bf68eec2..1ece1ea42f78 100644
--- a/drivers/gpu/drm/loongson/lsdc_drv.c
+++ b/drivers/gpu/drm/loongson/lsdc_drv.c
@@ -13,6 +13,7 @@
#include <drm/drm_drv.h>
#include <drm/drm_fbdev_ttm.h>
#include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_gem_ttm_helper.h>
#include <drm/drm_ioctl.h>
#include <drm/drm_modeset_helper.h>
#include <drm/drm_print.h>
@@ -45,7 +46,7 @@ static const struct drm_driver lsdc_drm_driver = {
.debugfs_init = lsdc_debugfs_init,
.dumb_create = lsdc_dumb_create,
- .dumb_map_offset = lsdc_dumb_map_offset,
+ .dumb_map_offset = drm_gem_ttm_dumb_map_offset,
.gem_prime_import_sg_table = lsdc_prime_import_sg_table,
DRM_FBDEV_TTM_DRIVER_OPS,
};
diff --git a/drivers/gpu/drm/loongson/lsdc_gem.c b/drivers/gpu/drm/loongson/lsdc_gem.c
index 6372db2d3093..2fb03487c983 100644
--- a/drivers/gpu/drm/loongson/lsdc_gem.c
+++ b/drivers/gpu/drm/loongson/lsdc_gem.c
@@ -234,21 +234,6 @@ int lsdc_dumb_create(struct drm_file *file, struct drm_device *ddev,
return 0;
}
-int lsdc_dumb_map_offset(struct drm_file *filp, struct drm_device *ddev,
- u32 handle, uint64_t *offset)
-{
- struct drm_gem_object *gobj;
-
- gobj = drm_gem_object_lookup(filp, handle);
- if (!gobj)
- return -ENOENT;
-
- *offset = drm_vma_node_offset_addr(&gobj->vma_node);
-
- drm_gem_object_put(gobj);
-
- return 0;
-}
void lsdc_gem_init(struct drm_device *ddev)
{
diff --git a/drivers/gpu/drm/loongson/lsdc_gem.h b/drivers/gpu/drm/loongson/lsdc_gem.h
index 92cbb10e6e13..96729b3eebec 100644
--- a/drivers/gpu/drm/loongson/lsdc_gem.h
+++ b/drivers/gpu/drm/loongson/lsdc_gem.h
@@ -14,10 +14,6 @@ lsdc_prime_import_sg_table(struct drm_device *ddev,
struct dma_buf_attachment *attach,
struct sg_table *sg);
-int lsdc_dumb_map_offset(struct drm_file *file,
- struct drm_device *dev,
- u32 handle,
- uint64_t *offset);
int lsdc_dumb_create(struct drm_file *file,
struct drm_device *ddev,
---
base-commit: c23719abc3308df7ed3ad35650ad211fb2d2003d
change-id: 20260308-master-58f0cb492c5e
Best regards,
--
Amin GATTOUT <amin.gattout@gmail.com>
next reply other threads:[~2026-03-08 10:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-08 10:15 Amin GATTOUT [this message]
2026-03-09 8:08 ` [PATCH] drm/loongson: use drm_gem_ttm_dumb_map_offset() Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260308-master-v1-1-af32d71c8a1d@gmail.com \
--to=amin.gattout@gmail.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=suijingfeng@loongson.cn \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox