fix for drivers/char/pc_keyb.c in 2.5.1-pre3
Subsystems (2)
PATCH 1/1 fix for drivers/char/pc_keyb.c in 2.5.1-pre3
Hi,
Here's a patch for 2.5.1-pre3 to fix the compile time problems in drivers/char/pc_keyb.c. It also fixes the places where the flags variable is the wrong type.
thanks,
greg k-h
drivers/char/pc_keyb.c +5 -5
@@ -420,7 +420,7 @@kbd_write_command (KBD_CCMD_WRITE_MODE );kb_wait ();kbd_write_output (AUX_INTS_OFF ); -spin_unlock (&kbd_controller_lock, flags); +spin_unlock (&kbd_controller_lock); }spin_unlock_irqrestore ( &aux_count_lock,flags ); }
@@ -433,7 +433,7 @@static inline void handle_mouse_event (unsigned char scancode) {#ifdef CONFIG_PSMOUSE -int flags; +unsigned long flags;static unsigned char prev_code;if (mouse_reply_expected) {if (scancode ==AUX_ACK ) {
@@ -1052,9 +1052,9 @@static int release_aux (struct inode * inode,struct file * file) { -int flags; +unsigned long flags;fasync_aux (-1 , file,0 ); -spin_lock_irqsave ( &aux_count, flags ); +spin_lock_irqsave ( &aux_count_lock, flags );if ( --aux_count ) {spin_unlock_irqrestore ( &aux_count_lock );return 0 ;
@@ -1073,7 +1073,7 @@static int open_aux (struct inode * inode,struct file * file) { -int flags; +unsigned long flags;spin_lock_irqsave ( &aux_count_lock, flags );if ( aux_count++ ) {spin_unlock_irqrestore ( &aux_count_lock );
Quoted 3 lines
Here's a patch for 2.5.1-pre3 to fix the compile time problems in
drivers/char/pc_keyb.c. It also fixes the places where the flags variable is the wrong type.
This is the diff I'm using. It
- Fixes the initrd lock
- Fixes keyboard (as with Greg but with the formatting unmangled too)
- Fixes wdt_pci (bitops on it)
- Makes wdt use the same locking as wdt_pci
- Returns pc110pad to the coding style and redoes the locks to
kill old style locking totally
drivers/block/rd.c +7 -6
@@ -409,13 +409,13 @@ {extern void free_initrd_mem (unsigned long ,unsigned long ); -spin_lock ( &initrd_users_lock ); +spin_lock (&initrd_users_lock);if (!--initrd_users) { -spin_unlock ( &initrd_users_lock ); +spin_unlock (&initrd_users_lock);free_initrd_mem (initrd_start, initrd_end); initrd_start =0 ; }else { -spin_unlock ( &initrd_users_lock ); +spin_unlock (&initrd_users_lock); }blkdev_put (inode->i_bdev,BDEV_FILE );
@@ -437,10 +437,11 @@#ifdef CONFIG_BLK_DEV_INITRD if (unit ==INITRD_MINOR ) { -spin_lock ( &initrd_users_lock ); +spin_lock (&initrd_users_lock); initrd_users++; -if (!initrd_start)return -ENODEV ; -spin_unlock ( &initrd_users_lock ); +spin_unlock (&initrd_users_lock); +if (!initrd_start) +return -ENODEV ; filp->f_op = &initrd_fops;return 0 ; }
drivers/char/pc110pad.c +11 -14
@@ -68,8 +68,8 @@/* driver/filesystem interface management */ static wait_queue_head_t queue;static struct fasync_struct *asyncptr; -static active_count = 0; /* number of concurrent open()s */ -static spinlock_t active_lock =SPIN_LOCK_UNLOCKED ; +static int active_count =0 ;/* number of concurrent open()s */ +static spinlock_t pc110_lock =SPIN_LOCK_UNLOCKED ;/* this lock should be held when referencing active_count */ static struct semaphore reader_lock;
@@ -482,15 +482,14 @@int thisd, thisdd, thisx, thisy;int b;unsigned long flags; - -save_flags (flags); -cli (); + +spin_lock_irqsave (&pc110_lock, flags);read_raw_pad (&thisd, &thisdd, &thisx, &thisy); d[0 ]=(thisd?0x80 :0 ) | (thisdd?0x40 :0 ) | bounce; d[1 ]=(recent_transition?0x80 :0 )+transition_count;read_button (&b); d[2 ]=(synthesize_tap<<4 ) | (b?0x01 :0 ); -restore_flags (flags); +spin_unlock_irqrestore (&pc110_lock, flags); }/**
@@ -586,11 +585,12 @@static int close_pad (struct inode * inode,struct file * file) { +unsigned long flags;fasync_pad (-1 , file,0 ); -spin_lock ( &active_lock ); +spin_lock_irqsave (&pc110_lock, flags);if (!--active_count)outb (0x30 , current_params.io+2 );/* switch off digitiser */ -spin_unlock ( &active_lock ); +spin_unlock_irqrestore (&active_lock, flags);return 0 ; }
@@ -610,16 +610,13 @@ {unsigned long flags; -spin_lock ( &active_lock ); +spin_lock_irqsave (&pc110_lock, flags);if (active_count++) { -spin_unlock ( &active_lock ); +spin_unlock_irqrestore (&pc110_lock, flags);return 0 ; } -spin_unlock ( &active_lock ); -save_flags (flags); -cli ();outb (0x30 , current_params.io+2 );/* switch off digitiser */ pad_irq (0 ,0 ,0 );/* read to flush any pending bytes */ pad_irq (0 ,0 ,0 );/* read to flush any pending bytes */
@@ -634,7 +631,7 @@ synthesize_tap=0 ;del_timer (&bounce_timer);del_timer (&tap_timer); -restore_flags (flags); +spin_unlock_irqrestore (&pc110_lock, flags);return 0 ; }
drivers/char/pc_keyb.c +15 -15
@@ -406,7 +406,7 @@if (rqst ==PM_RESUME ) {if (queue) {/* Aux port detected */ -spin_lock_irqsave ( &aux_count_lock, flags); +spin_lock_irqsave (&aux_count_lock, flags);if ( aux_count ==0 ) {/* Mouse not in use */ spin_lock (&kbd_controller_lock);/*
@@ -420,9 +420,9 @@kbd_write_command (KBD_CCMD_WRITE_MODE );kb_wait ();kbd_write_output (AUX_INTS_OFF ); - spin_unlock(&kbd_controller_lock, flags); + spin_unlock(&kbd_controller_lock); } -spin_unlock_irqrestore ( &aux_count_lock,flags ); +spin_unlock_irqrestore (&aux_count_lock, flags); } }#endif
@@ -433,7 +433,7 @@static inline void handle_mouse_event (unsigned char scancode) {#ifdef CONFIG_PSMOUSE -int flags; +unsigned long flags;static unsigned char prev_code;if (mouse_reply_expected) {if (scancode ==AUX_ACK ) {
@@ -452,7 +452,7 @@ prev_code = scancode;add_mouse_randomness (scancode); -spin_lock_irqsave ( &aux_count_lock, flags); +spin_lock_irqsave (&aux_count_lock, flags);if ( aux_count ) {int head = queue->head;
@@ -464,7 +464,7 @@ wake_up_interruptible(&queue->proc_list); } } -spin_unlock_irqrestore ( &aux_count_lock, flags); +spin_unlock_irqrestore (&aux_count_lock, flags);#endif }
@@ -1052,14 +1052,14 @@static int release_aux (struct inode * inode,struct file * file) { -int flags; +unsigned long flags;fasync_aux (-1 , file,0 ); -spin_lock_irqsave ( &aux_count, flags ); +spin_lock_irqsave (&aux_count, flags);if ( --aux_count ) { -spin_unlock_irqrestore ( &aux_count_lock ); +spin_unlock_irqrestore (&aux_count_lock, flags);return 0 ; } -spin_unlock_irqrestore ( &aux_count_lock, flags ); +spin_unlock_irqrestore (&aux_count_lock, flags);kbd_write_cmd (AUX_INTS_OFF );/* Disable controller ints */ kbd_write_command_w (KBD_CCMD_MOUSE_DISABLE );aux_free_irq (AUX_DEV );
@@ -1073,16 +1073,16 @@static int open_aux (struct inode * inode,struct file * file) { -int flags; -spin_lock_irqsave ( &aux_count_lock, flags ); +unsigned long flags; +spin_lock_irqsave (&aux_count_lock, flags);if ( aux_count++ ) { -spin_unlock_irqrestore ( &aux_count_lock ); +spin_unlock_irqrestore (&aux_count_lock, flags);return 0 ; } queue->head = queue->tail =0 ;/* Flush input queue */ if (aux_request_irq (keyboard_interrupt,AUX_DEV )) { aux_count--; -spin_unlock_irqrestore ( &aux_count_lock, flags ); +spin_unlock_irqrestore (&aux_count_lock, flags);return -EBUSY ; }kbd_write_command_w (KBD_CCMD_MOUSE_ENABLE );/* Enable the
@@ -1094,7 +1094,7 @@mdelay (2 );/* Ensure we follow the kbc access delay rules.. */ send_data (KBD_CMD_ENABLE );/* try to workaround toshiba4030cdt problem */ -spin_unlock_irqrestore ( &aux_count_lock, flags ); +spin_unlock_irqrestore (&aux_count_lock, flags);return 0 ; }
drivers/char/wdt.c +3 -4
@@ -50,7 +50,7 @@#include <linux/reboot.h> #include <linux/init.h> -static int wdt_is_open; +static unsigned long wdt_is_open;/* * You must set these - there is no sane way to probe for this board.
@@ -337,13 +337,12 @@switch (MINOR (inode->i_rdev)) {case WATCHDOG_MINOR : -if (wdt_is_open) +if (test_and_set_bit (0 , &wdt_is_open))return -EBUSY ;/* * Activate */ - wdt_is_open=1 ;inb_p (WDT_DC );/* Disable */ wdt_ctr_mode (0 ,3 );wdt_ctr_mode (1 ,2 );
@@ -380,7 +379,7 @@inb_p (WDT_DC );/* Disable counters */ wdt_ctr_load (2 ,0 );/* 0 length reset pulses now */ #endif - wdt_is_open=0 ; +clear_bit (0 , &wdt_is_open); }return 0 ; }
drivers/char/wdt_pci.c +1 -1
@@ -71,7 +71,7 @@#define PCI_DEVICE_ID_WDG_CSM 0x22c0#endif -static int wdt_is_open; +static unsigned long wdt_is_open;/* * You must set these - there is no sane way to probe for this board.
Quoted 8 lines · Alan Cox
This is the diff I'm using. It
(quoted diff) +0
-5- Fixes the initrd lock - Fixes keyboard (as with Greg but with the formatting unmangled too) - Fixes wdt_pci (bitops on it) - Makes wdt use the same locking as wdt_pci - Returns pc110pad to the coding style and redoes the locks tokill old style locking totally
Thanks, this patch is much nicer.
greg k-h
CONFIG_IPv8_TOS for 2.4
In reply to Greg KHIt seems that the "kernel" should be open and free of policy, with respect to the IPv4 TOS field.
http://www.dot-biz.com/IPv4/Tutorial/
These commands illustrate that not all TOS values can be easily set. ping -Q 34 192.168.0.1
ping -Q 35 192.168.0.1
Below are the changes I made to make the kernel more open.
Jim Fleming
http://www.IPv8.info
IPv16....One Better !!
------------
/*
* Networking options
*/
#define CONFIG_PACKET 1
#undef CONFIG_PACKET_MMAP
#undef CONFIG_NETLINK
#define CONFIG_NETFILTER 1
#undef CONFIG_NETFILTER_DEBUG
#undef CONFIG_FILTER
#define CONFIG_UNIX 1
#define CONFIG_INET 1
#undef CONFIG_TUX
#define CONFIG_IPv8_TOS 1
#define CONFIG_IP_MULTICAST 1
#undef CONFIG_IP_ADVANCED_ROUTER #undef CONFIG_IP_PNP #undef CONFIG_NET_IPIP #undef CONFIG_NET_IPGRE #undef CONFIG_IP_MROUTE #undef CONFIG_INET_ECN #undef CONFIG_SYN_COOKIES
#ifndef _LINUX_IP_H
#define _LINUX_IP_H
#include <asm/byteorder.h>
/* SOL_IP socket options */
#ifdef CONFIG_IPv8_TOS
#define IPTOS_TOS_MASK 0xFF
#define IPTOS_TOS(tos) (tos)
#else
#define IPTOS_TOS_MASK 0x1E #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) #define IPTOS_LOWDELAY 0x10
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
#define IPTOS_MINCOST 0x02
#define IPTOS_PREC_MASK 0xE0
#define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK)
#define IPTOS_PREC_NETCONTROL 0xe0 #define IPTOS_PREC_INTERNETCONTROL 0xc0 #define IPTOS_PREC_CRITIC_ECP 0xa0 #define IPTOS_PREC_FLASHOVERRIDE 0x80 #define IPTOS_PREC_FLASH 0x60 #define IPTOS_PREC_IMMEDIATE 0x40 #define IPTOS_PREC_PRIORITY 0x20 #define IPTOS_PREC_ROUTINE 0x00
#endif
Config.in:bool ' IP: IPv8 TOS' CONFIG_IPv8_TOS
---------------------------------------------------------------------icmp.c:
#ifdef CONFIG_IPv8_TOS
tos = iph->tos;
#else
tos = icmp_pointers[type].error ?
((iph->tos & IPTOS_TOS_MASK) | IPTOS_PREC_INTERNETCONTROL) :
iph->tos;
#endif
---------------------------------------------------------------------ip_sockglue.c:
case IP_TOS: /* This sets both TOS and Precedence */
#ifndef CONFIG_IPv8_TOS
/* Reject setting of unused bits */
#ifndef CONFIG_INET_ECN
if (val & ~(IPTOS_TOS_MASK|IPTOS_PREC_MASK))
goto e_inval;
#else
if (sk->type == SOCK_STREAM) {
val &= ~3;
val |= sk->protinfo.af_inet.tos & 3;
}
#endif
if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP &&
!capable(CAP_NET_ADMIN)) {
err = -EPERM;
break;
}
#endif
if (sk->protinfo.af_inet.tos != val) {
sk->protinfo.af_inet.tos=val;
sk->priority = rt_tos2priority(val);
sk_dst_reset(sk); }
break;
case IP_TTL:
---------------------------------------------------------------------
Quoted 7 lines · Alan Cox
Quoted 3 lines
Here's a patch for 2.5.1-pre3 to fix the compile time problems in
drivers/char/pc_keyb.c. It also fixes the places where the flags variable is the wrong type.This is the diff I'm using. It
drivers/char/pc_keyb.c line 1057
Quoted 8 lines
drivers/char/pc_keyb.c +2
-2@@ -1052,14 +1052,14 @@static int release_aux (struct inode * inode,struct file * file) { -int flags; +unsigned long flags;fasync_aux (-1 , file,0 ); -spin_lock_irqsave ( &aux_count, flags ); +spin_lock_irqsave (&aux_count, flags);
s/aux_count/aux_count_lock typo
Signature · 1 line
Jens Axboe