linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] powerpc/mpc512x: fix noderef sparse warnings
@ 2013-02-05  7:20 Anatolij Gustschin
  2013-02-05  7:20 ` [PATCH 2/3] powerpc/mpc512x: fix sparce warnings for non static symbols Anatolij Gustschin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anatolij Gustschin @ 2013-02-05  7:20 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Anatolij Gustschin

Fix:
warning: dereference of noderef expression

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 arch/powerpc/platforms/512x/clock.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index 7937361..8a784d4 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -184,7 +184,7 @@ static unsigned long spmf_mult(void)
 		36, 40, 44, 48,
 		52, 56, 60, 64
 	};
-	int spmf = (clockctl->spmr >> 24) & 0xf;
+	int spmf = (in_be32(&clockctl->spmr) >> 24) & 0xf;
 	return spmf_to_mult[spmf];
 }
 
@@ -206,7 +206,7 @@ static unsigned long sysdiv_div_x_2(void)
 		52, 56, 58, 62,
 		60, 64, 66,
 	};
-	int sysdiv = (clockctl->scfr2 >> 26) & 0x3f;
+	int sysdiv = (in_be32(&clockctl->scfr2) >> 26) & 0x3f;
 	return sysdiv_to_div_x_2[sysdiv];
 }
 
@@ -230,7 +230,7 @@ static unsigned long sys_to_ref(unsigned long rate)
 
 static long ips_to_ref(unsigned long rate)
 {
-	int ips_div = (clockctl->scfr1 >> 23) & 0x7;
+	int ips_div = (in_be32(&clockctl->scfr1) >> 23) & 0x7;
 
 	rate *= ips_div;	/* csb_clk = ips_clk * ips_div */
 	rate *= 2;		/* sys_clk = csb_clk * 2 */
@@ -284,7 +284,7 @@ static struct clk sys_clk = {
 
 static void diu_clk_calc(struct clk *clk)
 {
-	int diudiv_x_2 = clockctl->scfr1 & 0xff;
+	int diudiv_x_2 = in_be32(&clockctl->scfr1) & 0xff;
 	unsigned long rate;
 
 	rate = sys_clk.rate;
@@ -311,7 +311,7 @@ static void half_clk_calc(struct clk *clk)
 
 static void generic_div_clk_calc(struct clk *clk)
 {
-	int div = (clockctl->scfr1 >> clk->div_shift) & 0x7;
+	int div = (in_be32(&clockctl->scfr1) >> clk->div_shift) & 0x7;
 
 	clk->rate = clk->parent->rate / div;
 }
@@ -329,7 +329,7 @@ static struct clk csb_clk = {
 
 static void e300_clk_calc(struct clk *clk)
 {
-	int spmf = (clockctl->spmr >> 16) & 0xf;
+	int spmf = (in_be32(&clockctl->spmr) >> 16) & 0xf;
 	int ratex2 = clk->parent->rate * spmf;
 
 	clk->rate = ratex2 / 2;
@@ -648,12 +648,12 @@ static void psc_calc_rate(struct clk *clk, int pscnum, struct device_node *np)
 	out_be32(&clockctl->pccr[pscnum], 0x00020000);
 	out_be32(&clockctl->pccr[pscnum], 0x00030000);
 
-	if (clockctl->pccr[pscnum] & 0x80) {
+	if (in_be32(&clockctl->pccr[pscnum]) & 0x80) {
 		clk->rate = spdif_rxclk.rate;
 		return;
 	}
 
-	switch ((clockctl->pccr[pscnum] >> 14) & 0x3) {
+	switch ((in_be32(&clockctl->pccr[pscnum]) >> 14) & 0x3) {
 	case 0:
 		mclk_src = sys_clk.rate;
 		break;
@@ -668,7 +668,7 @@ static void psc_calc_rate(struct clk *clk, int pscnum, struct device_node *np)
 		break;
 	}
 
-	mclk_div = ((clockctl->pccr[pscnum] >> 17) & 0x7fff) + 1;
+	mclk_div = ((in_be32(&clockctl->pccr[pscnum]) >> 17) & 0x7fff) + 1;
 	clk->rate = mclk_src / mclk_div;
 }
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] powerpc/mpc512x: fix sparce warnings for non static symbols
  2013-02-05  7:20 [PATCH 1/3] powerpc/mpc512x: fix noderef sparse warnings Anatolij Gustschin
@ 2013-02-05  7:20 ` Anatolij Gustschin
  2013-02-05  7:20 ` [PATCH 3/3] powerpc/mpc5xxx: fix sparse warning for non static symbol Anatolij Gustschin
  2013-02-06  3:11 ` [PATCH 1/3] powerpc/mpc512x: fix noderef sparse warnings Kim Phillips
  2 siblings, 0 replies; 4+ messages in thread
From: Anatolij Gustschin @ 2013-02-05  7:20 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Anatolij Gustschin

Fix warnings:
symbol 'clockctl' was not declared. Should it be static?
symbol 'rate_clks' was not declared. Should it be static?
symbol 'dev_clks' was not declared. Should it be static?
symbol 'mpc5121_clk_init' was not declared. Should it be static?

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 arch/powerpc/include/asm/mpc5121.h  |    1 +
 arch/powerpc/platforms/512x/clock.c |    7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/mpc5121.h b/arch/powerpc/include/asm/mpc5121.h
index e700c8b..1b0ce6d 100644
--- a/arch/powerpc/include/asm/mpc5121.h
+++ b/arch/powerpc/include/asm/mpc5121.h
@@ -147,5 +147,6 @@ struct mpc512x_axe_module {
 
 
 int mpc512x_cs_config(int cs, u32 val);
+int __init mpc5121_clk_init(void);
 
 #endif /* __ASM_POWERPC_MPC5121_H__ */
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index 8a784d4..52d57d2 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -26,6 +26,7 @@
 
 #include <linux/of_platform.h>
 #include <asm/mpc5xxx.h>
+#include <asm/mpc5121.h>
 #include <asm/clk_interface.h>
 
 #undef CLK_DEBUG
@@ -122,7 +123,7 @@ struct mpc512x_clockctl {
 	u32 dccr;		/* DIU Clk Cnfg Reg */
 };
 
-struct mpc512x_clockctl __iomem *clockctl;
+static struct mpc512x_clockctl __iomem *clockctl;
 
 static int mpc5121_clk_enable(struct clk *clk)
 {
@@ -551,7 +552,7 @@ static struct clk ac97_clk = {
 	.calc = ac97_clk_calc,
 };
 
-struct clk *rate_clks[] = {
+static struct clk *rate_clks[] = {
 	&ref_clk,
 	&sys_clk,
 	&diu_clk,
@@ -607,7 +608,7 @@ static void rate_clks_init(void)
  * There are two clk enable registers with 32 enable bits each
  * psc clocks and device clocks are all stored in dev_clks
  */
-struct clk dev_clks[2][32];
+static struct clk dev_clks[2][32];
 
 /*
  * Given a psc number return the dev_clk
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] powerpc/mpc5xxx: fix sparse warning for non static symbol
  2013-02-05  7:20 [PATCH 1/3] powerpc/mpc512x: fix noderef sparse warnings Anatolij Gustschin
  2013-02-05  7:20 ` [PATCH 2/3] powerpc/mpc512x: fix sparce warnings for non static symbols Anatolij Gustschin
@ 2013-02-05  7:20 ` Anatolij Gustschin
  2013-02-06  3:11 ` [PATCH 1/3] powerpc/mpc512x: fix noderef sparse warnings Kim Phillips
  2 siblings, 0 replies; 4+ messages in thread
From: Anatolij Gustschin @ 2013-02-05  7:20 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Anatolij Gustschin

Fix warning:
symbol 'mpc5xxx_get_bus_frequency' was not declared. Should it be static?

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 arch/powerpc/sysdev/mpc5xxx_clocks.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/mpc5xxx_clocks.c b/arch/powerpc/sysdev/mpc5xxx_clocks.c
index 96f815a..5492dc5 100644
--- a/arch/powerpc/sysdev/mpc5xxx_clocks.c
+++ b/arch/powerpc/sysdev/mpc5xxx_clocks.c
@@ -9,9 +9,9 @@
 #include <linux/kernel.h>
 #include <linux/of_platform.h>
 #include <linux/export.h>
+#include <asm/mpc5xxx.h>
 
-unsigned int
-mpc5xxx_get_bus_frequency(struct device_node *node)
+unsigned long mpc5xxx_get_bus_frequency(struct device_node *node)
 {
 	struct device_node *np;
 	const unsigned int *p_bus_freq = NULL;
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] powerpc/mpc512x: fix noderef sparse warnings
  2013-02-05  7:20 [PATCH 1/3] powerpc/mpc512x: fix noderef sparse warnings Anatolij Gustschin
  2013-02-05  7:20 ` [PATCH 2/3] powerpc/mpc512x: fix sparce warnings for non static symbols Anatolij Gustschin
  2013-02-05  7:20 ` [PATCH 3/3] powerpc/mpc5xxx: fix sparse warning for non static symbol Anatolij Gustschin
@ 2013-02-06  3:11 ` Kim Phillips
  2 siblings, 0 replies; 4+ messages in thread
From: Kim Phillips @ 2013-02-06  3:11 UTC (permalink / raw)
  To: Anatolij Gustschin; +Cc: linuxppc-dev

On Tue, 5 Feb 2013 08:20:16 +0100
Anatolij Gustschin <agust@denx.de> wrote:

> Fix:
> warning: dereference of noderef expression
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  arch/powerpc/platforms/512x/clock.c |   18 +++++++++---------
>  1 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
> index 7937361..8a784d4 100644
> --- a/arch/powerpc/platforms/512x/clock.c
> +++ b/arch/powerpc/platforms/512x/clock.c
> @@ -184,7 +184,7 @@ static unsigned long spmf_mult(void)
>  		36, 40, 44, 48,
>  		52, 56, 60, 64
>  	};
> -	int spmf = (clockctl->spmr >> 24) & 0xf;
> +	int spmf = (in_be32(&clockctl->spmr) >> 24) & 0xf;

power arch should start using the more portable i/o accessors
io{read,write}32be instead of the arch-centric {in,out}_be32.  The
io{read,write}32be functions have better sparse annotation, so an
endian check will complain if registers are not defined __be32.

Kim

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-06  3:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-05  7:20 [PATCH 1/3] powerpc/mpc512x: fix noderef sparse warnings Anatolij Gustschin
2013-02-05  7:20 ` [PATCH 2/3] powerpc/mpc512x: fix sparce warnings for non static symbols Anatolij Gustschin
2013-02-05  7:20 ` [PATCH 3/3] powerpc/mpc5xxx: fix sparse warning for non static symbol Anatolij Gustschin
2013-02-06  3:11 ` [PATCH 1/3] powerpc/mpc512x: fix noderef sparse warnings Kim Phillips

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).