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

Commit 3b139cdb authored by David Howells's avatar David Howells
Browse files

Blackfin: Rename IRQ flags handling functions



Rename h/w IRQ flags handling functions to be in line with what is expected for
the irq renaming patch.  This renames local_*_hw() to hard_local_*() using the
following perl command:

	perl -pi -e 's/local_irq_(restore|enable|disable)_hw/hard_local_irq_\1/ or s/local_irq_save_hw([_a-z]*)[(]flags[)]/flags = hard_local_irq_save\1()/' `find arch/blackfin/ -name "*.[ch]"`

and then fixing up asm/irqflags.h manually.

Additionally, arch/hard_local_save_flags() and arch/hard_local_irq_save() both
return the flags rather than passing it through the argument list.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 5c74874b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@
#define prepare_arch_switch(next)		\
do {						\
	ipipe_schedule_notify(current, next);	\
	local_irq_disable_hw();			\
	hard_local_irq_disable();			\
} while (0)

#define task_hijacked(p)						\
@@ -57,7 +57,7 @@ do { \
		int __x__ = __ipipe_root_domain_p;			\
		__clear_bit(IPIPE_SYNC_FLAG, &ipipe_root_cpudom_var(status)); \
		if (__x__)						\
			local_irq_enable_hw();				\
			hard_local_irq_enable();				\
		!__x__;							\
	})

@@ -167,7 +167,7 @@ static inline unsigned long __ipipe_ffnz(unsigned long ul)
#define __ipipe_run_isr(ipd, irq)					\
	do {								\
		if (!__ipipe_pipeline_head_p(ipd))			\
			local_irq_enable_hw();				\
			hard_local_irq_enable();				\
		if (ipd == ipipe_root_domain) {				\
			if (unlikely(ipipe_virtual_irq_p(irq))) {	\
				irq_enter();				\
@@ -183,7 +183,7 @@ static inline unsigned long __ipipe_ffnz(unsigned long ul)
			__ipipe_run_irqtail();				\
			__set_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \
		}							\
		local_irq_disable_hw();					\
		hard_local_irq_disable();					\
	} while (0)

#define __ipipe_syscall_watched_p(p, sc)	\
+147 −137
Original line number Diff line number Diff line
@@ -33,191 +33,201 @@ static inline unsigned long bfin_cli(void)
	return flags;
}

#ifdef CONFIG_IPIPE

#include <linux/compiler.h>
#include <linux/ipipe_base.h>
#include <linux/ipipe_trace.h>

#ifdef CONFIG_DEBUG_HWERR
# define bfin_no_irqs 0x3f
#else
# define bfin_no_irqs 0x1f
#endif

#define raw_local_irq_disable()				\
	do {						\
		ipipe_check_context(ipipe_root_domain);	\
		__ipipe_stall_root();			\
		barrier();				\
	} while (0)

#define raw_local_irq_enable()				\
	do {						\
		barrier();				\
		ipipe_check_context(ipipe_root_domain);	\
		__ipipe_unstall_root();			\
	} while (0)
/*****************************************************************************/
/*
 * Hard, untraced CPU interrupt flag manipulation and access.
 */
static inline void __hard_local_irq_disable(void)
{
	bfin_cli();
}

#define raw_local_save_flags_ptr(x)					\
	do {								\
		*(x) = __ipipe_test_root() ? bfin_no_irqs : bfin_irq_flags; \
	} while (0)
static inline void __hard_local_irq_enable(void)
{
	bfin_sti(bfin_irq_flags);
}

#define raw_local_save_flags(x)		raw_local_save_flags_ptr(&(x))
static inline unsigned long hard_local_save_flags(void)
{
	return bfin_read_IMASK();
}

#define raw_irqs_disabled_flags(x)	((x) == bfin_no_irqs)
static inline unsigned long __hard_local_irq_save(void)
{
	unsigned long flags;
	flags = bfin_cli();
#ifdef CONFIG_DEBUG_HWERR
	bfin_sti(0x3f);
#endif
	return flags;
}

#define raw_local_irq_save_ptr(x)					\
	do {								\
		*(x) = __ipipe_test_and_stall_root() ? bfin_no_irqs : bfin_irq_flags; \
		barrier();						\
	} while (0)
static inline int hard_irqs_disabled_flags(unsigned long flags)
{
	return (flags & ~0x3f) == 0;
}

#define raw_local_irq_save(x)				\
	do {						\
		ipipe_check_context(ipipe_root_domain);	\
		raw_local_irq_save_ptr(&(x));		\
	} while (0)
static inline int hard_irqs_disabled(void)
{
	unsigned long flags = hard_local_save_flags();
	return hard_irqs_disabled_flags(flags);
}

static inline unsigned long raw_mangle_irq_bits(int virt, unsigned long real)
static inline void __hard_local_irq_restore(unsigned long flags)
{
	if (!hard_irqs_disabled_flags(flags))
		__hard_local_irq_enable();
}

/*****************************************************************************/
/*
	 * Merge virtual and real interrupt mask bits into a single
	 * 32bit word.
 * Interrupt pipe handling.
 */
	return (real & ~(1 << 31)) | ((virt != 0) << 31);
}
#ifdef CONFIG_IPIPE

#include <linux/compiler.h>
#include <linux/ipipe_base.h>
#include <linux/ipipe_trace.h>

static inline int raw_demangle_irq_bits(unsigned long *x)
/*
 * Interrupt pipe interface to linux/irqflags.h.
 */
static inline void arch_local_irq_disable(void)
{
	int virt = (*x & (1 << 31)) != 0;
	*x &= ~(1L << 31);
	return virt;
	ipipe_check_context(ipipe_root_domain);
	__ipipe_stall_root();
	barrier();
}

static inline void local_irq_disable_hw_notrace(void)
static inline void arch_local_irq_enable(void)
{
	bfin_cli();
	barrier();
	ipipe_check_context(ipipe_root_domain);
	__ipipe_unstall_root();
}

static inline void local_irq_enable_hw_notrace(void)
static inline unsigned long arch_local_save_flags(void)
{
	bfin_sti(bfin_irq_flags);
	return __ipipe_test_root() ? bfin_no_irqs : bfin_irq_flags;
}

#define local_save_flags_hw(flags)			\
	do {						\
		(flags) = bfin_read_IMASK();		\
	} while (0)

#define irqs_disabled_flags_hw(flags) (((flags) & ~0x3f) == 0)
static inline int arch_irqs_disabled_flags(unsigned long flags)
{
	return flags == bfin_no_irqs;
}

#define irqs_disabled_hw()			\
	({					\
	unsigned long flags;			\
	local_save_flags_hw(flags);		\
	irqs_disabled_flags_hw(flags);		\
	})
static inline void arch_local_irq_save_ptr(unsigned long *_flags)
{
	x = __ipipe_test_and_stall_root() ? bfin_no_irqs : bfin_irq_flags;
	barrier();
}

static inline void local_irq_save_ptr_hw(unsigned long *flags)
static inline unsigned long arch_local_irq_save(void)
{
	*flags = bfin_cli();
#ifdef CONFIG_DEBUG_HWERR
	bfin_sti(0x3f);
#endif
	ipipe_check_context(ipipe_root_domain);
	return __hard_local_irq_save();
}

#define local_irq_save_hw_notrace(flags)		\
	do {						\
		local_irq_save_ptr_hw(&(flags));	\
	} while (0)
static inline unsigned long arch_mangle_irq_bits(int virt, unsigned long real)
{
	/*
	 * Merge virtual and real interrupt mask bits into a single
	 * 32bit word.
	 */
	return (real & ~(1 << 31)) | ((virt != 0) << 31);
}

static inline void local_irq_restore_hw_notrace(unsigned long flags)
static inline int arch_demangle_irq_bits(unsigned long *x)
{
	if (!irqs_disabled_flags_hw(flags))
		local_irq_enable_hw_notrace();
	int virt = (*x & (1 << 31)) != 0;
	*x &= ~(1L << 31);
	return virt;
}

/*
 * Interface to various arch routines that may be traced.
 */
#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
# define local_irq_disable_hw()				\
	do {						\
		if (!irqs_disabled_hw()) {		\
			local_irq_disable_hw_notrace();	\
			ipipe_trace_begin(0x80000000);	\
		}					\
	} while (0)
# define local_irq_enable_hw()				\
	do {						\
		if (irqs_disabled_hw()) {		\
			ipipe_trace_end(0x80000000);	\
			local_irq_enable_hw_notrace();	\
		}					\
	} while (0)
# define local_irq_save_hw(flags)			\
	do {						\
		local_save_flags_hw(flags);		\
		if (!irqs_disabled_flags_hw(flags)) {	\
			local_irq_disable_hw_notrace();	\
			ipipe_trace_begin(0x80000001);	\
		}					\
	} while (0)
# define local_irq_restore_hw(flags)			\
	do {						\
		if (!irqs_disabled_flags_hw(flags)) {	\
			ipipe_trace_end(0x80000001);	\
			local_irq_enable_hw_notrace();	\
		}					\
	} while (0)
#else /* !CONFIG_IPIPE_TRACE_IRQSOFF */
# define local_irq_disable_hw()		local_irq_disable_hw_notrace()
# define local_irq_enable_hw()		local_irq_enable_hw_notrace()
# define local_irq_save_hw(flags)	local_irq_save_hw_notrace(flags)
# define local_irq_restore_hw(flags)	local_irq_restore_hw_notrace(flags)
#endif /* !CONFIG_IPIPE_TRACE_IRQSOFF */

#else /* CONFIG_IPIPE */
static inline void hard_local_irq_disable(void)
{
	if (!hard_irqs_disabled()) {
		__hard_local_irq_disable();
		ipipe_trace_begin(0x80000000);
	}
}

static inline void raw_local_irq_disable(void)
static inline void hard_local_irq_enable(void)
{
	bfin_cli();
	if (hard_irqs_disabled()) {
		ipipe_trace_end(0x80000000);
		__hard_local_irq_enable();
	}
}
static inline void raw_local_irq_enable(void)

static inline unsigned long hard_local_irq_save(void)
{
	bfin_sti(bfin_irq_flags);
	unsigned long flags = hard_local_save_flags();
	if (!hard_irqs_disabled_flags(flags)) {
		__hard_local_irq_disable();
		ipipe_trace_begin(0x80000001);
	}
	return flags;
}

static inline unsigned long arch_local_save_flags(void)
static inline void hard_local_irq_restore(unsigned long flags)
{
	return bfin_read_IMASK();
	if (!hard_irqs_disabled_flags(flags)) {
		ipipe_trace_end(0x80000001);
		__hard_local_irq_enable();
	}
}

#define raw_local_save_flags(flags) do { (flags) = arch_local_save_flags(); } while (0)
#else /* !CONFIG_IPIPE_TRACE_IRQSOFF */
# define hard_local_irq_disable()	__hard_local_irq_disable()
# define hard_local_irq_enable()	__hard_local_irq_enable()
# define hard_local_irq_save()		__hard_local_irq_save()
# define hard_local_irq_restore(flags)	__hard_local_irq_restore(flags)
#endif /* !CONFIG_IPIPE_TRACE_IRQSOFF */

#define raw_irqs_disabled_flags(flags) (((flags) & ~0x3f) == 0)
#else /* CONFIG_IPIPE */

static inline unsigned long __raw_local_irq_save(void)
{
	unsigned long flags = bfin_cli();
#ifdef CONFIG_DEBUG_HWERR
	bfin_sti(0x3f);
#endif
	return flags;
}
#define raw_local_irq_save(flags) do { (flags) = __raw_local_irq_save(); } while (0)
/*
 * Direct interface to linux/irqflags.h.
 */
#define arch_local_save_flags()		hard_local_save_flags()
#define arch_local_irq_save(flags)	__hard_local_irq_save()
#define arch_local_irq_restore(flags)	__hard_local_irq_restore(flags)
#define arch_local_irq_enable()		__hard_local_irq_enable()
#define arch_local_irq_disable()	__hard_local_irq_disable()
#define arch_irqs_disabled_flags(flags)	hard_irqs_disabled_flags(flags)
#define arch_irqs_disabled()		hard_irqs_disabled()

/*
 * Interface to various arch routines that may be traced.
 */
#define hard_local_irq_save()		__hard_local_irq_save()
#define hard_local_irq_restore(flags)	__hard_local_irq_restore(flags)
#define hard_local_irq_enable()		__hard_local_irq_enable()
#define hard_local_irq_disable()	__hard_local_irq_disable()

#define local_irq_save_hw(flags)	raw_local_irq_save(flags)
#define local_irq_restore_hw(flags)	raw_local_irq_restore(flags)
#define local_irq_enable_hw()		raw_local_irq_enable()
#define local_irq_disable_hw()		raw_local_irq_disable()
#define irqs_disabled_hw()		irqs_disabled()

#endif /* !CONFIG_IPIPE */

static inline void raw_local_irq_restore(unsigned long flags)
{
	if (!raw_irqs_disabled_flags(flags))
		raw_local_irq_enable();
}
/*
 * Raw interface to linux/irqflags.h.
 */
#define raw_local_save_flags(flags)	do { (flags) = arch_local_save_flags(); } while (0)
#define raw_local_irq_save(flags)	do { (flags) = arch_local_irq_save(); } while (0)
#define raw_local_irq_restore(flags)	arch_local_irq_restore(flags)
#define raw_local_irq_enable()		arch_local_irq_enable()
#define raw_local_irq_disable()		arch_local_irq_disable()
#define raw_irqs_disabled_flags(flags)	arch_irqs_disabled_flags(flags)
#define raw_irqs_disabled()		arch_irqs_disabled()

#endif
+4 −4
Original line number Diff line number Diff line
@@ -97,8 +97,8 @@ static inline void __switch_mm(struct mm_struct *prev_mm, struct mm_struct *next
}

#ifdef CONFIG_IPIPE
#define lock_mm_switch(flags)	local_irq_save_hw_cond(flags)
#define unlock_mm_switch(flags)	local_irq_restore_hw_cond(flags)
#define lock_mm_switch(flags)	flags = hard_local_irq_save_cond()
#define unlock_mm_switch(flags)	hard_local_irq_restore_cond(flags)
#else
#define lock_mm_switch(flags)	do { (void)(flags); } while (0)
#define unlock_mm_switch(flags)	do { (void)(flags); } while (0)
@@ -205,9 +205,9 @@ static inline void destroy_context(struct mm_struct *mm)
}

#define ipipe_mm_switch_protect(flags)		\
	local_irq_save_hw_cond(flags)
	flags = hard_local_irq_save_cond()

#define ipipe_mm_switch_unprotect(flags)	\
	local_irq_restore_hw_cond(flags)
	hard_local_irq_restore_cond(flags)

#endif
+2 −2
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
	unsigned long tmp = 0;
	unsigned long flags;

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();

	switch (size) {
	case 1:
@@ -139,7 +139,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
			 : "=&d" (tmp) : "d" (x), "m" (*__xg(ptr)) : "memory");
		break;
	}
	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);
	return tmp;
}

+51 −51
Original line number Diff line number Diff line
@@ -349,13 +349,13 @@ inline void portmux_setup(unsigned short per)
void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
{ \
	unsigned long flags; \
	local_irq_save_hw(flags); \
	flags = hard_local_irq_save(); \
	if (arg) \
		gpio_array[gpio_bank(gpio)]->name |= gpio_bit(gpio); \
	else \
		gpio_array[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \
	AWA_DUMMY_READ(name); \
	local_irq_restore_hw(flags); \
	hard_local_irq_restore(flags); \
} \
EXPORT_SYMBOL(set_gpio_ ## name);

@@ -371,14 +371,14 @@ void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
{ \
	unsigned long flags; \
	if (ANOMALY_05000311 || ANOMALY_05000323) \
		local_irq_save_hw(flags); \
		flags = hard_local_irq_save(); \
	if (arg) \
		gpio_array[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
	else \
		gpio_array[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \
	if (ANOMALY_05000311 || ANOMALY_05000323) { \
		AWA_DUMMY_READ(name); \
		local_irq_restore_hw(flags); \
		hard_local_irq_restore(flags); \
	} \
} \
EXPORT_SYMBOL(set_gpio_ ## name);
@@ -391,11 +391,11 @@ void set_gpio_toggle(unsigned gpio)
{
	unsigned long flags;
	if (ANOMALY_05000311 || ANOMALY_05000323)
		local_irq_save_hw(flags);
		flags = hard_local_irq_save();
	gpio_array[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
	if (ANOMALY_05000311 || ANOMALY_05000323) {
		AWA_DUMMY_READ(toggle);
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
	}
}
EXPORT_SYMBOL(set_gpio_toggle);
@@ -408,11 +408,11 @@ void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \
{ \
	unsigned long flags; \
	if (ANOMALY_05000311 || ANOMALY_05000323) \
		local_irq_save_hw(flags); \
		flags = hard_local_irq_save(); \
	gpio_array[gpio_bank(gpio)]->name = arg; \
	if (ANOMALY_05000311 || ANOMALY_05000323) { \
		AWA_DUMMY_READ(name); \
		local_irq_restore_hw(flags); \
		hard_local_irq_restore(flags); \
	} \
} \
EXPORT_SYMBOL(set_gpiop_ ## name);
@@ -433,11 +433,11 @@ unsigned short get_gpio_ ## name(unsigned gpio) \
	unsigned long flags; \
	unsigned short ret; \
	if (ANOMALY_05000311 || ANOMALY_05000323) \
		local_irq_save_hw(flags); \
		flags = hard_local_irq_save(); \
	ret = 0x01 & (gpio_array[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \
	if (ANOMALY_05000311 || ANOMALY_05000323) { \
		AWA_DUMMY_READ(name); \
		local_irq_restore_hw(flags); \
		hard_local_irq_restore(flags); \
	} \
	return ret; \
} \
@@ -460,11 +460,11 @@ unsigned short get_gpiop_ ## name(unsigned gpio) \
	unsigned long flags; \
	unsigned short ret; \
	if (ANOMALY_05000311 || ANOMALY_05000323) \
		local_irq_save_hw(flags); \
		flags = hard_local_irq_save(); \
	ret = (gpio_array[gpio_bank(gpio)]->name); \
	if (ANOMALY_05000311 || ANOMALY_05000323) { \
		AWA_DUMMY_READ(name); \
		local_irq_restore_hw(flags); \
		hard_local_irq_restore(flags); \
	} \
	return ret; \
} \
@@ -525,14 +525,14 @@ int gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl)
	if (check_gpio(gpio) < 0)
		return -EINVAL;

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();
	if (ctrl)
		reserve(wakeup, gpio);
	else
		unreserve(wakeup, gpio);

	set_gpio_maskb(gpio, ctrl);
	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);

	return 0;
}
@@ -690,7 +690,7 @@ int peripheral_request(unsigned short per, const char *label)

	BUG_ON(ident >= MAX_RESOURCES);

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();

	/* If a pin can be muxed as either GPIO or peripheral, make
	 * sure it is not already a GPIO pin when we request it.
@@ -701,7 +701,7 @@ int peripheral_request(unsigned short per, const char *label)
		printk(KERN_ERR
		       "%s: Peripheral %d is already reserved as GPIO by %s !\n",
		       __func__, ident, get_label(ident));
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		return -EBUSY;
	}

@@ -730,7 +730,7 @@ int peripheral_request(unsigned short per, const char *label)
			printk(KERN_ERR
			       "%s: Peripheral %d function %d is already reserved by %s !\n",
			       __func__, ident, P_FUNCT2MUX(per), get_label(ident));
			local_irq_restore_hw(flags);
			hard_local_irq_restore(flags);
			return -EBUSY;
		}
	}
@@ -741,7 +741,7 @@ int peripheral_request(unsigned short per, const char *label)
	portmux_setup(per);
	port_setup(ident, PERIPHERAL_USAGE);

	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);
	set_label(ident, label);

	return 0;
@@ -780,10 +780,10 @@ void peripheral_free(unsigned short per)
	if (!(per & P_DEFINED))
		return;

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();

	if (unlikely(!is_reserved(peri, ident, 0))) {
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		return;
	}

@@ -794,7 +794,7 @@ void peripheral_free(unsigned short per)

	set_label(ident, "free");

	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);
}
EXPORT_SYMBOL(peripheral_free);

@@ -828,7 +828,7 @@ int bfin_gpio_request(unsigned gpio, const char *label)
	if (check_gpio(gpio) < 0)
		return -EINVAL;

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();

	/*
	 * Allow that the identical GPIO can
@@ -837,7 +837,7 @@ int bfin_gpio_request(unsigned gpio, const char *label)
	 */

	if (cmp_label(gpio, label) == 0) {
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		return 0;
	}

@@ -846,7 +846,7 @@ int bfin_gpio_request(unsigned gpio, const char *label)
			dump_stack();
		printk(KERN_ERR "bfin-gpio: GPIO %d is already reserved by %s !\n",
		       gpio, get_label(gpio));
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		return -EBUSY;
	}
	if (unlikely(is_reserved(peri, gpio, 1))) {
@@ -855,7 +855,7 @@ int bfin_gpio_request(unsigned gpio, const char *label)
		printk(KERN_ERR
		       "bfin-gpio: GPIO %d is already reserved as Peripheral by %s !\n",
		       gpio, get_label(gpio));
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		return -EBUSY;
	}
	if (unlikely(is_reserved(gpio_irq, gpio, 1))) {
@@ -871,7 +871,7 @@ int bfin_gpio_request(unsigned gpio, const char *label)
	reserve(gpio, gpio);
	set_label(gpio, label);

	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);

	port_setup(gpio, GPIO_USAGE);

@@ -888,13 +888,13 @@ void bfin_gpio_free(unsigned gpio)

	might_sleep();

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();

	if (unlikely(!is_reserved(gpio, gpio, 0))) {
		if (system_state == SYSTEM_BOOTING)
			dump_stack();
		gpio_error(gpio);
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		return;
	}

@@ -902,7 +902,7 @@ void bfin_gpio_free(unsigned gpio)

	set_label(gpio, "free");

	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);
}
EXPORT_SYMBOL(bfin_gpio_free);

@@ -913,7 +913,7 @@ int bfin_special_gpio_request(unsigned gpio, const char *label)
{
	unsigned long flags;

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();

	/*
	 * Allow that the identical GPIO can
@@ -922,19 +922,19 @@ int bfin_special_gpio_request(unsigned gpio, const char *label)
	 */

	if (cmp_label(gpio, label) == 0) {
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		return 0;
	}

	if (unlikely(is_reserved(special_gpio, gpio, 1))) {
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		printk(KERN_ERR "bfin-gpio: GPIO %d is already reserved by %s !\n",
		       gpio, get_label(gpio));

		return -EBUSY;
	}
	if (unlikely(is_reserved(peri, gpio, 1))) {
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		printk(KERN_ERR
		       "bfin-gpio: GPIO %d is already reserved as Peripheral by %s !\n",
		       gpio, get_label(gpio));
@@ -946,7 +946,7 @@ int bfin_special_gpio_request(unsigned gpio, const char *label)
	reserve(peri, gpio);

	set_label(gpio, label);
	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);
	port_setup(gpio, GPIO_USAGE);

	return 0;
@@ -959,18 +959,18 @@ void bfin_special_gpio_free(unsigned gpio)

	might_sleep();

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();

	if (unlikely(!is_reserved(special_gpio, gpio, 0))) {
		gpio_error(gpio);
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		return;
	}

	unreserve(special_gpio, gpio);
	unreserve(peri, gpio);
	set_label(gpio, "free");
	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);
}
EXPORT_SYMBOL(bfin_special_gpio_free);
#endif
@@ -983,7 +983,7 @@ int bfin_gpio_irq_request(unsigned gpio, const char *label)
	if (check_gpio(gpio) < 0)
		return -EINVAL;

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();

	if (unlikely(is_reserved(peri, gpio, 1))) {
		if (system_state == SYSTEM_BOOTING)
@@ -991,7 +991,7 @@ int bfin_gpio_irq_request(unsigned gpio, const char *label)
		printk(KERN_ERR
		       "bfin-gpio: GPIO %d is already reserved as Peripheral by %s !\n",
		       gpio, get_label(gpio));
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		return -EBUSY;
	}
	if (unlikely(is_reserved(gpio, gpio, 1)))
@@ -1002,7 +1002,7 @@ int bfin_gpio_irq_request(unsigned gpio, const char *label)
	reserve(gpio_irq, gpio);
	set_label(gpio, label);

	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);

	port_setup(gpio, GPIO_USAGE);

@@ -1016,13 +1016,13 @@ void bfin_gpio_irq_free(unsigned gpio)
	if (check_gpio(gpio) < 0)
		return;

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();

	if (unlikely(!is_reserved(gpio_irq, gpio, 0))) {
		if (system_state == SYSTEM_BOOTING)
			dump_stack();
		gpio_error(gpio);
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		return;
	}

@@ -1030,7 +1030,7 @@ void bfin_gpio_irq_free(unsigned gpio)

	set_label(gpio, "free");

	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);
}

static inline void __bfin_gpio_direction_input(unsigned gpio)
@@ -1052,10 +1052,10 @@ int bfin_gpio_direction_input(unsigned gpio)
		return -EINVAL;
	}

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();
	__bfin_gpio_direction_input(gpio);
	AWA_DUMMY_READ(inen);
	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);

	return 0;
}
@@ -1070,9 +1070,9 @@ void bfin_gpio_irq_prepare(unsigned gpio)
	port_setup(gpio, GPIO_USAGE);

#ifdef CONFIG_BF54x
	local_irq_save_hw(flags);
	flags = hard_local_irq_save();
	__bfin_gpio_direction_input(gpio);
	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);
#endif
}

@@ -1094,7 +1094,7 @@ int bfin_gpio_direction_output(unsigned gpio, int value)
		return -EINVAL;
	}

	local_irq_save_hw(flags);
	flags = hard_local_irq_save();

	gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
	gpio_set_value(gpio, value);
@@ -1105,7 +1105,7 @@ int bfin_gpio_direction_output(unsigned gpio, int value)
#endif

	AWA_DUMMY_READ(dir);
	local_irq_restore_hw(flags);
	hard_local_irq_restore(flags);

	return 0;
}
@@ -1120,11 +1120,11 @@ int bfin_gpio_get_value(unsigned gpio)

	if (unlikely(get_gpio_edge(gpio))) {
		int ret;
		local_irq_save_hw(flags);
		flags = hard_local_irq_save();
		set_gpio_edge(gpio, 0);
		ret = get_gpio_data(gpio);
		set_gpio_edge(gpio, 1);
		local_irq_restore_hw(flags);
		hard_local_irq_restore(flags);
		return ret;
	} else
		return get_gpio_data(gpio);
Loading