public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Jaehoon Chung" <jh80.chung@samsung.com>
To: "'Jonas Karlman'" <jonas@kwiboo.se>
Cc: <sjg@chromium.org>, <patrice.chotard@foss.st.com>,
	<eugen.hristev@collabora.com>, <trini@konsulko.com>,
	<u-boot@lists.denx.de>
Subject: RE: [PATCH] power: regulator: Fix an handling error about EALREADY
Date: Wed, 1 Nov 2023 17:06:38 +0900	[thread overview]
Message-ID: <025e01da0c9a$573ccbf0$05b663d0$@samsung.com> (raw)
In-Reply-To: <ea09f0bc-738c-4585-bc2a-eab3cd7e59ec@kwiboo.se>



> -----Original Message-----
> From: Jonas Karlman <jonas@kwiboo.se>
> Sent: Wednesday, November 1, 2023 4:47 PM
> To: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: sjg@chromium.org; patrice.chotard@foss.st.com; eugen.hristev@collabora.com; trini@konsulko.com; u-
> boot@lists.denx.de
> Subject: Re: [PATCH] power: regulator: Fix an handling error about EALREADY
> 
> On 2023-11-01 08:23, Jaehoon Chung wrote:
> > If reegulator is already enabled, it will be return to EALREADY.
> > But driver that its function is called can notice as error, even though
> > it's working fine.
> >
> > Fixes: 4fcba5d556b ("regulator: implement basic reference counter")
> >
> > Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> > ---
> >  drivers/power/regulator/regulator-uclass.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
> > index 3a6ba69f6d5f..fc1c3eb93c9d 100644
> > --- a/drivers/power/regulator/regulator-uclass.c
> > +++ b/drivers/power/regulator/regulator-uclass.c
> > @@ -187,6 +187,10 @@ int regulator_set_enable(struct udevice *dev, bool enable)
> >  		}
> >  	}
> >
> > +	/* Regulator is already enabled */
> > +	if (ret == -EALREADY)
> > +		return 0;
> > +
> 
> Use of regulator_set_enable_if_allowed() will cover this error,
> and regulator_set_enable() should continue to return this error.

When I have checked on my target, It seems that it can't cover all cases.

On odroid-c4, USB doesn't work, even though its regulator is enabled.

=> ums 0 mmc 0
UMS: LUN 0, dev mmc 0, hwpart 0, sector 0x0, count 0x1dacc00
No USB device found
Couldn't init USB controller.


Best Regards,
Jaehoon Chung

> 
> Regards,
> Jonas
> 
> >  	return ret;
> >  }
> >



  reply	other threads:[~2023-11-01  8:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20231101072318epcas1p2dbf8d1c1bbbb521c8e6744fae8e0b01d@epcas1p2.samsung.com>
2023-11-01  7:23 ` [PATCH] power: regulator: Fix an handling error about EALREADY Jaehoon Chung
2023-11-01  7:47   ` Jonas Karlman
2023-11-01  8:06     ` Jaehoon Chung [this message]
2023-11-01  8:10       ` Jaehoon Chung
2023-11-01  8:19         ` Jaehoon Chung
2023-11-01  9:33           ` Jonas Karlman
2023-11-01 10:08             ` Jaehoon Chung

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='025e01da0c9a$573ccbf0$05b663d0$@samsung.com' \
    --to=jh80.chung@samsung.com \
    --cc=eugen.hristev@collabora.com \
    --cc=jonas@kwiboo.se \
    --cc=patrice.chotard@foss.st.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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