32 #include <linux/device.h>
33 #include <linux/module.h>
45 struct usb_hcd *usb_hcd = bus_to_hcd(usb_bus);
73 result =
sscanf(buf,
"%u", &trust_timeout);
83 (trust_timeout * CONFIG_HZ)/1000/2);
85 return result < 0 ? result :
size;
87 static DEVICE_ATTR(wusb_trust_timeout, 0644, wusb_trust_timeout_show,
88 wusb_trust_timeout_store);
96 struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
103 chid = &wusb_ckhdid_zero;
105 result += ckhdid_printf(buf,
PAGE_SIZE, chid);
106 result +=
sprintf(buf + result,
"\n");
121 const char *buf,
size_t size)
123 struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
128 "%02hhx %02hhx %02hhx %02hhx "
129 "%02hhx %02hhx %02hhx %02hhx "
130 "%02hhx %02hhx %02hhx %02hhx "
131 "%02hhx %02hhx %02hhx %02hhx\n",
141 dev_err(dev,
"Unrecognized CHID (need 16 8-bit hex digits): "
142 "%d\n", (
int)result);
146 return result < 0 ? result :
size;
148 static DEVICE_ATTR(wusb_chid, 0644, wusb_chid_show, wusb_chid_store);
155 struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
162 const char *buf,
size_t size)
164 struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
168 result =
sscanf(buf,
"%hhu", &phy_rate);
177 static DEVICE_ATTR(wusb_phy_rate, 0644, wusb_phy_rate_show, wusb_phy_rate_store);
180 static struct attribute *wusbhc_attrs[] = {
181 &dev_attr_wusb_trust_timeout.attr,
182 &dev_attr_wusb_chid.attr,
183 &dev_attr_wusb_phy_rate.attr,
189 .attrs = wusbhc_attrs,
215 goto error_mmcie_create;
218 goto error_devconnect_create;
221 goto error_rh_create;
224 goto error_sec_create;
231 error_devconnect_create:
238 static inline struct kobject *wusbhc_kobj(
struct wusbhc *wusbhc)
240 return &wusbhc->
usb_hcd.self.controller->kobj;
260 dev_err(dev,
"Cannot register WUSBHC attributes: %d\n", result);
261 goto error_create_attr_group;
266 goto error_pal_register;
271 error_create_attr_group:
305 #define CLUSTER_IDS 32
321 spin_lock(&wusb_cluster_ids_lock);
327 set_bit(
id, wusb_cluster_id_table);
330 spin_unlock(&wusb_cluster_ids_lock);
345 spin_lock(&wusb_cluster_ids_lock);
348 spin_unlock(&wusb_cluster_ids_lock);
372 if (status == 0 && wusb_dev) {
380 wusb_dev_put(wusb_dev);
405 static int __init wusbcore_init(
void)
410 goto error_crypto_init;
416 goto error_wusbd_create;
420 set_bit(0, wusb_cluster_id_table);
431 static void __exit wusbcore_exit(
void)
434 if (!bitmap_empty(wusb_cluster_id_table,
CLUSTER_IDS)) {
439 "on exit: %s\n", buf);