aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb
diff options
context:
space:
mode:
authorThomas Pugliese <thomas.pugliese@gmail.com>2014-09-16 16:53:08 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-24 01:04:44 -0400
commit848879340a7d220fd9801396eba82ecac2f2a739 (patch)
treee61a90d95d576c10e55b0296d7be17ef79a64acf /drivers/uwb
parent58e4ab3eb02c77e11eae1555e4d635a058afb629 (diff)
uwb: create a uwb bus type and add in-range peer devices to it
Documentation/usb/WUSB-Design-overview.txt states that UWB devices seen by a UWB radio controller are added to /sys/bus/uwb/devices, but this was not actually being done. This functionality is needed in order for UWB peer devices to be enumerated by user mode tools. This patch creates a uwb bus type and adds UWB peer devices to it as they are discovered by the radio controller. Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/uwb')
-rw-r--r--drivers/uwb/driver.c11
-rw-r--r--drivers/uwb/lc-dev.c11
-rw-r--r--drivers/uwb/uwb-internal.h1
3 files changed, 19 insertions, 4 deletions
diff --git a/drivers/uwb/driver.c b/drivers/uwb/driver.c
index 3e5454aba5d4..776bcb3c2140 100644
--- a/drivers/uwb/driver.c
+++ b/drivers/uwb/driver.c
@@ -121,9 +121,19 @@ static int __init uwb_subsys_init(void)
121 result = class_register(&uwb_rc_class); 121 result = class_register(&uwb_rc_class);
122 if (result < 0) 122 if (result < 0)
123 goto error_uwb_rc_class_register; 123 goto error_uwb_rc_class_register;
124
125 /* Register the UWB bus */
126 result = bus_register(&uwb_bus_type);
127 if (result) {
128 pr_err("%s - registering bus driver failed\n", __func__);
129 goto exit_bus;
130 }
131
124 uwb_dbg_init(); 132 uwb_dbg_init();
125 return 0; 133 return 0;
126 134
135exit_bus:
136 class_unregister(&uwb_rc_class);
127error_uwb_rc_class_register: 137error_uwb_rc_class_register:
128 uwb_est_destroy(); 138 uwb_est_destroy();
129error_est_init: 139error_est_init:
@@ -134,6 +144,7 @@ module_init(uwb_subsys_init);
134static void __exit uwb_subsys_exit(void) 144static void __exit uwb_subsys_exit(void)
135{ 145{
136 uwb_dbg_exit(); 146 uwb_dbg_exit();
147 bus_unregister(&uwb_bus_type);
137 class_unregister(&uwb_rc_class); 148 class_unregister(&uwb_rc_class);
138 uwb_est_destroy(); 149 uwb_est_destroy();
139 return; 150 return;
diff --git a/drivers/uwb/lc-dev.c b/drivers/uwb/lc-dev.c
index ba76810eea10..8c7cfab5cee3 100644
--- a/drivers/uwb/lc-dev.c
+++ b/drivers/uwb/lc-dev.c
@@ -255,6 +255,12 @@ static struct attribute *uwb_dev_attrs[] = {
255}; 255};
256ATTRIBUTE_GROUPS(uwb_dev); 256ATTRIBUTE_GROUPS(uwb_dev);
257 257
258/* UWB bus type. */
259struct bus_type uwb_bus_type = {
260 .name = "uwb",
261 .dev_groups = uwb_dev_groups,
262};
263
258/** 264/**
259 * Device SYSFS registration 265 * Device SYSFS registration
260 */ 266 */
@@ -263,10 +269,6 @@ static int __uwb_dev_sys_add(struct uwb_dev *uwb_dev, struct device *parent_dev)
263 struct device *dev; 269 struct device *dev;
264 270
265 dev = &uwb_dev->dev; 271 dev = &uwb_dev->dev;
266 /* Device sysfs files are only useful for neighbor devices not
267 local radio controllers. */
268 if (&uwb_dev->rc->uwb_dev != uwb_dev)
269 dev->groups = uwb_dev_groups;
270 dev->parent = parent_dev; 272 dev->parent = parent_dev;
271 dev_set_drvdata(dev, uwb_dev); 273 dev_set_drvdata(dev, uwb_dev);
272 274
@@ -428,6 +430,7 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce)
428 return; 430 return;
429 } 431 }
430 uwb_dev_init(uwb_dev); /* This sets refcnt to one, we own it */ 432 uwb_dev_init(uwb_dev); /* This sets refcnt to one, we own it */
433 uwb_dev->dev.bus = &uwb_bus_type;
431 uwb_dev->mac_addr = *bce->mac_addr; 434 uwb_dev->mac_addr = *bce->mac_addr;
432 uwb_dev->dev_addr = bce->dev_addr; 435 uwb_dev->dev_addr = bce->dev_addr;
433 dev_set_name(&uwb_dev->dev, "%s", macbuf); 436 dev_set_name(&uwb_dev->dev, "%s", macbuf);
diff --git a/drivers/uwb/uwb-internal.h b/drivers/uwb/uwb-internal.h
index 6d1bed1f3460..353c0555a1f5 100644
--- a/drivers/uwb/uwb-internal.h
+++ b/drivers/uwb/uwb-internal.h
@@ -314,6 +314,7 @@ int uwb_radio_force_channel(struct uwb_rc *rc, int channel);
314 314
315/* -- UWB Sysfs representation */ 315/* -- UWB Sysfs representation */
316extern struct class uwb_rc_class; 316extern struct class uwb_rc_class;
317extern struct bus_type uwb_bus_type;
317extern struct device_attribute dev_attr_mac_address; 318extern struct device_attribute dev_attr_mac_address;
318extern struct device_attribute dev_attr_beacon; 319extern struct device_attribute dev_attr_beacon;
319extern struct device_attribute dev_attr_scan; 320extern struct device_attribute dev_attr_scan;