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] [day] [month] [year] [list]
Message-ID: <50231574be4a848d3ef735f0e7cd96344514919f.camel@pengutronix.de>
Date:   Fri, 25 Feb 2022 09:24:07 +0100
From:   Philipp Zabel <p.zabel@...gutronix.de>
To:     Krishna Yarlagadda <kyarlagadda@...dia.com>,
        linux-kernel@...r.kernel.org, thierry.reding@...il.com
Subject: Re: [PATCH] reset: ACPI reset support

Hi Krishna,

On Fr, 2022-02-04 at 16:04 +0530, Krishna Yarlagadda wrote:
> Some of the IO devices like I2C or SPI require reset at runtime to
> recover from an error condition without changing the power state of
> the system. Added check for ACPI handle and a call to method '__RST'
> if supported. Devices using device tree method are unaffected by
> this.
> 
> Signed-off-by: Krishna Yarlagadda <kyarlagadda@...dia.com>
> ---
>  drivers/reset/core.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> index 61e6888..e4fb533 100644
> --- a/drivers/reset/core.c
> +++ b/drivers/reset/core.c
> @@ -12,6 +12,7 @@
>  #include <linux/kref.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
> +#include <linux/acpi.h>
>  #include <linux/reset.h>
>  #include <linux/reset-controller.h>
>  #include <linux/slab.h>
> @@ -1107,6 +1108,11 @@ int __device_reset(struct device *dev, bool optional)

Could you add a sentence to the kerneldoc description above this, for
example "For ACPI devices this calls the _RST method"?

>         struct reset_control *rstc;
>         int ret;
>  
> +       acpi_handle handle = ACPI_HANDLE(dev);
> +
> +       if (handle)

What does acpi_evaluate_object() do if the _RST method is not present?
I think we have to check

		if (!acpi_has_method(handle, "_RST"))
			return optional ? 0 : -ENOENT;

here.

> +               return acpi_evaluate_object(handle, "_RST", NULL, NULL);

acpi_evaluate_object() returns acpi_status, so that should probably be
something like:

		status = acpi_evaluate_object(handle, "_RST", NULL, NULL);
		if (ACPI_FAILURE(status))
			return -EIO;

> +
>         rstc = __reset_control_get(dev, NULL, 0, 0, optional, true);
>         if (IS_ERR(rstc))
>                 return PTR_ERR(rstc);

regards
Philipp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ