kernels/linux-2.4.0/kernel/pm.c
/**
 *	pm_send - send request to a single device
 *	@dev: device to send to
 *	@rqst: power management request
 *	@data: data for the callback
 *
 *	Issue a power management request to a given device. The 
 *	%PM_SUSPEND and %PM_RESUME events are handled specially. The
 *	data field must hold the intended next state. No call is made
 *	if the state matches.
 *
 *	BUGS: what stops two power management requests occuring in parallel
 *	and conflicting.
 */
send request to a single device
@dev: device to send to
@rqst: power management request
@data: data for the callback

Issue a power management request to a given device. The
%PM_SUSPEND and %PM_RESUME events are handled specially. The
data field must hold the intended next state. No call is made
if the state matches.


send request to a single device @dev : device to send to @rqst : power management request @data : data for the callback Issue a power management request to a given device . The %PM_SUSPEND and %PM_RESUME events are handled specially . The data field must hold the intended next state . No call is made if the state matches .
int pm_send(struct pm_dev *dev, pm_request_t rqst, void *data)
{
	int status = 0;
	int prev_state, next_state;
	switch (rqst) {
	case PM_SUSPEND:
	case PM_RESUME:
		prev_state = dev->state;
		next_state = (int) data;
		if (prev_state != next_state) {
			if (dev->callback)
				status = (*dev->callback)(dev, rqst, data);
			if (!status) {
				dev->state = next_state;
				dev->prev_state = prev_state;
			}
		}
		else {
			dev->prev_state = prev_state;
		}
		break;
	default:
		if (dev->callback)
			status = (*dev->callback)(dev, rqst, data);
		break;
	}
	return status;
}
int pm_send ( struct pm_dev * dev , pm_request_t rqst , void * data ) { int status = 0 ; int prev_state , next_state ; switch ( rqst ) { case PM_SUSPEND : case PM_RESUME : prev_state = dev -> state ; next_state = ( int ) data ; if ( prev_state != next_state ) { if ( dev -> callback ) status = ( * dev -> callback ) ( dev , rqst , data ) ; if ( ! status ) { dev -> state = next_state ; dev -> prev_state = prev_state ; } } else { dev -> prev_state = prev_state ; } break ; default : if ( dev -> callback ) status = ( * dev -> callback ) ( dev , rqst , data ) ; break ; } return status ; }
pm_send - send request to a single device
      @dev: device to send to
      @rqst: power management request
      @data: data for the callback
pm_send - send request to a single device @dev : device to send to @rqst : power management request @data : data for the callback