u-boot-amlogic.groups.io archive mirror
 help / color / mirror / Atom feed
From: Igor Prusov <ivprusov@salutedevices.com>
To: Sean Anderson <seanga2@gmail.com>
Cc: Igor Prusov <ivprusov@sberdevices.ru>,
	Michal Simek <michal.simek@amd.com>,
	Daniel Schwierzeck <daniel.schwierzeck@gmail.com>,
	Lukasz Majewski <lukma@denx.de>,
	Ryan Chen <ryan_chen@aspeedtech.com>,
	Chia-Wei Wang <chiawei_wang@aspeedtech.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Stefan Roese <sr@denx.de>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	<prusovigor@gmail.com>, <kernel@sberdevices.ru>,
	Aspeed BMC SW team <BMC-SW@aspeedtech.com>,
	Joel Stanley <joel@jms.id.au>, <u-boot@lists.denx.de>,
	<u-boot-amlogic@groups.io>,
	<uboot-stm32@st-md-mailman.stormreply.com>
Subject: Re: [PATCH v5 5/8] clk: Add dump operation to clk_ops
Date: Sat, 4 Nov 2023 21:46:44 +0300	[thread overview]
Message-ID: <20231104184644.3fv6nf5ssvsaomgf@pc> (raw)
In-Reply-To: <d6968ccd-9bd9-56d9-030c-52892d137c07@gmail.com>

On Sat, Nov 04, 2023 at 02:40:34PM -0400, Sean Anderson wrote:
> On 11/4/23 14:09, Igor Prusov wrote:
> > On Sat, Nov 04, 2023 at 11:24:32AM -0400, Sean Anderson wrote:
> > > On 11/2/23 08:20, Igor Prusov wrote:
> > > > This adds dump function to struct clk_ops which should replace
> > > > soc_clk_dump. It allows clock drivers to provide custom dump
> > > > implementation without overriding generic CCF dump function.
> > > > 
> > > > Signed-off-by: Igor Prusov <ivprusov@sberdevices.ru>
> > > > Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
> > > > Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
> > > > ---
> > > >    include/clk-uclass.h | 15 +++++++++++++++
> > > >    1 file changed, 15 insertions(+)
> > > > 
> > > > diff --git a/include/clk-uclass.h b/include/clk-uclass.h
> > > > index a22f1a5d84..793bf14160 100644
> > > > --- a/include/clk-uclass.h
> > > > +++ b/include/clk-uclass.h
> > > > @@ -25,6 +25,7 @@ struct ofnode_phandle_args;
> > > >     * @set_parent: Set current clock parent
> > > >     * @enable: Enable a clock.
> > > >     * @disable: Disable a clock.
> > > > + * @dump: Print clock information.
> > > >     *
> > > >     * The individual methods are described more fully below.
> > > >     */
> > > > @@ -39,6 +40,9 @@ struct clk_ops {
> > > >    	int (*set_parent)(struct clk *clk, struct clk *parent);
> > > >    	int (*enable)(struct clk *clk);
> > > >    	int (*disable)(struct clk *clk);
> > > > +#if IS_ENABLED(CONFIG_CMD_CLK)
> > > > +	int (*dump)(struct udevice *dev);
> > > > +#endif
> > > >    };
> > > >    #if 0 /* For documentation only */
> > > > @@ -135,6 +139,17 @@ int enable(struct clk *clk);
> > > >     * Return: zero on success, or -ve error code.
> > > >     */
> > > >    int disable(struct clk *clk);
> > > > +
> > > > +/**
> > > > + * dump() - Print clock information.
> > > > + * @clk:	The clock device to dump.
> > > > + *
> > > > + * If present, this function is called by "clk dump" command for each
> > > > + * bound device.
> > > > + *
> > > > + * Return: zero on success, or -ve error code.
> > > > + */
> > > > +int dump(struct udevice *dev);
> > > 
> > > Actually, this should return void, since we don't do anything with the return code.
> > Good catch! Though there is, for example, zynqmp_clk_dump() that may
> > return an error code. Wouldn't it be better to print an error message
> > with the code in soc_clk_dump()? It might be convinient to have common
> > code handling unexpected errors during dump.
> 
> Since this function is for printing, if the driver gets an error
> it should just print the error itself. It can probably provide a better
> error message than we can. And this command is mainly informational anyway,
> so we don't really need to set the return code (e.g. $?).

Got it, will fix in v6.


  reply	other threads:[~2023-11-04 18:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 12:20 [PATCH v5 0/8] clk: Switch from soc_clk_dump to clk_ops function Igor Prusov
2023-11-02 12:20 ` [PATCH v5 1/8] clk: zynq: Move soc_clk_dump to Zynq clock driver Igor Prusov
2023-11-02 12:20 ` [PATCH v5 2/8] clk: ast2600: Move soc_clk_dump function Igor Prusov
2023-11-02 12:20 ` [PATCH v5 3/8] clk: k210: " Igor Prusov
2023-11-02 12:20 ` [PATCH v5 4/8] clk: amlogic: Move driver and ops structs Igor Prusov
2023-11-02 12:20 ` [PATCH v5 5/8] clk: Add dump operation to clk_ops Igor Prusov
2023-11-04 15:24   ` Sean Anderson
2023-11-04 18:09     ` Igor Prusov
2023-11-04 18:40       ` Sean Anderson
2023-11-04 18:46         ` Igor Prusov [this message]
2023-11-02 12:20 ` [PATCH v5 6/8] cmd: clk: Use dump function from clk_ops Igor Prusov
2023-11-04 15:23   ` Sean Anderson
2023-11-02 12:20 ` [PATCH v5 7/8] clk: treewide: switch to clock dump " Igor Prusov
2023-11-02 12:20 ` [PATCH v5 8/8] cmd: clk: Make soc_clk_dump static Igor Prusov

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=20231104184644.3fv6nf5ssvsaomgf@pc \
    --to=ivprusov@salutedevices.com \
    --cc=BMC-SW@aspeedtech.com \
    --cc=chiawei_wang@aspeedtech.com \
    --cc=daniel.schwierzeck@gmail.com \
    --cc=ivprusov@sberdevices.ru \
    --cc=joel@jms.id.au \
    --cc=kernel@sberdevices.ru \
    --cc=lukma@denx.de \
    --cc=michal.simek@amd.com \
    --cc=neil.armstrong@linaro.org \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=prusovigor@gmail.com \
    --cc=ryan_chen@aspeedtech.com \
    --cc=seanga2@gmail.com \
    --cc=sr@denx.de \
    --cc=u-boot-amlogic@groups.io \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-stm32@st-md-mailman.stormreply.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 read-only IMAP folder(s) and NNTP newsgroup(s).