提交 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[] = {
};
static char system_vendor[48] = "?";
static char product_name [48] = "?";
static char bios_version [4] = "?";
static char product_name[48] = "?";
static char bios_version[4] = "?";
static char serial_number[16] = "?";
MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)");
......@@ -108,35 +108,34 @@ typedef struct {
/*
* 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 eax = regs->eax;
asm("pushl %%eax\n\t" \
"movl 0(%%eax),%%edx\n\t" \
"push %%edx\n\t" \
"movl 4(%%eax),%%ebx\n\t" \
"movl 8(%%eax),%%ecx\n\t" \
"movl 12(%%eax),%%edx\n\t" \
"movl 16(%%eax),%%esi\n\t" \
"movl 20(%%eax),%%edi\n\t" \
"popl %%eax\n\t" \
"out %%al,$0xb2\n\t" \
"out %%al,$0x84\n\t" \
asm("pushl %%eax\n\t"
"movl 0(%%eax),%%edx\n\t"
"push %%edx\n\t"
"movl 4(%%eax),%%ebx\n\t"
"movl 8(%%eax),%%ecx\n\t"
"movl 12(%%eax),%%edx\n\t"
"movl 16(%%eax),%%esi\n\t"
"movl 20(%%eax),%%edi\n\t"
"popl %%eax\n\t"
"out %%al,$0xb2\n\t"
"out %%al,$0x84\n\t"
"xchgl %%eax,(%%esp)\n\t"
"movl %%ebx,4(%%eax)\n\t" \
"movl %%ecx,8(%%eax)\n\t" \
"movl %%edx,12(%%eax)\n\t" \
"movl %%esi,16(%%eax)\n\t" \
"movl %%edi,20(%%eax)\n\t" \
"popl %%edx\n\t" \
"movl %%edx,0(%%eax)\n\t" \
"lahf\n\t" \
"shrl $8,%%eax\n\t" \
"andl $1,%%eax\n" \
: "=a" (rc)
: "a" (regs)
"movl %%ebx,4(%%eax)\n\t"
"movl %%ecx,8(%%eax)\n\t"
"movl %%edx,12(%%eax)\n\t"
"movl %%esi,16(%%eax)\n\t"
"movl %%edi,20(%%eax)\n\t"
"popl %%edx\n\t"
"movl %%edx,0(%%eax)\n\t"
"lahf\n\t"
"shrl $8,%%eax\n\t"
"andl $1,%%eax\n":"=a"(rc)
: "a"(regs)
: "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
if ((rc != 0) || ((regs->eax & 0xffff) == 0xffff) || (regs->eax == eax)) {
......@@ -156,7 +155,7 @@ static int i8k_get_bios_version(void)
int rc;
regs.eax = I8K_SMM_BIOS_VERSION;
if ((rc=i8k_smm(&regs)) < 0) {
if ((rc = i8k_smm(&regs)) < 0) {
return rc;
}
......@@ -181,7 +180,7 @@ static int i8k_get_fn_status(void)
int rc;
regs.eax = I8K_SMM_FN_STATUS;
if ((rc=i8k_smm(&regs)) < 0) {
if ((rc = i8k_smm(&regs)) < 0) {
return rc;
}
......@@ -206,7 +205,7 @@ static int i8k_get_power_status(void)
int rc;
regs.eax = I8K_SMM_POWER_STATUS;
if ((rc=i8k_smm(&regs)) < 0) {
if ((rc = i8k_smm(&regs)) < 0) {
return rc;
}
......@@ -228,7 +227,7 @@ static int i8k_get_fan_status(int fan)
regs.eax = I8K_SMM_GET_FAN;
regs.ebx = fan & 0xff;
if ((rc=i8k_smm(&regs)) < 0) {
if ((rc = i8k_smm(&regs)) < 0) {
return rc;
}
......@@ -245,7 +244,7 @@ static int i8k_get_fan_speed(int fan)
regs.eax = I8K_SMM_GET_SPEED;
regs.ebx = fan & 0xff;
if ((rc=i8k_smm(&regs)) < 0) {
if ((rc = i8k_smm(&regs)) < 0) {
return rc;
}
......@@ -264,7 +263,7 @@ static int i8k_set_fan(int fan, int speed)
regs.eax = I8K_SMM_SET_FAN;
regs.ebx = (fan & 0xff) | (speed << 8);
if ((rc=i8k_smm(&regs)) < 0) {
if ((rc = i8k_smm(&regs)) < 0) {
return rc;
}
......@@ -285,7 +284,7 @@ static int i8k_get_cpu_temp(void)
#endif
regs.eax = I8K_SMM_GET_TEMP;
if ((rc=i8k_smm(&regs)) < 0) {
if ((rc = i8k_smm(&regs)) < 0) {
return rc;
}
temp = regs.eax & 0xff;
......@@ -315,7 +314,7 @@ static int i8k_get_dell_signature(void)
int rc;
regs.eax = I8K_SMM_GET_DELL_SIG;
if ((rc=i8k_smm(&regs)) < 0) {
if ((rc = i8k_smm(&regs)) < 0) {
return rc;
}
......@@ -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))) {
return -EFAULT;
}
if (copy_from_user(&speed, argp+1, sizeof(int))) {
if (copy_from_user(&speed, argp + 1, sizeof(int))) {
return -EFAULT;
}
val = i8k_set_fan(val, speed);
......@@ -455,16 +454,13 @@ static int i8k_get_info(char *buffer, char **start, off_t fpos, int length)
serial_number,
cpu_temp,
left_fan,
right_fan,
left_speed,
right_speed,
ac_power,
fn_key);
right_fan, left_speed, right_speed, ac_power, fn_key);
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;
char info[128];
......@@ -490,7 +486,7 @@ static ssize_t i8k_read(struct file *f, char __user *buffer, size_t len, loff_t
return len;
}
static char* __init string_trim(char *s, int size)
static char *__init string_trim(char *s, int size)
{
int len;
char *p;
......@@ -499,7 +495,7 @@ static char* __init string_trim(char *s, int size)
len = size;
}
for (p=s+len-1; len && (*p==' '); len--,p--) {
for (p = s + len - 1; len && (*p == ' '); len--, p--) {
*p = '\0';
}
......@@ -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;
......@@ -524,7 +520,7 @@ static char* __init dmi_string(DMIHeader *dmi, u8 s)
}
s--;
p = (u8 *)dmi + dmi->length;
p = (u8 *) dmi + dmi->length;
while (s > 0) {
p += strlen(p);
p++;
......@@ -534,7 +530,7 @@ static char* __init dmi_string(DMIHeader *dmi, u8 s)
return p;
}
static void __init dmi_decode(DMIHeader *dmi)
static void __init dmi_decode(DMIHeader * dmi)
{
u8 *data = (u8 *) dmi;
char *p;
......@@ -542,7 +538,7 @@ static void __init dmi_decode(DMIHeader *dmi)
#ifdef I8K_DEBUG
int i;
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("\n");
......@@ -550,24 +546,24 @@ static void __init dmi_decode(DMIHeader *dmi)
switch (dmi->type) {
case 0: /* BIOS Information */
p = dmi_string(dmi,data[5]);
p = dmi_string(dmi, data[5]);
if (*p) {
strlcpy(bios_version, p, sizeof(bios_version));
string_trim(bios_version, sizeof(bios_version));
}
break;
case 1: /* System Information */
p = dmi_string(dmi,data[4]);
p = dmi_string(dmi, data[4]);
if (*p) {
strlcpy(system_vendor, p, sizeof(system_vendor));
string_trim(system_vendor, sizeof(system_vendor));
}
p = dmi_string(dmi,data[5]);
p = dmi_string(dmi, data[5]);
if (*p) {
strlcpy(product_name, p, sizeof(product_name));
string_trim(product_name, sizeof(product_name));
}
p = dmi_string(dmi,data[7]);
p = dmi_string(dmi, data[7]);
if (*p) {
strlcpy(serial_number, p, sizeof(serial_number));
string_trim(serial_number, sizeof(serial_number));
......@@ -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 *data;
......@@ -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
* or we run off the end of the table (also happens)
*/
while ((i<num) && ((data-buf) < len)) {
dmi = (DMIHeader *)data;
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) {
if ((data - buf + dmi->length) >= len) {
break;
}
fn(dmi);
......@@ -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
* stuff looking like string fill past the end
*/
while (((data-buf) < len) && (*data || data[1])) {
while (((data - buf) < len) && (*data || data[1])) {
data++;
}
data += 2;
......@@ -619,7 +616,7 @@ static int __init dmi_table(u32 base, int len, int num, void (*fn)(DMIHeader*))
return 0;
}
static int __init dmi_iterate(void (*decode)(DMIHeader *))
static int __init dmi_iterate(void (*decode) (DMIHeader *))
{
unsigned char buf[20];
void __iomem *p = ioremap(0xe0000, 0x20000), *q;
......@@ -629,20 +626,20 @@ static int __init dmi_iterate(void (*decode)(DMIHeader *))
for (q = p; q < p + 0x20000; q += 16) {
memcpy_fromio(buf, q, 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];
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);
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]);
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]);
buf[11] << 24 | buf[10] << 16 | buf[9] << 8 |
buf[8]);
#endif
if (dmi_table(base, len, num, decode)==0) {
if (dmi_table(base, len, num, decode) == 0) {
iounmap(p);
return 0;
}
......@@ -651,6 +648,7 @@ static int __init dmi_iterate(void (*decode)(DMIHeader *))
iounmap(p);
return -1;
}
/* end of DMI code */
/*
......@@ -665,17 +663,18 @@ static int __init i8k_dmi_probe(void)
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");
return -ENODEV;
}
for (p=supported_models; ; p++) {
for (p = supported_models;; 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;
}
if (strncmp(product_name,*p,strlen(*p)) == 0) {
if (strncmp(product_name, *p, strlen(*p)) == 0) {
break;
}
}
......@@ -730,9 +729,10 @@ static int __init i8k_probe(void)
/*
* 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 (strncmp(buff, bios_version, sizeof(bios_version)) != 0) {
printk(KERN_INFO
"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.
先完成此消息的编辑!
想要评论请 注册