/* This procedure runs as a kernel thread to poll the media bay once each tick and register and unregister the IDE interface with the IDE driver. It needs to be a thread because ide_register can't be called from interrupt context.  */
static int media_bay_task(void *x)
/* This procedure runs as a kernel thread to poll the media bay once each tick and register and unregister the IDE interface with the IDE driver. It needs to be a thread because ide_register can't be called from interrupt context.  */
static int media_bay_task(void *x)
{
	int	i;
	while (!kthread_should_stop()) {
		for (i = 0; i < media_bay_count; ++i) {
			mutex_lock(&media_bays[i].lock);
			if (!media_bays[i].sleeping)
				media_bay_step(i);
			mutex_unlock(&media_bays[i].lock);
		}
		msleep_interruptible(MB_POLL_DELAY);
	}
	return 0;
}