mirror of
https://github.com/archlinux-jerry/nvidia-340xx
synced 2024-11-25 00:50:41 +08:00
121 lines
3.8 KiB
Diff
121 lines
3.8 KiB
Diff
--- a/kernel/nv-acpi.c 2020-01-01 00:00:00.000000000 +0000
|
|
+++ b/kernel/nv-acpi.c 2020-01-01 00:00:00.000000000 +0000
|
|
@@ -190,9 +190,9 @@
|
|
union acpi_object control_argument_0 = { ACPI_TYPE_INTEGER };
|
|
struct acpi_object_list control_argument_list = { 0, NULL };
|
|
nv_stack_t *sp = NULL;
|
|
- struct list_head *node, *next;
|
|
nv_acpi_integer_t device_id = 0;
|
|
int device_counter = 0;
|
|
+ acpi_handle handle = NULL;
|
|
|
|
NV_KMEM_CACHE_ALLOC_STACK(sp);
|
|
if (sp == NULL)
|
|
@@ -220,13 +220,12 @@
|
|
|
|
// grab handles to all the important nodes representing devices
|
|
|
|
- list_for_each_safe(node, next, &device->children)
|
|
+ do
|
|
{
|
|
- struct acpi_device *dev =
|
|
- list_entry(node, struct acpi_device, node);
|
|
-
|
|
- if (!dev)
|
|
- continue;
|
|
+ status = acpi_get_next_object(ACPI_TYPE_DEVICE, device->handle,
|
|
+ handle, &handle);
|
|
+ if (ACPI_FAILURE(status) || (handle == NULL))
|
|
+ break;
|
|
|
|
if (device_counter == NV_MAXNUM_DISPLAY_DEVICES)
|
|
{
|
|
@@ -237,7 +236,7 @@
|
|
}
|
|
|
|
status =
|
|
- acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
|
|
+ acpi_evaluate_integer(handle, "_ADR", NULL, &device_id);
|
|
if (ACPI_FAILURE(status))
|
|
/* Couldnt query device_id for this device */
|
|
continue;
|
|
@@ -256,11 +255,11 @@
|
|
}
|
|
|
|
pNvAcpiObject->pNvVideo[device_counter].dev_id = device_id;
|
|
- pNvAcpiObject->pNvVideo[device_counter].dev_handle = dev->handle;
|
|
+ pNvAcpiObject->pNvVideo[device_counter].dev_handle = handle;
|
|
|
|
device_counter++;
|
|
|
|
- }
|
|
+ } while (handle != NULL);
|
|
|
|
// arg 0, bits 1:0, 0 = enable events
|
|
control_argument_0.integer.type = ACPI_TYPE_INTEGER;
|
|
@@ -1202,16 +1201,15 @@
|
|
)
|
|
{
|
|
acpi_status status;
|
|
- struct acpi_device *device = NULL;
|
|
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
|
|
union acpi_object *ddc;
|
|
union acpi_object ddc_arg0 = { ACPI_TYPE_INTEGER };
|
|
struct acpi_object_list input = { 1, &ddc_arg0 };
|
|
- struct list_head *node, *next;
|
|
nv_acpi_integer_t device_id = 0;
|
|
NvU32 i;
|
|
acpi_handle dev_handle = NULL;
|
|
acpi_handle lcd_dev_handle = NULL;
|
|
+ acpi_handle handle = NULL;
|
|
|
|
if (!nv_acpi_get_device_handle(nv, &dev_handle))
|
|
return RM_ERR_NOT_SUPPORTED;
|
|
@@ -1219,16 +1217,6 @@
|
|
if (!dev_handle)
|
|
return RM_ERR_INVALID_ARGUMENT;
|
|
|
|
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
|
- device = acpi_fetch_acpi_dev(dev_handle);
|
|
- status = 0;
|
|
-#else
|
|
- status = acpi_bus_get_device(dev_handle, &device);
|
|
-#endif
|
|
-
|
|
- if (ACPI_FAILURE(status) || !device)
|
|
- return RM_ERR_INVALID_ARGUMENT;
|
|
-
|
|
if (!NV_MAY_SLEEP())
|
|
{
|
|
#if defined(DEBUG)
|
|
@@ -1239,15 +1227,15 @@
|
|
return RM_ERR_NOT_SUPPORTED;
|
|
}
|
|
|
|
- list_for_each_safe(node, next, &device->children)
|
|
+ while (lcd_dev_handle == NULL)
|
|
{
|
|
- struct acpi_device *dev =
|
|
- list_entry(node, struct acpi_device, node);
|
|
+ status = acpi_get_next_object(ACPI_TYPE_DEVICE, dev_handle,
|
|
+ handle, &handle);
|
|
+ if (ACPI_FAILURE(status) || (handle == NULL))
|
|
+ break;
|
|
|
|
- if (!dev)
|
|
- continue;
|
|
+ status = acpi_evaluate_integer(handle, "_ADR", NULL, &device_id);
|
|
|
|
- status = acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
|
|
if (ACPI_FAILURE(status))
|
|
/* Couldnt query device_id for this device */
|
|
continue;
|
|
@@ -1256,7 +1244,7 @@
|
|
|
|
if ((device_id == 0x0110) || (device_id == 0x0118) || (device_id == 0x0400)) /* Only for an LCD*/
|
|
{
|
|
- lcd_dev_handle = dev->handle;
|
|
+ lcd_dev_handle = handle;
|
|
nv_printf(NV_DBG_INFO, "NVRM: %s Found LCD: %x\n", __FUNCTION__, device_id);
|
|
break;
|
|
}
|