Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7907684rwd; Tue, 20 Jun 2023 07:46:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4c6xisp794Ez7hzcJ5cfLTVW3GWTBREmbhOUORwDzfp0OTi/aLolnI86Sgxgu1/6DeUmWB X-Received: by 2002:a92:d90b:0:b0:343:a11b:1557 with SMTP id s11-20020a92d90b000000b00343a11b1557mr2468725iln.29.1687272372305; Tue, 20 Jun 2023 07:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687272372; cv=none; d=google.com; s=arc-20160816; b=Ar4U87Jnm3NNeD00O7K0nuV76AJq2qQdrnH6hWOt0JSRW7iZT3kBSC/z7hrcD1hiKb yclboHBcEDxg51vjq3ns86Nyda7tCo+Qf08fe247HcypcSYQ4mkEQ00N+4E2Qsw4PdSa vMdzxbFpyhjwHL3BifZjNqbFMuTKiJsbvhLjDtVZm8KWBLTuwHXQeK8uEccSq04xqN5K CS4Z4UTjHgrD5nqstQh4R8ssYzwTSxvnbJI6WKRw7WmShLbho0DvAOPhgUNocP/G2V/T zPhGPkWYnpcmXfSBQzTeMOPnSiWeRMa43S9HAG9cQkIhEN94MTi/uGyYBTJPlVImEaJJ GYew== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=C0ttNayj6xU4/zLcPtRiBRUJmo+VJ1ZcretIz1NgIrA=; b=SJmViI1dOFdWfXAj2LeRWH7+y74E9xtT1Xthei2IX2BWBrvcqb+//M4WDQ00LV8SSj vV8K1J/UPFn4MAtXdj9OnfcuH++vFXzwlo3DCc3mYeiXU6I1xveIsaJ9xjGigc5kHuIf 7gkx3PlzonKBrsw0+u3Jscj5hZJd38kfx/8NGr4nXlDoOuvQy9/YO9s4bhNx7tC9Uyu0 f1wpxLPKiF+1uZWguF8EkIxHv6BSoY0lzhlrVYhtAOE/cvAS/pNV/xzs9zuVaYZTPNSE pt0+H0nyHxfUy2Zgd0Dp5uYVGrTu/w8E7TWtDtcTdp71OFloN0TRlkhZVQgFpRQTmv0J qAVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AQ1kjlBk; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-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 l73-20020a633e4c000000b005538c82b70esi894841pga.101.2023.06.20.07.45.47; Tue, 20 Jun 2023 07:46:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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=AQ1kjlBk; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-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 S231909AbjFTOlC (ORCPT + 99 others); Tue, 20 Jun 2023 10:41:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232191AbjFTOk5 (ORCPT ); Tue, 20 Jun 2023 10:40:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88A621708; Tue, 20 Jun 2023 07:40:56 -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 256E7612A4; Tue, 20 Jun 2023 14:40:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 256D3C433C8; Tue, 20 Jun 2023 14:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687272055; bh=ESB3mfiK6QBH5mUFKpOX+efwTKUL4XJTjgbpWQzRRMc=; h=From:To:Cc:Subject:Date:From; b=AQ1kjlBk64T4zNDLF05DXcQeIMF1Azrj4JzQbk6DV3OMIBEM+H72Cd02fjbRAheDS ZVCUP00qc/iAFD2TW/2QuqBOfi8tOHaa2BKsuVg12gBVhyL8YUn5g/8vLjGmLiA8i+ dX+sm6yPDe9vlBEhnCKBrwziBD2ce7N2yt9Q6LEk= From: Greg Kroah-Hartman To: linux-bluetooth@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ivan Orlov , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Greg Kroah-Hartman Subject: [PATCH] Bluetooth: hci_sysfs: make bt_class a static const structure Date: Tue, 20 Jun 2023 16:40:52 +0200 Message-ID: <20230620144051.580683-2-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1970; i=gregkh@linuxfoundation.org; h=from:subject; bh=PS9eqLmRrtetpOBWHADQYLqQmcboniXU2OhUOrX6kXY=; b=owGbwMvMwCRo6H6F97bub03G02pJDCkTdxV/TnoreGNRbulcu9k9hks53jDv2mrVeu+fLctpz xVLj/mmdMSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBECqsYFrReU/xVucrw5mTr jD8vZEzDNH/rxjHMr7gurLFI7JqN7WUBgarzJXOrfhuFAQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-bluetooth@vger.kernel.org From: Ivan Orlov Now that the driver core allows for struct class to be in read-only memory, move the bt_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at load time. Cc: Marcel Holtmann Cc: Johan Hedberg Cc: Luiz Augusto von Dentz Cc: linux-bluetooth@vger.kernel.org Suggested-by: Greg Kroah-Hartman Signed-off-by: Ivan Orlov Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/hci_sysfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 2934d7f4d564..15b33579007c 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -6,7 +6,9 @@ #include #include -static struct class *bt_class; +static const struct class bt_class = { + .name = "bluetooth", +}; static void bt_link_release(struct device *dev) { @@ -36,7 +38,7 @@ void hci_conn_init_sysfs(struct hci_conn *conn) BT_DBG("conn %p", conn); conn->dev.type = &bt_link; - conn->dev.class = bt_class; + conn->dev.class = &bt_class; conn->dev.parent = &hdev->dev; device_initialize(&conn->dev); @@ -104,7 +106,7 @@ void hci_init_sysfs(struct hci_dev *hdev) struct device *dev = &hdev->dev; dev->type = &bt_host; - dev->class = bt_class; + dev->class = &bt_class; __module_get(THIS_MODULE); device_initialize(dev); @@ -112,12 +114,10 @@ void hci_init_sysfs(struct hci_dev *hdev) int __init bt_sysfs_init(void) { - bt_class = class_create("bluetooth"); - - return PTR_ERR_OR_ZERO(bt_class); + return class_register(&bt_class); } void bt_sysfs_cleanup(void) { - class_destroy(bt_class); + class_unregister(&bt_class); } -- 2.41.0