aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_sysfs.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-02-09 15:58:33 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-13 10:01:37 -0500
commit3dc07322b1ce3c8477690d54ebbf15a165f43066 (patch)
treec66786eff790fdb08747b3f92ee5014a5569d4e8 /net/bluetooth/hci_sysfs.c
parent155961e8001719af6d87cbcc961111e8ce477843 (diff)
Bluetooth: Introduce to_hci_conn
This avoids using the dev_set/get_drvdata() functions to retrieve a pointer to our own structure. We can use simple pointer arithmetic here. The drvdata field is actually not needed by any other code-path but this makes the code more consistent with hci_dev. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_sysfs.c')
-rw-r--r--net/bluetooth/hci_sysfs.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 2a0243add1e4..17e6cd48ad4d 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -33,19 +33,19 @@ static inline char *link_typetostr(int type)
33 33
34static ssize_t show_link_type(struct device *dev, struct device_attribute *attr, char *buf) 34static ssize_t show_link_type(struct device *dev, struct device_attribute *attr, char *buf)
35{ 35{
36 struct hci_conn *conn = dev_get_drvdata(dev); 36 struct hci_conn *conn = to_hci_conn(dev);
37 return sprintf(buf, "%s\n", link_typetostr(conn->type)); 37 return sprintf(buf, "%s\n", link_typetostr(conn->type));
38} 38}
39 39
40static ssize_t show_link_address(struct device *dev, struct device_attribute *attr, char *buf) 40static ssize_t show_link_address(struct device *dev, struct device_attribute *attr, char *buf)
41{ 41{
42 struct hci_conn *conn = dev_get_drvdata(dev); 42 struct hci_conn *conn = to_hci_conn(dev);
43 return sprintf(buf, "%s\n", batostr(&conn->dst)); 43 return sprintf(buf, "%s\n", batostr(&conn->dst));
44} 44}
45 45
46static ssize_t show_link_features(struct device *dev, struct device_attribute *attr, char *buf) 46static ssize_t show_link_features(struct device *dev, struct device_attribute *attr, char *buf)
47{ 47{
48 struct hci_conn *conn = dev_get_drvdata(dev); 48 struct hci_conn *conn = to_hci_conn(dev);
49 49
50 return sprintf(buf, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n", 50 return sprintf(buf, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
51 conn->features[0], conn->features[1], 51 conn->features[0], conn->features[1],
@@ -79,7 +79,7 @@ static const struct attribute_group *bt_link_groups[] = {
79 79
80static void bt_link_release(struct device *dev) 80static void bt_link_release(struct device *dev)
81{ 81{
82 void *data = dev_get_drvdata(dev); 82 void *data = to_hci_conn(dev);
83 kfree(data); 83 kfree(data);
84} 84}
85 85
@@ -120,8 +120,6 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
120 120
121 dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); 121 dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
122 122
123 dev_set_drvdata(&conn->dev, conn);
124
125 if (device_add(&conn->dev) < 0) { 123 if (device_add(&conn->dev) < 0) {
126 BT_ERR("Failed to register connection device"); 124 BT_ERR("Failed to register connection device");
127 return; 125 return;