Re: "Safely remove hardware" for USB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Montag, 28. September 2009 08:19:57 schrieb Alan Stern:
> + * After @udev's port has been disabled, khubd is notified and it will
> + * see that the device has been disconnected.  When the device is
> + * physically unplugged and something is plugged in, the events will
> + * be received and processed normally.
> + */
> +int usb_remove_device(struct usb_device *udev)
> +{
> +       struct usb_hub *hub;
> +       struct usb_interface *intf;
> +
> +       if (!udev->parent)      /* Can't remove a root hub */
> +               return -EINVAL;
> +       hub = hdev_to_hub(udev->parent);
> +       intf = to_usb_interface(hub->intfdev);
> +
> +       usb_autopm_get_interface(intf);
> +       set_bit(udev->portnum, hub->removed_bits);
> +       hub_port_logical_disconnect(hub, udev->portnum);
> +       usb_autopm_put_interface(intf);

Wouldn't it be better if the device were removed in a suspended state
so buffers on storage devices could be flushed?

	Regards
		Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux