Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp396040rdb; Thu, 5 Oct 2023 08:58:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQgdvj+YyccwzLhakoPGuyrdziR7NSZK4ywgQNaWqITNFo5N/bw6vWeZYicd2Yt/BFgLBb X-Received: by 2002:a17:902:e886:b0:1c5:f7e2:c5e0 with SMTP id w6-20020a170902e88600b001c5f7e2c5e0mr5971344plg.51.1696521518630; Thu, 05 Oct 2023 08:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696521518; cv=none; d=google.com; s=arc-20160816; b=AZLzcPMojdLB/uIcw0gbfdBQx7cuXx3g+5jt8YC92v2lh43vm2kLJBjyvWQVEzpYyR w6Ea6SNkNR/n3ahsbmye05rX5baarpXhqViHXIYivj8SKMVpOqWTMo1mg4bGZiDiF1Ha 9HnSEpO2KtPbkcpa/tCMs1dSsAU9cJ0y59JRWNBYO3ykltdzC50PKvHaVFrds/ge83o3 Jqm38eLym/XHYzKQBjFH6Kp/sONQ2nhOqpaGjszAg3BeSUgda33LAgDwOfGSz7G2gx71 01L5VtiM+VPJ8/vmVa02miaS4OxqDq/m2YR2xrFcuaag967PDSPD78GrcuvVNuHAUVYT ZNAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:lines:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+LfrBwW+0ryxNRdUzledQD31oRgoWeL94th2/F4WjTw=; fh=q7mo4k8FfMXd6hcYopUpbHK+K3YgTJh5eRxIFzY8XrM=; b=t0xRjh5zVtYJ3aopmXS0BK2ivltzTjEGctSsrLZ8gGy/64r0ne2BdTkVahmgD2kGhZ DnLWHh7aC7UjMYZBwkVWd3su494Hk5jel3ussy2MhiSyvixyNjrxLVkfCf/3HI15VoOT mXdhUWbcBQOhuATbGDDO2uba4Q6ce25OUBC5o+hl7Pnr32koPMHTIIYctdBtLu3ndqxb W/fLJlgbf+TcfXQzZqTq5MbQS6Q2Q6hWGRIU6CVXkZoWQMvtv9aPD9gGt30Nsj9fytzI yZGqXyn8KblnP7ejyAyx3rkJLpUVdJWxCWdWpV5Y+3Z1hGqsEnXZfH9tewa/OlhLc1Mk UehA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gnPv76Mv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id u11-20020a170902e5cb00b001c32fe6cdf9si1870964plf.386.2023.10.05.08.58.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 08:58:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gnPv76Mv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CD49988D5150; Thu, 5 Oct 2023 08:58:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236936AbjJEP6O (ORCPT + 99 others); Thu, 5 Oct 2023 11:58:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232660AbjJEP4o (ORCPT ); Thu, 5 Oct 2023 11:56:44 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C8984ED4; Thu, 5 Oct 2023 06:52:31 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D177DC4AF6E; Thu, 5 Oct 2023 13:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696512835; bh=Ajq8gV1LGJFvnPZhXDFFK3hzihK5NkBL+73XF7NmfLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gnPv76MvuwiBgqT0NgoekRfweaFvnh+3jHOlQlW7mrJYPUb4SPLy3W1JV1ZEtZpnU SHKV1Kbs5ahtwZ31CnUJMi4jhkyP2Gaw13sJniLcx/imC72HsarqQ3+MV1L97SZcrm ZLRVgnOb3HNVtxsqIjyQVKlBIL1Xa4Zj8QOR+QSg= From: Greg Kroah-Hartman To: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH 2/2] tty: vc_screen: make vc_class constant Date: Thu, 5 Oct 2023 15:33:48 +0200 Message-ID: <2023100549-sixth-anger-ac34@gregkh> X-Mailer: git-send-email 2.42.0 In-Reply-To: <2023100546-humbly-prologue-e58c@gregkh> References: <2023100546-humbly-prologue-e58c@gregkh> MIME-Version: 1.0 Lines: 67 X-Developer-Signature: v=1; a=openpgp-sha256; l=2689; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Ajq8gV1LGJFvnPZhXDFFK3hzihK5NkBL+73XF7NmfLI=; b=owGbwMvMwCRo6H6F97bub03G02pJDKlyu+3yq3oYfi5vZ1p9a+Hi5Av96lVGVge1BaQOep2o4 dZ8krC0I5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACYiJsmwYN38TToLHZN+7te/ 9LvMguFf8FV3P4Y5nG90Xhf83Xa61FfjptL/l0Z8FeseAgA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 05 Oct 2023 08:58:37 -0700 (PDT) Now that the driver core allows for struct class to be in read-only memory, making all 'class' structures to be declared at build time placing them into read-only memory, instead of having to be dynamically allocated at load time. Cc: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vc_screen.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index 829c4be66f3b..b16ea517bb17 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c @@ -786,23 +786,22 @@ static const struct file_operations vcs_fops = { .release = vcs_release, }; -static struct class *vc_class; +static const struct class vc_class = { + .name = "vc", +}; void vcs_make_sysfs(int index) { - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 1), NULL, - "vcs%u", index + 1); - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 65), NULL, - "vcsu%u", index + 1); - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 129), NULL, - "vcsa%u", index + 1); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, index + 1), NULL, "vcs%u", index + 1); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, index + 65), NULL, "vcsu%u", index + 1); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, index + 129), NULL, "vcsa%u", index + 1); } void vcs_remove_sysfs(int index) { - device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 1)); - device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 65)); - device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 129)); + device_destroy(&vc_class, MKDEV(VCS_MAJOR, index + 1)); + device_destroy(&vc_class, MKDEV(VCS_MAJOR, index + 65)); + device_destroy(&vc_class, MKDEV(VCS_MAJOR, index + 129)); } int __init vcs_init(void) @@ -811,11 +810,12 @@ int __init vcs_init(void) if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops)) panic("unable to get major %d for vcs device", VCS_MAJOR); - vc_class = class_create("vc"); + if (class_register(&vc_class)) + panic("unable to create vc_class"); - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 64), NULL, "vcsu"); - device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, 64), NULL, "vcsu"); + device_create(&vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); for (i = 0; i < MIN_NR_CONSOLES; i++) vcs_make_sysfs(i); return 0; -- 2.42.0