Commit 8433a509 authored by Nishanth Aravamudan's avatar Nishanth Aravamudan Committed by Jaroslav Kysela
Browse files

[ALSA] Fix schedule_timeout usage



Use schedule_timeout_{,un}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.  Also use
human-time conversion functions instead of hard-coded division to avoid
rounding issues.

Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d78bec21
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -109,8 +109,7 @@ void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr)
			spin_lock_irqsave(&list->lock, flags);
			while (instr->use) {
				spin_unlock_irqrestore(&list->lock, flags);
				set_current_state(TASK_INTERRUPTIBLE);
				schedule_timeout(1);
				schedule_timeout_interruptible(1);
				spin_lock_irqsave(&list->lock, flags);
			}				
			spin_unlock_irqrestore(&list->lock, flags);
@@ -199,10 +198,8 @@ int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list,
		while (flist) {
			instr = flist;
			flist = instr->next;
			while (instr->use) {
				set_current_state(TASK_INTERRUPTIBLE);
				schedule_timeout(1);
			}				
			while (instr->use)
				schedule_timeout_interruptible(1);
			if (snd_seq_instr_free(instr, atomic)<0)
				snd_printk(KERN_WARNING "instrument free problem\n");
			instr = next;
@@ -554,8 +551,7 @@ static int instr_free(snd_seq_kinstr_ops_t *ops,
			instr->ops->notify(instr->ops->private_data, instr, SNDRV_SEQ_INSTR_NOTIFY_REMOVE);
		while (instr->use) {
			spin_unlock_irqrestore(&list->lock, flags);
			set_current_state(TASK_INTERRUPTIBLE);
			schedule_timeout(1);
			schedule_timeout_interruptible(1);
			spin_lock_irqsave(&list->lock, flags);
		}				
		spin_unlock_irqrestore(&list->lock, flags);
+1 −2
Original line number Diff line number Diff line
@@ -39,8 +39,7 @@ void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
			snd_printk(KERN_WARNING "seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line);
			break;
		}
		set_current_state(TASK_UNINTERRUPTIBLE);
		schedule_timeout(1);
		schedule_timeout_uninterruptible(1);
		max_count--;
	}
}
+1 −2
Original line number Diff line number Diff line
@@ -423,8 +423,7 @@ int snd_seq_pool_done(pool_t *pool)
			snd_printk(KERN_WARNING "snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter));
			break;
		}
		set_current_state(TASK_UNINTERRUPTIBLE);
		schedule_timeout(1);
		schedule_timeout_uninterruptible(1);
		max_count--;
	}
	
+1 −2
Original line number Diff line number Diff line
@@ -302,8 +302,7 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427)
		snd_i2c_unlock(cs8427->bus);
		if (!(data & CS8427_UNLOCK))
			break;
		set_current_state(TASK_UNINTERRUPTIBLE);
		schedule_timeout(1);
		schedule_timeout_uninterruptible(1);
	}
	snd_i2c_lock(cs8427->bus);
	chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK;
+2 −4
Original line number Diff line number Diff line
@@ -243,8 +243,7 @@ static void snd_ad1848_mce_down(ad1848_t *chip)
			snd_printk(KERN_ERR "mce_down - auto calibration time out (2)\n");
			return;
		}
		set_current_state(TASK_INTERRUPTIBLE);
		time = schedule_timeout(time);
		time = schedule_timeout_interruptible(time);
		spin_lock_irqsave(&chip->reg_lock, flags);
	}
#if 0
@@ -257,8 +256,7 @@ static void snd_ad1848_mce_down(ad1848_t *chip)
			snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n");
			return;
		}
		set_current_state(TASK_INTERRUPTIBLE);
		time = schedule_timeout(time);
		time = schedule_timeout_interruptible(time);
		spin_lock_irqsave(&chip->reg_lock, flags);
	}
	spin_unlock_irqrestore(&chip->reg_lock, flags);
Loading