acpi_ibm: whitespace and wrapping cleanup

This commit is contained in:
Ed Maste 2020-02-02 19:01:16 +00:00
parent 682397c263
commit 66671c1428
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357416

View file

@ -363,8 +363,7 @@ static driver_t acpi_ibm_driver = {
static devclass_t acpi_ibm_devclass;
DRIVER_MODULE(acpi_ibm, acpi, acpi_ibm_driver, acpi_ibm_devclass,
0, 0);
DRIVER_MODULE(acpi_ibm, acpi, acpi_ibm_driver, acpi_ibm_devclass, 0, 0);
MODULE_DEPEND(acpi_ibm, acpi, 1, 1, 1);
static char *ibm_ids[] = {"IBM0068", "LEN0068", "LEN0268", NULL};
@ -384,7 +383,7 @@ acpi_status_to_errno(ACPI_STATUS status)
static void
ibm_led(void *softc, int onoff)
{
struct acpi_ibm_softc* sc = (struct acpi_ibm_softc*) softc;
struct acpi_ibm_softc *sc = (struct acpi_ibm_softc *)softc;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@ -410,7 +409,7 @@ ibm_led_task(struct acpi_ibm_softc *sc, int pending __unused)
}
static int
acpi_ibm_mic_led_set (struct acpi_ibm_softc *sc, int arg)
acpi_ibm_mic_led_set(struct acpi_ibm_softc *sc, int arg)
{
ACPI_OBJECT_LIST input;
ACPI_OBJECT params[1];
@ -429,10 +428,10 @@ acpi_ibm_mic_led_set (struct acpi_ibm_softc *sc, int arg)
input.Pointer = params;
input.Count = 1;
status = AcpiEvaluateObject (sc->handle, "MMTS", &input, NULL);
status = AcpiEvaluateObject(sc->handle, "MMTS", &input, NULL);
if (ACPI_SUCCESS(status))
sc->mic_led_state = arg;
return(status);
return (status);
}
return (0);
@ -443,14 +442,13 @@ acpi_ibm_probe(device_t dev)
{
int rv;
if (acpi_disabled("ibm") ||
device_get_unit(dev) != 0)
if (acpi_disabled("ibm") || device_get_unit(dev) != 0)
return (ENXIO);
rv = ACPI_ID_PROBE(device_get_parent(dev), dev, ibm_ids, NULL);
if (rv <= 0)
if (rv <= 0)
device_set_desc(dev, "ThinkPad ACPI Extras");
return (rv);
}
@ -459,7 +457,7 @@ acpi_ibm_attach(device_t dev)
{
int i;
int hkey;
struct acpi_ibm_softc *sc;
struct acpi_ibm_softc *sc;
char *maker, *product;
ACPI_OBJECT_LIST input;
ACPI_OBJECT params[1];
@ -474,12 +472,12 @@ acpi_ibm_attach(device_t dev)
sc->handle = acpi_get_handle(dev);
/* Look for the first embedded controller */
if (!(ec_devclass = devclass_find ("acpi_ec"))) {
if (!(ec_devclass = devclass_find ("acpi_ec"))) {
if (bootverbose)
device_printf(dev, "Couldn't find acpi_ec devclass\n");
return (EINVAL);
}
if (!(sc->ec_dev = devclass_get_device(ec_devclass, 0))) {
if (!(sc->ec_dev = devclass_get_device(ec_devclass, 0))) {
if (bootverbose)
device_printf(dev, "Couldn't find acpi_ec device\n");
return (EINVAL);
@ -496,14 +494,13 @@ acpi_ibm_attach(device_t dev)
if (sc->events_mask_supported) {
SYSCTL_ADD_UINT(sc->sysctl_ctx,
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
"initialmask", CTLFLAG_RD,
&sc->events_initialmask, 0, "Initial eventmask");
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "initialmask",
CTLFLAG_RD, &sc->events_initialmask, 0,
"Initial eventmask");
if (ACPI_SUCCESS (acpi_GetInteger(sc->handle, "MHKV", &hkey))) {
device_printf(dev, "Firmware version is 0x%X\n", hkey);
switch(hkey >> 8)
{
switch (hkey >> 8) {
case 1:
/* The availmask is the bitmask of supported events */
if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
@ -561,18 +558,17 @@ acpi_ibm_attach(device_t dev)
/* Hook up thermal node */
if (acpi_ibm_sysctl_init(sc, ACPI_IBM_METHOD_THERMAL)) {
SYSCTL_ADD_PROC(sc->sysctl_ctx,
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
"thermal", CTLTYPE_INT | CTLFLAG_RD,
sc, 0, acpi_ibm_thermal_sysctl, "I",
"Thermal zones");
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "thermal",
CTLTYPE_INT | CTLFLAG_RD, sc, 0, acpi_ibm_thermal_sysctl,
"I", "Thermal zones");
}
/* Hook up handlerevents node */
if (acpi_ibm_sysctl_init(sc, ACPI_IBM_METHOD_HANDLEREVENTS)) {
SYSCTL_ADD_PROC(sc->sysctl_ctx,
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
"handlerevents", CTLTYPE_STRING | CTLFLAG_RW,
sc, 0, acpi_ibm_handlerevents_sysctl, "I",
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "handlerevents",
CTLTYPE_STRING | CTLFLAG_RW, sc, 0,
acpi_ibm_handlerevents_sysctl, "I",
"devd(8) events handled by acpi_ibm");
}
@ -610,7 +606,6 @@ acpi_ibm_attach(device_t dev)
acpi_ibm_sysctl_set(sc, ACPI_IBM_METHOD_EVENTS, 1);
ACPI_SERIAL_END(ibm);
return (0);
}
@ -677,7 +672,7 @@ acpi_ibm_eventmask_set(struct acpi_ibm_softc *sc, int val)
arg[1].Type = ACPI_TYPE_INTEGER;
for (int i = 0; i < 32; ++i) {
arg[0].Integer.Value = i+1;
arg[0].Integer.Value = i + 1;
arg[1].Integer.Value = (((1 << i) & val) != 0);
status = AcpiEvaluateObject(sc->handle,
IBM_NAME_EVENTS_MASK_SET, &args, NULL);
@ -814,8 +809,7 @@ acpi_ibm_sysctl_get(struct acpi_ibm_softc *sc, int method)
if (sc->fan_handle) {
if(ACPI_FAILURE(acpi_GetInteger(sc->fan_handle, NULL, &val)))
val = -1;
}
else {
} else {
ACPI_EC_READ(sc->ec_dev, IBM_EC_FANSPEED, &val_ec, 2);
val = val_ec;
}
@ -841,10 +835,10 @@ acpi_ibm_sysctl_get(struct acpi_ibm_softc *sc, int method)
if (!sc->fan_handle) {
ACPI_EC_READ(sc->ec_dev, IBM_EC_FANSTATUS, &val_ec, 1);
val = (val_ec & IBM_EC_MASK_FANSTATUS) == IBM_EC_MASK_FANSTATUS;
}
else
} else
val = -1;
break;
case ACPI_IBM_METHOD_MIC_LED:
if (sc->mic_led_handle)
return sc->mic_led_state;
@ -855,7 +849,6 @@ acpi_ibm_sysctl_get(struct acpi_ibm_softc *sc, int method)
case ACPI_IBM_METHOD_PRIVACYGUARD:
val = acpi_ibm_privacyguard_get(sc);
break;
}
return (val);
@ -901,7 +894,7 @@ acpi_ibm_sysctl_set(struct acpi_ibm_softc *sc, int method, int arg)
break;
case ACPI_IBM_METHOD_MIC_LED:
return acpi_ibm_mic_led_set (sc, arg);
return acpi_ibm_mic_led_set(sc, arg);
break;
case ACPI_IBM_METHOD_THINKLIGHT:
@ -971,10 +964,9 @@ acpi_ibm_sysctl_init(struct acpi_ibm_softc *sc, int method)
if (ACPI_SUCCESS(AcpiGetHandle(sc->handle, "MMTS", &sc->mic_led_handle)))
{
/* Turn off mic led by default */
acpi_ibm_mic_led_set (sc, 0);
return(TRUE);
}
else
acpi_ibm_mic_led_set(sc, 0);
return (TRUE);
} else
sc->mic_led_handle = NULL;
return (FALSE);
@ -995,8 +987,7 @@ acpi_ibm_sysctl_init(struct acpi_ibm_softc *sc, int method)
else if (ACPI_SUCCESS(AcpiGetHandle(sc->handle, "\\LGHT", &sc->light_handle))) {
sc->light_cmd_on = 1;
sc->light_cmd_off = 0;
}
else
} else
sc->light_handle = NULL;
sc->light_set_supported = (sc->light_handle &&
@ -1050,7 +1041,6 @@ acpi_ibm_sysctl_init(struct acpi_ibm_softc *sc, int method)
case ACPI_IBM_METHOD_PRIVACYGUARD:
return (acpi_ibm_privacyguard_get(sc) != -1);
}
return (FALSE);
}
@ -1273,7 +1263,8 @@ acpi_ibm_thinklight_set(struct acpi_ibm_softc *sc, int arg)
* Only meant to be used internally by the get/set functions below.
*/
static ACPI_STATUS
acpi_ibm_privacyguard_acpi_call(struct acpi_ibm_softc *sc, bool write, int *arg) {
acpi_ibm_privacyguard_acpi_call(struct acpi_ibm_softc *sc, bool write, int *arg)
{
ACPI_OBJECT Arg;
ACPI_OBJECT_LIST Args;
ACPI_STATUS status;
@ -1485,7 +1476,6 @@ acpi_ibm_notify(ACPI_HANDLE h, UINT32 notify, void *context)
if (event == 0)
break;
type = (event >> 12) & 0xf;
arg = event & 0xfff;
switch (type) {