Update of /cvsroot/linux-vax/kernel-2.4/drivers/char
In directory sc8-pr-cvs1:/tmp/cvs-serv7538/drivers/char
Modified Files:
console.c i8k.c ip2.c mem.c pty.c rtc.c serial.c sonypi.c
sonypi.h synclink.c sysrq.c tty_io.c
Log Message:
DA: sync with Marcelo 2.4.17
Index: console.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/console.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- console.c 11 Apr 2002 13:30:51 -0000 1.2
+++ console.c 10 Jun 2003 01:13:26 -0000 1.3
@@ -100,6 +100,7 @@
#include <linux/tqueue.h>
#include <linux/bootmem.h>
#include <linux/pm.h>
+#include <linux/smp_lock.h>
#include <asm/io.h>
#include <asm/system.h>
@@ -2348,17 +2349,25 @@
set_leds();
}
+/*
+ * we can race here against con_close, so we grab the bkl
+ * and check the pointer before calling set_cursor
+ */
static void con_flush_chars(struct tty_struct *tty)
{
- struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
+ struct vt_struct *vt;
if (in_interrupt()) /* from flush_to_ldisc */
return;
pm_access(pm_con);
+ lock_kernel();
acquire_console_sem();
- set_cursor(vt->vc_num);
+ vt = (struct vt_struct *)tty->driver_data;
+ if (vt)
+ set_cursor(vt->vc_num);
release_console_sem();
+ unlock_kernel();
}
/*
@@ -2599,10 +2608,10 @@
static void set_vesa_blanking(unsigned long arg)
{
- char *argp = (char *)arg + 1;
- unsigned int mode;
- get_user(mode, argp);
- vesa_blank_mode = (mode < 4) ? mode : 0;
+ char *argp = (char *)arg + 1;
+ unsigned int mode;
+ if (get_user(mode, argp) == 0)
+ vesa_blank_mode = (mode < 4) ? mode : 0;
}
/* We can't register the console with devfs during con_init(), because it
Index: i8k.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/i8k.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- i8k.c 11 Apr 2002 13:30:53 -0000 1.1
+++ i8k.c 10 Jun 2003 01:13:26 -0000 1.2
@@ -1,5 +1,7 @@
/*
- * i8k.c -- Linux driver for accessing the SMM BIOS on Dell I8000 laptops
+ * i8k.c -- Linux driver for accessing the SMM BIOS on Dell laptops.
+ * See http://www.debian.org/~dz/i8k/ for more information
+ * and for latest version of this driver.
*
* Copyright (C) 2001 Massimo Dal Zotto <dz...@de...>
*
@@ -19,15 +21,13 @@
#include <linux/types.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
-#include <asm/io.h>
+#include <linux/apm_bios.h>
#include <asm/uaccess.h>
+#include <asm/io.h>
#include <linux/i8k.h>
-#define I8K_VERSION "1.1 02/11/2001"
-#define I8K_BIOS_SIGNATURE "Dell System Inspiron 8000"
-#define I8K_BIOS_SIGNATURE_ADDR 0x000ec000
-#define I8K_BIOS_VERSION_OFFSET 32
+#define I8K_VERSION "1.7 21/11/2001"
#define I8K_SMM_FN_STATUS 0x0025
#define I8K_SMM_POWER_STATUS 0x0069
@@ -35,31 +35,47 @@
#define I8K_SMM_GET_FAN 0x00a3
#define I8K_SMM_GET_SPEED 0x02a3
#define I8K_SMM_GET_TEMP 0x10a3
+#define I8K_SMM_GET_DELL_SIG 0xffa3
#define I8K_SMM_BIOS_VERSION 0x00a6
#define I8K_FAN_MULT 30
#define I8K_MAX_TEMP 127
-#define I8K_FN_NONE 0x08
-#define I8K_FN_UP 0x09
-#define I8K_FN_DOWN 0x0a
-#define I8K_FN_MUTE 0x0c
+#define I8K_FN_NONE 0x00
+#define I8K_FN_UP 0x01
+#define I8K_FN_DOWN 0x02
+#define I8K_FN_MUTE 0x04
+#define I8K_FN_MASK 0x07
+#define I8K_FN_SHIFT 8
#define I8K_POWER_AC 0x05
#define I8K_POWER_BATTERY 0x01
#define I8K_TEMPERATURE_BUG 1
-static char bios_version[4] = "?";
-static char bios_machine_id[16] = "?";
+#define DELL_SIGNATURE "Dell Computer"
+
+static char *supported_models[] = {
+ "Inspiron",
+ "Latitude",
+ NULL
+};
+
+static char system_vendor[48] = "?";
+static char product_name [48] = "?";
+static char bios_version [4] = "?";
+static char serial_number[16] = "?";
int force = 0;
+int power_status = 0;
MODULE_AUTHOR("Massimo Dal Zotto (dz...@de...)");
-MODULE_DESCRIPTION("Driver for accessing the SMM BIOS on Dell I8000 laptops");
+MODULE_DESCRIPTION("Driver for accessing SMM BIOS on Dell laptops");
MODULE_LICENSE("GPL");
MODULE_PARM(force, "i");
-MODULE_PARM_DESC(force, "Force loading without checking for an Inspiron 8000");
+MODULE_PARM(power_status, "i");
+MODULE_PARM_DESC(force, "Force loading without checking for supported models");
+MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k");
static ssize_t i8k_read(struct file *, char *, size_t, loff_t *);
static int i8k_ioctl(struct inode *, struct file *, unsigned int,
@@ -79,12 +95,19 @@
unsigned int edi __attribute__ ((packed));
} SMMRegisters;
+typedef struct {
+ u8 type;
+ u8 length;
+ u16 handle;
+} DMIHeader;
+
/*
- * Call the System Management Mode BIOS.
+ * Call the System Management Mode BIOS. Code provided by Jonathan Buzzard.
*/
static int i8k_smm(SMMRegisters *regs)
{
int rc;
+ int eax = regs->eax;
asm("pushl %%eax\n\t" \
"movl 0(%%eax),%%edx\n\t" \
@@ -112,7 +135,7 @@
: "a" (regs)
: "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
- if ((rc != 0) || ((regs->eax & 0xffff) == 0xffff)) {
+ if ((rc != 0) || ((regs->eax & 0xffff) == 0xffff) || (regs->eax == eax)) {
return -EINVAL;
}
@@ -137,11 +160,12 @@
}
/*
- * Read the machine id. Not yet implemented.
+ * Read the machine id.
*/
-static int i8k_get_machine_id(unsigned char *buff)
+static int i8k_get_serial_number(unsigned char *buff)
{
- return -EINVAL;
+ strncpy(buff, serial_number, 16);
+ return 0;
}
/*
@@ -157,7 +181,7 @@
return rc;
}
- switch ((regs.eax & 0xff00) >> 8) {
+ switch ((regs.eax >> I8K_FN_SHIFT) & I8K_FN_MASK) {
case I8K_FN_UP:
return I8K_VOL_UP;
case I8K_FN_DOWN:
@@ -281,6 +305,23 @@
return temp;
}
+static int i8k_get_dell_signature(void)
+{
+ SMMRegisters regs = { 0, 0, 0, 0, 0, 0 };
+ int rc;
+
+ regs.eax = I8K_SMM_GET_DELL_SIG;
+ if ((rc=i8k_smm(®s)) < 0) {
+ return rc;
+ }
+
+ if ((regs.eax == 1145651527) && (regs.edx == 1145392204)) {
+ return 0;
+ } else {
+ return -1;
+ }
+}
+
static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
unsigned long arg)
{
@@ -299,7 +340,7 @@
case I8K_MACHINE_ID:
memset(buff, 0, 16);
- val = i8k_get_machine_id(buff);
+ val = i8k_get_serial_number(buff);
break;
case I8K_FN_STATUS:
@@ -375,13 +416,17 @@
int n, fn_key, cpu_temp, ac_power;
int left_fan, right_fan, left_speed, right_speed;
- cpu_temp = i8k_get_cpu_temp();
- left_fan = i8k_get_fan_status(I8K_FAN_LEFT);
- right_fan = i8k_get_fan_status(I8K_FAN_RIGHT);
- left_speed = i8k_get_fan_speed(I8K_FAN_LEFT);
- right_speed = i8k_get_fan_speed(I8K_FAN_RIGHT);
- ac_power = i8k_get_power_status();
- fn_key = i8k_get_fn_status();
+ cpu_temp = i8k_get_cpu_temp(); /* 11100 µs */
+ left_fan = i8k_get_fan_status(I8K_FAN_LEFT); /* 580 µs */
+ right_fan = i8k_get_fan_status(I8K_FAN_RIGHT); /* 580 µs */
+ left_speed = i8k_get_fan_speed(I8K_FAN_LEFT); /* 580 µs */
+ right_speed = i8k_get_fan_speed(I8K_FAN_RIGHT); /* 580 µs */
+ fn_key = i8k_get_fn_status(); /* 750 µs */
+ if (power_status) {
+ ac_power = i8k_get_power_status(); /* 14700 µs */
+ } else {
+ ac_power = -1;
+ }
/*
* Info:
@@ -400,7 +445,7 @@
n = sprintf(buffer, "%s %s %s %d %d %d %d %d %d %d\n",
I8K_PROC_FMT,
bios_version,
- bios_machine_id,
+ serial_number,
cpu_temp,
left_fan,
right_fan,
@@ -438,76 +483,253 @@
return len;
}
+static char* __init string_trim(char *s, int size)
+{
+ int len;
+ char *p;
+
+ if ((len = strlen(s)) > size) {
+ len = size;
+ }
+
+ for (p=s+len-1; len && (*p==' '); len--,p--) {
+ *p = '\0';
+ }
+
+ return s;
+}
+
+/* DMI code, stolen from arch/i386/kernel/dmi_scan.c */
+
/*
- * Probe for the presence of an Inspiron I8000.
+ * |<-- dmi->length -->|
+ * | |
+ * |dmi header s=N | string1,\0, ..., stringN,\0, ..., \0
+ * | |
+ * +-----------------------+
*/
-static int i8k_probe(void)
+static char* __init dmi_string(DMIHeader *dmi, u8 s)
{
- unsigned char *buff, *p;
- unsigned char bios_vers[4];
- int version;
+ u8 *p;
+
+ if (!s) {
+ return "";
+ }
+ s--;
+
+ p = (u8 *)dmi + dmi->length;
+ while (s > 0) {
+ p += strlen(p);
+ p++;
+ s--;
+ }
+
+ return p;
+}
+
+static void __init dmi_decode(DMIHeader *dmi)
+{
+ u8 *data = (u8 *) dmi;
+ char *p;
+
+#ifdef I8K_DEBUG
+ int i;
+ printk("%08x ", (int)data);
+ for (i=0; i<data[1] && i<64; i++) {
+ printk("%02x ", data[i]);
+ }
+ printk("\n");
+#endif
+
+ switch (dmi->type) {
+ case 0: /* BIOS Information */
+ p = dmi_string(dmi,data[5]);
+ if (*p) {
+ strncpy(bios_version, p, sizeof(bios_version));
+ string_trim(bios_version, sizeof(bios_version));
+ }
+ break;
+ case 1: /* System Information */
+ p = dmi_string(dmi,data[4]);
+ if (*p) {
+ strncpy(system_vendor, p, sizeof(system_vendor));
+ string_trim(system_vendor, sizeof(system_vendor));
+ }
+ p = dmi_string(dmi,data[5]);
+ if (*p) {
+ strncpy(product_name, p, sizeof(product_name));
+ string_trim(product_name, sizeof(product_name));
+ }
+ p = dmi_string(dmi,data[7]);
+ if (*p) {
+ strncpy(serial_number, p, sizeof(serial_number));
+ string_trim(serial_number, sizeof(serial_number));
+ }
+ break;
+ }
+}
+
+static int __init dmi_table(u32 base, int len, int num, void (*fn)(DMIHeader*))
+{
+ u8 *buf;
+ u8 *data;
+ DMIHeader *dmi;
+ int i = 1;
+
+ buf = ioremap(base, len);
+ if (buf == NULL) {
+ return -1;
+ }
+ data = buf;
/*
- * Until Dell tell us how to reliably check for an Inspiron system
- * look for a signature at a fixed location in the BIOS memory.
- * Ugly but safe.
+ * Stop when we see al the items the table claimed to have
+ * or we run off the end of the table (also happens)
*/
- if (!force) {
- buff = ioremap(I8K_BIOS_SIGNATURE_ADDR, I8K_BIOS_VERSION_OFFSET+4);
- if (buff == NULL) {
- printk("i8k: ioremap failed\n");
- return -ENODEV;
+ while ((i<num) && ((data-buf) < len)) {
+ dmi = (DMIHeader *)data;
+ /*
+ * Avoid misparsing crud if the length of the last
+ * record is crap
+ */
+ if ((data-buf+dmi->length) >= len) {
+ break;
+ }
+ fn(dmi);
+ data += dmi->length;
+ /*
+ * Don't go off the end of the data if there is
+ * stuff looking like string fill past the end
+ */
+ while (((data-buf) < len) && (*data || data[1])) {
+ data++;
}
- if (strncmp(buff,I8K_BIOS_SIGNATURE,sizeof(I8K_BIOS_SIGNATURE)) != 0) {
- printk("i8k: Inspiron 8000 BIOS signature not found\n");
- iounmap(buff);
- return -ENODEV;
+ data += 2;
+ i++;
+ }
+ iounmap(buf);
+
+ return 0;
+}
+
+static int __init dmi_iterate(void (*decode)(DMIHeader *))
+{
+ unsigned char buf[20];
+ long fp = 0x000e0000L;
+ fp -= 16;
+
+ while (fp < 0x000fffffL) {
+ fp += 16;
+ isa_memcpy_fromio(buf, fp, 20);
+ if (memcmp(buf, "_DMI_", 5)==0) {
+ u16 num = buf[13]<<8 | buf[12];
+ u16 len = buf [7]<<8 | buf [6];
+ u32 base = buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8];
+#ifdef I8K_DEBUG
+ printk(KERN_INFO "DMI %d.%d present.\n",
+ buf[14]>>4, buf[14]&0x0F);
+ printk(KERN_INFO "%d structures occupying %d bytes.\n",
+ buf[13]<<8 | buf[12],
+ buf [7]<<8 | buf[6]);
+ printk(KERN_INFO "DMI table at 0x%08X.\n",
+ buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8]);
+#endif
+ if (dmi_table(base, len, num, decode)==0) {
+ return 0;
+ }
}
- strncpy(bios_vers, buff+I8K_BIOS_VERSION_OFFSET, 3);
- bios_vers[3] = '\0';
- iounmap(buff);
- }
- if (force >= 2) {
- buff = ioremap(0x000c0000, 0x00100000-0x000c0000);
- if (buff == NULL) {
- printk("i8k: ioremap failed\n");
+ }
+ return -1;
+}
+/* end of DMI code */
+
+/*
+ * Get DMI information.
+ */
+static int __init i8k_dmi_probe(void)
+{
+ char **p;
+
+ if (dmi_iterate(dmi_decode) != 0) {
+ printk(KERN_INFO "i8k: unable to get DMI information\n");
+ return -ENODEV;
+ }
+
+ if (strncmp(system_vendor,DELL_SIGNATURE,strlen(DELL_SIGNATURE)) != 0) {
+ printk(KERN_INFO "i8k: not running on a Dell system\n");
+ return -ENODEV;
+ }
+
+ for (p=supported_models; ; p++) {
+ if (!*p) {
+ printk(KERN_INFO "i8k: unsupported model: %s\n", product_name);
return -ENODEV;
}
- for (p=buff; (p-buff)<(0x00100000-0x000c0000); p+=16) {
- if (strncmp(p,I8K_BIOS_SIGNATURE,sizeof(I8K_BIOS_SIGNATURE))==0) {
- printk("i8k: Inspiron 8000 BIOS signature found at %08x\n",
- 0x000c0000+(p-buff));
- break;
- }
+ if (strncmp(product_name,*p,strlen(*p)) == 0) {
+ break;
}
- iounmap(buff);
}
+ return 0;
+}
+
+/*
+ * Probe for the presence of a supported laptop.
+ */
+static int __init i8k_probe(void)
+{
+ char buff[4];
+ int version;
+ int smm_found = 0;
+
/*
- * Next try to get the BIOS version with an SMM call. If this
- * fails SMM can't be reliably used on this system.
+ * Get DMI information
*/
- version = i8k_get_bios_version();
- if (version <= 0) {
- printk("i8k: unable to get BIOS version\n");
- return -ENODEV;
+ if (i8k_dmi_probe() != 0) {
+ printk(KERN_INFO "i8k: vendor=%s, model=%s, version=%s\n",
+ system_vendor, product_name, bios_version);
}
- bios_version[0] = (version >> 16) & 0xff;
- bios_version[1] = (version >> 8) & 0xff;
- bios_version[2] = (version) & 0xff;
- bios_version[3] = '\0';
/*
- * Finally check if the two versions match.
+ * Get SMM Dell signature
*/
- if (!force) {
- if (strncmp(bios_version,bios_vers,sizeof(bios_version)) != 0) {
- printk("i8k: BIOS version mismatch: %s != %s\n",
- bios_version, bios_vers);
- return -ENODEV;
+ if (i8k_get_dell_signature() != 0) {
+ printk(KERN_INFO "i8k: unable to get SMM Dell signature\n");
+ } else {
+ smm_found = 1;
+ }
+
+ /*
+ * Get SMM BIOS version.
+ */
+ version = i8k_get_bios_version();
+ if (version <= 0) {
+ printk(KERN_INFO "i8k: unable to get SMM BIOS version\n");
+ } else {
+ smm_found = 1;
+ buff[0] = (version >> 16) & 0xff;
+ buff[1] = (version >> 8) & 0xff;
+ buff[2] = (version) & 0xff;
+ buff[3] = '\0';
+ /*
+ * If DMI BIOS version is unknown use SMM BIOS version.
+ */
+ if (bios_version[0] == '?') {
+ strcpy(bios_version, buff);
+ }
+ /*
+ * Check if the two versions match.
+ */
+ if (strncmp(buff,bios_version,sizeof(bios_version)) != 0) {
+ printk(KERN_INFO "i8k: BIOS version mismatch: %s != %s\n",
+ buff, bios_version);
}
}
+ if (!smm_found && !force) {
+ return -ENODEV;
+ }
+
return 0;
}
@@ -518,7 +740,7 @@
{
struct proc_dir_entry *proc_i8k;
- /* Are we running on an Inspiron 8000 laptop? */
+ /* Are we running on an supported laptop? */
if (i8k_probe() != 0) {
return -ENODEV;
}
@@ -532,7 +754,7 @@
SET_MODULE_OWNER(proc_i8k);
printk(KERN_INFO
- "Inspiron 8000 SMM driver v%s Massimo Dal Zotto (dz...@de...)\n",
+ "Dell laptop SMM driver v%s Massimo Dal Zotto (dz...@de...)\n",
I8K_VERSION);
return 0;
Index: ip2.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/ip2.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ip2.c 11 Apr 2002 13:30:53 -0000 1.2
+++ ip2.c 10 Jun 2003 01:13:26 -0000 1.3
@@ -33,9 +33,10 @@
*/
static int io[IP2_MAX_BOARDS]= { 0, 0, 0, 0 };
static int irq[IP2_MAX_BOARDS] = { -1, -1, -1, -1 };
-static int poll_only = 0;
#ifdef MODULE
+
+static int poll_only = 0;
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
MODULE_AUTHOR("Doug McNash");
Index: mem.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/mem.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mem.c 11 Apr 2002 13:30:54 -0000 1.2
+++ mem.c 10 Jun 2003 01:13:26 -0000 1.3
@@ -272,6 +272,8 @@
return virtr + read;
}
+extern long vwrite(char *buf, char *addr, unsigned long count);
+
/*
* This function writes to the *virtual* memory as seen by the kernel.
*/
@@ -279,12 +281,46 @@
size_t count, loff_t *ppos)
{
unsigned long p = *ppos;
+ ssize_t wrote = 0;
+ ssize_t virtr = 0;
+ char * kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */
+
+ if (p < (unsigned long) high_memory) {
+ wrote = count;
+ if (count > (unsigned long) high_memory - p)
+ wrote = (unsigned long) high_memory - p;
+
+ wrote = do_write_mem(file, (void*)p, p, buf, wrote, ppos);
+
+ p += wrote;
+ buf += wrote;
+ count -= wrote;
+ }
+
+ if (count > 0) {
+ kbuf = (char *)__get_free_page(GFP_KERNEL);
+ if (!kbuf)
+ return -ENOMEM;
+ while (count > 0) {
+ int len = count;
+
+ if (len > PAGE_SIZE)
+ len = PAGE_SIZE;
+ if (len && copy_from_user(kbuf, buf, len)) {
+ free_page((unsigned long)kbuf);
+ return -EFAULT;
+ }
+ len = vwrite(kbuf, (char *)p, len);
+ count -= len;
+ buf += len;
+ virtr += len;
+ p += len;
+ }
+ free_page((unsigned long)kbuf);
+ }
- if (p >= (unsigned long) high_memory)
- return 0;
- if (count > (unsigned long) high_memory - p)
- count = (unsigned long) high_memory - p;
- return do_write_mem(file, (void*)p, p, buf, count, ppos);
+ *ppos = p;
+ return virtr + wrote;
}
#if !defined(__mc68000__)
Index: pty.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/pty.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pty.c 11 Apr 2002 13:30:55 -0000 1.2
+++ pty.c 10 Jun 2003 01:13:26 -0000 1.3
@@ -334,8 +334,7 @@
/* Register a slave for the master */
if (tty->driver.major == PTY_MASTER_MAJOR)
tty_register_devfs(&tty->link->driver,
- DEVFS_FL_CURRENT_OWNER |
- DEVFS_FL_NO_PERSISTENCE | DEVFS_FL_WAIT,
+ DEVFS_FL_CURRENT_OWNER | DEVFS_FL_WAIT,
tty->link->driver.minor_start +
MINOR(tty->device)-tty->driver.minor_start);
retval = 0;
Index: rtc.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/rtc.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- rtc.c 11 Apr 2002 13:30:56 -0000 1.2
+++ rtc.c 10 Jun 2003 01:13:26 -0000 1.3
@@ -785,6 +785,9 @@
printk(KERN_INFO "rtc: %s epoch (%lu) detected\n", guess, epoch);
#endif
#if RTC_IRQ
+ if (rtc_has_irq == 0)
+ goto no_irq2;
+
init_timer(&rtc_irq_timer);
rtc_irq_timer.function = rtc_dropped_irq;
spin_lock_irq(&rtc_lock);
@@ -792,6 +795,7 @@
CMOS_WRITE(((CMOS_READ(RTC_FREQ_SELECT) & 0xF0) | 0x06), RTC_FREQ_SELECT);
spin_unlock_irq(&rtc_lock);
rtc_freq = 1024;
+no_irq2:
#endif
printk(KERN_INFO "Real Time Clock Driver v" RTC_VERSION "\n");
Index: serial.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/serial.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- serial.c 11 Apr 2002 13:30:58 -0000 1.2
+++ serial.c 10 Jun 2003 01:13:26 -0000 1.3
@@ -3133,6 +3133,10 @@
* enables interrupts for a serial port, linking in its async structure into
* the IRQ chain. It also performs the serial-specific
* initialization for the tty structure.
+ *
+ * Note that on failure, we don't decrement the module use count - the tty
+ * later will call rs_close, which will decrement it for us as long as
+ * tty->driver_data is set non-NULL. --rmk
*/
static int rs_open(struct tty_struct *tty, struct file * filp)
{
@@ -3153,10 +3157,8 @@
}
tty->driver_data = info;
info->tty = tty;
- if (serial_paranoia_check(info, tty->device, "rs_open")) {
- MOD_DEC_USE_COUNT;
+ if (serial_paranoia_check(info, tty->device, "rs_open"))
return -ENODEV;
- }
#ifdef SERIAL_DEBUG_OPEN
printk("rs_open %s%d, count = %d\n", tty->driver.name, info->line,
@@ -3171,10 +3173,8 @@
*/
if (!tmp_buf) {
page = get_zeroed_page(GFP_KERNEL);
- if (!page) {
- MOD_DEC_USE_COUNT;
+ if (!page)
return -ENOMEM;
- }
if (tmp_buf)
free_page(page);
else
@@ -3188,7 +3188,6 @@
(info->flags & ASYNC_CLOSING)) {
if (info->flags & ASYNC_CLOSING)
interruptible_sleep_on(&info->close_wait);
- MOD_DEC_USE_COUNT;
#ifdef SERIAL_DO_RESTART
return ((info->flags & ASYNC_HUP_NOTIFY) ?
-EAGAIN : -ERESTARTSYS);
@@ -3201,10 +3200,8 @@
* Start up serial port
*/
retval = startup(info);
- if (retval) {
- MOD_DEC_USE_COUNT;
+ if (retval)
return retval;
- }
retval = block_til_ready(tty, filp, info);
if (retval) {
@@ -3212,7 +3209,6 @@
printk("rs_open returning after block_til_ready with %d\n",
retval);
#endif
- MOD_DEC_USE_COUNT;
return retval;
}
@@ -4896,7 +4892,7 @@
static struct pci_driver serial_pci_driver = {
name: "serial",
probe: serial_init_one,
- remove: serial_remove_one,
+ remove: __devexit_p(serial_remove_one),
id_table: serial_pci_tbl,
};
Index: sonypi.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/sonypi.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sonypi.c 11 Apr 2002 13:30:58 -0000 1.1
+++ sonypi.c 10 Jun 2003 01:13:27 -0000 1.2
@@ -617,8 +617,11 @@
goto out3;
}
+#if !defined(CONFIG_ACPI)
+ /* Enable ACPI mode to get Fn key events */
if (fnkeyinit)
outb(0xf0, 0xb2);
+#endif
if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2)
sonypi_type2_srs();
@@ -666,6 +669,11 @@
sonypi_type2_dis();
else
sonypi_type1_dis();
+#if !defined(CONFIG_ACPI)
+ /* disable ACPI mode */
+ if (fnkeyinit)
+ outb(0xf1, 0xb2);
+#endif
free_irq(sonypi_device.irq, sonypi_irq);
release_region(sonypi_device.ioport1, sonypi_device.region_size);
misc_deregister(&sonypi_misc_device);
Index: sonypi.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/sonypi.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sonypi.h 11 Apr 2002 13:30:58 -0000 1.1
+++ sonypi.h 10 Jun 2003 01:13:27 -0000 1.2
@@ -35,7 +35,7 @@
#ifdef __KERNEL__
#define SONYPI_DRIVER_MAJORVERSION 1
-#define SONYPI_DRIVER_MINORVERSION 7
+#define SONYPI_DRIVER_MINORVERSION 8
#include <linux/types.h>
#include <linux/pci.h>
Index: synclink.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/synclink.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- synclink.c 11 Apr 2002 13:30:58 -0000 1.2
+++ synclink.c 10 Jun 2003 01:13:27 -0000 1.3
@@ -926,7 +926,7 @@
static int __init synclink_init_one (struct pci_dev *dev,
const struct pci_device_id *ent);
-static void __exit synclink_remove_one (struct pci_dev *dev);
+static void __devexit synclink_remove_one (struct pci_dev *dev);
static struct pci_device_id synclink_pci_tbl[] __devinitdata = {
{ PCI_VENDOR_ID_MICROGATE, PCI_DEVICE_ID_MICROGATE_USC, PCI_ANY_ID, PCI_ANY_ID, },
Index: sysrq.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/sysrq.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sysrq.c 11 Apr 2002 13:30:59 -0000 1.2
+++ sysrq.c 10 Jun 2003 01:13:27 -0000 1.3
@@ -336,7 +336,7 @@
/* Key Operations table and lock */
-spinlock_t sysrq_key_table_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t sysrq_key_table_lock = SPIN_LOCK_UNLOCKED;
#define SYSRQ_KEY_TABLE_LENGTH 36
static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
/* 0 */ &sysrq_loglevel_op,
Index: tty_io.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/tty_io.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- tty_io.c 3 Jun 2002 02:33:07 -0000 1.7
+++ tty_io.c 10 Jun 2003 01:13:27 -0000 1.8
@@ -1343,7 +1343,7 @@
set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */
minor -= driver->minor_start;
devpts_pty_new(driver->other->name_base + minor, MKDEV(driver->other->major, minor + driver->other->minor_start));
- tty_register_devfs(&pts_driver[major], DEVFS_FL_NO_PERSISTENCE,
+ tty_register_devfs(&pts_driver[major], DEVFS_FL_DEFAULT,
pts_driver[major].minor_start + minor);
noctty = 1;
goto init_dev_done;
|