cregit-Linux how code gets into the kernel

Release 4.7 net/bluetooth/hci_sysfs.c

Directory: net/bluetooth
/* Bluetooth HCI driver model support. */

#include <linux/module.h>

#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>


static struct class *bt_class;


static inline char *link_typetostr(int type) { switch (type) { case ACL_LINK: return "ACL"; case SCO_LINK: return "SCO"; case ESCO_LINK: return "eSCO"; case LE_LINK: return "LE"; default: return "UNKNOWN"; } }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann3475.56%466.67%
peter hurleypeter hurley613.33%116.67%
maksim krasnyanskiymaksim krasnyanskiy511.11%116.67%
Total45100.00%6100.00%


static ssize_t show_link_type(struct device *dev, struct device_attribute *attr, char *buf) { struct hci_conn *conn = to_hci_conn(dev); return sprintf(buf, "%s\n", link_typetostr(conn->type)); }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann2862.22%466.67%
maksim krasnyanskiymaksim krasnyanskiy1635.56%116.67%
david herrmanndavid herrmann12.22%116.67%
Total45100.00%6100.00%


static ssize_t show_link_address(struct device *dev, struct device_attribute *attr, char *buf) { struct hci_conn *conn = to_hci_conn(dev); return sprintf(buf, "%pMR\n", &conn->dst); }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann2455.81%342.86%
maksim krasnyanskiymaksim krasnyanskiy1432.56%114.29%
gustavo f. padovangustavo f. padovan36.98%114.29%
andrei emeltchenkoandrei emeltchenko12.33%114.29%
david herrmanndavid herrmann12.33%114.29%
Total43100.00%7100.00%

#define LINK_ATTR(_name, _mode, _show, _store) \ struct device_attribute link_attr_##_name = __ATTR(_name, _mode, _show, _store) static LINK_ATTR(type, S_IRUGO, show_link_type, NULL); static LINK_ATTR(address, S_IRUGO, show_link_address, NULL); static struct attribute *bt_link_attrs[] = { &link_attr_type.attr, &link_attr_address.attr, NULL }; ATTRIBUTE_GROUPS(bt_link);
static void bt_link_release(struct device *dev) { struct hci_conn *conn = to_hci_conn(dev); kfree(conn); }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann2180.77%250.00%
david herrmanndavid herrmann519.23%250.00%
Total26100.00%4100.00%

static struct device_type bt_link = { .name = "link", .groups = bt_link_groups, .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); }

Contributors

PersonTokensPropCommitsCommitProp
gustavo f. padovangustavo f. padovan2379.31%150.00%
marcel holtmannmarcel holtmann620.69%150.00%
Total29100.00%2100.00%


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); }

Contributors

PersonTokensPropCommitsCommitProp
gustavo f. padovangustavo f. padovan5487.10%133.33%
marcel holtmannmarcel holtmann812.90%266.67%
Total62100.00%3100.00%


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); }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann5376.81%480.00%
gustavo f. padovangustavo f. padovan1623.19%120.00%
Total69100.00%5100.00%


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); }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann8494.38%360.00%
gustavo f. padovangustavo f. padovan33.37%120.00%
cornelia huckcornelia huck22.25%120.00%
Total89100.00%5100.00%


static inline char *host_typetostr(int type) { switch (type) { case HCI_BREDR: return "BR/EDR"; case HCI_AMP: return "AMP"; default: return "UNKNOWN"; } }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann3193.94%150.00%
david vrabeldavid vrabel26.06%150.00%
Total33100.00%2100.00%


static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf) { struct hci_dev *hdev = to_hci_dev(dev); return sprintf(buf, "%s\n", host_typetostr(hdev->dev_type)); }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann4497.78%150.00%
david herrmanndavid herrmann12.22%150.00%
Total45100.00%2100.00%


static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf) { struct hci_dev *hdev = to_hci_dev(dev); char name[HCI_MAX_NAME_LENGTH + 1]; int i; for (i = 0; i < HCI_MAX_NAME_LENGTH; i++) name[i] = hdev->dev_name[i]; name[HCI_MAX_NAME_LENGTH] = '\0'; return sprintf(buf, "%s\n", name); }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann7792.77%360.00%
johan hedbergjohan hedberg56.02%120.00%
david herrmanndavid herrmann11.20%120.00%
Total83100.00%5100.00%


static ssize_t show_address(struct device *dev, struct device_attribute *attr, char *buf) { struct hci_dev *hdev = to_hci_dev(dev); return sprintf(buf, "%pMR\n", &hdev->bdaddr); }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann3888.37%555.56%
gustavo f. padovangustavo f. padovan24.65%111.11%
andrei emeltchenkoandrei emeltchenko12.33%111.11%
maksim krasnyanskiymaksim krasnyanskiy12.33%111.11%
david herrmanndavid herrmann12.33%111.11%
Total43100.00%9100.00%

static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); static struct attribute *bt_host_attrs[] = { &dev_attr_type.attr, &dev_attr_name.attr, &dev_attr_address.attr, NULL }; ATTRIBUTE_GROUPS(bt_host);
static void bt_host_release(struct device *dev) { struct hci_dev *hdev = to_hci_dev(dev); kfree(hdev); module_put(THIS_MODULE); }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann1858.06%450.00%
david herrmanndavid herrmann1032.26%337.50%
dave youngdave young39.68%112.50%
Total31100.00%8100.00%

static struct device_type bt_host = { .name = "host", .groups = bt_host_groups, .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); }

Contributors

PersonTokensPropCommitsCommitProp
david herrmanndavid herrmann43100.00%2100.00%
Total43100.00%2100.00%


int __init bt_sysfs_init(void) { bt_class = class_create(THIS_MODULE, "bluetooth"); return PTR_ERR_OR_ZERO(bt_class); }

Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann1565.22%466.67%
maksim krasnyanskiymaksim krasnyanskiy730.43%116.67%
rusty russellrusty russell14.35%116.67%
Total23100.00%6100.00%


void bt_sysfs_cleanup(void) { class_destroy(bt_class); }

Contributors

PersonTokensPropCommitsCommitProp
maksim krasnyanskiymaksim krasnyanskiy650.00%125.00%
marcel holtmannmarcel holtmann325.00%250.00%
dave youngdave young325.00%125.00%
Total12100.00%4100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
marcel holtmannmarcel holtmann64670.76%2047.62%
gustavo f. padovangustavo f. padovan10311.28%37.14%
david herrmanndavid herrmann636.90%511.90%
maksim krasnyanskiymaksim krasnyanskiy556.02%12.38%
dave youngdave young121.31%37.14%
wei yongjunwei yongjun101.10%12.38%
peter hurleypeter hurley60.66%12.38%
johan hedbergjohan hedberg50.55%12.38%
paul gortmakerpaul gortmaker30.33%12.38%
david howellsdavid howells20.22%12.38%
andrei emeltchenkoandrei emeltchenko20.22%12.38%
david vrabeldavid vrabel20.22%12.38%
cornelia huckcornelia huck20.22%12.38%
david s. millerdavid s. miller10.11%12.38%
rusty russellrusty russell10.11%12.38%
Total913100.00%42100.00%
Directory: net/bluetooth
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}