aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/wusbcore
diff options
context:
space:
mode:
authorThomas Pugliese <thomas.pugliese@gmail.com>2013-06-18 14:31:26 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-24 19:19:02 -0400
commitf265d4d3c2c36e4a35a604593dc8f2905581008f (patch)
tree410fa5a93a4a0bba8a239c2a37843049779fb4d9 /drivers/usb/wusbcore
parent8bf1d0712d54bcb7c55b3f03b2c1a2f6fdfa6536 (diff)
wusbcore: add sysfs attribute for retry count
This patch adds a sysfs attribute for the wireless host controller transaction retry count. It also changes the default value from 15 retries to infinite retries because the driver currently does not handle retry errors gracefully. Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/wusbcore')
-rw-r--r--drivers/usb/wusbcore/wa-rpipe.c3
-rw-r--r--drivers/usb/wusbcore/wusbhc.c31
-rw-r--r--drivers/usb/wusbcore/wusbhc.h3
3 files changed, 35 insertions, 2 deletions
diff --git a/drivers/usb/wusbcore/wa-rpipe.c b/drivers/usb/wusbcore/wa-rpipe.c
index 9429c12e4bfd..9a595c1ed867 100644
--- a/drivers/usb/wusbcore/wa-rpipe.c
+++ b/drivers/usb/wusbcore/wa-rpipe.c
@@ -367,8 +367,7 @@ static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa,
367 rpipe->descr.bmAttribute = (ep->desc.bmAttributes & 367 rpipe->descr.bmAttribute = (ep->desc.bmAttributes &
368 USB_ENDPOINT_XFERTYPE_MASK); 368 USB_ENDPOINT_XFERTYPE_MASK);
369 /* rpipe->descr.bmCharacteristics RO */ 369 /* rpipe->descr.bmCharacteristics RO */
370 /* FIXME: bmRetryOptions */ 370 rpipe->descr.bmRetryOptions = (wa->wusb->retry_count & 0xF);
371 rpipe->descr.bmRetryOptions = 15;
372 /* FIXME: use for assessing link quality? */ 371 /* FIXME: use for assessing link quality? */
373 rpipe->descr.wNumTransactionErrors = 0; 372 rpipe->descr.wNumTransactionErrors = 0;
374 result = __rpipe_set_descr(wa, &rpipe->descr, 373 result = __rpipe_set_descr(wa, &rpipe->descr,
diff --git a/drivers/usb/wusbcore/wusbhc.c b/drivers/usb/wusbcore/wusbhc.c
index 8759aa66da28..e712af3e46c2 100644
--- a/drivers/usb/wusbcore/wusbhc.c
+++ b/drivers/usb/wusbcore/wusbhc.c
@@ -205,12 +205,42 @@ static ssize_t wusb_dnts_store(struct device *dev,
205} 205}
206static DEVICE_ATTR(wusb_dnts, 0644, wusb_dnts_show, wusb_dnts_store); 206static DEVICE_ATTR(wusb_dnts, 0644, wusb_dnts_show, wusb_dnts_store);
207 207
208static ssize_t wusb_retry_count_show(struct device *dev,
209 struct device_attribute *attr,
210 char *buf)
211{
212 struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
213
214 return sprintf(buf, "%d\n", wusbhc->retry_count);
215}
216
217static ssize_t wusb_retry_count_store(struct device *dev,
218 struct device_attribute *attr,
219 const char *buf, size_t size)
220{
221 struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
222 uint8_t retry_count;
223 ssize_t result;
224
225 result = sscanf(buf, "%hhu", &retry_count);
226
227 if (result != 1)
228 return -EINVAL;
229
230 wusbhc->retry_count = max_t(uint8_t, retry_count, WUSB_RETRY_COUNT_MAX);
231
232 return size;
233}
234static DEVICE_ATTR(wusb_retry_count, 0644, wusb_retry_count_show,
235 wusb_retry_count_store);
236
208/* Group all the WUSBHC attributes */ 237/* Group all the WUSBHC attributes */
209static struct attribute *wusbhc_attrs[] = { 238static struct attribute *wusbhc_attrs[] = {
210 &dev_attr_wusb_trust_timeout.attr, 239 &dev_attr_wusb_trust_timeout.attr,
211 &dev_attr_wusb_chid.attr, 240 &dev_attr_wusb_chid.attr,
212 &dev_attr_wusb_phy_rate.attr, 241 &dev_attr_wusb_phy_rate.attr,
213 &dev_attr_wusb_dnts.attr, 242 &dev_attr_wusb_dnts.attr,
243 &dev_attr_wusb_retry_count.attr,
214 NULL, 244 NULL,
215}; 245};
216 246
@@ -241,6 +271,7 @@ int wusbhc_create(struct wusbhc *wusbhc)
241 wusbhc->phy_rate = UWB_PHY_RATE_INVALID - 1; 271 wusbhc->phy_rate = UWB_PHY_RATE_INVALID - 1;
242 wusbhc->dnts_num_slots = 4; 272 wusbhc->dnts_num_slots = 4;
243 wusbhc->dnts_interval = 2; 273 wusbhc->dnts_interval = 2;
274 wusbhc->retry_count = WUSB_RETRY_COUNT_INFINITE;
244 275
245 mutex_init(&wusbhc->mutex); 276 mutex_init(&wusbhc->mutex);
246 result = wusbhc_mmcie_create(wusbhc); 277 result = wusbhc_mmcie_create(wusbhc);
diff --git a/drivers/usb/wusbcore/wusbhc.h b/drivers/usb/wusbcore/wusbhc.h
index a7069f49c05a..711b1952b114 100644
--- a/drivers/usb/wusbcore/wusbhc.h
+++ b/drivers/usb/wusbcore/wusbhc.h
@@ -69,6 +69,8 @@
69 * zone 0. 69 * zone 0.
70 */ 70 */
71#define WUSB_CHANNEL_STOP_DELAY_MS 8 71#define WUSB_CHANNEL_STOP_DELAY_MS 8
72#define WUSB_RETRY_COUNT_MAX 15
73#define WUSB_RETRY_COUNT_INFINITE 0
72 74
73/** 75/**
74 * Wireless USB device 76 * Wireless USB device
@@ -254,6 +256,7 @@ struct wusbhc {
254 uint8_t phy_rate; 256 uint8_t phy_rate;
255 uint8_t dnts_num_slots; 257 uint8_t dnts_num_slots;
256 uint8_t dnts_interval; 258 uint8_t dnts_interval;
259 uint8_t retry_count;
257 struct wuie_host_info *wuie_host_info; 260 struct wuie_host_info *wuie_host_info;
258 261
259 struct mutex mutex; /* locks everything else */ 262 struct mutex mutex; /* locks everything else */