Ejemplo n.º 1
0
int parport_wait_event (struct parport *port, signed long timeout)
{
	int ret;
	struct timer_list timer;

	if (!port->physport->cad->timeout)
		/* Zero timeout is special, and we can't down() the
		   semaphore. */
		return 1;

	init_timer_on_stack(&timer);
	timer.expires = jiffies + timeout;
	timer.function = timeout_waiting_on_port;
	port_from_cookie[port->number % PARPORT_MAX] = port;
	timer.data = port->number;

	add_timer (&timer);
	ret = down_interruptible (&port->physport->ieee1284.irq);
	if (!del_timer_sync(&timer) && !ret)
		/* Timed out. */
		ret = 1;

	destroy_timer_on_stack(&timer);

	return ret;
}
Ejemplo n.º 2
0
static void edf_stop_account(resch_task_t *rt)
{
#ifdef NO_LINUX_LOAD_BALANCE
	del_timer_sync(&rt->expire_timer);
	destroy_timer_on_stack(&rt->expire_timer);
#else
	rt->task->signal->rlim[RLIMIT_RTTIME].rlim_cur = RLIM_INFINITY;
#endif
}
Ejemplo n.º 3
0
void pm_wd_del_timer(struct timer_list *timer)
{
	del_timer_sync(timer);
	destroy_timer_on_stack(timer);
}
Ejemplo n.º 4
0
SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
		size_t, count)
{
	struct file *file;
	ssize_t ret = -EBADF;
	int fput_needed;
#ifdef CONFIG_DIRTY_SYSTEM_DETECTOR
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
	struct mount *mnt;
#else
	struct vfsmount *mnt;
#endif
#endif

	file = fget_light(fd, &fput_needed);

#ifdef CONFIG_DIRTY_SYSTEM_DETECTOR
	
	
	if (!get_tamper_sf() && file != NULL) {
		
		if (board_mfg_mode() != 2
				&& strcmp("htcunzip", current->comm)) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
			mnt = real_mount(file->f_path.mnt);
#else
			mnt = file->f_path.mnt;
#endif
			if (!strcmp("system",  mnt->mnt_mountpoint->d_name.name)) {
				printk("%s to /system partition: file(%s)\n", __func__, file->f_path.dentry->d_name.name);
				mark_system_dirty(file->f_path.dentry->d_name.name);
			}
		}
	}
#endif
	if (file) {
#if defined(CONFIG_HTC_DEBUG_BINDER_WRITE)
		struct timer_list timer;
		int debug_write;
#endif
		loff_t pos = file_pos_read(file);

#if defined(CONFIG_HTC_DEBUG_BINDER_WRITE)
		debug_write = current_task_is_system_server_binder();
		if (debug_write) {
			init_timer_on_stack(&timer);
			timer.function = vfs_write_timeout;
			timer.expires = jiffies + HZ * WRITE_TIMEOUT_VALUE;
			timer.data = (unsigned long) current;
			add_timer(&timer);
		}
#endif

		ret = vfs_write(file, buf, count, &pos);

#if defined(CONFIG_HTC_DEBUG_BINDER_WRITE)
		if (debug_write) {
			del_timer_sync(&timer);
			destroy_timer_on_stack(&timer);
			if (ret < 0 && file && file->f_op) {
				pr_info("%s: %s (%d:%d) ret: %d, write: %pf, aio_write: %pf\n",
						__func__, current->comm, current->tgid, current->pid, ret,
						file->f_op->write, file->f_op->aio_write);
			}
		}
#endif

		file_pos_write(file, pos);
		fput_light(file, fput_needed);
	}

	return ret;
}