Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139206
b: refs/heads/master
c: be84cfc
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Machek authored and Linus Torvalds committed Apr 1, 2009
1 parent 0b1c74e commit 3361495
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 107 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2b872903c5d66bccdf4306a35e3e94d4da8555d3
refs/heads/master: be84cfc588b19f14764d78556dc7b630ee8c914c
48 changes: 24 additions & 24 deletions trunk/drivers/hwmon/hp_accel.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ acpi_status lis3lv02d_acpi_write(acpi_handle handle, int reg, u8 val)

static int lis3lv02d_dmi_matched(const struct dmi_system_id *dmi)
{
adev.ac = *((struct axis_conversion *)dmi->driver_data);
lis3_dev.ac = *((struct axis_conversion *)dmi->driver_data);
printk(KERN_INFO DRIVER_NAME ": hardware type %s found.\n", dmi->ident);

return 1;
Expand Down Expand Up @@ -214,7 +214,7 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {

static void hpled_set(struct delayed_led_classdev *led_cdev, enum led_brightness value)
{
acpi_handle handle = adev.device->handle;
acpi_handle handle = lis3_dev.device->handle;
unsigned long long ret; /* Not used when writing */
union acpi_object in_obj[1];
struct acpi_object_list args = { 1, in_obj };
Expand Down Expand Up @@ -254,7 +254,7 @@ static void lis3lv02d_enum_resources(struct acpi_device *device)
acpi_status status;

status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
lis3lv02d_get_resource, &adev.irq);
lis3lv02d_get_resource, &lis3_dev.irq);
if (ACPI_FAILURE(status))
printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n");
}
Expand All @@ -263,16 +263,16 @@ static s16 lis3lv02d_read_16(acpi_handle handle, int reg)
{
u8 lo, hi;

adev.read(handle, reg - 1, &lo);
adev.read(handle, reg, &hi);
lis3_dev.read(handle, reg - 1, &lo);
lis3_dev.read(handle, reg, &hi);
/* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */
return (s16)((hi << 8) | lo);
}

static s16 lis3lv02d_read_8(acpi_handle handle, int reg)
{
s8 lo;
adev.read(handle, reg, &lo);
lis3_dev.read(handle, reg, &lo);
return lo;
}

Expand All @@ -283,37 +283,37 @@ static int lis3lv02d_add(struct acpi_device *device)
if (!device)
return -EINVAL;

adev.device = device;
adev.init = lis3lv02d_acpi_init;
adev.read = lis3lv02d_acpi_read;
adev.write = lis3lv02d_acpi_write;
lis3_dev.device = device;
lis3_dev.init = lis3lv02d_acpi_init;
lis3_dev.read = lis3lv02d_acpi_read;
lis3_dev.write = lis3lv02d_acpi_write;
strcpy(acpi_device_name(device), DRIVER_NAME);
strcpy(acpi_device_class(device), ACPI_MDPS_CLASS);
device->driver_data = &adev;
device->driver_data = &lis3_dev;

lis3lv02d_acpi_read(device->handle, WHO_AM_I, &adev.whoami);
switch (adev.whoami) {
lis3lv02d_acpi_read(device->handle, WHO_AM_I, &lis3_dev.whoami);
switch (lis3_dev.whoami) {
case LIS_DOUBLE_ID:
printk(KERN_INFO DRIVER_NAME ": 2-byte sensor found\n");
adev.read_data = lis3lv02d_read_16;
adev.mdps_max_val = 2048;
lis3_dev.read_data = lis3lv02d_read_16;
lis3_dev.mdps_max_val = 2048;
break;
case LIS_SINGLE_ID:
printk(KERN_INFO DRIVER_NAME ": 1-byte sensor found\n");
adev.read_data = lis3lv02d_read_8;
adev.mdps_max_val = 128;
lis3_dev.read_data = lis3lv02d_read_8;
lis3_dev.mdps_max_val = 128;
break;
default:
printk(KERN_ERR DRIVER_NAME
": unknown sensor type 0x%X\n", adev.whoami);
": unknown sensor type 0x%X\n", lis3_dev.whoami);
return -EINVAL;
}

/* If possible use a "standard" axes order */
if (dmi_check_system(lis3lv02d_dmi_ids) == 0) {
printk(KERN_INFO DRIVER_NAME ": laptop model unknown, "
"using default axes configuration\n");
adev.ac = lis3lv02d_axis_normal;
lis3_dev.ac = lis3lv02d_axis_normal;
}

INIT_WORK(&hpled_led.work, delayed_set_status_worker);
Expand All @@ -322,9 +322,9 @@ static int lis3lv02d_add(struct acpi_device *device)
return ret;

/* obtain IRQ number of our device from ACPI */
lis3lv02d_enum_resources(adev.device);
lis3lv02d_enum_resources(lis3_dev.device);

ret = lis3lv02d_init_device(&adev);
ret = lis3lv02d_init_device(&lis3_dev);
if (ret) {
flush_work(&hpled_led.work);
led_classdev_unregister(&hpled_led.led_classdev);
Expand Down Expand Up @@ -360,12 +360,12 @@ static int lis3lv02d_suspend(struct acpi_device *device, pm_message_t state)
static int lis3lv02d_resume(struct acpi_device *device)
{
/* put back the device in the right state (ACPI might turn it on) */
mutex_lock(&adev.lock);
if (adev.usage > 0)
mutex_lock(&lis3_dev.lock);
if (lis3_dev.usage > 0)
lis3lv02d_poweron(device->handle);
else
lis3lv02d_poweroff(device->handle);
mutex_unlock(&adev.lock);
mutex_unlock(&lis3_dev.lock);
return 0;
}
#else
Expand Down
Loading

0 comments on commit 3361495

Please sign in to comment.