diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-17 15:53:02 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-12-18 14:07:58 -0500 |
commit | 6d438e335ce83ff0528415a58632dc6508e4fde1 (patch) | |
tree | 79e191a1c9bd02dfde23c2c38b7c211e5a00e14e /net/bluetooth/hci_sysfs.c | |
parent | 32845eb1242e4c862de8d27c19ae9b3011f89291 (diff) |
Bluetooth: Remove work_add and work_del from hci_sysfs
As we run in process context now we don't need worqueue to add e del from
sysfs.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_sysfs.c')
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 71 |
1 files changed, 27 insertions, 44 deletions
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index c3c1ec871d46..db6af705f8f1 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -88,11 +88,35 @@ static struct device_type bt_link = { | |||
88 | .release = bt_link_release, | 88 | .release = bt_link_release, |
89 | }; | 89 | }; |
90 | 90 | ||
91 | static void add_conn(struct work_struct *work) | 91 | /* |
92 | * The rfcomm tty device will possibly retain even when conn | ||
93 | * is down, and sysfs doesn't support move zombie device, | ||
94 | * so we should move the device before conn device is destroyed. | ||
95 | */ | ||
96 | static int __match_tty(struct device *dev, void *data) | ||
97 | { | ||
98 | return !strncmp(dev_name(dev), "rfcomm", 6); | ||
99 | } | ||
100 | |||
101 | void hci_conn_init_sysfs(struct hci_conn *conn) | ||
102 | { | ||
103 | struct hci_dev *hdev = conn->hdev; | ||
104 | |||
105 | BT_DBG("conn %p", conn); | ||
106 | |||
107 | conn->dev.type = &bt_link; | ||
108 | conn->dev.class = bt_class; | ||
109 | conn->dev.parent = &hdev->dev; | ||
110 | |||
111 | device_initialize(&conn->dev); | ||
112 | } | ||
113 | |||
114 | void hci_conn_add_sysfs(struct hci_conn *conn) | ||
92 | { | 115 | { |
93 | struct hci_conn *conn = container_of(work, struct hci_conn, work_add); | ||
94 | struct hci_dev *hdev = conn->hdev; | 116 | struct hci_dev *hdev = conn->hdev; |
95 | 117 | ||
118 | BT_DBG("conn %p", conn); | ||
119 | |||
96 | dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); | 120 | dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); |
97 | 121 | ||
98 | dev_set_drvdata(&conn->dev, conn); | 122 | dev_set_drvdata(&conn->dev, conn); |
@@ -105,19 +129,8 @@ static void add_conn(struct work_struct *work) | |||
105 | hci_dev_hold(hdev); | 129 | hci_dev_hold(hdev); |
106 | } | 130 | } |
107 | 131 | ||
108 | /* | 132 | void hci_conn_del_sysfs(struct hci_conn *conn) |
109 | * The rfcomm tty device will possibly retain even when conn | ||
110 | * is down, and sysfs doesn't support move zombie device, | ||
111 | * so we should move the device before conn device is destroyed. | ||
112 | */ | ||
113 | static int __match_tty(struct device *dev, void *data) | ||
114 | { | ||
115 | return !strncmp(dev_name(dev), "rfcomm", 6); | ||
116 | } | ||
117 | |||
118 | static void del_conn(struct work_struct *work) | ||
119 | { | 133 | { |
120 | struct hci_conn *conn = container_of(work, struct hci_conn, work_del); | ||
121 | struct hci_dev *hdev = conn->hdev; | 134 | struct hci_dev *hdev = conn->hdev; |
122 | 135 | ||
123 | if (!device_is_registered(&conn->dev)) | 136 | if (!device_is_registered(&conn->dev)) |
@@ -139,36 +152,6 @@ static void del_conn(struct work_struct *work) | |||
139 | hci_dev_put(hdev); | 152 | hci_dev_put(hdev); |
140 | } | 153 | } |
141 | 154 | ||
142 | void hci_conn_init_sysfs(struct hci_conn *conn) | ||
143 | { | ||
144 | struct hci_dev *hdev = conn->hdev; | ||
145 | |||
146 | BT_DBG("conn %p", conn); | ||
147 | |||
148 | conn->dev.type = &bt_link; | ||
149 | conn->dev.class = bt_class; | ||
150 | conn->dev.parent = &hdev->dev; | ||
151 | |||
152 | device_initialize(&conn->dev); | ||
153 | |||
154 | INIT_WORK(&conn->work_add, add_conn); | ||
155 | INIT_WORK(&conn->work_del, del_conn); | ||
156 | } | ||
157 | |||
158 | void hci_conn_add_sysfs(struct hci_conn *conn) | ||
159 | { | ||
160 | BT_DBG("conn %p", conn); | ||
161 | |||
162 | queue_work(conn->hdev->workqueue, &conn->work_add); | ||
163 | } | ||
164 | |||
165 | void hci_conn_del_sysfs(struct hci_conn *conn) | ||
166 | { | ||
167 | BT_DBG("conn %p", conn); | ||
168 | |||
169 | queue_work(conn->hdev->workqueue, &conn->work_del); | ||
170 | } | ||
171 | |||
172 | static inline char *host_bustostr(int bus) | 155 | static inline char *host_bustostr(int bus) |
173 | { | 156 | { |
174 | switch (bus) { | 157 | switch (bus) { |