https://github.com/torvalds/linux
Revision 86f40cc3c994822ffeb226753526d87be21bd79a authored by Andrew de Quincey on 30 March 2006, 18:53:35 UTC, committed by Mauro Carvalho Chehab on 02 April 2006, 07:56:02 UTC
Unfortunately on the budget-av board, the CAM reset line is tied to the
frontend reset line, so resetting the CAM also zaps the frontend. This
breaks the tda1004x at least, and causes it to fail to tune until the
budget-av module is reloaded. This patch adds an exported function to dvb_frontend
that allows a card to forcibly reinitialise a frontend. The budget-av now
does this on CAM reset, which corrects this problem.
since they do not tie the CAM reset line to the frontend reset line.

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
1 parent 5e85bd0
Raw File
Tip revision: 86f40cc3c994822ffeb226753526d87be21bd79a authored by Andrew de Quincey on 30 March 2006, 18:53:35 UTC
V4L/DVB (3673): Fix budget-av CAM reset
Tip revision: 86f40cc
dec_and_lock.c
#include <linux/module.h>
#include <linux/spinlock.h>
#include <asm/atomic.h>

/*
 * This is an implementation of the notion of "decrement a
 * reference count, and return locked if it decremented to zero".
 *
 * NOTE NOTE NOTE! This is _not_ equivalent to
 *
 *	if (atomic_dec_and_test(&atomic)) {
 *		spin_lock(&lock);
 *		return 1;
 *	}
 *	return 0;
 *
 * because the spin-lock and the decrement must be
 * "atomic".
 */
int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)
{
#ifdef CONFIG_SMP
	/* Subtract 1 from counter unless that drops it to 0 (ie. it was 1) */
	if (atomic_add_unless(atomic, -1, 1))
		return 0;
#endif
	/* Otherwise do it the slow way */
	spin_lock(lock);
	if (atomic_dec_and_test(atomic))
		return 1;
	spin_unlock(lock);
	return 0;
}

EXPORT_SYMBOL(_atomic_dec_and_lock);
back to top