Re: [PATCH v2] phy: renesas: rcar-gen3-usb2: fix imbalance powered flag

From: Geert Uytterhoeven
Date: Fri Jun 07 2019 - 09:27:35 EST


Hi Shimoda-san,

Thanks for the update!

On Fri, Jun 7, 2019 at 12:07 PM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@xxxxxxxxxxx> wrote:
> The powered flag should be set for any other phys anyway. Also
> the flag should be locked by the channel. Otherwise, after we have
> revised the device tree for the usb phy, the following warning
> happened during a second system suspend. And if the driver doesn't
> lock the flag, enabling the regulator is possible to be imbalance

I think it reads better as:

..., an imbalance is possible when enabling the regulator ...

> during system resume. So, this patch fixes the issues.

> --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c

> @@ -106,6 +107,7 @@ struct rcar_gen3_chan {
> struct rcar_gen3_phy rphys[NUM_OF_PHYS];
> struct regulator *vbus;
> struct work_struct work;
> + struct mutex lock;

It is always a good idea to document what is protected by the mutex:

struct mutex lock; /* protects rphys[...].powered */

Checkpatch does have a check for this, but unfortunately it is enabled for
drivers/net/, net/, and drivers/staging/ only:

CHECK: struct mutex definition without comment

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

and the imbalance is gone:
Tested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>


Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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