From b8ed894279eb87b16c1a001fb291e4284eb4353f Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Wed, 1 Nov 2023 06:38:14 +0000 Subject: [PATCH] misc: Drop THIS_MODULE from class create for Linux 6.6 THIS_MODULE is dropped from Linux6.6. Removing this via conftest. Bug 4346767 Change-Id: I01a03b6ce6daeb1715fd06d3f6c4a2507f1a441c Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3008088 GVS: Gerrit_Virtual_Submit --- drivers/misc/ioctl_example.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/misc/ioctl_example.c b/drivers/misc/ioctl_example.c index 74ce3d6f..a67cb623 100644 --- a/drivers/misc/ioctl_example.c +++ b/drivers/misc/ioctl_example.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only /* SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ +#include + #include #include #include @@ -53,7 +55,9 @@ static long device_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } static struct file_operations fops = { +#if !defined(NV_CLASS_CREATE_HAS_NO_OWNER_ARG) .owner = THIS_MODULE, +#endif .open = device_open, .release = device_release, .unlocked_ioctl = device_ioctl, @@ -69,7 +73,12 @@ static int __init ioctl_example_init(void) cdev_add(&cdev, dev_num, 1); /* Create a device class */ + +#if defined(NV_CLASS_CREATE_HAS_NO_OWNER_ARG) + dev_class = class_create("ioctl_example"); +#else dev_class = class_create(THIS_MODULE, "ioctl_example"); +#endif device_create(dev_class, NULL, dev_num, NULL, "ioctl_example"); pr_info("ioctl_example: Module loaded\n");