提交 dec63ec3 编写于 作者: D Dmitry Torokhov 提交者: Linus Torvalds

[PATCH] I8K: pass through lindent

I8K: pass through Lindent to change 4 spaces identation to TABs
Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 3f5f7e2e
...@@ -61,8 +61,8 @@ static char *supported_models[] = { ...@@ -61,8 +61,8 @@ static char *supported_models[] = {
}; };
static char system_vendor[48] = "?"; static char system_vendor[48] = "?";
static char product_name [48] = "?"; static char product_name[48] = "?";
static char bios_version [4] = "?"; static char bios_version[4] = "?";
static char serial_number[16] = "?"; static char serial_number[16] = "?";
MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)"); MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)");
...@@ -108,35 +108,34 @@ typedef struct { ...@@ -108,35 +108,34 @@ typedef struct {
/* /*
* Call the System Management Mode BIOS. Code provided by Jonathan Buzzard. * Call the System Management Mode BIOS. Code provided by Jonathan Buzzard.
*/ */
static int i8k_smm(SMMRegisters *regs) static int i8k_smm(SMMRegisters * regs)
{ {
int rc; int rc;
int eax = regs->eax; int eax = regs->eax;
asm("pushl %%eax\n\t" \ asm("pushl %%eax\n\t"
"movl 0(%%eax),%%edx\n\t" \ "movl 0(%%eax),%%edx\n\t"
"push %%edx\n\t" \ "push %%edx\n\t"
"movl 4(%%eax),%%ebx\n\t" \ "movl 4(%%eax),%%ebx\n\t"
"movl 8(%%eax),%%ecx\n\t" \ "movl 8(%%eax),%%ecx\n\t"
"movl 12(%%eax),%%edx\n\t" \ "movl 12(%%eax),%%edx\n\t"
"movl 16(%%eax),%%esi\n\t" \ "movl 16(%%eax),%%esi\n\t"
"movl 20(%%eax),%%edi\n\t" \ "movl 20(%%eax),%%edi\n\t"
"popl %%eax\n\t" \ "popl %%eax\n\t"
"out %%al,$0xb2\n\t" \ "out %%al,$0xb2\n\t"
"out %%al,$0x84\n\t" \ "out %%al,$0x84\n\t"
"xchgl %%eax,(%%esp)\n\t" "xchgl %%eax,(%%esp)\n\t"
"movl %%ebx,4(%%eax)\n\t" \ "movl %%ebx,4(%%eax)\n\t"
"movl %%ecx,8(%%eax)\n\t" \ "movl %%ecx,8(%%eax)\n\t"
"movl %%edx,12(%%eax)\n\t" \ "movl %%edx,12(%%eax)\n\t"
"movl %%esi,16(%%eax)\n\t" \ "movl %%esi,16(%%eax)\n\t"
"movl %%edi,20(%%eax)\n\t" \ "movl %%edi,20(%%eax)\n\t"
"popl %%edx\n\t" \ "popl %%edx\n\t"
"movl %%edx,0(%%eax)\n\t" \ "movl %%edx,0(%%eax)\n\t"
"lahf\n\t" \ "lahf\n\t"
"shrl $8,%%eax\n\t" \ "shrl $8,%%eax\n\t"
"andl $1,%%eax\n" \ "andl $1,%%eax\n":"=a"(rc)
: "=a" (rc) : "a"(regs)
: "a" (regs)
: "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
if ((rc != 0) || ((regs->eax & 0xffff) == 0xffff) || (regs->eax == eax)) { if ((rc != 0) || ((regs->eax & 0xffff) == 0xffff) || (regs->eax == eax)) {
...@@ -156,7 +155,7 @@ static int i8k_get_bios_version(void) ...@@ -156,7 +155,7 @@ static int i8k_get_bios_version(void)
int rc; int rc;
regs.eax = I8K_SMM_BIOS_VERSION; regs.eax = I8K_SMM_BIOS_VERSION;
if ((rc=i8k_smm(&regs)) < 0) { if ((rc = i8k_smm(&regs)) < 0) {
return rc; return rc;
} }
...@@ -181,7 +180,7 @@ static int i8k_get_fn_status(void) ...@@ -181,7 +180,7 @@ static int i8k_get_fn_status(void)
int rc; int rc;
regs.eax = I8K_SMM_FN_STATUS; regs.eax = I8K_SMM_FN_STATUS;
if ((rc=i8k_smm(&regs)) < 0) { if ((rc = i8k_smm(&regs)) < 0) {
return rc; return rc;
} }
...@@ -206,7 +205,7 @@ static int i8k_get_power_status(void) ...@@ -206,7 +205,7 @@ static int i8k_get_power_status(void)
int rc; int rc;
regs.eax = I8K_SMM_POWER_STATUS; regs.eax = I8K_SMM_POWER_STATUS;
if ((rc=i8k_smm(&regs)) < 0) { if ((rc = i8k_smm(&regs)) < 0) {
return rc; return rc;
} }
...@@ -228,7 +227,7 @@ static int i8k_get_fan_status(int fan) ...@@ -228,7 +227,7 @@ static int i8k_get_fan_status(int fan)
regs.eax = I8K_SMM_GET_FAN; regs.eax = I8K_SMM_GET_FAN;
regs.ebx = fan & 0xff; regs.ebx = fan & 0xff;
if ((rc=i8k_smm(&regs)) < 0) { if ((rc = i8k_smm(&regs)) < 0) {
return rc; return rc;
} }
...@@ -245,7 +244,7 @@ static int i8k_get_fan_speed(int fan) ...@@ -245,7 +244,7 @@ static int i8k_get_fan_speed(int fan)
regs.eax = I8K_SMM_GET_SPEED; regs.eax = I8K_SMM_GET_SPEED;
regs.ebx = fan & 0xff; regs.ebx = fan & 0xff;
if ((rc=i8k_smm(&regs)) < 0) { if ((rc = i8k_smm(&regs)) < 0) {
return rc; return rc;
} }
...@@ -264,7 +263,7 @@ static int i8k_set_fan(int fan, int speed) ...@@ -264,7 +263,7 @@ static int i8k_set_fan(int fan, int speed)
regs.eax = I8K_SMM_SET_FAN; regs.eax = I8K_SMM_SET_FAN;
regs.ebx = (fan & 0xff) | (speed << 8); regs.ebx = (fan & 0xff) | (speed << 8);
if ((rc=i8k_smm(&regs)) < 0) { if ((rc = i8k_smm(&regs)) < 0) {
return rc; return rc;
} }
...@@ -285,7 +284,7 @@ static int i8k_get_cpu_temp(void) ...@@ -285,7 +284,7 @@ static int i8k_get_cpu_temp(void)
#endif #endif
regs.eax = I8K_SMM_GET_TEMP; regs.eax = I8K_SMM_GET_TEMP;
if ((rc=i8k_smm(&regs)) < 0) { if ((rc = i8k_smm(&regs)) < 0) {
return rc; return rc;
} }
temp = regs.eax & 0xff; temp = regs.eax & 0xff;
...@@ -315,7 +314,7 @@ static int i8k_get_dell_signature(void) ...@@ -315,7 +314,7 @@ static int i8k_get_dell_signature(void)
int rc; int rc;
regs.eax = I8K_SMM_GET_DELL_SIG; regs.eax = I8K_SMM_GET_DELL_SIG;
if ((rc=i8k_smm(&regs)) < 0) { if ((rc = i8k_smm(&regs)) < 0) {
return rc; return rc;
} }
...@@ -380,7 +379,7 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, ...@@ -380,7 +379,7 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
if (copy_from_user(&val, argp, sizeof(int))) { if (copy_from_user(&val, argp, sizeof(int))) {
return -EFAULT; return -EFAULT;
} }
if (copy_from_user(&speed, argp+1, sizeof(int))) { if (copy_from_user(&speed, argp + 1, sizeof(int))) {
return -EFAULT; return -EFAULT;
} }
val = i8k_set_fan(val, speed); val = i8k_set_fan(val, speed);
...@@ -455,16 +454,13 @@ static int i8k_get_info(char *buffer, char **start, off_t fpos, int length) ...@@ -455,16 +454,13 @@ static int i8k_get_info(char *buffer, char **start, off_t fpos, int length)
serial_number, serial_number,
cpu_temp, cpu_temp,
left_fan, left_fan,
right_fan, right_fan, left_speed, right_speed, ac_power, fn_key);
left_speed,
right_speed,
ac_power,
fn_key);
return n; return n;
} }
static ssize_t i8k_read(struct file *f, char __user *buffer, size_t len, loff_t *fpos) static ssize_t i8k_read(struct file *f, char __user * buffer, size_t len,
loff_t * fpos)
{ {
int n; int n;
char info[128]; char info[128];
...@@ -490,7 +486,7 @@ static ssize_t i8k_read(struct file *f, char __user *buffer, size_t len, loff_t ...@@ -490,7 +486,7 @@ static ssize_t i8k_read(struct file *f, char __user *buffer, size_t len, loff_t
return len; return len;
} }
static char* __init string_trim(char *s, int size) static char *__init string_trim(char *s, int size)
{ {
int len; int len;
char *p; char *p;
...@@ -499,7 +495,7 @@ static char* __init string_trim(char *s, int size) ...@@ -499,7 +495,7 @@ static char* __init string_trim(char *s, int size)
len = size; len = size;
} }
for (p=s+len-1; len && (*p==' '); len--,p--) { for (p = s + len - 1; len && (*p == ' '); len--, p--) {
*p = '\0'; *p = '\0';
} }
...@@ -515,7 +511,7 @@ static char* __init string_trim(char *s, int size) ...@@ -515,7 +511,7 @@ static char* __init string_trim(char *s, int size)
* | | * | |
* +-----------------------+ * +-----------------------+
*/ */
static char* __init dmi_string(DMIHeader *dmi, u8 s) static char *__init dmi_string(DMIHeader * dmi, u8 s)
{ {
u8 *p; u8 *p;
...@@ -524,7 +520,7 @@ static char* __init dmi_string(DMIHeader *dmi, u8 s) ...@@ -524,7 +520,7 @@ static char* __init dmi_string(DMIHeader *dmi, u8 s)
} }
s--; s--;
p = (u8 *)dmi + dmi->length; p = (u8 *) dmi + dmi->length;
while (s > 0) { while (s > 0) {
p += strlen(p); p += strlen(p);
p++; p++;
...@@ -534,7 +530,7 @@ static char* __init dmi_string(DMIHeader *dmi, u8 s) ...@@ -534,7 +530,7 @@ static char* __init dmi_string(DMIHeader *dmi, u8 s)
return p; return p;
} }
static void __init dmi_decode(DMIHeader *dmi) static void __init dmi_decode(DMIHeader * dmi)
{ {
u8 *data = (u8 *) dmi; u8 *data = (u8 *) dmi;
char *p; char *p;
...@@ -542,7 +538,7 @@ static void __init dmi_decode(DMIHeader *dmi) ...@@ -542,7 +538,7 @@ static void __init dmi_decode(DMIHeader *dmi)
#ifdef I8K_DEBUG #ifdef I8K_DEBUG
int i; int i;
printk("%08x ", (int)data); printk("%08x ", (int)data);
for (i=0; i<data[1] && i<64; i++) { for (i = 0; i < data[1] && i < 64; i++) {
printk("%02x ", data[i]); printk("%02x ", data[i]);
} }
printk("\n"); printk("\n");
...@@ -550,24 +546,24 @@ static void __init dmi_decode(DMIHeader *dmi) ...@@ -550,24 +546,24 @@ static void __init dmi_decode(DMIHeader *dmi)
switch (dmi->type) { switch (dmi->type) {
case 0: /* BIOS Information */ case 0: /* BIOS Information */
p = dmi_string(dmi,data[5]); p = dmi_string(dmi, data[5]);
if (*p) { if (*p) {
strlcpy(bios_version, p, sizeof(bios_version)); strlcpy(bios_version, p, sizeof(bios_version));
string_trim(bios_version, sizeof(bios_version)); string_trim(bios_version, sizeof(bios_version));
} }
break; break;
case 1: /* System Information */ case 1: /* System Information */
p = dmi_string(dmi,data[4]); p = dmi_string(dmi, data[4]);
if (*p) { if (*p) {
strlcpy(system_vendor, p, sizeof(system_vendor)); strlcpy(system_vendor, p, sizeof(system_vendor));
string_trim(system_vendor, sizeof(system_vendor)); string_trim(system_vendor, sizeof(system_vendor));
} }
p = dmi_string(dmi,data[5]); p = dmi_string(dmi, data[5]);
if (*p) { if (*p) {
strlcpy(product_name, p, sizeof(product_name)); strlcpy(product_name, p, sizeof(product_name));
string_trim(product_name, sizeof(product_name)); string_trim(product_name, sizeof(product_name));
} }
p = dmi_string(dmi,data[7]); p = dmi_string(dmi, data[7]);
if (*p) { if (*p) {
strlcpy(serial_number, p, sizeof(serial_number)); strlcpy(serial_number, p, sizeof(serial_number));
string_trim(serial_number, sizeof(serial_number)); string_trim(serial_number, sizeof(serial_number));
...@@ -576,7 +572,8 @@ static void __init dmi_decode(DMIHeader *dmi) ...@@ -576,7 +572,8 @@ static void __init dmi_decode(DMIHeader *dmi)
} }
} }
static int __init dmi_table(u32 base, int len, int num, void (*fn)(DMIHeader*)) static int __init dmi_table(u32 base, int len, int num,
void (*fn) (DMIHeader *))
{ {
u8 *buf; u8 *buf;
u8 *data; u8 *data;
...@@ -593,13 +590,13 @@ static int __init dmi_table(u32 base, int len, int num, void (*fn)(DMIHeader*)) ...@@ -593,13 +590,13 @@ static int __init dmi_table(u32 base, int len, int num, void (*fn)(DMIHeader*))
* Stop when we see al the items the table claimed to have * Stop when we see al the items the table claimed to have
* or we run off the end of the table (also happens) * or we run off the end of the table (also happens)
*/ */
while ((i<num) && ((data-buf) < len)) { while ((i < num) && ((data - buf) < len)) {
dmi = (DMIHeader *)data; dmi = (DMIHeader *) data;
/* /*
* Avoid misparsing crud if the length of the last * Avoid misparsing crud if the length of the last
* record is crap * record is crap
*/ */
if ((data-buf+dmi->length) >= len) { if ((data - buf + dmi->length) >= len) {
break; break;
} }
fn(dmi); fn(dmi);
...@@ -608,7 +605,7 @@ static int __init dmi_table(u32 base, int len, int num, void (*fn)(DMIHeader*)) ...@@ -608,7 +605,7 @@ static int __init dmi_table(u32 base, int len, int num, void (*fn)(DMIHeader*))
* Don't go off the end of the data if there is * Don't go off the end of the data if there is
* stuff looking like string fill past the end * stuff looking like string fill past the end
*/ */
while (((data-buf) < len) && (*data || data[1])) { while (((data - buf) < len) && (*data || data[1])) {
data++; data++;
} }
data += 2; data += 2;
...@@ -619,7 +616,7 @@ static int __init dmi_table(u32 base, int len, int num, void (*fn)(DMIHeader*)) ...@@ -619,7 +616,7 @@ static int __init dmi_table(u32 base, int len, int num, void (*fn)(DMIHeader*))
return 0; return 0;
} }
static int __init dmi_iterate(void (*decode)(DMIHeader *)) static int __init dmi_iterate(void (*decode) (DMIHeader *))
{ {
unsigned char buf[20]; unsigned char buf[20];
void __iomem *p = ioremap(0xe0000, 0x20000), *q; void __iomem *p = ioremap(0xe0000, 0x20000), *q;
...@@ -629,20 +626,20 @@ static int __init dmi_iterate(void (*decode)(DMIHeader *)) ...@@ -629,20 +626,20 @@ static int __init dmi_iterate(void (*decode)(DMIHeader *))
for (q = p; q < p + 0x20000; q += 16) { for (q = p; q < p + 0x20000; q += 16) {
memcpy_fromio(buf, q, 20); memcpy_fromio(buf, q, 20);
if (memcmp(buf, "_DMI_", 5)==0) { if (memcmp(buf, "_DMI_", 5) == 0) {
u16 num = buf[13]<<8 | buf[12]; u16 num = buf[13] << 8 | buf[12];
u16 len = buf [7]<<8 | buf [6]; u16 len = buf[7] << 8 | buf[6];
u32 base = buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8]; u32 base = buf[11] << 24 | buf[10] << 16 | buf[9] << 8 | buf[8];
#ifdef I8K_DEBUG #ifdef I8K_DEBUG
printk(KERN_INFO "DMI %d.%d present.\n", printk(KERN_INFO "DMI %d.%d present.\n",
buf[14]>>4, buf[14]&0x0F); buf[14] >> 4, buf[14] & 0x0F);
printk(KERN_INFO "%d structures occupying %d bytes.\n", printk(KERN_INFO "%d structures occupying %d bytes.\n",
buf[13]<<8 | buf[12], buf[13] << 8 | buf[12], buf[7] << 8 | buf[6]);
buf [7]<<8 | buf[6]);
printk(KERN_INFO "DMI table at 0x%08X.\n", printk(KERN_INFO "DMI table at 0x%08X.\n",
buf[11]<<24 | buf[10]<<16 | buf[9]<<8 | buf[8]); buf[11] << 24 | buf[10] << 16 | buf[9] << 8 |
buf[8]);
#endif #endif
if (dmi_table(base, len, num, decode)==0) { if (dmi_table(base, len, num, decode) == 0) {
iounmap(p); iounmap(p);
return 0; return 0;
} }
...@@ -651,6 +648,7 @@ static int __init dmi_iterate(void (*decode)(DMIHeader *)) ...@@ -651,6 +648,7 @@ static int __init dmi_iterate(void (*decode)(DMIHeader *))
iounmap(p); iounmap(p);
return -1; return -1;
} }
/* end of DMI code */ /* end of DMI code */
/* /*
...@@ -665,17 +663,18 @@ static int __init i8k_dmi_probe(void) ...@@ -665,17 +663,18 @@ static int __init i8k_dmi_probe(void)
return -ENODEV; return -ENODEV;
} }
if (strncmp(system_vendor,DELL_SIGNATURE,strlen(DELL_SIGNATURE)) != 0) { if (strncmp(system_vendor, DELL_SIGNATURE, strlen(DELL_SIGNATURE)) != 0) {
printk(KERN_INFO "i8k: not running on a Dell system\n"); printk(KERN_INFO "i8k: not running on a Dell system\n");
return -ENODEV; return -ENODEV;
} }
for (p=supported_models; ; p++) { for (p = supported_models;; p++) {
if (!*p) { if (!*p) {
printk(KERN_INFO "i8k: unsupported model: %s\n", product_name); printk(KERN_INFO "i8k: unsupported model: %s\n",
product_name);
return -ENODEV; return -ENODEV;
} }
if (strncmp(product_name,*p,strlen(*p)) == 0) { if (strncmp(product_name, *p, strlen(*p)) == 0) {
break; break;
} }
} }
...@@ -730,9 +729,10 @@ static int __init i8k_probe(void) ...@@ -730,9 +729,10 @@ static int __init i8k_probe(void)
/* /*
* Check if the two versions match. * Check if the two versions match.
*/ */
if (strncmp(buff,bios_version,sizeof(bios_version)) != 0) { if (strncmp(buff, bios_version, sizeof(bios_version)) != 0) {
printk(KERN_INFO "i8k: BIOS version mismatch: %s != %s\n", printk(KERN_INFO
buff, bios_version); "i8k: BIOS version mismatch: %s != %s\n", buff,
bios_version);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册