/* * drivers/s390/cio/device_fsm.c * finite state machine for device handling * * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation * Author(s): Cornelia Huck (cornelia.huck@de.ibm.com) * Martin Schwidefsky (schwidefsky@de.ibm.com) */#include<linux/module.h>#include<linux/init.h>#include<linux/jiffies.h>#include<linux/string.h>#include<asm/ccwdev.h>#include<asm/cio.h>#include"cio.h"#include"cio_debug.h"#include"css.h"#include"device.h"#include"chsc.h"#include"ioasm.h"intdevice_is_online(structsubchannel*sch){structccw_device*cdev;if(!sch->dev.driver_data)return0;cdev=sch->dev.driver_data;return(cdev->private->state==DEV_STATE_ONLINE);}intdevice_is_disconnected(structsubchannel*sch){structccw_device*cdev;if(!sch->dev.driver_data)return0;cdev=sch->dev.driver_data;return(cdev->private->state==DEV_STATE_DISCONNECTED||cdev->private->state==DEV_STATE_DISCONNECTED_SENSE_ID);}voiddevice_set_disconnected(structsubchannel*sch){structccw_device*cdev;if(!sch->dev.driver_data)return;cdev=sch->dev.driver_data;ccw_device_set_timeout(cdev,0);cdev->private->flags.fake_irb=0;cdev->private->state=DEV_STATE_DISCONNECTED;}voiddevice_set_waiting(structsubchannel*sch){structccw_device*cdev;if(!sch->dev.driver_data)return;cdev=sch->dev.driver_data;ccw_device_set_timeout(cdev,10*HZ);cdev->private->state=DEV_STATE_WAIT4IO;}/* * Timeout function. It just triggers a DEV_EVENT_TIMEOUT. */staticvoidccw_device_timeout(unsignedlongdata){structccw_device*cdev;cdev=(structccw_device*)data;spin_lock_irq(