Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7920780rwd; Tue, 20 Jun 2023 07:57:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5XL8j7RzAfMsEVvuDpuareEMs8XggiOPJJ+S0CsrNRlvKz8gfYGRPftcjjE+G/LRrgu9cZ X-Received: by 2002:a17:90b:3686:b0:25e:8076:dd04 with SMTP id mj6-20020a17090b368600b0025e8076dd04mr23377542pjb.6.1687273056794; Tue, 20 Jun 2023 07:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687273056; cv=none; d=google.com; s=arc-20160816; b=MqW2tqavxfIPvlpxs1/KX0aohgfnGKW86hkE7yxwjBPDPQdpUtEXdStC5d19r6x4g5 wggJ/i2ODAVFxtKfGaz2gjdA+G8vfL0Ul+YqvyZI8d+bICLPf1znKun0Rhisixz8yGoK 4DPfTlT6O7DjdXs+H/bBagkGOIooSTWuXMWZnWQ3fuuiOsl3cmvQlFMVJ+NYfJ/v+a5d J1X1wwEdjtARw1vLQ4HmUXhnEyuqE4gKBswmVEVker7RS/1wpVvl6DlvJ4MiQfb83PXM JS/ATkrarYnhtTi7KldMqOh0bIMeaSruc/K9BarAFgVr/lJ8AlozlaTaAfBoP++ogkjw M3Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TQa1dMlsM+zU0dwx9nkPZldqKPs+K9lCQvJjWrKa1uA=; b=F2a7eEmX8UADv3MwzUGxB3CabYI96FSQa4OhJF6WuvdwwD0LYjmXxqUBQy/rMUTick n85k9YYk6YB9OexBU0B1hGJc03jM2j24e4AN0V32MHBv7CfbW+hAY9ILaasgeiYA1qhj YSZYWqPU9BVyJ3HQKAlphGntYUIsWZG7/dW71GMTE0J+IzMi3Ykk5VOq9mjByvRbo7oK Qu+34M61XKnfpiKFgb9JmOuwKC1wuQ4fvj/izljY7gVNKHGnajs6xJo+xiZhQYpjARcu Hg2Du8m/TQ/e3zU+UcZAR0QMbCBY+EumnTgDT4w9iIqFWSxy464HXThfFw+5yHBPsOb0 M3xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PSBem03D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jx20-20020a17090b46d400b0025de453ee4csi2019106pjb.168.2023.06.20.07.57.21; Tue, 20 Jun 2023 07:57:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PSBem03D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233313AbjFTOh7 (ORCPT + 99 others); Tue, 20 Jun 2023 10:37:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231272AbjFTOh6 (ORCPT ); Tue, 20 Jun 2023 10:37:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D76595 for ; Tue, 20 Jun 2023 07:37:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 030926126D for ; Tue, 20 Jun 2023 14:37:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 075CAC433C0; Tue, 20 Jun 2023 14:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687271876; bh=YE9m+nJJxh6aOa03h/WHgHWu9OpOX6QmULhfRkMKaCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSBem03Ddue+jvEKN2DbbsjQDXD4szBbGdpInvvIfNsny2r1ZP0rQVoxudmxTgEYn Y3CTO1mfIzHRky5iVK5Z0O0wbu78eYKyQC/UO8IjSI57NPBxO3l20cibVHggJ/zPjN l7rE2Xuh8hRikViB0U5C0Hg5VWF3m2uvneqRepmo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Ivan Orlov , Arnd Bergmann , Greg Kroah-Hartman Subject: [PATCH 2/9] dsp56k: make dsp56k_class a static const structure Date: Tue, 20 Jun 2023 16:37:53 +0200 Message-ID: <20230620143751.578239-11-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620143751.578239-10-gregkh@linuxfoundation.org> References: <20230620143751.578239-10-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2151; i=gregkh@linuxfoundation.org; h=from:subject; bh=eDeV6EZT0WbX/n0zteTSKFxR5yU/pGMS0Gd2MNY4l2g=; b=owGbwMvMwCRo6H6F97bub03G02pJDCkTd+4/sFjwv/+6ugn/eHVMkvlMPPJa/vodf7T9WqT7V cX7Fh8CO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiu1YxzHebcq6D5WzUtnXB 7ikPnToqyy9uYWeYn6Oim7y/dtHtiUr7NCynZ3G+DvwhBAA= 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,T_SCC_BODY_TEXT_LINE,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 From: Ivan Orlov Now that the driver core allows for struct class to be in read-only memory, move the dsp56k_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Arnd Bergmann Suggested-by: Greg Kroah-Hartman Signed-off-by: Ivan Orlov Signed-off-by: Greg Kroah-Hartman --- drivers/char/dsp56k.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index b3eaf3e5ef2e..bda27e595da1 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c @@ -101,7 +101,9 @@ static struct dsp56k_device { int tx_wsize, rx_wsize; } dsp56k; -static struct class *dsp56k_class; +static const struct class dsp56k_class = { + .name = "dsp56k", +}; static int dsp56k_reset(void) { @@ -493,7 +495,7 @@ static const char banner[] __initconst = KERN_INFO "DSP56k driver installed\n"; static int __init dsp56k_init_driver(void) { - int err = 0; + int err; if(!MACH_IS_ATARI || !ATARIHW_PRESENT(DSP56K)) { printk("DSP56k driver: Hardware not present\n"); @@ -504,12 +506,10 @@ static int __init dsp56k_init_driver(void) printk("DSP56k driver: Unable to register driver\n"); return -ENODEV; } - dsp56k_class = class_create("dsp56k"); - if (IS_ERR(dsp56k_class)) { - err = PTR_ERR(dsp56k_class); + err = class_register(&dsp56k_class); + if (err) goto out_chrdev; - } - device_create(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), NULL, + device_create(&dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k"); printk(banner); @@ -524,8 +524,8 @@ module_init(dsp56k_init_driver); static void __exit dsp56k_cleanup_driver(void) { - device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0)); - class_destroy(dsp56k_class); + device_destroy(&dsp56k_class, MKDEV(DSP56K_MAJOR, 0)); + class_unregister(&dsp56k_class); unregister_chrdev(DSP56K_MAJOR, "dsp56k"); } module_exit(dsp56k_cleanup_driver); -- 2.41.0