From nobody Wed Apr 06 17:46:05 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 545D41AA6073; Wed, 6 Apr 2022 17:46:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KYX4G0FCFz3DKK; Wed, 6 Apr 2022 17:46:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649267166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1pQdQcDE/89Ch66ITAMuURxxpgpBLeMXarzDdaanL6M=; b=qj+lVMCRFtT2tvNejFPR7teNtmdLDpD295yAozCg4HghFa7GtCKuYIYZJaXUGD3CbSZP2q cwFR307y00wQvFAVLLdun0xR0PFK3SLCuJYKG+y6A93xl2tFk5Y5gYQNv5t9CrMX0MnXMT 0Y3FngpOitnFY30V8MLglBksF2rDWUuVn9MHq69rn1cQVq2pcjT/WSuUaQXx/XicZjp6WT lHByonAs0rUZL2rqUB/O4vYMdyuQimdQnPjScCahWkemRwuQ+7CtmzrA9xBkBY1z5lmMfL wvkhRzGg3sWSN0ME0TzTB2QIojpfcz74g6FEO8HkE6zuxX0ZPnovsyZj6gsKdg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C43601F8E4; Wed, 6 Apr 2022 17:46:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 236Hk5XL022633; Wed, 6 Apr 2022 17:46:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 236Hk5vk022632; Wed, 6 Apr 2022 17:46:05 GMT (envelope-from git) Date: Wed, 6 Apr 2022 17:46:05 GMT Message-Id: <202204061746.236Hk5vk022632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 169aa349594c - releng/13.1 - linuxkpi: Move class_create to .c file List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.1 X-Git-Reftype: branch X-Git-Commit: 169aa349594cb8226e53fbefc93a6e857b00015c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649267166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1pQdQcDE/89Ch66ITAMuURxxpgpBLeMXarzDdaanL6M=; b=uDXeOkzIX9qzrN5tgN/g9HBP4gxfzPxd80qbcb2BVesT5Ra+cdYUsDETRdRAZVSdFCl5BU 8r8mNIrZVyMnSR5UvlKn1boE/X3f2BaRTL+u5ifcravP69P7+XtFxgOsPSTLnuBCATH17T QjewFBya1Hkjnh/6HOPWPtwrz6n2szzAWBywYLEDRkv3Zi7VGBdWP8eQ+fwRotgS3FS21a huBht2JVrZGNJt+jID4qDsqTEmbAi5v3afxZTxboqsKJWGAXsS/GlZvyzXLgcCW5O/4pul PGVX8rgornI/RZ7aqcNiheFwQlcRYJ2SQWwEEyrfp/+HFRqR7spe1Kk6pDO5+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649267166; a=rsa-sha256; cv=none; b=Fl8/BIS2QhmeIQhVe5x6ZorWEUI5WQ4B5Elw/D8jFzEBh9UCiBgTpLLUC7fW/Fq/DegxiD BWq3pCsaNT3BM7Nt6c254RX7c/WyVpr74E6erPpTABcXIH6JLQygOG6JfUpJhphRkNOTqZ iW+muziOdXvfb3shz3JIlAL45GZy0b6bblecjH3BWOc6NGQawg3kXfpa8eD+KG6KX4sS1L PfFFWXj+0teMAHiYewRxnjnP2BOOuZpYy3b1PQCKAQ4AMz52HWDAWNDDFuDEo74jFJ+Mt2 lBzq/OwBeSjtgzyNPyQDWaXUDxexBDyY1/w/NQtTGFgfxpDW4yUCI4pmykhTGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=169aa349594cb8226e53fbefc93a6e857b00015c commit 169aa349594cb8226e53fbefc93a6e857b00015c Author: Warner Losh AuthorDate: 2022-04-05 05:05:43 +0000 Commit: Warner Losh CommitDate: 2022-04-06 17:45:23 +0000 linuxkpi: Move class_create to .c file class_create encodes the size of struct class into the generated code. Move from .h file to .c file to move this knowledge from the client modules that call this into the linuxkpi module. Approved by: re@ (gjb) Sponsored by: Netflix Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D34769 (cherry picked from commit 1341ac9f9c111bba4e1ca046c479f32f2d4989c0) (cherry picked from commit 98d2b4a158f15d6d971a88315c5c5987036f89a3) --- sys/compat/linuxkpi/common/include/linux/device.h | 21 ++------------------- sys/compat/linuxkpi/common/src/linux_compat.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 2d310953fcd1..a6e735da92bd 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -289,6 +289,8 @@ put_device(struct device *dev) kobject_put(&dev->kobj); } +struct class *class_create(struct module *owner, const char *name); + static inline int class_register(struct class *class) { @@ -525,25 +527,6 @@ linux_class_kfree(struct class *class) kfree(class); } -static inline struct class * -class_create(struct module *owner, const char *name) -{ - struct class *class; - int error; - - class = kzalloc(sizeof(*class), M_WAITOK); - class->owner = owner; - class->name = name; - class->class_release = linux_class_kfree; - error = class_register(class); - if (error) { - kfree(class); - return (NULL); - } - - return (class); -} - static inline void class_destroy(struct class *class) { diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index ed8b8d050e92..7a3378f57b3a 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -495,6 +495,25 @@ error: return ERR_PTR(retval); } +struct class * +class_create(struct module *owner, const char *name) +{ + struct class *class; + int error; + + class = kzalloc(sizeof(*class), M_WAITOK); + class->owner = owner; + class->name = name; + class->class_release = linux_class_kfree; + error = class_register(class); + if (error) { + kfree(class); + return (NULL); + } + + return (class); +} + int kobject_init_and_add(struct kobject *kobj, const struct kobj_type *ktype, struct kobject *parent, const char *fmt, ...)