[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250929200316.18417-6-loic.molinari@collabora.com>
Date: Mon, 29 Sep 2025 22:03:13 +0200
From: Loïc Molinari <loic.molinari@...labora.com>
To: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Tvrtko Ursulin <tursulin@...ulin.net>,
Boris Brezillon <boris.brezillon@...labora.com>,
Rob Herring <robh@...nel.org>,
Steven Price <steven.price@....com>,
Liviu Dudau <liviu.dudau@....com>,
Melissa Wen <mwen@...lia.com>,
Maíra Canal <mcanal@...lia.com>,
Hugh Dickins <hughd@...gle.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Loïc Molinari <loic.molinari@...labora.com>,
Al Viro <viro@...iv.linux.org.uk>,
Mikołaj Wasiak <mikolaj.wasiak@...el.com>,
Christian Brauner <brauner@...nel.org>,
Nitin Gote <nitin.r.gote@...el.com>,
Andi Shyti <andi.shyti@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org,
linux-mm@...ck.org,
kernel@...labora.com
Subject: [PATCH 5/8] drm/v3d: Use huge tmpfs mount point helpers
Make use of the new drm_gem_shmem_huge_mnt_create() and
drm_gem_shmem_huge_mnt_free() helpers to avoid code duplication.
drm_gem_shmem_huge_mnt_free() handles NULL pointers.
Signed-off-by: Loïc Molinari <loic.molinari@...labora.com>
---
drivers/gpu/drm/v3d/v3d_gemfs.c | 31 +++----------------------------
1 file changed, 3 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/v3d/v3d_gemfs.c b/drivers/gpu/drm/v3d/v3d_gemfs.c
index 8ec6ed82b3d9..f54705dba217 100644
--- a/drivers/gpu/drm/v3d/v3d_gemfs.c
+++ b/drivers/gpu/drm/v3d/v3d_gemfs.c
@@ -1,23 +1,11 @@
// SPDX-License-Identifier: GPL-2.0+
/* Copyright (C) 2024 Raspberry Pi */
-#include <linux/fs.h>
-#include <linux/mount.h>
-#include <linux/fs_context.h>
-
#include "v3d_drv.h"
-static int add_param(struct fs_context *fc, const char *key, const char *val)
-{
- return vfs_parse_fs_string(fc, key, val, strlen(val));
-}
-
void v3d_gemfs_init(struct v3d_dev *v3d)
{
- struct file_system_type *type;
- struct fs_context *fc;
struct vfsmount *gemfs;
- int ret;
/*
* By creating our own shmemfs mountpoint, we can pass in
@@ -31,20 +19,8 @@ void v3d_gemfs_init(struct v3d_dev *v3d)
if (!super_pages)
goto err;
- type = get_fs_type("tmpfs");
- if (!type)
- goto err;
-
- fc = fs_context_for_mount(type, SB_KERNMOUNT);
- if (IS_ERR(fc))
- goto err;
- ret = add_param(fc, "source", "tmpfs");
- if (!ret)
- ret = add_param(fc, "huge", "within_size");
- if (!ret)
- gemfs = fc_mount_longterm(fc);
- put_fs_context(fc);
- if (ret)
+ gemfs = drm_gem_shmem_huge_mnt_create("within_size");
+ if (IS_ERR(gemfs))
goto err;
v3d->gemfs = gemfs;
@@ -60,6 +36,5 @@ void v3d_gemfs_init(struct v3d_dev *v3d)
void v3d_gemfs_fini(struct v3d_dev *v3d)
{
- if (v3d->gemfs)
- kern_unmount(v3d->gemfs);
+ drm_gem_shmem_huge_mnt_free(v3d->gemfs);
}
--
2.47.3
Powered by blists - more mailing lists