/* Note: this function is invoked from the scsi mid-level. This function potentially frees up a device name (e.g. /dev/sdc) that could be re-used by a subsequent sd_probe(). This function is not called when the built-in sd driver is "exit-ed".  */
static int sd_remove(struct device *)
/* Note: this function is invoked from the scsi mid-level. This function potentially frees up a device name (e.g. /dev/sdc) that could be re-used by a subsequent sd_probe(). This function is not called when the built-in sd driver is "exit-ed".  */
static int sd_remove(struct device *)
{
	struct scsi_disk *sdkp;
	async_synchronize_full();
	sdkp = dev_get_drvdata(dev);
	blk_queue_prep_rq(sdkp->device->request_queue, scsi_prep_fn);
	device_del(&sdkp->dev);
	del_gendisk(sdkp->disk);
	sd_shutdown(dev);
	mutex_lock(&sd_ref_mutex);
	dev_set_drvdata(dev, NULL);
	put_device(&sdkp->dev);
	mutex_unlock(&sd_ref_mutex);
	return 0;
}