Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da4cd8df authored by Nishanth Aravamudan's avatar Nishanth Aravamudan Committed by Linus Torvalds
Browse files

[PATCH] drivers/char: fix-up schedule_timeout() usage



Use schedule_timeout_interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.

Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2ddee1b7
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -387,10 +387,8 @@ int fdc_interrupt_wait(unsigned int time)

	set_current_state(TASK_INTERRUPTIBLE);
	add_wait_queue(&ftape_wait_intr, &wait);
	while (!ft_interrupt_seen && timeout) {
		set_current_state(TASK_INTERRUPTIBLE);
		timeout = schedule_timeout(timeout);
        }
	while (!ft_interrupt_seen && timeout)
		timeout = schedule_timeout_interruptible(timeout);

	spin_lock_irq(&current->sighand->siglock);
	current->blocked = old_sigmask;
+1 −4
Original line number Diff line number Diff line
@@ -513,10 +513,7 @@ static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
			return ret ? : -EAGAIN;

		if(need_resched())
		{
			current->state = TASK_INTERRUPTIBLE;
			schedule_timeout(1);
		}
			schedule_timeout_interruptible(1);
		else
			udelay(200);	/* FIXME: We could poll for 250uS ?? */

+2 −4
Original line number Diff line number Diff line
@@ -655,8 +655,7 @@ i2QueueCommands(int type, i2ChanStrPtr pCh, int timeout, int nCommands,
			timeout--;   // So negative values == forever
		
		if (!in_interrupt()) {
			current->state = TASK_INTERRUPTIBLE;
			schedule_timeout(1);	// short nap 
			schedule_timeout_interruptible(1);	// short nap
		} else {
			// we cannot sched/sleep in interrrupt silly
			return 0;   
@@ -1132,8 +1131,7 @@ i2Output(i2ChanStrPtr pCh, const char *pSource, int count, int user )

					ip2trace (CHANN, ITRC_OUTPUT, 61, 0 );

					current->state = TASK_INTERRUPTIBLE;
					schedule_timeout(2);
					schedule_timeout_interruptible(2);
					if (signal_pending(current)) {
						break;
					}
+6 −12
Original line number Diff line number Diff line
@@ -1920,8 +1920,7 @@ static int try_get_dev_id(struct smi_info *smi_info)
	for (;;)
	{
		if (smi_result == SI_SM_CALL_WITH_DELAY) {
			set_current_state(TASK_UNINTERRUPTIBLE);
			schedule_timeout(1);
			schedule_timeout_uninterruptible(1);
			smi_result = smi_info->handlers->event(
				smi_info->si_sm, 100);
		}
@@ -2256,10 +2255,8 @@ static int init_one_smi(int intf_num, struct smi_info **smi)

	/* Wait for the timer to stop.  This avoids problems with race
	   conditions removing the timer here. */
	while (! new_smi->timer_stopped) {
		set_current_state(TASK_UNINTERRUPTIBLE);
		schedule_timeout(1);
	}
	while (!new_smi->timer_stopped)
		schedule_timeout_uninterruptible(1);

 out_err:
	if (new_smi->intf)
@@ -2379,17 +2376,14 @@ static void __exit cleanup_one_si(struct smi_info *to_clean)

	/* Wait for the timer to stop.  This avoids problems with race
	   conditions removing the timer here. */
	while (! to_clean->timer_stopped) {
		set_current_state(TASK_UNINTERRUPTIBLE);
		schedule_timeout(1);
	}
	while (!to_clean->timer_stopped)
		schedule_timeout_uninterruptible(1);

	/* Interrupts and timeouts are stopped, now make sure the
	   interface is in a clean state. */
	while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) {
		poll(to_clean);
		set_current_state(TASK_UNINTERRUPTIBLE);
		schedule_timeout(1);
		schedule_timeout_uninterruptible(1);
	}

	rv = ipmi_unregister_smi(to_clean->intf);
+2 −4
Original line number Diff line number Diff line
@@ -1037,10 +1037,8 @@ static __exit void ipmi_unregister_watchdog(void)
	/* Wait to make sure the message makes it out.  The lower layer has
	   pointers to our buffers, we want to make sure they are done before
	   we release our memory. */
	while (atomic_read(&set_timeout_tofree)) {
		set_current_state(TASK_UNINTERRUPTIBLE);
		schedule_timeout(1);
	}
	while (atomic_read(&set_timeout_tofree))
		schedule_timeout_uninterruptible(1);

	/* Disconnect from IPMI. */
	rv = ipmi_destroy_user(watchdog_user);
Loading