acpi/nfit: Fix bus command validation
authorDan Williams <dan.j.williams@intel.com>
Thu, 7 Feb 2019 22:56:50 +0000 (14:56 -0800)
committerDan Williams <dan.j.williams@intel.com>
Thu, 7 Feb 2019 22:56:50 +0000 (14:56 -0800)
commitebe9f6f19d80d8978d16078dff3d5bd93ad8d102
tree26493b6289c3213ce45b1df3d2908bfc06182571
parentf17b5f06cb92ef2250513a1e154c47b78df07d40
acpi/nfit: Fix bus command validation

Commit 11189c1089da "acpi/nfit: Fix command-supported detection" broke
ND_CMD_CALL for bus-level commands. The "func = cmd" assumption is only
valid for:

    ND_CMD_ARS_CAP
    ND_CMD_ARS_START
    ND_CMD_ARS_STATUS
    ND_CMD_CLEAR_ERROR

The function number otherwise needs to be pulled from the command
payload for:

    NFIT_CMD_TRANSLATE_SPA
    NFIT_CMD_ARS_INJECT_SET
    NFIT_CMD_ARS_INJECT_CLEAR
    NFIT_CMD_ARS_INJECT_GET

Update cmd_to_func() for the bus case and call it in the common path.

Fixes: 11189c1089da ("acpi/nfit: Fix command-supported detection")
Cc: <stable@vger.kernel.org>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Reported-by: Grzegorz Burzynski <grzegorz.burzynski@intel.com>
Tested-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/acpi/nfit/core.c