linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Jonas Gorski <jonas.gorski@gmail.com>
Cc: Prashant Gaikwad <pgaikwad@nvidia.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Heiko Stuebner <heiko@sntech.de>, Stephen Boyd <sboyd@kernel.org>,
	Fabio Estevam <festevam@gmail.com>,
	Peter De Schrijver <pdeschrijver@nvidia.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	linux-rockchip@lists.infradead.org,
	Michael Turquette <mturquette@baylibre.com>,
	Paul Mackerras <paulus@samba.org>,
	kbuild-all@01.org,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	linux-tegra@vger.kernel.org,
	Thierry Reding <thierry.reding@gmail.com>,
	Anatolij Gustschin <agust@denx.de>,
	linuxppc-dev@lists.ozlabs.org, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	NXP Linux Team <linux-imx@nxp.com>
Subject: Re: [PATCH RFT V2 1/8] clk: divider: add explicit big endian support
Date: Tue, 16 Apr 2019 12:05:48 +0800	[thread overview]
Message-ID: <201904161252.kWbdH4TW%lkp@intel.com> (raw)
In-Reply-To: <20190415101046.5872-2-jonas.gorski@gmail.com>

Hi Jonas,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on clk/clk-next]
[also build test WARNING on v5.1-rc5 next-20190415]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jonas-Gorski/clk-make-register-endianness-a-run-time-property/20190415-235847
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'


sparse warnings: (new ones prefixed by >>)

   drivers/clk/clk-divider.c:317:18: sparse: expression using sizeof(void)
   drivers/clk/clk-divider.c:317:18: sparse: expression using sizeof(void)
>> drivers/clk/clk-divider.c:391:44: sparse: incorrect type in argument 1 (different address spaces) @@    expected struct clk_divider *divider @@    got voistruct clk_divider *divider @@
   drivers/clk/clk-divider.c:391:44:    expected struct clk_divider *divider
   drivers/clk/clk-divider.c:391:44:    got void [noderef] <asn:2>*reg
   drivers/clk/clk-divider.c:416:16: sparse: expression using sizeof(void)
   drivers/clk/clk-divider.c:416:16: sparse: expression using sizeof(void)
   drivers/clk/clk-divider.c:441:44: sparse: incorrect type in argument 1 (different address spaces) @@    expected struct clk_divider *divider @@    got voistruct clk_divider *divider @@
   drivers/clk/clk-divider.c:441:44:    expected struct clk_divider *divider
   drivers/clk/clk-divider.c:441:44:    got void [noderef] <asn:2>*reg

vim +391 drivers/clk/clk-divider.c

   289	
   290	static int clk_divider_bestdiv(struct clk_hw *hw, struct clk_hw *parent,
   291				       unsigned long rate,
   292				       unsigned long *best_parent_rate,
   293				       const struct clk_div_table *table, u8 width,
   294				       unsigned long flags)
   295	{
   296		int i, bestdiv = 0;
   297		unsigned long parent_rate, best = 0, now, maxdiv;
   298		unsigned long parent_rate_saved = *best_parent_rate;
   299	
   300		if (!rate)
   301			rate = 1;
   302	
   303		maxdiv = _get_maxdiv(table, width, flags);
   304	
   305		if (!(clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)) {
   306			parent_rate = *best_parent_rate;
   307			bestdiv = _div_round(table, parent_rate, rate, flags);
   308			bestdiv = bestdiv == 0 ? 1 : bestdiv;
   309			bestdiv = bestdiv > maxdiv ? maxdiv : bestdiv;
   310			return bestdiv;
   311		}
   312	
   313		/*
   314		 * The maximum divider we can use without overflowing
   315		 * unsigned long in rate * i below
   316		 */
 > 317		maxdiv = min(ULONG_MAX / rate, maxdiv);
   318	
   319		for (i = _next_div(table, 0, flags); i <= maxdiv;
   320						     i = _next_div(table, i, flags)) {
   321			if (rate * i == parent_rate_saved) {
   322				/*
   323				 * It's the most ideal case if the requested rate can be
   324				 * divided from parent clock without needing to change
   325				 * parent rate, so return the divider immediately.
   326				 */
   327				*best_parent_rate = parent_rate_saved;
   328				return i;
   329			}
   330			parent_rate = clk_hw_round_rate(parent, rate * i);
   331			now = DIV_ROUND_UP_ULL((u64)parent_rate, i);
   332			if (_is_best_div(rate, now, best, flags)) {
   333				bestdiv = i;
   334				best = now;
   335				*best_parent_rate = parent_rate;
   336			}
   337		}
   338	
   339		if (!bestdiv) {
   340			bestdiv = _get_maxdiv(table, width, flags);
   341			*best_parent_rate = clk_hw_round_rate(parent, 1);
   342		}
   343	
   344		return bestdiv;
   345	}
   346	
   347	long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
   348				       unsigned long rate, unsigned long *prate,
   349				       const struct clk_div_table *table,
   350				       u8 width, unsigned long flags)
   351	{
   352		int div;
   353	
   354		div = clk_divider_bestdiv(hw, parent, rate, prate, table, width, flags);
   355	
   356		return DIV_ROUND_UP_ULL((u64)*prate, div);
   357	}
   358	EXPORT_SYMBOL_GPL(divider_round_rate_parent);
   359	
   360	long divider_ro_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
   361					  unsigned long rate, unsigned long *prate,
   362					  const struct clk_div_table *table, u8 width,
   363					  unsigned long flags, unsigned int val)
   364	{
   365		int div;
   366	
   367		div = _get_div(table, val, flags, width);
   368	
   369		/* Even a read-only clock can propagate a rate change */
   370		if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
   371			if (!parent)
   372				return -EINVAL;
   373	
   374			*prate = clk_hw_round_rate(parent, rate * div);
   375		}
   376	
   377		return DIV_ROUND_UP_ULL((u64)*prate, div);
   378	}
   379	EXPORT_SYMBOL_GPL(divider_ro_round_rate_parent);
   380	
   381	
   382	static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
   383					unsigned long *prate)
   384	{
   385		struct clk_divider *divider = to_clk_divider(hw);
   386	
   387		/* if read only, just return current value */
   388		if (divider->flags & CLK_DIVIDER_READ_ONLY) {
   389			u32 val;
   390	
 > 391			val = clk_div_readl(divider->reg) >> divider->shift;
   392			val &= clk_div_mask(divider->width);
   393	
   394			return divider_ro_round_rate(hw, rate, prate, divider->table,
   395						     divider->width, divider->flags,
   396						     val);
   397		}
   398	
   399		return divider_round_rate(hw, rate, prate, divider->table,
   400					  divider->width, divider->flags);
   401	}
   402	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

  reply	other threads:[~2019-04-16  4:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 10:10 [PATCH RFT V2 0/8] clk: make register endianness a run-time property Jonas Gorski
2019-04-15 10:10 ` [PATCH RFT V2 1/8] clk: divider: add explicit big endian support Jonas Gorski
2019-04-16  4:05   ` kbuild test robot [this message]
2019-04-17 23:32   ` Stephen Boyd
2019-04-18  9:00     ` Jonas Gorski
2019-04-15 10:10 ` [PATCH RFT V2 2/8] clk: fractional-divider: " Jonas Gorski
2019-04-17 23:30   ` Stephen Boyd
2019-04-15 10:10 ` [PATCH RFT V2 3/8] clk: gate: " Jonas Gorski
2019-04-15 10:10 ` [PATCH RFT V2 4/8] clk: multiplier: " Jonas Gorski
2019-04-15 10:10 ` [PATCH RFT V2 5/8] clk: mux: " Jonas Gorski
2019-04-15 10:10 ` [PATCH RFT V2 6/8] powerpc/512x: mark clocks as big endian Jonas Gorski
2019-04-15 10:10 ` [PATCH RFT V2 7/8] clk: core: remove powerpc special handling Jonas Gorski
2019-04-15 10:10 ` [PATCH RFT V2 8/8] clk: core: replace clk_{readl, writel} with {readl, writel} Jonas Gorski

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=201904161252.kWbdH4TW%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=agust@denx.de \
    --cc=festevam@gmail.com \
    --cc=heiko@sntech.de \
    --cc=jonas.gorski@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=kbuild-all@01.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=michal.simek@xilinx.com \
    --cc=mturquette@baylibre.com \
    --cc=paulus@samba.org \
    --cc=pdeschrijver@nvidia.com \
    --cc=pgaikwad@nvidia.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=thierry.reding@gmail.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).