From nobody Tue Apr 05 05:10:01 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 1271B1AA3921; Tue, 5 Apr 2022 05:10:02 +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 4KXbLK68qBz3hbt; Tue, 5 Apr 2022 05:10:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649135402; 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=uAme3TZJzM3a/TMi8PWktYtildr7UL4oNNrwRE4etSY=; b=Pg6ebVpJspsj+8SI8mLDbczpA3SXQkV5KwQFspsrcuc8GtL+2WAp3P7qM7mxK1HcHkkVR5 AiqtJimJZH0pX5sidlhzxXTKYG2t87pWY2LLzfefeQ8pv0gMW76MOwHlfRImBuVcOa2oYH d1AMZw9V+3xRBmp9k9sUyWR82vVMV0He2cDMN13MWa10B0LEDPZXRV+WM2P4tWaNc/Wfw/ wzyhcuz/gXxEiu7SBvaWDyZZrWXFQZC9928n2N0TcNMwJtWDoNbXnYHYACSgGNzl8jn6ZH wvbFgFdFCp2MmFWH61QneV3WqT7LwmfUPlFl9gBF6RdmlbSWP6C4ZJHJHJxk3w== 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 8F50E203A7; Tue, 5 Apr 2022 05:10:01 +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 2355A1QK052995; Tue, 5 Apr 2022 05:10:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2355A1OQ052983; Tue, 5 Apr 2022 05:10:01 GMT (envelope-from git) Date: Tue, 5 Apr 2022 05:10:01 GMT Message-Id: <202204050510.2355A1OQ052983@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1341ac9f9c11 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 1341ac9f9c111bba4e1ca046c479f32f2d4989c0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649135402; 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=uAme3TZJzM3a/TMi8PWktYtildr7UL4oNNrwRE4etSY=; b=JdpH1p/kgtSI8Q3ay6XTEo5yLHrXSTtgAnO3bAF65RKe7DSGkSHZ+JdBJcM2yT9JoEEUvG B3fbT4SEGCcgszIF/AHujgd/Hbu7K2nwB1UsAhSaBwVJpmmaLZNZSxwQJE73xzThzAteNI wHYM5gyuFhgToCwbMvHeibL7py5M88HngYu6oPb+IEiavIWYvO/vkfeaiXivGYxazqHAha vH3Jmp1QrOA1TEj8RPTb4XqFtD//c7B9CJbtpKUB1mhotACPNen80+O4xiIBSuD8uQTOIq Vz/r7VjoCEBkowlpLQ/3Wj74yvJD1QtwBHVJiIrvFENrqSZ6ub1SOVnOO9rZtQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649135402; a=rsa-sha256; cv=none; b=LxWwV97KyoFlLaJGjSURceL8DZidvlJ/sLAJMt3vA5nQTdqAuEleMleO1KKDZazJyXG4zY E2sIXpY0/vJfFzKBDoArm+mYltn5VFF9CJFsE7njerNI9ZDkvVG7OYDq0s8NyQwgDYntam RkVIMmtOBMnK3vl1bGb/5l1HJtEGxn2c133EZu2nJODT3ErTjVgr2EjgpAjUJvhOkvY2HB 25+T3jSPNmJFG9rhqn+YytgwldnOYO84Dc09JZG6Hj+9R2ydF+eQfBBHX0S8v3MnPJpsmX hIUQUd5n5EmPG05dTGmsHKlOhqHgEet9difMcWv1lf7INDUUuYiENuY2o4np4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1341ac9f9c111bba4e1ca046c479f32f2d4989c0 commit 1341ac9f9c111bba4e1ca046c479f32f2d4989c0 Author: Warner Losh AuthorDate: 2022-04-05 05:05:43 +0000 Commit: Warner Losh CommitDate: 2022-04-05 05:05:43 +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 --- 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 e11ed0289043..e39b3f95ca0d 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 22652e87d20f..404b0e0857a5 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -496,6 +496,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, ...)