/* Writing a 0 deauthorizes the device, writing a 1 authorizes it.  */
static ssize_t usb_dev_authorized_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
/* Writing a 0 deauthorizes the device, writing a 1 authorizes it.  */
static ssize_t usb_dev_authorized_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
{
	ssize_t result;
	struct usb_device *usb_dev = to_usb_device(dev);
	unsigned val;
	result = sscanf(buf, "%u\n", &val);
	if (result != 1)
		result = -EINVAL;
	else if (val == 0)
		result = usb_deauthorize_device(usb_dev);
	else
		result = usb_authorize_device(usb_dev);
	return result < 0? result : size;
}