Commit ea400752 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'acpi-utils', 'acpi-resource', 'acpi-property' and 'acpi-soc'

Merge ACPI utilities updates, ACPI resource management updates, ACPI
device properties management updates and ACPI LPSS (Intel SoC) driver
update for 6.7-rc1:

 - Rework acpi_handle_list handling so as to manage it dynamically,
   including size computation (Rafael Wysocki).

 - Clean up ACPI utilities code so as to make it follow the kernel
   coding style (Jonathan Bergh).

 - Consolidate IRQ trigger-type override DMI tables and drop .ident
   values from dmi_system_id tables used for ACPI resources management
   quirks (Hans de Goede).

 - Add ACPI IRQ override for TongFang GMxXGxx (Werner Sembach).

 - Allow _DSD buffer data only for byte accessors and document the _DSD
   data buffer GUID (Andy Shevchenko).

 - Drop BayTrail and Lynxpoint pinctrl device IDs from the ACPI LPSS
   driver, because it does not need them (Raag Jadav).

* acpi-utils:
  ACPI: utils: Remove redundant braces around individual statement
  ACPI: utils: Fix up white space in a few places
  ACPI: utils: Dynamically determine acpi_handle_list size
  ACPI: thermal: Merge trip initialization functions
  ACPI: thermal: Collapse trip devices update function wrappers
  ACPI: thermal: Collapse trip devices update functions
  ACPI: thermal: Add device list to struct acpi_thermal_trip
  ACPI: thermal: Fix a small leak in acpi_thermal_add()
  ACPI: thermal: Drop valid flag from struct acpi_thermal_trip
  ACPI: thermal: Drop redundant trip point flags
  ACPI: thermal: Untangle initialization and updates of active trips
  ACPI: thermal: Untangle initialization and updates of the passive trip
  ACPI: thermal: Simplify critical and hot trips representation
  ACPI: thermal: Create and populate trip points table earlier
  ACPI: thermal: Determine the number of trip points earlier
  ACPI: thermal: Fold acpi_thermal_get_info() into its caller
  ACPI: thermal: Simplify initialization of critical and hot trips

* acpi-resource:
  ACPI: resource: Do IRQ override on TongFang GMxXGxx
  ACPI: resource: Drop .ident values from dmi_system_id tables
  ACPI: resource: Consolidate IRQ trigger-type override DMI tables

* acpi-property:
  ACPI: property: Document the _DSD data buffer GUID
  ACPI: property: Allow _DSD buffer data only for byte accessors

* acpi-soc:
  ACPI: LPSS: drop BayTrail and Lynxpoint pinctrl HIDs
...@@ -368,7 +368,6 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { ...@@ -368,7 +368,6 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
{ "INT33C4", LPSS_ADDR(lpt_uart_dev_desc) }, { "INT33C4", LPSS_ADDR(lpt_uart_dev_desc) },
{ "INT33C5", LPSS_ADDR(lpt_uart_dev_desc) }, { "INT33C5", LPSS_ADDR(lpt_uart_dev_desc) },
{ "INT33C6", LPSS_ADDR(lpt_sdio_dev_desc) }, { "INT33C6", LPSS_ADDR(lpt_sdio_dev_desc) },
{ "INT33C7", },
/* BayTrail LPSS devices */ /* BayTrail LPSS devices */
{ "80860F09", LPSS_ADDR(byt_pwm_dev_desc) }, { "80860F09", LPSS_ADDR(byt_pwm_dev_desc) },
...@@ -376,8 +375,6 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { ...@@ -376,8 +375,6 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
{ "80860F0E", LPSS_ADDR(byt_spi_dev_desc) }, { "80860F0E", LPSS_ADDR(byt_spi_dev_desc) },
{ "80860F14", LPSS_ADDR(byt_sdio_dev_desc) }, { "80860F14", LPSS_ADDR(byt_sdio_dev_desc) },
{ "80860F41", LPSS_ADDR(byt_i2c_dev_desc) }, { "80860F41", LPSS_ADDR(byt_i2c_dev_desc) },
{ "INT33B2", },
{ "INT33FC", },
/* Braswell LPSS devices */ /* Braswell LPSS devices */
{ "80862286", LPSS_ADDR(lpss_dma_desc) }, { "80862286", LPSS_ADDR(lpss_dma_desc) },
...@@ -396,7 +393,6 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { ...@@ -396,7 +393,6 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
{ "INT3434", LPSS_ADDR(lpt_uart_dev_desc) }, { "INT3434", LPSS_ADDR(lpt_uart_dev_desc) },
{ "INT3435", LPSS_ADDR(lpt_uart_dev_desc) }, { "INT3435", LPSS_ADDR(lpt_uart_dev_desc) },
{ "INT3436", LPSS_ADDR(lpt_sdio_dev_desc) }, { "INT3436", LPSS_ADDR(lpt_sdio_dev_desc) },
{ "INT3437", },
/* Wildcat Point LPSS devices */ /* Wildcat Point LPSS devices */
{ "INT3438", LPSS_ADDR(lpt_spi_dev_desc) }, { "INT3438", LPSS_ADDR(lpt_spi_dev_desc) },
...@@ -578,6 +574,7 @@ static bool acpi_lpss_dep(struct acpi_device *adev, acpi_handle handle) ...@@ -578,6 +574,7 @@ static bool acpi_lpss_dep(struct acpi_device *adev, acpi_handle handle)
{ {
struct acpi_handle_list dep_devices; struct acpi_handle_list dep_devices;
acpi_status status; acpi_status status;
bool ret = false;
int i; int i;
if (!acpi_has_method(adev->handle, "_DEP")) if (!acpi_has_method(adev->handle, "_DEP"))
...@@ -591,11 +588,14 @@ static bool acpi_lpss_dep(struct acpi_device *adev, acpi_handle handle) ...@@ -591,11 +588,14 @@ static bool acpi_lpss_dep(struct acpi_device *adev, acpi_handle handle)
} }
for (i = 0; i < dep_devices.count; i++) { for (i = 0; i < dep_devices.count; i++) {
if (dep_devices.handles[i] == handle) if (dep_devices.handles[i] == handle) {
return true; ret = true;
break;
}
} }
return false; acpi_handle_list_free(&dep_devices);
return ret;
} }
static void acpi_lpss_link_consumer(struct device *dev1, static void acpi_lpss_link_consumer(struct device *dev1,
...@@ -657,10 +657,9 @@ static int acpi_lpss_create_device(struct acpi_device *adev, ...@@ -657,10 +657,9 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
int ret; int ret;
dev_desc = (const struct lpss_device_desc *)id->driver_data; dev_desc = (const struct lpss_device_desc *)id->driver_data;
if (!dev_desc) { if (!dev_desc)
pdev = acpi_create_platform_device(adev, NULL); return -EINVAL;
return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1;
}
pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
if (!pdata) if (!pdata)
return -ENOMEM; return -ENOMEM;
......
...@@ -55,6 +55,7 @@ static const guid_t ads_guid = ...@@ -55,6 +55,7 @@ static const guid_t ads_guid =
GUID_INIT(0xdbb8e3e6, 0x5886, 0x4ba6, GUID_INIT(0xdbb8e3e6, 0x5886, 0x4ba6,
0x87, 0x95, 0x13, 0x19, 0xf5, 0x2a, 0x96, 0x6b); 0x87, 0x95, 0x13, 0x19, 0xf5, 0x2a, 0x96, 0x6b);
/* ACPI _DSD data buffer GUID: edb12dd0-363d-4085-a3d2-49522ca160c4 */
static const guid_t buffer_prop_guid = static const guid_t buffer_prop_guid =
GUID_INIT(0xedb12dd0, 0x363d, 0x4085, GUID_INIT(0xedb12dd0, 0x363d, 0x4085,
0xa3, 0xd2, 0x49, 0x52, 0x2c, 0xa1, 0x60, 0xc4); 0xa3, 0xd2, 0x49, 0x52, 0x2c, 0xa1, 0x60, 0xc4);
...@@ -1102,25 +1103,26 @@ static int acpi_data_prop_read(const struct acpi_device_data *data, ...@@ -1102,25 +1103,26 @@ static int acpi_data_prop_read(const struct acpi_device_data *data,
switch (proptype) { switch (proptype) {
case DEV_PROP_STRING: case DEV_PROP_STRING:
break; break;
case DEV_PROP_U8 ... DEV_PROP_U64: default:
if (obj->type == ACPI_TYPE_BUFFER) { if (obj->type == ACPI_TYPE_BUFFER) {
if (nval > obj->buffer.length) if (nval > obj->buffer.length)
return -EOVERFLOW; return -EOVERFLOW;
break; } else {
if (nval > obj->package.count)
return -EOVERFLOW;
} }
fallthrough;
default:
if (nval > obj->package.count)
return -EOVERFLOW;
break; break;
} }
if (nval == 0) if (nval == 0)
return -EINVAL; return -EINVAL;
if (obj->type != ACPI_TYPE_BUFFER) if (obj->type == ACPI_TYPE_BUFFER) {
items = obj->package.elements; if (proptype != DEV_PROP_U8)
else return -EPROTO;
items = obj; items = obj;
} else {
items = obj->package.elements;
}
switch (proptype) { switch (proptype) {
case DEV_PROP_U8: case DEV_PROP_U8:
......
...@@ -385,127 +385,144 @@ unsigned int acpi_dev_get_irq_type(int triggering, int polarity) ...@@ -385,127 +385,144 @@ unsigned int acpi_dev_get_irq_type(int triggering, int polarity)
} }
EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type); EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type);
static const struct dmi_system_id medion_laptop[] = { /*
* DMI matches for boards where the DSDT specifies the kbd IRQ as
* level active-low and using the override changes this to rising edge,
* stopping the keyboard from working.
*/
static const struct dmi_system_id irq1_level_low_skip_override[] = {
{ {
.ident = "MEDION P15651", /* MEDION P15651 */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
DMI_MATCH(DMI_BOARD_NAME, "M15T"), DMI_MATCH(DMI_BOARD_NAME, "M15T"),
}, },
}, },
{ {
.ident = "MEDION S17405", /* MEDION S17405 */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
DMI_MATCH(DMI_BOARD_NAME, "M17T"), DMI_MATCH(DMI_BOARD_NAME, "M17T"),
}, },
}, },
{ {
.ident = "MEDION S17413", /* MEDION S17413 */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
DMI_MATCH(DMI_BOARD_NAME, "M1xA"), DMI_MATCH(DMI_BOARD_NAME, "M1xA"),
}, },
}, },
{ }
};
static const struct dmi_system_id asus_laptop[] = {
{ {
.ident = "Asus Vivobook K3402ZA", /* Asus Vivobook K3402ZA */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_BOARD_NAME, "K3402ZA"), DMI_MATCH(DMI_BOARD_NAME, "K3402ZA"),
}, },
}, },
{ {
.ident = "Asus Vivobook K3502ZA", /* Asus Vivobook K3502ZA */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_BOARD_NAME, "K3502ZA"), DMI_MATCH(DMI_BOARD_NAME, "K3502ZA"),
}, },
}, },
{ {
.ident = "Asus Vivobook S5402ZA", /* Asus Vivobook S5402ZA */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_BOARD_NAME, "S5402ZA"), DMI_MATCH(DMI_BOARD_NAME, "S5402ZA"),
}, },
}, },
{ {
.ident = "Asus Vivobook S5602ZA", /* Asus Vivobook S5602ZA */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_BOARD_NAME, "S5602ZA"), DMI_MATCH(DMI_BOARD_NAME, "S5602ZA"),
}, },
}, },
{ {
.ident = "Asus ExpertBook B1402CBA", /* Asus ExpertBook B1402CBA */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_BOARD_NAME, "B1402CBA"), DMI_MATCH(DMI_BOARD_NAME, "B1402CBA"),
}, },
}, },
{ {
.ident = "Asus ExpertBook B1502CBA", /* Asus ExpertBook B1502CBA */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_BOARD_NAME, "B1502CBA"), DMI_MATCH(DMI_BOARD_NAME, "B1502CBA"),
}, },
}, },
{ {
.ident = "Asus ExpertBook B2402CBA", /* Asus ExpertBook B2402CBA */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_BOARD_NAME, "B2402CBA"), DMI_MATCH(DMI_BOARD_NAME, "B2402CBA"),
}, },
}, },
{ {
.ident = "Asus ExpertBook B2402FBA", /* Asus ExpertBook B2402FBA */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_BOARD_NAME, "B2402FBA"), DMI_MATCH(DMI_BOARD_NAME, "B2402FBA"),
}, },
}, },
{ {
.ident = "Asus ExpertBook B2502", /* Asus ExpertBook B2502 */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_BOARD_NAME, "B2502CBA"), DMI_MATCH(DMI_BOARD_NAME, "B2502CBA"),
}, },
}, },
{
/* LG Electronics 17U70P */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
DMI_MATCH(DMI_BOARD_NAME, "17U70P"),
},
},
{ } { }
}; };
static const struct dmi_system_id tongfang_gm_rg[] = { /*
* DMI matches for AMD Zen boards where the DSDT specifies the kbd IRQ
* as falling edge and this must be overridden to rising edge,
* to have a working keyboard.
*/
static const struct dmi_system_id irq1_edge_low_force_override[] = {
{ {
.ident = "TongFang GMxRGxx/XMG CORE 15 (M22)/TUXEDO Stellaris 15 Gen4 AMD", /* TongFang GMxRGxx/XMG CORE 15 (M22)/TUXEDO Stellaris 15 Gen4 AMD */
.matches = { .matches = {
DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"), DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"),
}, },
}, },
{ }
};
static const struct dmi_system_id maingear_laptop[] = {
{ {
.ident = "MAINGEAR Vector Pro 2 15", /* TongFang GMxXGxx/TUXEDO Polaris 15 Gen5 AMD */
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "GMxXGxx"),
},
},
{
/* TongFang GM6XGxX/TUXEDO Stellaris 16 Gen5 AMD */
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "GM6XGxX"),
},
},
{
/* MAINGEAR Vector Pro 2 15 */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Micro Electronics Inc"), DMI_MATCH(DMI_SYS_VENDOR, "Micro Electronics Inc"),
DMI_MATCH(DMI_PRODUCT_NAME, "MG-VCP2-15A3070T"), DMI_MATCH(DMI_PRODUCT_NAME, "MG-VCP2-15A3070T"),
} }
}, },
{ {
.ident = "MAINGEAR Vector Pro 2 17", /* MAINGEAR Vector Pro 2 17 */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Micro Electronics Inc"), DMI_MATCH(DMI_SYS_VENDOR, "Micro Electronics Inc"),
DMI_MATCH(DMI_PRODUCT_NAME, "MG-VCP2-17A3070T"), DMI_MATCH(DMI_PRODUCT_NAME, "MG-VCP2-17A3070T"),
}, },
}, },
{ }
};
static const struct dmi_system_id pcspecialist_laptop[] = {
{ {
/* TongFang GM6BGEQ / PCSpecialist Elimina Pro 16 M, RTX 3050 */ /* TongFang GM6BGEQ / PCSpecialist Elimina Pro 16 M, RTX 3050 */
.matches = { .matches = {
...@@ -527,17 +544,6 @@ static const struct dmi_system_id pcspecialist_laptop[] = { ...@@ -527,17 +544,6 @@ static const struct dmi_system_id pcspecialist_laptop[] = {
{ } { }
}; };
static const struct dmi_system_id lg_laptop[] = {
{
.ident = "LG Electronics 17U70P",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
DMI_MATCH(DMI_BOARD_NAME, "17U70P"),
},
},
{ }
};
struct irq_override_cmp { struct irq_override_cmp {
const struct dmi_system_id *system; const struct dmi_system_id *system;
unsigned char irq; unsigned char irq;
...@@ -548,12 +554,8 @@ struct irq_override_cmp { ...@@ -548,12 +554,8 @@ struct irq_override_cmp {
}; };
static const struct irq_override_cmp override_table[] = { static const struct irq_override_cmp override_table[] = {
{ medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false }, { irq1_level_low_skip_override, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
{ asus_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false }, { irq1_edge_low_force_override, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
{ tongfang_gm_rg, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
{ maingear_laptop, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
{ pcspecialist_laptop, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
{ lg_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
}; };
static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity, static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
......
...@@ -2032,6 +2032,7 @@ static u32 acpi_scan_check_dep(acpi_handle handle, bool check_dep) ...@@ -2032,6 +2032,7 @@ static u32 acpi_scan_check_dep(acpi_handle handle, bool check_dep)
mutex_unlock(&acpi_dep_list_lock); mutex_unlock(&acpi_dep_list_lock);
} }
acpi_handle_list_free(&dep_devices);
return count; return count;
} }
......
This diff is collapsed.
...@@ -342,9 +342,8 @@ acpi_evaluate_reference(acpi_handle handle, ...@@ -342,9 +342,8 @@ acpi_evaluate_reference(acpi_handle handle,
u32 i = 0; u32 i = 0;
if (!list) { if (!list)
return AE_BAD_PARAMETER; return AE_BAD_PARAMETER;
}
/* Evaluate object. */ /* Evaluate object. */
...@@ -370,7 +369,8 @@ acpi_evaluate_reference(acpi_handle handle, ...@@ -370,7 +369,8 @@ acpi_evaluate_reference(acpi_handle handle,
goto end; goto end;
} }
if (package->package.count > ACPI_MAX_HANDLES) { list->handles = kcalloc(package->package.count, sizeof(*list->handles), GFP_KERNEL);
if (!list->handles) {
kfree(package); kfree(package);
return AE_NO_MEMORY; return AE_NO_MEMORY;
} }
...@@ -399,10 +399,11 @@ acpi_evaluate_reference(acpi_handle handle, ...@@ -399,10 +399,11 @@ acpi_evaluate_reference(acpi_handle handle,
acpi_handle_debug(list->handles[i], "Found in reference list\n"); acpi_handle_debug(list->handles[i], "Found in reference list\n");
} }
end: end:
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
list->count = 0; list->count = 0;
//kfree(list->handles); kfree(list->handles);
list->handles = NULL;
} }
kfree(buffer.pointer); kfree(buffer.pointer);
...@@ -412,6 +413,61 @@ acpi_evaluate_reference(acpi_handle handle, ...@@ -412,6 +413,61 @@ acpi_evaluate_reference(acpi_handle handle,
EXPORT_SYMBOL(acpi_evaluate_reference); EXPORT_SYMBOL(acpi_evaluate_reference);
/**
* acpi_handle_list_equal - Check if two ACPI handle lists are the same
* @list1: First list to compare.
* @list2: Second list to compare.
*
* Return true if the given ACPI handle lists are of the same size and
* contain the same ACPI handles in the same order. Otherwise, return false.
*/
bool acpi_handle_list_equal(struct acpi_handle_list *list1,
struct acpi_handle_list *list2)
{
return list1->count == list2->count &&
!memcmp(list1->handles, list2->handles,
list1->count * sizeof(acpi_handle));
}
EXPORT_SYMBOL_GPL(acpi_handle_list_equal);
/**
* acpi_handle_list_replace - Replace one ACPI handle list with another
* @dst: ACPI handle list to replace.
* @src: Source ACPI handle list.
*
* Free the handles table in @dst, move the handles table from @src to @dst,
* copy count from @src to @dst and clear @src.
*/
void acpi_handle_list_replace(struct acpi_handle_list *dst,
struct acpi_handle_list *src)
{
if (dst->count)
kfree(dst->handles);
dst->count = src->count;
dst->handles = src->handles;
src->handles = NULL;
src->count = 0;
}
EXPORT_SYMBOL_GPL(acpi_handle_list_replace);
/**
* acpi_handle_list_free - Free the handles table in an ACPI handle list
* @list: ACPI handle list to free.
*
* Free the handles table in @list and clear its count field.
*/
void acpi_handle_list_free(struct acpi_handle_list *list)
{
if (!list->count)
return;
kfree(list->handles);
list->count = 0;
}
EXPORT_SYMBOL_GPL(acpi_handle_list_free);
acpi_status acpi_status
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld) acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld)
{ {
...@@ -523,7 +579,7 @@ acpi_handle_printk(const char *level, acpi_handle handle, const char *fmt, ...) ...@@ -523,7 +579,7 @@ acpi_handle_printk(const char *level, acpi_handle handle, const char *fmt, ...)
vaf.va = &args; vaf.va = &args;
path = acpi_handle_path(handle); path = acpi_handle_path(handle);
printk("%sACPI: %s: %pV", level, path ? path : "<n/a>" , &vaf); printk("%sACPI: %s: %pV", level, path ? path : "<n/a>", &vaf);
va_end(args); va_end(args);
kfree(path); kfree(path);
......
...@@ -741,6 +741,7 @@ static bool is_san_consumer(struct platform_device *pdev, acpi_handle handle) ...@@ -741,6 +741,7 @@ static bool is_san_consumer(struct platform_device *pdev, acpi_handle handle)
struct acpi_handle_list dep_devices; struct acpi_handle_list dep_devices;
acpi_handle supplier = ACPI_HANDLE(&pdev->dev); acpi_handle supplier = ACPI_HANDLE(&pdev->dev);
acpi_status status; acpi_status status;
bool ret = false;
int i; int i;
if (!acpi_has_method(handle, "_DEP")) if (!acpi_has_method(handle, "_DEP"))
...@@ -753,11 +754,14 @@ static bool is_san_consumer(struct platform_device *pdev, acpi_handle handle) ...@@ -753,11 +754,14 @@ static bool is_san_consumer(struct platform_device *pdev, acpi_handle handle)
} }
for (i = 0; i < dep_devices.count; i++) { for (i = 0; i < dep_devices.count; i++) {
if (dep_devices.handles[i] == supplier) if (dep_devices.handles[i] == supplier) {
return true; ret = true;
break;
}
} }
return false; acpi_handle_list_free(&dep_devices);
return ret;
} }
static acpi_status san_consumer_setup(acpi_handle handle, u32 lvl, static acpi_status san_consumer_setup(acpi_handle handle, u32 lvl,
......
...@@ -12,11 +12,9 @@ ...@@ -12,11 +12,9 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/property.h> #include <linux/property.h>
/* TBD: Make dynamic */
#define ACPI_MAX_HANDLES 10
struct acpi_handle_list { struct acpi_handle_list {
u32 count; u32 count;
acpi_handle handles[ACPI_MAX_HANDLES]; acpi_handle* handles;
}; };
/* acpi_utils.h */ /* acpi_utils.h */
...@@ -32,6 +30,11 @@ acpi_evaluate_reference(acpi_handle handle, ...@@ -32,6 +30,11 @@ acpi_evaluate_reference(acpi_handle handle,
acpi_string pathname, acpi_string pathname,
struct acpi_object_list *arguments, struct acpi_object_list *arguments,
struct acpi_handle_list *list); struct acpi_handle_list *list);
bool acpi_handle_list_equal(struct acpi_handle_list *list1,
struct acpi_handle_list *list2);
void acpi_handle_list_replace(struct acpi_handle_list *dst,
struct acpi_handle_list *src);
void acpi_handle_list_free(struct acpi_handle_list *list);
acpi_status acpi_status
acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code, acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code,
struct acpi_buffer *status_buf); struct acpi_buffer *status_buf);
......
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