lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMHSBOW-MpsmnhG3shXBHf8_qB=+1WoQfNju_GDOb7fyZu79GA@mail.gmail.com>
Date:   Fri, 1 Dec 2017 11:49:54 -0800
From:   Gwendal Grignou <gwendal@...omium.org>
To:     Thierry Escande <thierry.escande@...labora.com>
Cc:     Benson Leung <bleung@...omium.org>,
        Lee Jones <lee.jones@...aro.org>,
        Jonathan Cameron <jic23@...nel.org>,
        Enric Balletbo i Serra <enric.balletbo@...labora.com>,
        Gwendal Grignou <gwendal@...omium.org>,
        Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 1/3] platform/chrome: cros_ec_lpc: Register the driver
 if ACPI entry is missing.

Checked against 7412f0a0d90ee6ddbad4cde794f88f1489422f3a (CHROMIUM:
platform/chrome: Support MKBP protocol over ACPI)
Reviewed-by: Gwendal Grignou <gwendal@...omium.org>

On Fri, Dec 1, 2017 at 5:42 AM, Thierry Escande
<thierry.escande@...labora.com> wrote:
> From: Enric Balletbo i Serra <enric.balletbo@...labora.com>
>
> Commit 12278dc7c572 ("platform/chrome: cros_ec_lpc: Add support for
> GOOG004 ACPI device") added support when the firmware reports the ACPI
> device, there are some firmwares though that doesn't report this device
> but have it. In such cases we need to instantiate the driver explicitly
> if it is not instantiated through ACPI.
>
> Fixes: 12278dc7c572 ("platform/chrome: cros_ec_lpc: Add support for GOOG004 ACPI device")
> Signed-off-by: Guenter Roeck <groeck@...omium.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@...labora.com>
> Signed-off-by: Thierry Escande <thierry.escande@...labora.com>
> ---
>  drivers/platform/chrome/cros_ec_lpc.c | 34 +++++++++++++++++++++++++++++++++-
>  1 file changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
> index 1baf720..0b26a09 100644
> --- a/drivers/platform/chrome/cros_ec_lpc.c
> +++ b/drivers/platform/chrome/cros_ec_lpc.c
> @@ -35,6 +35,9 @@
>  #define DRV_NAME "cros_ec_lpcs"
>  #define ACPI_DRV_NAME "GOOG0004"
>
> +/* True if ACPI device is present */
> +static bool cros_ec_lpc_acpi_device_found;
> +
>  static int ec_response_timed_out(void)
>  {
>         unsigned long one_second = jiffies + HZ;
> @@ -396,9 +399,21 @@ static struct platform_driver cros_ec_lpc_driver = {
>         .remove = cros_ec_lpc_remove,
>  };
>
> +static struct platform_device cros_ec_lpc_device = {
> +       .name = DRV_NAME
> +};
> +
> +static acpi_status cros_ec_lpc_parse_device(acpi_handle handle, u32 level,
> +                                           void *context, void **retval)
> +{
> +       *(bool *)context = true;
> +       return AE_CTRL_TERMINATE;
> +}
> +
>  static int __init cros_ec_lpc_init(void)
>  {
>         int ret;
> +       acpi_status status;
>
>         if (!dmi_check_system(cros_ec_lpc_dmi_table)) {
>                 pr_err(DRV_NAME ": unsupported system.\n");
> @@ -415,11 +430,28 @@ static int __init cros_ec_lpc_init(void)
>                 return ret;
>         }
>
> -       return 0;
> +       status = acpi_get_devices(ACPI_DRV_NAME, cros_ec_lpc_parse_device,
> +                                 &cros_ec_lpc_acpi_device_found, NULL);
> +       if (ACPI_FAILURE(status))
> +               pr_warn(DRV_NAME ": Looking for %s failed\n", ACPI_DRV_NAME);
> +
> +       if (!cros_ec_lpc_acpi_device_found) {
> +               /* Register the device, and it'll get hooked up automatically */
> +               ret = platform_device_register(&cros_ec_lpc_device);
> +               if (ret) {
> +                       pr_err(DRV_NAME ": can't register device: %d\n", ret);
> +                       platform_driver_unregister(&cros_ec_lpc_driver);
> +                       cros_ec_lpc_reg_destroy();
> +               }
> +       }
> +
> +       return ret;
>  }
>
>  static void __exit cros_ec_lpc_exit(void)
>  {
> +       if (!cros_ec_lpc_acpi_device_found)
> +               platform_device_unregister(&cros_ec_lpc_device);
>         platform_driver_unregister(&cros_ec_lpc_driver);
>         cros_ec_lpc_reg_destroy();
>  }
> --
> 2.7.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ