* [PATCH] Bluetooth: hci_sysfs: make bt_class a static const structure
@ 2023-06-20 14:40 Greg Kroah-Hartman
2023-06-20 18:30 ` patchwork-bot+bluetooth
0 siblings, 1 reply; 2+ messages in thread
From: Greg Kroah-Hartman @ 2023-06-20 14:40 UTC (permalink / raw)
To: linux-bluetooth
Cc: linux-kernel, Ivan Orlov, Marcel Holtmann, Johan Hedberg,
Luiz Augusto von Dentz, Greg Kroah-Hartman
From: Ivan Orlov <ivan.orlov0322@gmail.com>
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 <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
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 <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
-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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] Bluetooth: hci_sysfs: make bt_class a static const structure
2023-06-20 14:40 [PATCH] Bluetooth: hci_sysfs: make bt_class a static const structure Greg Kroah-Hartman
@ 2023-06-20 18:30 ` patchwork-bot+bluetooth
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2023-06-20 18:30 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-bluetooth, linux-kernel, ivan.orlov0322, marcel,
johan.hedberg, luiz.dentz
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 20 Jun 2023 16:40:52 +0200 you wrote:
> From: Ivan Orlov <ivan.orlov0322@gmail.com>
>
> 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.
>
> [...]
Here is the summary with links:
- Bluetooth: hci_sysfs: make bt_class a static const structure
https://git.kernel.org/bluetooth/bluetooth-next/c/665baafde870
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-20 18:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20 14:40 [PATCH] Bluetooth: hci_sysfs: make bt_class a static const structure Greg Kroah-Hartman
2023-06-20 18:30 ` patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome