netfilter: nf_nat: fix out-of-bounds access in address selection
[linux-2.6/btrfs-unstable.git] / arch / arm / mach-pxa / leds-lubbock.c
blob0bd85c884a7c39dcfdfe2bbb39c551240e77bf8c
1 /*
2 * linux/arch/arm/mach-pxa/leds-lubbock.c
4 * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu>
6 * Copyright (c) 2001 Jeff Sutherland <jeffs@accelent.com>
8 * Original (leds-footbridge.c) by Russell King
10 * Major surgery on April 2004 by Nicolas Pitre for less global
11 * namespace collision. Mostly adapted the Mainstone version.
14 #include <linux/init.h>
16 #include <mach/hardware.h>
17 #include <asm/leds.h>
18 #include <mach/pxa25x.h>
19 #include <mach/lubbock.h>
21 #include "leds.h"
24 * 8 discrete leds available for general use:
26 * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays
27 * so be sure to not monkey with them here.
30 #define D28 (1 << 0)
31 #define D27 (1 << 1)
32 #define D26 (1 << 2)
33 #define D25 (1 << 3)
34 #define D24 (1 << 4)
35 #define D23 (1 << 5)
36 #define D22 (1 << 6)
37 #define D21 (1 << 7)
39 #define LED_STATE_ENABLED 1
40 #define LED_STATE_CLAIMED 2
42 static unsigned int led_state;
43 static unsigned int hw_led_state;
45 void lubbock_leds_event(led_event_t evt)
47 unsigned long flags;
49 local_irq_save(flags);
51 switch (evt) {
52 case led_start:
53 hw_led_state = 0;
54 led_state = LED_STATE_ENABLED;
55 break;
57 case led_stop:
58 led_state &= ~LED_STATE_ENABLED;
59 break;
61 case led_claim:
62 led_state |= LED_STATE_CLAIMED;
63 hw_led_state = 0;
64 break;
66 case led_release:
67 led_state &= ~LED_STATE_CLAIMED;
68 hw_led_state = 0;
69 break;
71 #ifdef CONFIG_LEDS_TIMER
72 case led_timer:
73 hw_led_state ^= D26;
74 break;
75 #endif
77 #ifdef CONFIG_LEDS_CPU
78 case led_idle_start:
79 hw_led_state &= ~D27;
80 break;
82 case led_idle_end:
83 hw_led_state |= D27;
84 break;
85 #endif
87 case led_halted:
88 break;
90 case led_green_on:
91 hw_led_state |= D21;
92 break;
94 case led_green_off:
95 hw_led_state &= ~D21;
96 break;
98 case led_amber_on:
99 hw_led_state |= D22;
100 break;
102 case led_amber_off:
103 hw_led_state &= ~D22;
104 break;
106 case led_red_on:
107 hw_led_state |= D23;
108 break;
110 case led_red_off:
111 hw_led_state &= ~D23;
112 break;
114 default:
115 break;
118 if (led_state & LED_STATE_ENABLED)
119 LUB_DISC_BLNK_LED = (LUB_DISC_BLNK_LED | 0xff) & ~hw_led_state;
120 else
121 LUB_DISC_BLNK_LED |= 0xff;
123 local_irq_restore(flags);