Skip to content

Commit

Permalink
Merge branches 'acpi-extlog', 'acpi-memhotplug', 'acpi-button', 'acpi…
Browse files Browse the repository at this point in the history
…-tools' and 'acpi-pci'

* acpi-extlog:
  ACPI / extlog: Check for RDMSR failure

* acpi-memhotplug:
  ACPI: memhotplug: Remove 'state' from struct acpi_memory_device

* acpi-button:
  ACPI: button: fix handling lid state changes when input device closed

* acpi-tools:
  tools/power/acpi: Serialize Makefile

* acpi-pci:
  ACPI: PCI: update kernel-doc line comments
  • Loading branch information
rafaeljw committed Oct 13, 2020
6 parents 5d2a3ca + 7cecb47 + c18483a + 21988a8 + 05c36e5 + 8e8883c commit 8be2362
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
6 changes: 3 additions & 3 deletions drivers/acpi/acpi_extlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ static int __init extlog_init(void)
u64 cap;
int rc;

rdmsrl(MSR_IA32_MCG_CAP, cap);

if (!(cap & MCG_ELOG_P) || !extlog_get_l1addr())
if (rdmsrl_safe(MSR_IA32_MCG_CAP, &cap) ||
!(cap & MCG_ELOG_P) ||
!extlog_get_l1addr())
return -ENODEV;

rc = -EINVAL;
Expand Down
12 changes: 1 addition & 11 deletions drivers/acpi/acpi_memhotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ static const struct acpi_device_id memory_device_ids[] = {

#ifdef CONFIG_ACPI_HOTPLUG_MEMORY

/* Memory Device States */
#define MEMORY_INVALID_STATE 0
#define MEMORY_POWER_ON_STATE 1
#define MEMORY_POWER_OFF_STATE 2

static int acpi_memory_device_add(struct acpi_device *device,
const struct acpi_device_id *not_used);
static void acpi_memory_device_remove(struct acpi_device *device);
Expand All @@ -57,8 +52,7 @@ struct acpi_memory_info {
};

struct acpi_memory_device {
struct acpi_device * device;
unsigned int state; /* State of the memory device */
struct acpi_device *device;
struct list_head res_list;
};

Expand Down Expand Up @@ -226,7 +220,6 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
}
if (!num_enabled) {
dev_err(&mem_device->device->dev, "add_memory failed\n");
mem_device->state = MEMORY_INVALID_STATE;
return -EINVAL;
}
/*
Expand Down Expand Up @@ -297,9 +290,6 @@ static int acpi_memory_device_add(struct acpi_device *device,
return result;
}

/* Set the device state */
mem_device->state = MEMORY_POWER_ON_STATE;

result = acpi_memory_check_device(mem_device);
if (result) {
acpi_memory_device_free(mem_device);
Expand Down
13 changes: 7 additions & 6 deletions drivers/acpi/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ struct acpi_button {
int last_state;
ktime_t last_time;
bool suspended;
bool lid_state_initialized;
};

static struct acpi_device *lid_device;
Expand Down Expand Up @@ -383,6 +384,8 @@ static int acpi_lid_update_state(struct acpi_device *device,

static void acpi_lid_initialize_state(struct acpi_device *device)
{
struct acpi_button *button = acpi_driver_data(device);

switch (lid_init_state) {
case ACPI_BUTTON_LID_INIT_OPEN:
(void)acpi_lid_notify_state(device, 1);
Expand All @@ -394,13 +397,14 @@ static void acpi_lid_initialize_state(struct acpi_device *device)
default:
break;
}

button->lid_state_initialized = true;
}

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 @@ -409,10 +413,7 @@ 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) {
mutex_lock(&button->input->mutex);
users = button->input->users;
mutex_unlock(&button->input->mutex);
if (users)
if (button->lid_state_initialized)
acpi_lid_update_state(device, true);
} else {
int keycode;
Expand Down Expand Up @@ -457,7 +458,7 @@ 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 && button->input->users) {
if (button->type == ACPI_BUTTON_TYPE_LID) {
button->last_state = !!acpi_lid_evaluate_state(device);
button->last_time = ktime_get();
acpi_lid_initialize_state(device);
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static DEFINE_MUTEX(osc_lock);

/**
* acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge
* @handle - the ACPI CA node in question.
* @handle: the ACPI CA node in question.
*
* Note: we could make this API take a struct acpi_device * instead, but
* for now, it's more convenient to operate on an acpi_handle.
Expand Down
2 changes: 2 additions & 0 deletions tools/power/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

include ../../scripts/Makefile.include

.NOTPARALLEL:

all: acpidbg acpidump ec
clean: acpidbg_clean acpidump_clean ec_clean
install: acpidbg_install acpidump_install ec_install
Expand Down

0 comments on commit 8be2362

Please sign in to comment.