Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Apr 2022 14:42:30 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d1f93d6721a6 - stable/13 - linuxkpi: Move cdev_alloc into .c file
Message-ID:  <202204051442.235EgU2G030005@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=d1f93d6721a6c51c0cb49078ad5c5d535a383964

commit d1f93d6721a6c51c0cb49078ad5c5d535a383964
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-05 05:05:59 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-05 14:40:10 +0000

    linuxkpi: Move cdev_alloc into .c file
    
    Move cdev_alloc into linux_compat.c since it encodes the size of struct
    linux_cdev into the client modules otherwise.
    
    Sponsored by:           Netflix
    Reviewed by:            hselasky, emaste
    Differential Revision:  https://reviews.freebsd.org/D34771
    
    (cherry picked from commit aca0bcbca344b39f2a448e8c1c0d80bac8c0d6de)
---
 sys/compat/linuxkpi/common/include/linux/cdev.h | 13 ++-----------
 sys/compat/linuxkpi/common/src/linux_compat.c   | 11 +++++++++++
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/cdev.h b/sys/compat/linuxkpi/common/include/linux/cdev.h
index fb7a3cf0b447..2befe9b259cb 100644
--- a/sys/compat/linuxkpi/common/include/linux/cdev.h
+++ b/sys/compat/linuxkpi/common/include/linux/cdev.h
@@ -57,6 +57,8 @@ struct linux_cdev {
 	u_int		siref;
 };
 
+struct linux_cdev *cdev_alloc(void);
+
 static inline void
 cdev_init(struct linux_cdev *cdev, const struct file_operations *ops)
 {
@@ -66,17 +68,6 @@ cdev_init(struct linux_cdev *cdev, const struct file_operations *ops)
 	cdev->refs = 1;
 }
 
-static inline struct linux_cdev *
-cdev_alloc(void)
-{
-	struct linux_cdev *cdev;
-
-	cdev = kzalloc(sizeof(struct linux_cdev), M_WAITOK);
-	kobject_init(&cdev->kobj, &linux_cdev_ktype);
-	cdev->refs = 1;
-	return (cdev);
-}
-
 static inline void
 cdev_put(struct linux_cdev *p)
 {
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 7a3378f57b3a..a146b7bc9aa0 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -601,6 +601,17 @@ linux_file_free(struct linux_file *filp)
 	}
 }
 
+struct linux_cdev *
+cdev_alloc(void)
+{
+	struct linux_cdev *cdev;
+
+	cdev = kzalloc(sizeof(struct linux_cdev), M_WAITOK);
+	kobject_init(&cdev->kobj, &linux_cdev_ktype);
+	cdev->refs = 1;
+	return (cdev);
+}
+
 static int
 linux_cdev_pager_fault(vm_object_t vm_obj, vm_ooffset_t offset, int prot,
     vm_page_t *mres)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202204051442.235EgU2G030005>