diff options
Diffstat (limited to 'drivers/usb/wusbcore')
-rw-r--r-- | drivers/usb/wusbcore/cbaf.c | 3 | ||||
-rw-r--r-- | drivers/usb/wusbcore/crypto.c | 3 | ||||
-rw-r--r-- | drivers/usb/wusbcore/devconnect.c | 12 | ||||
-rw-r--r-- | drivers/usb/wusbcore/mmc.c | 3 | ||||
-rw-r--r-- | drivers/usb/wusbcore/rh.c | 1 | ||||
-rw-r--r-- | drivers/usb/wusbcore/security.c | 7 | ||||
-rw-r--r-- | drivers/usb/wusbcore/wa-hc.c | 1 | ||||
-rw-r--r-- | drivers/usb/wusbcore/wa-nep.c | 1 | ||||
-rw-r--r-- | drivers/usb/wusbcore/wa-rpipe.c | 1 | ||||
-rw-r--r-- | drivers/usb/wusbcore/wa-xfer.c | 5 | ||||
-rw-r--r-- | drivers/usb/wusbcore/wusbhc.c | 32 | ||||
-rw-r--r-- | drivers/usb/wusbcore/wusbhc.h | 3 |
12 files changed, 57 insertions, 15 deletions
diff --git a/drivers/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c index 25eae405f622..c0c5665e60a9 100644 --- a/drivers/usb/wusbcore/cbaf.c +++ b/drivers/usb/wusbcore/cbaf.c | |||
@@ -92,6 +92,7 @@ | |||
92 | #include <linux/interrupt.h> | 92 | #include <linux/interrupt.h> |
93 | #include <linux/delay.h> | 93 | #include <linux/delay.h> |
94 | #include <linux/random.h> | 94 | #include <linux/random.h> |
95 | #include <linux/slab.h> | ||
95 | #include <linux/mutex.h> | 96 | #include <linux/mutex.h> |
96 | #include <linux/uwb.h> | 97 | #include <linux/uwb.h> |
97 | #include <linux/usb/wusb.h> | 98 | #include <linux/usb/wusb.h> |
@@ -641,7 +642,7 @@ static void cbaf_disconnect(struct usb_interface *iface) | |||
641 | kzfree(cbaf); | 642 | kzfree(cbaf); |
642 | } | 643 | } |
643 | 644 | ||
644 | static struct usb_device_id cbaf_id_table[] = { | 645 | static const struct usb_device_id cbaf_id_table[] = { |
645 | { USB_INTERFACE_INFO(0xef, 0x03, 0x01), }, | 646 | { USB_INTERFACE_INFO(0xef, 0x03, 0x01), }, |
646 | { }, | 647 | { }, |
647 | }; | 648 | }; |
diff --git a/drivers/usb/wusbcore/crypto.c b/drivers/usb/wusbcore/crypto.c index 9ec7fd5da489..827c87f10cc5 100644 --- a/drivers/usb/wusbcore/crypto.c +++ b/drivers/usb/wusbcore/crypto.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/module.h> | 49 | #include <linux/module.h> |
50 | #include <linux/err.h> | 50 | #include <linux/err.h> |
51 | #include <linux/uwb.h> | 51 | #include <linux/uwb.h> |
52 | #include <linux/slab.h> | ||
52 | #include <linux/usb/wusb.h> | 53 | #include <linux/usb/wusb.h> |
53 | #include <linux/scatterlist.h> | 54 | #include <linux/scatterlist.h> |
54 | 55 | ||
@@ -111,7 +112,7 @@ struct aes_ccm_b1 { | |||
111 | * | 112 | * |
112 | * CCM uses Ax blocks to generate a keystream with which the MIC and | 113 | * CCM uses Ax blocks to generate a keystream with which the MIC and |
113 | * the message's payload are encoded. A0 always encrypts/decrypts the | 114 | * the message's payload are encoded. A0 always encrypts/decrypts the |
114 | * MIC. Ax (x>0) are used for the sucesive payload blocks. | 115 | * MIC. Ax (x>0) are used for the successive payload blocks. |
115 | * | 116 | * |
116 | * The x is the counter, and is increased for each block. | 117 | * The x is the counter, and is increased for each block. |
117 | */ | 118 | */ |
diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c index 4ac4300a3f9a..7ec24e46b34b 100644 --- a/drivers/usb/wusbcore/devconnect.c +++ b/drivers/usb/wusbcore/devconnect.c | |||
@@ -88,6 +88,7 @@ | |||
88 | 88 | ||
89 | #include <linux/jiffies.h> | 89 | #include <linux/jiffies.h> |
90 | #include <linux/ctype.h> | 90 | #include <linux/ctype.h> |
91 | #include <linux/slab.h> | ||
91 | #include <linux/workqueue.h> | 92 | #include <linux/workqueue.h> |
92 | #include "wusbhc.h" | 93 | #include "wusbhc.h" |
93 | 94 | ||
@@ -119,10 +120,12 @@ static struct wusb_dev *wusb_dev_alloc(struct wusbhc *wusbhc) | |||
119 | urb = usb_alloc_urb(0, GFP_KERNEL); | 120 | urb = usb_alloc_urb(0, GFP_KERNEL); |
120 | if (urb == NULL) | 121 | if (urb == NULL) |
121 | goto err; | 122 | goto err; |
123 | wusb_dev->set_gtk_urb = urb; | ||
122 | 124 | ||
123 | req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | 125 | req = kmalloc(sizeof(*req), GFP_KERNEL); |
124 | if (req == NULL) | 126 | if (req == NULL) |
125 | goto err; | 127 | goto err; |
128 | wusb_dev->set_gtk_req = req; | ||
126 | 129 | ||
127 | req->bRequestType = USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE; | 130 | req->bRequestType = USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE; |
128 | req->bRequest = USB_REQ_SET_DESCRIPTOR; | 131 | req->bRequest = USB_REQ_SET_DESCRIPTOR; |
@@ -130,9 +133,6 @@ static struct wusb_dev *wusb_dev_alloc(struct wusbhc *wusbhc) | |||
130 | req->wIndex = 0; | 133 | req->wIndex = 0; |
131 | req->wLength = cpu_to_le16(wusbhc->gtk.descr.bLength); | 134 | req->wLength = cpu_to_le16(wusbhc->gtk.descr.bLength); |
132 | 135 | ||
133 | wusb_dev->set_gtk_urb = urb; | ||
134 | wusb_dev->set_gtk_req = req; | ||
135 | |||
136 | return wusb_dev; | 136 | return wusb_dev; |
137 | err: | 137 | err: |
138 | wusb_dev_free(wusb_dev); | 138 | wusb_dev_free(wusb_dev); |
@@ -438,7 +438,7 @@ static void __wusbhc_keep_alive(struct wusbhc *wusbhc) | |||
438 | old_keep_alives = ie->hdr.bLength - sizeof(ie->hdr); | 438 | old_keep_alives = ie->hdr.bLength - sizeof(ie->hdr); |
439 | keep_alives = 0; | 439 | keep_alives = 0; |
440 | for (cnt = 0; | 440 | for (cnt = 0; |
441 | keep_alives <= WUIE_ELT_MAX && cnt < wusbhc->ports_max; | 441 | keep_alives < WUIE_ELT_MAX && cnt < wusbhc->ports_max; |
442 | cnt++) { | 442 | cnt++) { |
443 | unsigned tt = msecs_to_jiffies(wusbhc->trust_timeout); | 443 | unsigned tt = msecs_to_jiffies(wusbhc->trust_timeout); |
444 | 444 | ||
@@ -869,7 +869,7 @@ static struct usb_wireless_cap_descriptor wusb_cap_descr_default = { | |||
869 | * reference that we'll drop. | 869 | * reference that we'll drop. |
870 | * | 870 | * |
871 | * First we need to determine if the device is a WUSB device (else we | 871 | * First we need to determine if the device is a WUSB device (else we |
872 | * ignore it). For that we use the speed setting (USB_SPEED_VARIABLE) | 872 | * ignore it). For that we use the speed setting (USB_SPEED_WIRELESS) |
873 | * [FIXME: maybe we'd need something more definitive]. If so, we track | 873 | * [FIXME: maybe we'd need something more definitive]. If so, we track |
874 | * it's usb_busd and from there, the WUSB HC. | 874 | * it's usb_busd and from there, the WUSB HC. |
875 | * | 875 | * |
diff --git a/drivers/usb/wusbcore/mmc.c b/drivers/usb/wusbcore/mmc.c index 3b52161e6e9c..0a57ff0a0b0c 100644 --- a/drivers/usb/wusbcore/mmc.c +++ b/drivers/usb/wusbcore/mmc.c | |||
@@ -37,6 +37,7 @@ | |||
37 | * - add timers that autoremove intervalled IEs? | 37 | * - add timers that autoremove intervalled IEs? |
38 | */ | 38 | */ |
39 | #include <linux/usb/wusb.h> | 39 | #include <linux/usb/wusb.h> |
40 | #include <linux/slab.h> | ||
40 | #include "wusbhc.h" | 41 | #include "wusbhc.h" |
41 | 42 | ||
42 | /* Initialize the MMCIEs handling mechanism */ | 43 | /* Initialize the MMCIEs handling mechanism */ |
@@ -263,7 +264,7 @@ int wusbhc_chid_set(struct wusbhc *wusbhc, const struct wusb_ckhdid *chid) | |||
263 | { | 264 | { |
264 | int result = 0; | 265 | int result = 0; |
265 | 266 | ||
266 | if (memcmp(chid, &wusb_ckhdid_zero, sizeof(chid)) == 0) | 267 | if (memcmp(chid, &wusb_ckhdid_zero, sizeof(*chid)) == 0) |
267 | chid = NULL; | 268 | chid = NULL; |
268 | 269 | ||
269 | mutex_lock(&wusbhc->mutex); | 270 | mutex_lock(&wusbhc->mutex); |
diff --git a/drivers/usb/wusbcore/rh.c b/drivers/usb/wusbcore/rh.c index 9fe4246cecb9..a68ad7aa0b59 100644 --- a/drivers/usb/wusbcore/rh.c +++ b/drivers/usb/wusbcore/rh.c | |||
@@ -69,6 +69,7 @@ | |||
69 | * | 69 | * |
70 | * wusbhc_rh_start_port_reset() ??? unimplemented | 70 | * wusbhc_rh_start_port_reset() ??? unimplemented |
71 | */ | 71 | */ |
72 | #include <linux/slab.h> | ||
72 | #include "wusbhc.h" | 73 | #include "wusbhc.h" |
73 | 74 | ||
74 | /* | 75 | /* |
diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c index 4516c36436e6..b60799b811c1 100644 --- a/drivers/usb/wusbcore/security.c +++ b/drivers/usb/wusbcore/security.c | |||
@@ -23,6 +23,7 @@ | |||
23 | * FIXME: docs | 23 | * FIXME: docs |
24 | */ | 24 | */ |
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/slab.h> | ||
26 | #include <linux/usb/ch9.h> | 27 | #include <linux/usb/ch9.h> |
27 | #include <linux/random.h> | 28 | #include <linux/random.h> |
28 | #include "wusbhc.h" | 29 | #include "wusbhc.h" |
@@ -205,15 +206,15 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc, | |||
205 | const void *itr, *top; | 206 | const void *itr, *top; |
206 | char buf[64]; | 207 | char buf[64]; |
207 | 208 | ||
208 | secd = kmalloc(sizeof(struct usb_security_descriptor), GFP_KERNEL); | 209 | secd = kmalloc(sizeof(*secd), GFP_KERNEL); |
209 | if (secd == NULL) { | 210 | if (secd == NULL) { |
210 | result = -ENOMEM; | 211 | result = -ENOMEM; |
211 | goto out; | 212 | goto out; |
212 | } | 213 | } |
213 | 214 | ||
214 | result = usb_get_descriptor(usb_dev, USB_DT_SECURITY, | 215 | result = usb_get_descriptor(usb_dev, USB_DT_SECURITY, |
215 | 0, secd, sizeof(struct usb_security_descriptor)); | 216 | 0, secd, sizeof(*secd)); |
216 | if (result < sizeof(secd)) { | 217 | if (result < sizeof(*secd)) { |
217 | dev_err(dev, "Can't read security descriptor or " | 218 | dev_err(dev, "Can't read security descriptor or " |
218 | "not enough data: %d\n", result); | 219 | "not enough data: %d\n", result); |
219 | goto out; | 220 | goto out; |
diff --git a/drivers/usb/wusbcore/wa-hc.c b/drivers/usb/wusbcore/wa-hc.c index 9d04722415bb..59a748a0e5da 100644 --- a/drivers/usb/wusbcore/wa-hc.c +++ b/drivers/usb/wusbcore/wa-hc.c | |||
@@ -22,6 +22,7 @@ | |||
22 | * | 22 | * |
23 | * FIXME: docs | 23 | * FIXME: docs |
24 | */ | 24 | */ |
25 | #include <linux/slab.h> | ||
25 | #include "wusbhc.h" | 26 | #include "wusbhc.h" |
26 | #include "wa-hc.h" | 27 | #include "wa-hc.h" |
27 | 28 | ||
diff --git a/drivers/usb/wusbcore/wa-nep.c b/drivers/usb/wusbcore/wa-nep.c index 17d2626038be..f67f7f1e6df9 100644 --- a/drivers/usb/wusbcore/wa-nep.c +++ b/drivers/usb/wusbcore/wa-nep.c | |||
@@ -51,6 +51,7 @@ | |||
51 | */ | 51 | */ |
52 | #include <linux/workqueue.h> | 52 | #include <linux/workqueue.h> |
53 | #include <linux/ctype.h> | 53 | #include <linux/ctype.h> |
54 | #include <linux/slab.h> | ||
54 | 55 | ||
55 | #include "wa-hc.h" | 56 | #include "wa-hc.h" |
56 | #include "wusbhc.h" | 57 | #include "wusbhc.h" |
diff --git a/drivers/usb/wusbcore/wa-rpipe.c b/drivers/usb/wusbcore/wa-rpipe.c index 7369655f69cd..c7b1d8108de9 100644 --- a/drivers/usb/wusbcore/wa-rpipe.c +++ b/drivers/usb/wusbcore/wa-rpipe.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <linux/init.h> | 60 | #include <linux/init.h> |
61 | #include <asm/atomic.h> | 61 | #include <asm/atomic.h> |
62 | #include <linux/bitmap.h> | 62 | #include <linux/bitmap.h> |
63 | #include <linux/slab.h> | ||
63 | 64 | ||
64 | #include "wusbhc.h" | 65 | #include "wusbhc.h" |
65 | #include "wa-hc.h" | 66 | #include "wa-hc.h" |
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c index 613a5fc490d3..112ef7e26f6b 100644 --- a/drivers/usb/wusbcore/wa-xfer.c +++ b/drivers/usb/wusbcore/wa-xfer.c | |||
@@ -81,6 +81,7 @@ | |||
81 | */ | 81 | */ |
82 | #include <linux/init.h> | 82 | #include <linux/init.h> |
83 | #include <linux/spinlock.h> | 83 | #include <linux/spinlock.h> |
84 | #include <linux/slab.h> | ||
84 | #include <linux/hash.h> | 85 | #include <linux/hash.h> |
85 | 86 | ||
86 | #include "wa-hc.h" | 87 | #include "wa-hc.h" |
@@ -558,7 +559,7 @@ static void wa_seg_dto_cb(struct urb *urb) | |||
558 | /* | 559 | /* |
559 | * Callback for the segment request | 560 | * Callback for the segment request |
560 | * | 561 | * |
561 | * If succesful transition state (unless already transitioned or | 562 | * If successful transition state (unless already transitioned or |
562 | * outbound transfer); otherwise, take a note of the error, mark this | 563 | * outbound transfer); otherwise, take a note of the error, mark this |
563 | * segment done and try completion. | 564 | * segment done and try completion. |
564 | * | 565 | * |
@@ -1364,7 +1365,7 @@ segment_aborted: | |||
1364 | /* | 1365 | /* |
1365 | * Callback for the IN data phase | 1366 | * Callback for the IN data phase |
1366 | * | 1367 | * |
1367 | * If succesful transition state; otherwise, take a note of the | 1368 | * If successful transition state; otherwise, take a note of the |
1368 | * error, mark this segment done and try completion. | 1369 | * error, mark this segment done and try completion. |
1369 | * | 1370 | * |
1370 | * Note we don't access until we are sure that the transfer hasn't | 1371 | * Note we don't access until we are sure that the transfer hasn't |
diff --git a/drivers/usb/wusbcore/wusbhc.c b/drivers/usb/wusbcore/wusbhc.c index ee6256f23636..eab86e4bc770 100644 --- a/drivers/usb/wusbcore/wusbhc.c +++ b/drivers/usb/wusbcore/wusbhc.c | |||
@@ -147,10 +147,40 @@ static ssize_t wusb_chid_store(struct device *dev, | |||
147 | } | 147 | } |
148 | static DEVICE_ATTR(wusb_chid, 0644, wusb_chid_show, wusb_chid_store); | 148 | static DEVICE_ATTR(wusb_chid, 0644, wusb_chid_show, wusb_chid_store); |
149 | 149 | ||
150 | |||
151 | static ssize_t wusb_phy_rate_show(struct device *dev, | ||
152 | struct device_attribute *attr, | ||
153 | char *buf) | ||
154 | { | ||
155 | struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev); | ||
156 | |||
157 | return sprintf(buf, "%d\n", wusbhc->phy_rate); | ||
158 | } | ||
159 | |||
160 | static ssize_t wusb_phy_rate_store(struct device *dev, | ||
161 | struct device_attribute *attr, | ||
162 | const char *buf, size_t size) | ||
163 | { | ||
164 | struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev); | ||
165 | uint8_t phy_rate; | ||
166 | ssize_t result; | ||
167 | |||
168 | result = sscanf(buf, "%hhu", &phy_rate); | ||
169 | if (result != 1) | ||
170 | return -EINVAL; | ||
171 | if (phy_rate >= UWB_PHY_RATE_INVALID) | ||
172 | return -EINVAL; | ||
173 | |||
174 | wusbhc->phy_rate = phy_rate; | ||
175 | return size; | ||
176 | } | ||
177 | static DEVICE_ATTR(wusb_phy_rate, 0644, wusb_phy_rate_show, wusb_phy_rate_store); | ||
178 | |||
150 | /* Group all the WUSBHC attributes */ | 179 | /* Group all the WUSBHC attributes */ |
151 | static struct attribute *wusbhc_attrs[] = { | 180 | static struct attribute *wusbhc_attrs[] = { |
152 | &dev_attr_wusb_trust_timeout.attr, | 181 | &dev_attr_wusb_trust_timeout.attr, |
153 | &dev_attr_wusb_chid.attr, | 182 | &dev_attr_wusb_chid.attr, |
183 | &dev_attr_wusb_phy_rate.attr, | ||
154 | NULL, | 184 | NULL, |
155 | }; | 185 | }; |
156 | 186 | ||
@@ -177,6 +207,8 @@ int wusbhc_create(struct wusbhc *wusbhc) | |||
177 | int result = 0; | 207 | int result = 0; |
178 | 208 | ||
179 | wusbhc->trust_timeout = WUSB_TRUST_TIMEOUT_MS; | 209 | wusbhc->trust_timeout = WUSB_TRUST_TIMEOUT_MS; |
210 | wusbhc->phy_rate = UWB_PHY_RATE_INVALID - 1; | ||
211 | |||
180 | mutex_init(&wusbhc->mutex); | 212 | mutex_init(&wusbhc->mutex); |
181 | result = wusbhc_mmcie_create(wusbhc); | 213 | result = wusbhc_mmcie_create(wusbhc); |
182 | if (result < 0) | 214 | if (result < 0) |
diff --git a/drivers/usb/wusbcore/wusbhc.h b/drivers/usb/wusbcore/wusbhc.h index 797c2453a35b..759cda55f7c3 100644 --- a/drivers/usb/wusbcore/wusbhc.h +++ b/drivers/usb/wusbcore/wusbhc.h | |||
@@ -198,7 +198,7 @@ struct wusb_port { | |||
198 | * ports) this HC will take. Read-only. | 198 | * ports) this HC will take. Read-only. |
199 | * | 199 | * |
200 | * @port Array of port status for each fake root port. Guaranteed to | 200 | * @port Array of port status for each fake root port. Guaranteed to |
201 | * always be the same lenght during device existence | 201 | * always be the same length during device existence |
202 | * [this allows for some unlocked but referenced reading]. | 202 | * [this allows for some unlocked but referenced reading]. |
203 | * | 203 | * |
204 | * @mmcies_max Max number of Information Elements this HC can send | 204 | * @mmcies_max Max number of Information Elements this HC can send |
@@ -253,6 +253,7 @@ struct wusbhc { | |||
253 | 253 | ||
254 | unsigned trust_timeout; /* in jiffies */ | 254 | unsigned trust_timeout; /* in jiffies */ |
255 | struct wusb_ckhdid chid; | 255 | struct wusb_ckhdid chid; |
256 | uint8_t phy_rate; | ||
256 | struct wuie_host_info *wuie_host_info; | 257 | struct wuie_host_info *wuie_host_info; |
257 | 258 | ||
258 | struct mutex mutex; /* locks everything else */ | 259 | struct mutex mutex; /* locks everything else */ |