/* We share a lock (that we have) with device_del(), so we need to defer its call.  */
int usb_deauthorize_device(struct usb_device *usb_dev)
/* We share a lock (that we have) with device_del(), so we need to defer its call.  */
int usb_deauthorize_device(struct usb_device *usb_dev)
{
	usb_lock_device(usb_dev);
	if (usb_dev->authorized == 0)
		goto out_unauthorized;
	usb_dev->authorized = 0;
	usb_set_configuration(usb_dev, -1);
	kfree(usb_dev->product);
	usb_dev->product = kstrdup("n/a (unauthorized)", GFP_KERNEL);
	kfree(usb_dev->manufacturer);
	usb_dev->manufacturer = kstrdup("n/a (unauthorized)", GFP_KERNEL);
	kfree(usb_dev->serial);
	usb_dev->serial = kstrdup("n/a (unauthorized)", GFP_KERNEL);
	usb_destroy_configuration(usb_dev);
	usb_dev->descriptor.bNumConfigurations = 0;
out_unauthorized:
	usb_unlock_device(usb_dev);
	return 0;
}