U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: Sean Anderson <seanga2@gmail.com>
Cc: Heiko Thiery <heiko.thiery@gmail.com>,
	u-boot@lists.denx.de, Marek Vasut <marex@denx.de>,
	Angus Ainslie <angus@akkea.ca>,
	Angus Ainslie <angus.ainslie@puri.sm>,
	lukma@denx.de, sbabic@denx.de, festevam@gmail.com,
	uboot-imx@nxp.com, peng.fan@nxp.com
Subject: Re: [RFC] serial: mxc: get the clock frequency from the used clock for the device
Date: Thu, 17 Mar 2022 15:47:11 +0100	[thread overview]
Message-ID: <25046b02eb285f3f281cd003961e4900@walle.cc> (raw)
In-Reply-To: <99e5643a-ade5-655d-937f-ee6ce711a99d@gmail.com>


>> +		struct clk clk;
>> +		if(!clk_get_by_name(dev, "ipg", &clk))
>> +			rate = clk_get_rate(&clk);
>> +	}
>> +
>> +	/* as fallback we try to get the clk rate that way */
>> +	if (rate == 0)
> 
> !rate || IS_ERR_VALUE(rate)

This looked so weird I had to actually look at clk_get_rate()
in u-boot.

/**
  * clk_get_rate() - Get current clock rate.
  * @clk:	A clock struct that was previously successfully requested by
  *		clk_request/get_by_*().
  *
  * Return: clock rate in Hz on success, 0 for invalid clock, or -ve 
error code
  *	   for other errors.
  */
ulong clk_get_rate(struct clk *clk);

How can an ulong return a negative error value? What if the clock speed
happens to be the same as -errno?

-michael

  reply	other threads:[~2022-03-17 14:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17 12:41 [RFC] serial: mxc: get the clock frequency from the used clock for the device Heiko Thiery
2022-03-17 13:19 ` Angus Ainslie
2022-03-18 19:06   ` Heiko Thiery
2022-03-19 14:32     ` Angus Ainslie
2022-03-21 13:50       ` Heiko Thiery
2022-03-22 12:47         ` Angus Ainslie
2022-03-24  2:08           ` Adam Ford
2022-03-24  9:58             ` Heiko Thiery
2022-03-24 10:57               ` Adam Ford
2022-03-17 14:38 ` Sean Anderson
2022-03-17 14:47   ` Michael Walle [this message]
2022-03-18  2:15     ` Sean Anderson
2022-03-17 16:31   ` Lukasz Majewski
2022-03-17 19:14   ` Heiko Thiery
2022-03-18  2:19     ` Sean Anderson
2022-03-18  8:05       ` Heiko Thiery
2022-03-18 13:26         ` Sean Anderson

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=25046b02eb285f3f281cd003961e4900@walle.cc \
    --to=michael@walle.cc \
    --cc=angus.ainslie@puri.sm \
    --cc=angus@akkea.ca \
    --cc=festevam@gmail.com \
    --cc=heiko.thiery@gmail.com \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=peng.fan@nxp.com \
    --cc=sbabic@denx.de \
    --cc=seanga2@gmail.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.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