summaryrefslogtreecommitdiffstats
path: root/drivers/usb/wusbcore/wusbhc.c
diff options
context:
space:
mode:
authorThomas Pugliese <thomas.pugliese@gmail.com>2013-06-18 13:31:26 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-24 16:19:02 -0700
commitf265d4d3c2c36e4a35a604593dc8f2905581008f (patch)
tree410fa5a93a4a0bba8a239c2a37843049779fb4d9 /drivers/usb/wusbcore/wusbhc.c
parent8bf1d0712d54bcb7c55b3f03b2c1a2f6fdfa6536 (diff)
downloadlinux-f265d4d3c2c36e4a35a604593dc8f2905581008f.tar.gz
linux-f265d4d3c2c36e4a35a604593dc8f2905581008f.tar.bz2
linux-f265d4d3c2c36e4a35a604593dc8f2905581008f.zip
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/wusbhc.c')
-rw-r--r--drivers/usb/wusbcore/wusbhc.c31
1 files changed, 31 insertions, 0 deletions
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,
}
static DEVICE_ATTR(wusb_dnts, 0644, wusb_dnts_show, wusb_dnts_store);
+static ssize_t wusb_retry_count_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
+
+ return sprintf(buf, "%d\n", wusbhc->retry_count);
+}
+
+static ssize_t wusb_retry_count_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t size)
+{
+ struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
+ uint8_t retry_count;
+ ssize_t result;
+
+ result = sscanf(buf, "%hhu", &retry_count);
+
+ if (result != 1)
+ return -EINVAL;
+
+ wusbhc->retry_count = max_t(uint8_t, retry_count, WUSB_RETRY_COUNT_MAX);
+
+ return size;
+}
+static DEVICE_ATTR(wusb_retry_count, 0644, wusb_retry_count_show,
+ wusb_retry_count_store);
+
/* Group all the WUSBHC attributes */
static struct attribute *wusbhc_attrs[] = {
&dev_attr_wusb_trust_timeout.attr,
&dev_attr_wusb_chid.attr,
&dev_attr_wusb_phy_rate.attr,
&dev_attr_wusb_dnts.attr,
+ &dev_attr_wusb_retry_count.attr,
NULL,
};
@@ -241,6 +271,7 @@ int wusbhc_create(struct wusbhc *wusbhc)
wusbhc->phy_rate = UWB_PHY_RATE_INVALID - 1;
wusbhc->dnts_num_slots = 4;
wusbhc->dnts_interval = 2;
+ wusbhc->retry_count = WUSB_RETRY_COUNT_INFINITE;
mutex_init(&wusbhc->mutex);
result = wusbhc_mmcie_create(wusbhc);