aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/hci_sysfs.c')
-rw-r--r--net/bluetooth/hci_sysfs.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index ec03ee2b301..2a0243add1e 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -189,19 +189,19 @@ static inline char *host_typetostr(int type)
189 189
190static ssize_t show_bus(struct device *dev, struct device_attribute *attr, char *buf) 190static ssize_t show_bus(struct device *dev, struct device_attribute *attr, char *buf)
191{ 191{
192 struct hci_dev *hdev = dev_get_drvdata(dev); 192 struct hci_dev *hdev = to_hci_dev(dev);
193 return sprintf(buf, "%s\n", host_bustostr(hdev->bus)); 193 return sprintf(buf, "%s\n", host_bustostr(hdev->bus));
194} 194}
195 195
196static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf) 196static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf)
197{ 197{
198 struct hci_dev *hdev = dev_get_drvdata(dev); 198 struct hci_dev *hdev = to_hci_dev(dev);
199 return sprintf(buf, "%s\n", host_typetostr(hdev->dev_type)); 199 return sprintf(buf, "%s\n", host_typetostr(hdev->dev_type));
200} 200}
201 201
202static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf) 202static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf)
203{ 203{
204 struct hci_dev *hdev = dev_get_drvdata(dev); 204 struct hci_dev *hdev = to_hci_dev(dev);
205 char name[HCI_MAX_NAME_LENGTH + 1]; 205 char name[HCI_MAX_NAME_LENGTH + 1];
206 int i; 206 int i;
207 207
@@ -214,20 +214,20 @@ static ssize_t show_name(struct device *dev, struct device_attribute *attr, char
214 214
215static ssize_t show_class(struct device *dev, struct device_attribute *attr, char *buf) 215static ssize_t show_class(struct device *dev, struct device_attribute *attr, char *buf)
216{ 216{
217 struct hci_dev *hdev = dev_get_drvdata(dev); 217 struct hci_dev *hdev = to_hci_dev(dev);
218 return sprintf(buf, "0x%.2x%.2x%.2x\n", 218 return sprintf(buf, "0x%.2x%.2x%.2x\n",
219 hdev->dev_class[2], hdev->dev_class[1], hdev->dev_class[0]); 219 hdev->dev_class[2], hdev->dev_class[1], hdev->dev_class[0]);
220} 220}
221 221
222static ssize_t show_address(struct device *dev, struct device_attribute *attr, char *buf) 222static ssize_t show_address(struct device *dev, struct device_attribute *attr, char *buf)
223{ 223{
224 struct hci_dev *hdev = dev_get_drvdata(dev); 224 struct hci_dev *hdev = to_hci_dev(dev);
225 return sprintf(buf, "%s\n", batostr(&hdev->bdaddr)); 225 return sprintf(buf, "%s\n", batostr(&hdev->bdaddr));
226} 226}
227 227
228static ssize_t show_features(struct device *dev, struct device_attribute *attr, char *buf) 228static ssize_t show_features(struct device *dev, struct device_attribute *attr, char *buf)
229{ 229{
230 struct hci_dev *hdev = dev_get_drvdata(dev); 230 struct hci_dev *hdev = to_hci_dev(dev);
231 231
232 return sprintf(buf, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n", 232 return sprintf(buf, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
233 hdev->features[0], hdev->features[1], 233 hdev->features[0], hdev->features[1],
@@ -238,31 +238,31 @@ static ssize_t show_features(struct device *dev, struct device_attribute *attr,
238 238
239static ssize_t show_manufacturer(struct device *dev, struct device_attribute *attr, char *buf) 239static ssize_t show_manufacturer(struct device *dev, struct device_attribute *attr, char *buf)
240{ 240{
241 struct hci_dev *hdev = dev_get_drvdata(dev); 241 struct hci_dev *hdev = to_hci_dev(dev);
242 return sprintf(buf, "%d\n", hdev->manufacturer); 242 return sprintf(buf, "%d\n", hdev->manufacturer);
243} 243}
244 244
245static ssize_t show_hci_version(struct device *dev, struct device_attribute *attr, char *buf) 245static ssize_t show_hci_version(struct device *dev, struct device_attribute *attr, char *buf)
246{ 246{
247 struct hci_dev *hdev = dev_get_drvdata(dev); 247 struct hci_dev *hdev = to_hci_dev(dev);
248 return sprintf(buf, "%d\n", hdev->hci_ver); 248 return sprintf(buf, "%d\n", hdev->hci_ver);
249} 249}
250 250
251static ssize_t show_hci_revision(struct device *dev, struct device_attribute *attr, char *buf) 251static ssize_t show_hci_revision(struct device *dev, struct device_attribute *attr, char *buf)
252{ 252{
253 struct hci_dev *hdev = dev_get_drvdata(dev); 253 struct hci_dev *hdev = to_hci_dev(dev);
254 return sprintf(buf, "%d\n", hdev->hci_rev); 254 return sprintf(buf, "%d\n", hdev->hci_rev);
255} 255}
256 256
257static ssize_t show_idle_timeout(struct device *dev, struct device_attribute *attr, char *buf) 257static ssize_t show_idle_timeout(struct device *dev, struct device_attribute *attr, char *buf)
258{ 258{
259 struct hci_dev *hdev = dev_get_drvdata(dev); 259 struct hci_dev *hdev = to_hci_dev(dev);
260 return sprintf(buf, "%d\n", hdev->idle_timeout); 260 return sprintf(buf, "%d\n", hdev->idle_timeout);
261} 261}
262 262
263static ssize_t store_idle_timeout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 263static ssize_t store_idle_timeout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
264{ 264{
265 struct hci_dev *hdev = dev_get_drvdata(dev); 265 struct hci_dev *hdev = to_hci_dev(dev);
266 unsigned int val; 266 unsigned int val;
267 int rv; 267 int rv;
268 268
@@ -280,13 +280,13 @@ static ssize_t store_idle_timeout(struct device *dev, struct device_attribute *a
280 280
281static ssize_t show_sniff_max_interval(struct device *dev, struct device_attribute *attr, char *buf) 281static ssize_t show_sniff_max_interval(struct device *dev, struct device_attribute *attr, char *buf)
282{ 282{
283 struct hci_dev *hdev = dev_get_drvdata(dev); 283 struct hci_dev *hdev = to_hci_dev(dev);
284 return sprintf(buf, "%d\n", hdev->sniff_max_interval); 284 return sprintf(buf, "%d\n", hdev->sniff_max_interval);
285} 285}
286 286
287static ssize_t store_sniff_max_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 287static ssize_t store_sniff_max_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
288{ 288{
289 struct hci_dev *hdev = dev_get_drvdata(dev); 289 struct hci_dev *hdev = to_hci_dev(dev);
290 u16 val; 290 u16 val;
291 int rv; 291 int rv;
292 292
@@ -304,13 +304,13 @@ static ssize_t store_sniff_max_interval(struct device *dev, struct device_attrib
304 304
305static ssize_t show_sniff_min_interval(struct device *dev, struct device_attribute *attr, char *buf) 305static ssize_t show_sniff_min_interval(struct device *dev, struct device_attribute *attr, char *buf)
306{ 306{
307 struct hci_dev *hdev = dev_get_drvdata(dev); 307 struct hci_dev *hdev = to_hci_dev(dev);
308 return sprintf(buf, "%d\n", hdev->sniff_min_interval); 308 return sprintf(buf, "%d\n", hdev->sniff_min_interval);
309} 309}
310 310
311static ssize_t store_sniff_min_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 311static ssize_t store_sniff_min_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
312{ 312{
313 struct hci_dev *hdev = dev_get_drvdata(dev); 313 struct hci_dev *hdev = to_hci_dev(dev);
314 u16 val; 314 u16 val;
315 int rv; 315 int rv;
316 316
@@ -370,7 +370,7 @@ static const struct attribute_group *bt_host_groups[] = {
370 370
371static void bt_host_release(struct device *dev) 371static void bt_host_release(struct device *dev)
372{ 372{
373 void *data = dev_get_drvdata(dev); 373 void *data = to_hci_dev(dev);
374 kfree(data); 374 kfree(data);
375 module_put(THIS_MODULE); 375 module_put(THIS_MODULE);
376} 376}
@@ -525,7 +525,6 @@ void hci_init_sysfs(struct hci_dev *hdev)
525 dev->class = bt_class; 525 dev->class = bt_class;
526 526
527 __module_get(THIS_MODULE); 527 __module_get(THIS_MODULE);
528 dev_set_drvdata(dev, hdev);
529 device_initialize(dev); 528 device_initialize(dev);
530} 529}
531 530