From nobody Tue Apr 05 14:42:28 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 D89A31A8F1C7; Tue, 5 Apr 2022 14:42:29 +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 4KXr2s3TDdz4cTZ; Tue, 5 Apr 2022 14:42:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649169749; 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=XySY8wu/923o4pkcV2VKZXVLs8aNxBjjwJq+mhM7SC4=; b=IgjYbR40FmWQrGWUJgKLPie7Kg34rBgfQIrvvHKs/x8mCj5p54o/DMcoudDpfN4WLwqXvm h28jWZtYC1nZeoCuLwewpEX8h1p94/FJhLXhj+qMQDGZTfiVjnj1AH/UQ6U1mHBWYfbDnY YFYasLIaksLQ3Sie3u/+8S+XwPmiblFVPuEfhZMYsKuUnkc8odsKya/5BsxLGolFjxsuSr D0N3pKYviDYNbYv6b/G82owCoNAfm0V9PS2Gc1vdHXMmc/fuuCsagCvYPpE7vMw4313tbq ZxdjXLG6FelQBejowCw4yykzBlzkslGf84jpFTCHAQbLb79XnCDAinvKrTSbGQ== 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 2EA6E4E6; Tue, 5 Apr 2022 14:42:29 +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 235EgSqc029981; Tue, 5 Apr 2022 14:42:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 235EgSG2029980; Tue, 5 Apr 2022 14:42:28 GMT (envelope-from git) Date: Tue, 5 Apr 2022 14:42:28 GMT Message-Id: <202204051442.235EgSG2029980@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: 98d2b4a158f1 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 98d2b4a158f15d6d971a88315c5c5987036f89a3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649169749; 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=XySY8wu/923o4pkcV2VKZXVLs8aNxBjjwJq+mhM7SC4=; b=wEJweSnVpEtKJpZ7AJhEjBCybUl7hduOGwuNMTvV7YQismjkeYlBX6QFvIYIdOg73BrTVh pZ98g/xTQXvYbX/5sEDUVhxX6goonTZAwcdhMNUC9DdEVy/lT6mdb/I+0vKd5tEAdulDff VnhVPtDlEHkdn3QNQbyELv5YtNwEwPaSWdGBC5JThRHrAAGFXNIfDeAUOmMJZmd5nmC8KR dqSz7PAy8Voj553/dkKVHEheVeA+v5lCaKolidKxYB3CqACZ+LWx6DvPECDpJG98nIyI8b 1NOV12DbcL/yO+DgkPq5SAUa2ZBV6zHVlr7RTGIFtiWtWilou7VWyiXARo/MEQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649169749; a=rsa-sha256; cv=none; b=TQJvN1MnsSShx5sN4JEStDbFrckSFs4Si+WI9eyjQJNDr02tOAbLyTrK2X5hc6vRm4sYZU V+3SqQGcwOHejrEMrJy12zGP4n8dewKL0b3SkQlahdiAkjW4P6SRb9BpAubNKIqB3ASefz s0vPIxALLqJKN6t5iyj+aV/DTpfOG8bUKBK/26i3EFvavooalyb2H/IGBDLuto3+0TlRX2 kO6uBTCGuFCLHN61zUCKd0sZoftSjRyp/y0GUC6sHXqDbXrat3tqMzbuRKlZnGm7KbNwVY Hyo68hFQzEQpd609+awpP03EiaMoriaJMX3GNIKeKWrFDSlju4KqGUOyyv/lDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=98d2b4a158f15d6d971a88315c5c5987036f89a3 commit 98d2b4a158f15d6d971a88315c5c5987036f89a3 Author: Warner Losh AuthorDate: 2022-04-05 05:05:43 +0000 Commit: Warner Losh CommitDate: 2022-04-05 14:40:10 +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. Sponsored by: Netflix Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D34769 (cherry picked from commit 1341ac9f9c111bba4e1ca046c479f32f2d4989c0) --- 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, ...)