Skip to content

Commit

Permalink
Merge branches 'acpi-ec', 'acpi-button', 'acpi-sysfs', 'acpi-lpss' an…
Browse files Browse the repository at this point in the history
…d 'acpi-cppc'

* acpi-ec:
  ACPI / EC: Fix regression related to triggering source of EC event handling

* acpi-button:
  ACPI / button: Delay acpi_lid_initialize_state() until first user space open

* acpi-sysfs:
  ACPI / sysfs: Make function param_set_trace_method_name() static

* acpi-lpss:
  ACPI / LPSS: Remove redundant initialization of clk

* acpi-cppc:
  ACPI / CPPC: Make CPPC ACPI driver aware of PCC subspace IDs
  mailbox: PCC: Move the MAX_PCC_SUBSPACES definition to header file
  • Loading branch information
Rafael J. Wysocki committed Nov 13, 2017
6 parents 85595ad + 53c5eaa + 84d3f6b + 3e87ead + 71c50db + 85b1407 commit eb5fcc3
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 102 deletions.
2 changes: 1 addition & 1 deletion drivers/acpi/acpi_lpss.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ static int register_device_clock(struct acpi_device *adev,
{
const struct lpss_device_desc *dev_desc = pdata->dev_desc;
const char *devname = dev_name(&adev->dev);
struct clk *clk = ERR_PTR(-ENODEV);
struct clk *clk;
struct lpss_clk_data *clk_data;
const char *parent, *clk_name;
void __iomem *prv_base;
Expand Down
26 changes: 21 additions & 5 deletions drivers/acpi/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
{
struct acpi_button *button = acpi_driver_data(device);
struct input_dev *input;
int users;

switch (event) {
case ACPI_FIXED_HARDWARE_EVENT:
Expand All @@ -398,7 +399,11 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
case ACPI_BUTTON_NOTIFY_STATUS:
input = button->input;
if (button->type == ACPI_BUTTON_TYPE_LID) {
acpi_lid_update_state(device);
mutex_lock(&button->input->mutex);
users = button->input->users;
mutex_unlock(&button->input->mutex);
if (users)
acpi_lid_update_state(device);
} else {
int keycode;

Expand Down Expand Up @@ -442,12 +447,24 @@ static int acpi_button_resume(struct device *dev)
struct acpi_button *button = acpi_driver_data(device);

button->suspended = false;
if (button->type == ACPI_BUTTON_TYPE_LID)
if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users)
acpi_lid_initialize_state(device);
return 0;
}
#endif

static int acpi_lid_input_open(struct input_dev *input)
{
struct acpi_device *device = input_get_drvdata(input);
struct acpi_button *button = acpi_driver_data(device);

button->last_state = !!acpi_lid_evaluate_state(device);
button->last_time = ktime_get();
acpi_lid_initialize_state(device);

return 0;
}

static int acpi_button_add(struct acpi_device *device)
{
struct acpi_button *button;
Expand Down Expand Up @@ -488,8 +505,7 @@ static int acpi_button_add(struct acpi_device *device)
strcpy(name, ACPI_BUTTON_DEVICE_NAME_LID);
sprintf(class, "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
button->last_state = !!acpi_lid_evaluate_state(device);
button->last_time = ktime_get();
input->open = acpi_lid_input_open;
} else {
printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", hid);
error = -ENODEV;
Expand Down Expand Up @@ -522,11 +538,11 @@ static int acpi_button_add(struct acpi_device *device)
break;
}

input_set_drvdata(input, device);
error = input_register_device(input);
if (error)
goto err_remove_fs;
if (button->type == ACPI_BUTTON_TYPE_LID) {
acpi_lid_initialize_state(device);
/*
* This assumes there's only one lid device, or if there are
* more we only care about the last one...
Expand Down
Loading

0 comments on commit eb5fcc3

Please sign in to comment.