/* Bluetooth HCI driver model support. */ #include #include #include static struct class *bt_class; static void bt_link_release(struct device *dev) { struct hci_conn *conn = to_hci_conn(dev); kfree(conn); } static struct device_type bt_link = { .name = "link", .release = bt_link_release, }; /* * The rfcomm tty device will possibly retain even when conn * is down, and sysfs doesn't support move zombie device, * so we should move the device before conn device is destroyed. */ static int __match_tty(struct device *dev, void *data) { return !strncmp(dev_name(dev), "rfcomm", 6); } void hci_conn_init_sysfs(struct hci_conn *conn) { struct hci_dev *hdev = conn->hdev; BT_DBG("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_DBG("conn %p", conn); dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); if (device_add(&conn->dev) < 0) { BT_ERR("Failed to register connection device"); return; } hci_dev_hold(hdev); } void hci_conn_del_sysfs(struct hci_conn *conn) { struct hci_dev *hdev = conn->hdev; if (!device_is_registered(&conn->dev)) return; while (1) { struct device *dev; dev = device_find_child(&conn->dev, NULL, __match_tty); if (!dev) break; device_move(dev, NULL, DPM_ORDER_DEV_LAST); put_device(dev); } device_del(&conn->dev); hci_dev_put(hdev); } static void bt_host_release(struct device *dev) { struct hci_dev *hdev = to_hci_dev(dev); kfree(hdev); module_put(THIS_MODULE); } static 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) { bt_class = class_create(THIS_MODULE, "bluetooth"); return PTR_ERR_OR_ZERO(bt_class); } void bt_sysfs_cleanup(void) { class_destroy(bt_class); } ' name='id' value='eaa7df3c5afe257e59e03746cdf9800fcd2494d2'/>
AgeCommit message (Expand)AuthorFilesLines
2017-02-09openvswitch: Pack struct sw_flow_key.Jarno Rajahalme4-34/+39
2017-02-09openvswitch: Add force commit.Jarno Rajahalme1-2/+24
2017-02-09openvswitch: Add original direction conntrack tuple to sw_flow_key.Jarno Rajahalme7-46/+227
2017-02-09openvswitch: Inherit master's labels.Jarno Rajahalme1-14/+31
2017-02-09openvswitch: Refactor labels initialization.Jarno Rajahalme1-42/+62
2017-02-09openvswitch: Simplify labels length logic.Jarno Rajahalme1-11/+9
2017-02-09openvswitch: Unionize ovs_key_ct_label with a u32 array.Jarno Rajahalme1-7/+8
2017-02-09openvswitch: Do not trigger events for unconfirmed connections.Jarno Rajahalme1-6/+22
2017-02-09openvswitch: Use inverted tuple in ovs_ct_find_existing() if NATted.Jarno Rajahalme1-2/+22
2017-02-09openvswitch: Fix comments for skb->_nfctJarno Rajahalme1-7/+7
2017-02-03Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-nextDavid S. Miller1-7/+5
2017-02-02netfilter: add and use nf_ct_set helperFlorian Westphal1-4/+2
2017-02-02skbuff: add and use skb_nfct helperFlorian Westphal1-3/+3