Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9668/arch/vax/kernel
Modified Files:
diag_led.c
Log Message:
- KA670 wasn't yet ment to be checked in.
Index: diag_led.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel/diag_led.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- diag_led.c 3 Oct 2004 11:30:28 -0000 1.9
+++ diag_led.c 24 Apr 2005 20:53:30 -0000 1.10
@@ -23,7 +23,8 @@
MODULE_LICENSE ("GPL");
MODULE_DESCRIPTION ("Hackish driver for VAXens diagnostic LEDs");
-static volatile uint16_t *diag;
+static volatile uint8_t *diag;
+static uint8_t state;
static int inverted;
@@ -40,53 +41,55 @@
if (is_ka46 ()) {
inverted = 1;
return DIAG_LED_KA46_BASE;
- }
- if (is_ka42 ()) {
+ } else if (is_ka42 ()) {
inverted = 1;
return DIAG_LED_KA42_BASE;
- }
- if (is_ka48 ()) {
+ } else if (is_ka48 ()) {
inverted = 1;
return DIAG_LED_KA48_BASE;
- }
- if (is_ka49 ()) {
+ } else if (is_ka49 ()) {
inverted = 1;
return DIAG_LED_KA49_BASE;
- }
- if (is_vxt ()) {
+ } else if (is_vxt ()) {
inverted = 1;
return DIAG_LED_VXT_BASE;
+#if 0
+ } else if (is_ka670 ()) {
+ inverted = 1;
+ return DIAG_LED_KA670_BASE;
+#endif
+ } else if (is_ka43 ()) {
+ inverted = 1;
+ return DIAG_LED_KA43_BASE;
+ } else {
+ printk (KERN_ERR "diag_led: No base address known for your machine yet!\n");
+ return 0;
}
-
- printk (KERN_ERR "No base address known for your machine yet!\n");
- return 0;
}
/*
* A binary "1" for a lit LED, a binary "0" for an off LED
*/
int
-diag_led_set_state (unsigned char state)
+diag_led_set_state (uint8_t new_state)
{
- uint16_t w_state;
-
if (!diag)
return -ENODEV;
- w_state = state;
- if (inverted)
- w_state ^= 0xffff;
-
- *diag = w_state;
+ if (inverted) {
+ *diag = new_state ^ 0xff;
+ state = new_state;
+ } else {
+ *diag = new_state;
+ state = new_state;
+ }
return 0;
}
-unsigned char
+uint8_t
diag_led_get_state (void)
{
- uint16_t w_state;
-
if (!diag) {
printk (KERN_ERR "Attention, there's no diag LEDs known on "
"your system!!!\n");
@@ -94,12 +97,7 @@
return 0;
}
- w_state = *diag;
-
- if (inverted)
- return (w_state & 0xff) ^ 0xff;
- else
- return w_state & 0xff;
+ return state;
}
/*
@@ -111,7 +109,7 @@
int
diag_led_on (int led_num)
{
- unsigned char state;
+ uint8_t new_state;
if (led_num < 0 || led_num > 7) {
printk (KERN_ERR "led_num out of range!\n");
@@ -119,10 +117,9 @@
return -EINVAL;
}
- state = diag_led_get_state ();
- state |= 1 << led_num;
+ new_state = diag_led_get_state () | (1 << led_num);
- return diag_led_set_state (state);
+ return diag_led_set_state (new_state);
}
/*
@@ -134,7 +131,7 @@
int
diag_led_off (int led_num)
{
- unsigned char state;
+ uint8_t new_state;
if (led_num < 0 || led_num > 7) {
printk (KERN_ERR "led_num out of range!\n");
@@ -142,10 +139,9 @@
return -EINVAL;
}
- state = diag_led_get_state ();
- state &= ~(1 << led_num);
+ new_state = diag_led_get_state () & ~(1 << led_num);
- return diag_led_set_state (state);
+ return diag_led_set_state (new_state);
}
#ifdef DIAG_LED_DEBUG
@@ -180,7 +176,7 @@
if (!base_address)
return -ENODEV;
- diag = ioremap (base_address, 2);
+ diag = ioremap (base_address, 1);
if (!diag) {
/* FIXME: Register with /proc/iomem */
printk (KERN_ERR "Failed to ioremap (0x%08lx, 2)\n", base_address);
@@ -220,9 +216,9 @@
};
static int __init
-diag_led_init(void)
+diag_led_init (void)
{
- return driver_register(&diag_led_driver);
+ return driver_register (&diag_led_driver);
}
|