/* Return value: 0 for success or error number otherwise.  */
int hpsb_read_cycle_timer(struct hpsb_host *host, u32 *cycle_timer, u64 *local_time)
/* Return value: 0 for success or error number otherwise.  */
int hpsb_read_cycle_timer(struct hpsb_host *host, u32 *cycle_timer, u64 *local_time)
{
	int ctr;
	struct timeval tv;
	unsigned long flags;
	if (!host || !cycle_timer || !local_time)
		return -EINVAL;
	preempt_disable();
	local_irq_save(flags);
	ctr = host->driver->devctl(host, GET_CYCLE_COUNTER, 0);
	if (ctr)
		do_gettimeofday(&tv);
	local_irq_restore(flags);
	preempt_enable();
	if (!ctr)
		return -EIO;
	*cycle_timer = ctr;
	*local_time = tv.tv_sec * 1000000ULL + tv.tv_usec;
	return 0;
}