On Mon, 28 Sep 2009, Oliver Neukum wrote: > 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? That is a userspace detail. The intended mode of operation is that a program like "eject" will first unmount all filesystems on the device and unbind usb-storage (causing buffers to be flushed), and then write to the "remove" attribute. Alan Stern -- 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