[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f76f56af-91dd-49ce-bf7d-f42dba07eeaa@arm.com>
Date: Mon, 23 Jun 2025 09:42:28 +0100
From: Steven Price <steven.price@....com>
To: Chia-I Wu <olvaffe@...il.com>,
Boris Brezillon <boris.brezillon@...labora.com>,
Liviu Dudau <liviu.dudau@....com>,
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>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] panthor: set owner field for driver fops
On 21/06/2025 00:50, Chia-I Wu wrote:
> It allows us to get rid of manual try_module_get / module_put.
>
> Signed-off-by: Chia-I Wu <olvaffe@...il.com>
Reviewed-by: Steven Price <steven.price@....com>
> ---
> drivers/gpu/drm/panthor/panthor_drv.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index 1116f2d2826ee..775a66c394544 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -1400,14 +1400,9 @@ panthor_open(struct drm_device *ddev, struct drm_file *file)
> struct panthor_file *pfile;
> int ret;
>
> - if (!try_module_get(THIS_MODULE))
> - return -EINVAL;
> -
> pfile = kzalloc(sizeof(*pfile), GFP_KERNEL);
> - if (!pfile) {
> - ret = -ENOMEM;
> - goto err_put_mod;
> - }
> + if (!pfile)
> + return -ENOMEM;
>
> pfile->ptdev = ptdev;
> pfile->user_mmio.offset = DRM_PANTHOR_USER_MMIO_OFFSET;
> @@ -1439,9 +1434,6 @@ panthor_open(struct drm_device *ddev, struct drm_file *file)
>
> err_free_file:
> kfree(pfile);
> -
> -err_put_mod:
> - module_put(THIS_MODULE);
> return ret;
> }
>
> @@ -1454,7 +1446,6 @@ panthor_postclose(struct drm_device *ddev, struct drm_file *file)
> panthor_vm_pool_destroy(pfile);
>
> kfree(pfile);
> - module_put(THIS_MODULE);
> }
>
> static const struct drm_ioctl_desc panthor_drm_driver_ioctls[] = {
> @@ -1555,6 +1546,7 @@ static void panthor_show_fdinfo(struct drm_printer *p, struct drm_file *file)
> }
>
> static const struct file_operations panthor_drm_driver_fops = {
> + .owner = THIS_MODULE,
> .open = drm_open,
> .release = drm_release,
> .unlocked_ioctl = drm_ioctl,
Powered by blists - more mailing lists