Contributors: 20
Author |
Tokens |
Token Proportion |
Commits |
Commit Proportion |
Marcel Holtmann |
276 |
61.88% |
16 |
36.36% |
Maksim Krasnyanskiy |
32 |
7.17% |
2 |
4.55% |
David Herrmann |
30 |
6.73% |
5 |
11.36% |
Yang Ruirui |
19 |
4.26% |
3 |
6.82% |
ZhengHan Wang |
16 |
3.59% |
1 |
2.27% |
Linus Torvalds |
14 |
3.14% |
2 |
4.55% |
Ivan Orlov |
14 |
3.14% |
1 |
2.27% |
Gustavo Padovan |
10 |
2.24% |
1 |
2.27% |
David S. Miller |
8 |
1.79% |
1 |
2.27% |
Wei Yongjun |
6 |
1.35% |
1 |
2.27% |
Tetsuo Handa |
4 |
0.90% |
2 |
4.55% |
Paul Gortmaker |
3 |
0.67% |
1 |
2.27% |
Cornelia Huck |
2 |
0.45% |
1 |
2.27% |
Andrei Emeltchenko |
2 |
0.45% |
1 |
2.27% |
Luiz Augusto von Dentz |
2 |
0.45% |
1 |
2.27% |
Kay Sievers |
2 |
0.45% |
1 |
2.27% |
Bhumika Goyal |
2 |
0.45% |
1 |
2.27% |
Dmitry Antipov |
2 |
0.45% |
1 |
2.27% |
Johan Hedberg |
1 |
0.22% |
1 |
2.27% |
Greg Kroah-Hartman |
1 |
0.22% |
1 |
2.27% |
Total |
446 |
|
44 |
|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
// SPDX-License-Identifier: GPL-2.0
/* Bluetooth HCI driver model support. */
#include <linux/module.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
static const struct class bt_class = {
.name = "bluetooth",
};
static void bt_link_release(struct device *dev)
{
struct hci_conn *conn = to_hci_conn(dev);
kfree(conn);
}
static const struct device_type bt_link = {
.name = "link",
.release = bt_link_release,
};
void hci_conn_init_sysfs(struct hci_conn *conn)
{
struct hci_dev *hdev = conn->hdev;
bt_dev_dbg(hdev, "conn %p", conn);
conn->dev.type = &bt_link;
conn->dev.class = &bt_class;
conn->dev.parent = &hdev->dev;
device_initialize(&conn->dev);
}
void hci_conn_add_sysfs(struct hci_conn *conn)
{
struct hci_dev *hdev = conn->hdev;
bt_dev_dbg(hdev, "conn %p", conn);
if (device_is_registered(&conn->dev))
return;
dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
if (device_add(&conn->dev) < 0)
bt_dev_err(hdev, "failed to register connection device");
}
void hci_conn_del_sysfs(struct hci_conn *conn)
{
struct hci_dev *hdev = conn->hdev;
bt_dev_dbg(hdev, "conn %p", conn);
if (!device_is_registered(&conn->dev)) {
/* If device_add() has *not* succeeded, use *only* put_device()
* to drop the reference count.
*/
put_device(&conn->dev);
return;
}
/* If there are devices using the connection as parent reset it to NULL
* before unregistering the device.
*/
while (1) {
struct device *dev;
dev = device_find_any_child(&conn->dev);
if (!dev)
break;
device_move(dev, NULL, DPM_ORDER_DEV_LAST);
put_device(dev);
}
device_unregister(&conn->dev);
}
static void bt_host_release(struct device *dev)
{
struct hci_dev *hdev = to_hci_dev(dev);
if (hci_dev_test_flag(hdev, HCI_UNREGISTER))
hci_release_dev(hdev);
else
kfree(hdev);
module_put(THIS_MODULE);
}
static const struct device_type bt_host = {
.name = "host",
.release = bt_host_release,
};
void hci_init_sysfs(struct hci_dev *hdev)
{
struct device *dev = &hdev->dev;
dev->type = &bt_host;
dev->class = &bt_class;
__module_get(THIS_MODULE);
device_initialize(dev);
}
int __init bt_sysfs_init(void)
{
return class_register(&bt_class);
}
void bt_sysfs_cleanup(void)
{
class_unregister(&bt_class);
}