From patchwork Thu Oct 5 13:33:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 148829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp396073vqb; Thu, 5 Oct 2023 08:58:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6/CZUn0J6z3lncHJYhxkbT1ypu4Ehxwxj8aFgQWdXq9KJTcJ76skC1ktpgWHjvW58DqH0 X-Received: by 2002:a17:90a:e7c3:b0:277:4002:f5ca with SMTP id kb3-20020a17090ae7c300b002774002f5camr5325108pjb.9.1696521519714; Thu, 05 Oct 2023 08:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696521519; cv=none; d=google.com; s=arc-20160816; b=j831IjX5fhak2BeUgxkQZGwVf9DtX9IRpIXTUDeIfaXD+vw+KQrD+PQG9oylNM5Lzq WTeoizY7rJb+hPQbo/JsYbYBCLKkLu/VnrrOQQMNeOZijZr0JV9nEzb5O0PHw2Tb6enu Cjc29fdPaHTScuzVDEoUFMQdJ3UJCwybsjBI9Du0Qxap5eSqHLCA4W0JPNRI8j6ERE95 ek81/gzsAXsIQ37fH+Xk8MQvkJncVRrG4/vJDepY0x7HB4yVQRLSWtCAQa+aadniLiOI 4tibhhl3gOcqjuPaL1oH0jvycuy+jD5uI1ZzYb88Q/fJPjSiue4+e42xzgy7o1XYBbn4 Rkng== 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 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id f2-20020a17090a638200b00277e0d7163asi1839189pjj.32.2023.10.05.08.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 08:58:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; 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 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 876FF82F7F9E; Thu, 5 Oct 2023 08:58:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238084AbjJEP6P (ORCPT + 19 others); Thu, 5 Oct 2023 11:58:15 -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 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 (snail.vger.email [0.0.0.0]); Thu, 05 Oct 2023 08:58:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778931749389612683 X-GMAIL-MSGID: 1778931749389612683 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 Reviewed-by: Jiri Slaby --- 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;