Commit 12186f51 authored by Guenter Roeck's avatar Guenter Roeck Committed by Greg Kroah-Hartman

i8k: Fix various checkpatch warnings and errors

Fix:
WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
WARNING: Use #include <linux/io.h> instead of <asm/io.h>
WARNING: __packed is preferred over __attribute__((packed))
WARNING: externs should be avoided in .c files
ERROR: spaces required around that ':' (ctx:ExV)
ERROR: do not use assignment in if condition
WARNING: line over 80 characters
WARNING: __initdata should be placed after i8k_dmi_table[]
ERROR: code indent should use tabs where possible
WARNING: please, no spaces at the start of a line
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 60e71aaf
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/hwmon.h> #include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h> #include <linux/hwmon-sysfs.h>
#include <asm/uaccess.h> #include <linux/uaccess.h>
#include <asm/io.h> #include <linux/io.h>
#include <linux/i8k.h> #include <linux/i8k.h>
...@@ -105,11 +105,11 @@ static const struct file_operations i8k_fops = { ...@@ -105,11 +105,11 @@ static const struct file_operations i8k_fops = {
struct smm_regs { struct smm_regs {
unsigned int eax; unsigned int eax;
unsigned int ebx __attribute__ ((packed)); unsigned int ebx __packed;
unsigned int ecx __attribute__ ((packed)); unsigned int ecx __packed;
unsigned int edx __attribute__ ((packed)); unsigned int edx __packed;
unsigned int esi __attribute__ ((packed)); unsigned int esi __packed;
unsigned int edi __attribute__ ((packed)); unsigned int edi __packed;
}; };
static inline const char *i8k_get_dmi_data(int field) static inline const char *i8k_get_dmi_data(int field)
...@@ -150,7 +150,7 @@ static int i8k_smm(struct smm_regs *regs) ...@@ -150,7 +150,7 @@ static int i8k_smm(struct smm_regs *regs)
"pushfq\n\t" "pushfq\n\t"
"popq %%rax\n\t" "popq %%rax\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");
#else #else
...@@ -176,7 +176,7 @@ static int i8k_smm(struct smm_regs *regs) ...@@ -176,7 +176,7 @@ static int i8k_smm(struct smm_regs *regs)
"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");
#endif #endif
...@@ -205,7 +205,8 @@ static int i8k_get_fn_status(void) ...@@ -205,7 +205,8 @@ static int i8k_get_fn_status(void)
struct smm_regs regs = { .eax = I8K_SMM_FN_STATUS, }; struct smm_regs regs = { .eax = I8K_SMM_FN_STATUS, };
int rc; int rc;
if ((rc = i8k_smm(&regs)) < 0) rc = i8k_smm(&regs);
if (rc < 0)
return rc; return rc;
switch ((regs.eax >> I8K_FN_SHIFT) & I8K_FN_MASK) { switch ((regs.eax >> I8K_FN_SHIFT) & I8K_FN_MASK) {
...@@ -228,7 +229,8 @@ static int i8k_get_power_status(void) ...@@ -228,7 +229,8 @@ static int i8k_get_power_status(void)
struct smm_regs regs = { .eax = I8K_SMM_POWER_STATUS, }; struct smm_regs regs = { .eax = I8K_SMM_POWER_STATUS, };
int rc; int rc;
if ((rc = i8k_smm(&regs)) < 0) rc = i8k_smm(&regs);
if (rc < 0)
return rc; return rc;
return (regs.eax & 0xff) == I8K_POWER_AC ? I8K_AC : I8K_BATTERY; return (regs.eax & 0xff) == I8K_POWER_AC ? I8K_AC : I8K_BATTERY;
...@@ -282,7 +284,8 @@ static int i8k_get_temp(int sensor) ...@@ -282,7 +284,8 @@ static int i8k_get_temp(int sensor)
static int prev; static int prev;
#endif #endif
regs.ebx = sensor & 0xff; regs.ebx = sensor & 0xff;
if ((rc = i8k_smm(&regs)) < 0) rc = i8k_smm(&regs);
if (rc < 0)
return rc; return rc;
temp = regs.eax & 0xff; temp = regs.eax & 0xff;
...@@ -311,7 +314,8 @@ static int i8k_get_dell_signature(int req_fn) ...@@ -311,7 +314,8 @@ static int i8k_get_dell_signature(int req_fn)
struct smm_regs regs = { .eax = req_fn, }; struct smm_regs regs = { .eax = req_fn, };
int rc; int rc;
if ((rc = i8k_smm(&regs)) < 0) rc = i8k_smm(&regs);
if (rc < 0)
return rc; return rc;
return regs.eax == 1145651527 && regs.edx == 1145392204 ? 0 : -1; return regs.eax == 1145651527 && regs.edx == 1145392204 ? 0 : -1;
...@@ -335,7 +339,8 @@ i8k_ioctl_unlocked(struct file *fp, unsigned int cmd, unsigned long arg) ...@@ -335,7 +339,8 @@ i8k_ioctl_unlocked(struct file *fp, unsigned int cmd, unsigned long arg)
case I8K_MACHINE_ID: case I8K_MACHINE_ID:
memset(buff, 0, 16); memset(buff, 0, 16);
strlcpy(buff, i8k_get_dmi_data(DMI_PRODUCT_SERIAL), sizeof(buff)); strlcpy(buff, i8k_get_dmi_data(DMI_PRODUCT_SERIAL),
sizeof(buff));
break; break;
case I8K_FN_STATUS: case I8K_FN_STATUS:
...@@ -609,7 +614,7 @@ static void __exit i8k_exit_hwmon(void) ...@@ -609,7 +614,7 @@ static void __exit i8k_exit_hwmon(void)
hwmon_device_unregister(i8k_hwmon_dev); hwmon_device_unregister(i8k_hwmon_dev);
} }
static struct dmi_system_id __initdata i8k_dmi_table[] = { static struct dmi_system_id i8k_dmi_table[] __initdata = {
{ {
.ident = "Dell Inspiron", .ident = "Dell Inspiron",
.matches = { .matches = {
...@@ -673,7 +678,7 @@ static struct dmi_system_id __initdata i8k_dmi_table[] = { ...@@ -673,7 +678,7 @@ static struct dmi_system_id __initdata i8k_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "XPS L421X"), DMI_MATCH(DMI_PRODUCT_NAME, "XPS L421X"),
}, },
}, },
{ } { }
}; };
/* /*
...@@ -698,7 +703,8 @@ static int __init i8k_probe(void) ...@@ -698,7 +703,8 @@ static int __init i8k_probe(void)
i8k_get_dmi_data(DMI_BIOS_VERSION)); i8k_get_dmi_data(DMI_BIOS_VERSION));
} }
strlcpy(bios_version, i8k_get_dmi_data(DMI_BIOS_VERSION), sizeof(bios_version)); strlcpy(bios_version, i8k_get_dmi_data(DMI_BIOS_VERSION),
sizeof(bios_version));
/* /*
* Get SMM Dell signature * Get SMM Dell signature
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment