mirror of https://gitee.com/openkylin/linux.git
WUSB: correct format of wusb_chid sysfs file
Make the wusb_chid sysfs file match the ABI documentation. Print all zeros if the WUSB host is stopped (instead of an empty file) and end the file with a newline. Signed-off-by: David Vrabel <david.vrabel@csr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
5936ac7f93
commit
fca10c81d9
|
@ -88,33 +88,31 @@ static DEVICE_ATTR(wusb_trust_timeout, 0644, wusb_trust_timeout_show,
|
||||||
wusb_trust_timeout_store);
|
wusb_trust_timeout_store);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show & store the current WUSB CHID
|
* Show the current WUSB CHID.
|
||||||
*/
|
*/
|
||||||
static ssize_t wusb_chid_show(struct device *dev,
|
static ssize_t wusb_chid_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
|
struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
|
||||||
|
const struct wusb_ckhdid *chid;
|
||||||
ssize_t result = 0;
|
ssize_t result = 0;
|
||||||
|
|
||||||
if (wusbhc->wuie_host_info != NULL)
|
if (wusbhc->wuie_host_info != NULL)
|
||||||
result += ckhdid_printf(buf, PAGE_SIZE,
|
chid = &wusbhc->wuie_host_info->CHID;
|
||||||
&wusbhc->wuie_host_info->CHID);
|
else
|
||||||
|
chid = &wusb_ckhdid_zero;
|
||||||
|
|
||||||
|
result += ckhdid_printf(buf, PAGE_SIZE, chid);
|
||||||
|
result += sprintf(buf + result, "\n");
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Store a new CHID
|
* Store a new CHID.
|
||||||
*
|
*
|
||||||
* This will (FIXME) trigger many changes.
|
* - Write an all zeros CHID and it will stop the controller
|
||||||
*
|
* - Write a non-zero CHID and it will start it.
|
||||||
* - Send an all zeros CHID and it will stop the controller
|
|
||||||
* - Send a non-zero CHID and it will start it
|
|
||||||
* (unless it was started, it will just change the CHID,
|
|
||||||
* diconnecting all devices first).
|
|
||||||
*
|
|
||||||
* So first we scan the MMC we are sent and then we act on it. We
|
|
||||||
* read it in the same format as we print it, an ASCII string of 16
|
|
||||||
* hex bytes.
|
|
||||||
*
|
*
|
||||||
* See wusbhc_chid_set() for more info.
|
* See wusbhc_chid_set() for more info.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue