linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	Linux PWM List <linux-pwm@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v2 3/4] pwm: sysfs: Add suspend/resume support
Date: Fri, 31 May 2019 09:34:25 +0200	[thread overview]
Message-ID: <CAMuHMdXVVOvoZ4S9LC=RD_8r-XJ6tPt512rONjv8QEK0L=akww@mail.gmail.com> (raw)
In-Reply-To: <1559211367-25106-4-git-send-email-yoshihiro.shimoda.uh@renesas.com>

Hi Shimoda-san,

On Thu, May 30, 2019 at 12:21 PM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> According to the Documentation/pwm.txt, all PWM consumers should have
> power management. Since this sysfs interface is one of consumers so that
> this patch adds suspend/resume support.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/drivers/pwm/sysfs.c
> +++ b/drivers/pwm/sysfs.c

> @@ -372,10 +373,109 @@ static struct attribute *pwm_chip_attrs[] = {
>  };
>  ATTRIBUTE_GROUPS(pwm_chip);
>

You may want to add a comment "takes export->lock on success" here...

> +static struct pwm_export *pwm_class_get_state(struct device *parent,
> +                                             struct pwm_device *pwm,
> +                                             struct pwm_state *state)
> +{
> +       struct device *child;
> +       struct pwm_export *export;
> +
> +       if (!test_bit(PWMF_EXPORTED, &pwm->flags))
> +               return NULL;
> +
> +       child = device_find_child(parent, pwm, pwm_unexport_match);
> +       if (!child)
> +               return NULL;
> +
> +       export = child_to_pwm_export(child);
> +       put_device(child);      /* for device_find_child() */
> +
> +       mutex_lock(&export->lock);
> +       pwm_get_state(pwm, state);
> +
> +       return export;
> +}
> +
> +static int pwm_class_apply_state(struct pwm_export *export,
> +                                struct pwm_device *pwm,
> +                                struct pwm_state *state)
> +{
> +       int ret = pwm_apply_state(pwm, state);
> +

... and "release lock taken in pwm_class_get_state()" here.

> +       mutex_unlock(&export->lock);
> +
> +       return ret;
> +}

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2019-05-31  7:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 10:16 [PATCH v2 0/4] pwm: add power management on sysfs and switch to SPDX Yoshihiro Shimoda
2019-05-30 10:16 ` [PATCH v2 1/4] pwm: Add power management descriptions Yoshihiro Shimoda
2019-05-31  7:20   ` Geert Uytterhoeven
2019-05-31  9:22     ` Yoshihiro Shimoda
2019-05-31  9:28       ` Geert Uytterhoeven
2019-05-31  9:31         ` Yoshihiro Shimoda
2019-05-30 10:16 ` [PATCH v2 2/4] pwm: sysfs: Switch to SPDX identifier Yoshihiro Shimoda
2019-05-31  7:20   ` Geert Uytterhoeven
2019-05-30 10:16 ` [PATCH v2 3/4] pwm: sysfs: Add suspend/resume support Yoshihiro Shimoda
2019-05-31  7:34   ` Geert Uytterhoeven [this message]
2019-05-31  9:24     ` Yoshihiro Shimoda
2019-05-30 10:16 ` [PATCH v2 4/4] pwm: rcar: Remove " Yoshihiro Shimoda
2019-05-31  7:35   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMuHMdXVVOvoZ4S9LC=RD_8r-XJ6tPt512rONjv8QEK0L=akww@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).