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: <CAJZ5v0hEHkpoyc9-fYrZ8A79B0XRd4_RUB2wcRcq1kMKXnb7Jw@mail.gmail.com>
Date:   Mon, 7 Jun 2021 14:38:46 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Thierry Reding <thierry.reding@...il.com>,
        Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>,
        Flavio Suligoi <f.suligoi@...m.it>,
        "open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux PWM List <linux-pwm@...r.kernel.org>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Jonathan Corbet <corbet@....net>,
        Lee Jones <lee.jones@...aro.org>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>
Subject: Re: [PATCH v3 3/6] pwm: core: Reuse fwnode_to_pwmchip() in ACPI case

On Mon, Jun 7, 2021 at 2:24 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> In ACPI case we may use matching by fwnode as provided via
> fwnode_to_pwmchip(). This makes device_to_pwmchip() not needed
> anymore.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

> ---
> v3: rebased on the tree without dropped patch 2/7
> v2: no change
>  drivers/pwm/core.c | 31 +------------------------------
>  1 file changed, 1 insertion(+), 30 deletions(-)
>
> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> index f26da1a6a376..c63626c5266c 100644
> --- a/drivers/pwm/core.c
> +++ b/drivers/pwm/core.c
> @@ -820,28 +820,6 @@ struct pwm_device *of_pwm_get(struct device *dev, struct device_node *np,
>  }
>  EXPORT_SYMBOL_GPL(of_pwm_get);
>
> -#if IS_ENABLED(CONFIG_ACPI)
> -static struct pwm_chip *device_to_pwmchip(struct device *dev)
> -{
> -       struct pwm_chip *chip;
> -
> -       mutex_lock(&pwm_lock);
> -
> -       list_for_each_entry(chip, &pwm_chips, list) {
> -               struct acpi_device *adev = ACPI_COMPANION(chip->dev);
> -
> -               if ((chip->dev == dev) || (adev && &adev->dev == dev)) {
> -                       mutex_unlock(&pwm_lock);
> -                       return chip;
> -               }
> -       }
> -
> -       mutex_unlock(&pwm_lock);
> -
> -       return ERR_PTR(-EPROBE_DEFER);
> -}
> -#endif
> -
>  /**
>   * acpi_pwm_get() - request a PWM via parsing "pwms" property in ACPI
>   * @fwnode: firmware node to get the "pwm" property from
> @@ -862,9 +840,7 @@ static struct pwm_chip *device_to_pwmchip(struct device *dev)
>  static struct pwm_device *acpi_pwm_get(struct fwnode_handle *fwnode)
>  {
>         struct pwm_device *pwm = ERR_PTR(-ENODEV);
> -#if IS_ENABLED(CONFIG_ACPI)
>         struct fwnode_reference_args args;
> -       struct acpi_device *acpi;
>         struct pwm_chip *chip;
>         int ret;
>
> @@ -874,14 +850,10 @@ static struct pwm_device *acpi_pwm_get(struct fwnode_handle *fwnode)
>         if (ret < 0)
>                 return ERR_PTR(ret);
>
> -       acpi = to_acpi_device_node(args.fwnode);
> -       if (!acpi)
> -               return ERR_PTR(-EINVAL);
> -
>         if (args.nargs < 2)
>                 return ERR_PTR(-EPROTO);
>
> -       chip = device_to_pwmchip(&acpi->dev);
> +       chip = fwnode_to_pwmchip(args.fwnode);
>         if (IS_ERR(chip))
>                 return ERR_CAST(chip);
>
> @@ -894,7 +866,6 @@ static struct pwm_device *acpi_pwm_get(struct fwnode_handle *fwnode)
>
>         if (args.nargs > 2 && args.args[2] & PWM_POLARITY_INVERTED)
>                 pwm->args.polarity = PWM_POLARITY_INVERSED;
> -#endif
>
>         return pwm;
>  }
> --
> 2.30.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ