Skip to content

Commit

Permalink
platform/x86: hp_accel: Remove _INI method call
Browse files Browse the repository at this point in the history
According to ACPI specification the _INI method must be called
when device is enumerated first time. After that there is no need
to repeat the procedure. Convert the lis3lv02d_acpi_init() to be
a stub (Note, we may not remove it because it is called unconditionally
by the accelerometer main driver).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20210823093222.19544-2-andriy.shevchenko@linux.intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Andy Shevchenko authored and Hans de Goede committed Aug 26, 2021
1 parent 0c59e61 commit 34570a8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
1 change: 0 additions & 1 deletion drivers/misc/lis3lv02d/lis3lv02d.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ struct lis3lv02d {
int regs_size;
u8 *reg_cache;
bool regs_stored;
bool init_required;
u8 odr_mask; /* ODR bit mask */
u8 whoami; /* indicates measurement precision */
s16 (*read_data) (struct lis3lv02d *lis3, int reg);
Expand Down
14 changes: 1 addition & 13 deletions drivers/platform/x86/hp_accel.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,14 @@ static const struct acpi_device_id lis3lv02d_device_ids[] = {
};
MODULE_DEVICE_TABLE(acpi, lis3lv02d_device_ids);


/**
* lis3lv02d_acpi_init - ACPI _INI method: initialize the device.
* lis3lv02d_acpi_init - initialize the device for ACPI
* @lis3: pointer to the device struct
*
* Returns 0 on success.
*/
static int lis3lv02d_acpi_init(struct lis3lv02d *lis3)
{
struct acpi_device *dev = lis3->bus_priv;
if (!lis3->init_required)
return 0;

if (acpi_evaluate_object(dev->handle, METHOD_NAME__INI,
NULL, NULL) != AE_OK)
return -EINVAL;

return 0;
}

Expand Down Expand Up @@ -359,7 +350,6 @@ static int lis3lv02d_add(struct acpi_device *device)
}

/* call the core layer do its init */
lis3_dev.init_required = true;
ret = lis3lv02d_init_device(&lis3_dev);
if (ret)
return ret;
Expand Down Expand Up @@ -407,14 +397,12 @@ static int lis3lv02d_suspend(struct device *dev)

static int lis3lv02d_resume(struct device *dev)
{
lis3_dev.init_required = false;
lis3lv02d_poweron(&lis3_dev);
return 0;
}

static int lis3lv02d_restore(struct device *dev)
{
lis3_dev.init_required = true;
lis3lv02d_poweron(&lis3_dev);
return 0;
}
Expand Down

0 comments on commit 34570a8

Please sign in to comment.