Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/acpica/acpi_ec.c
Show First 20 Lines • Show All 356 Lines • ▼ Show 20 Lines | return (ENXIO); | ||||
ret = ENXIO; | ret = ENXIO; | ||||
ecdt = 0; | ecdt = 0; | ||||
buf.Pointer = NULL; | buf.Pointer = NULL; | ||||
buf.Length = ACPI_ALLOCATE_BUFFER; | buf.Length = ACPI_ALLOCATE_BUFFER; | ||||
params = acpi_get_private(dev); | params = acpi_get_private(dev); | ||||
if (params != NULL) { | if (params != NULL) { | ||||
ecdt = 1; | ecdt = 1; | ||||
ret = 0; | ret = 0; | ||||
} else if (ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids)) { | } else if (ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids, NULL) | ||||
<= 0) { | |||||
jhb: I think for here it might be more consistent to do this:
```
} else {
ret =… | |||||
params = malloc(sizeof(struct acpi_ec_params), M_TEMP, | params = malloc(sizeof(struct acpi_ec_params), M_TEMP, | ||||
M_WAITOK | M_ZERO); | M_WAITOK | M_ZERO); | ||||
h = acpi_get_handle(dev); | h = acpi_get_handle(dev); | ||||
/* | /* | ||||
* Read the unit ID to check for duplicate attach and the | * Read the unit ID to check for duplicate attach and the | ||||
* global lock value to see if we should acquire it when | * global lock value to see if we should acquire it when | ||||
* accessing the EC. | * accessing the EC. | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | acpi_ec_probe(device_t dev) | ||||
/* Store the values we got from the namespace for attach. */ | /* Store the values we got from the namespace for attach. */ | ||||
acpi_set_private(dev, params); | acpi_set_private(dev, params); | ||||
/* | /* | ||||
* Check for a duplicate probe. This can happen when a probe | * Check for a duplicate probe. This can happen when a probe | ||||
* via ECDT succeeded already. If this is a duplicate, disable | * via ECDT succeeded already. If this is a duplicate, disable | ||||
* this device. | * this device. | ||||
*/ | */ | ||||
peer = devclass_get_device(acpi_ec_devclass, params->uid); | peer = devclass_get_device(acpi_ec_devclass, params->uid); | ||||
Done Inline ActionsThis would also need to be updated to handle 'ret' to set it to ENXIO in the device_disable case, maybe by just inverting the conditional: if (peer != NULL && device_is_alive(peer)) { device_disable(dev); ret = ENXIO; } jhb: This would also need to be updated to handle 'ret' to set it to ENXIO in the device_disable… | |||||
if (peer == NULL || !device_is_alive(peer)) | if (peer == NULL || !device_is_alive(peer)) | ||||
ret = 0; | ret = 0; | ||||
else | else | ||||
device_disable(dev); | device_disable(dev); | ||||
} | } | ||||
out: | out: | ||||
if (ret == 0) { | if (ret == 0) { | ||||
Done Inline ActionsMake this 'if (ret <= 0) {'. jhb: Make this 'if (ret <= 0) {'. | |||||
snprintf(desc, sizeof(desc), "Embedded Controller: GPE %#x%s%s", | snprintf(desc, sizeof(desc), "Embedded Controller: GPE %#x%s%s", | ||||
params->gpe_bit, (params->glk) ? ", GLK" : "", | params->gpe_bit, (params->glk) ? ", GLK" : "", | ||||
ecdt ? ", ECDT" : ""); | ecdt ? ", ECDT" : ""); | ||||
device_set_desc_copy(dev, desc); | device_set_desc_copy(dev, desc); | ||||
} else | } else | ||||
free(params, M_TEMP); | free(params, M_TEMP); | ||||
if (buf.Pointer) | if (buf.Pointer) | ||||
AcpiOsFree(buf.Pointer); | AcpiOsFree(buf.Pointer); | ||||
▲ Show 20 Lines • Show All 586 Lines • Show Last 20 Lines |
I think for here it might be more consistent to do this:
And then fix the 'out' label to handle return values that aren't 0.