* [RFC PATCH powerpc] Fix compiling error in powernv/rng.c
@ 2013-11-15 7:36 Li Zhong
2013-11-19 4:04 ` Michael Ellerman
0 siblings, 1 reply; 3+ messages in thread
From: Li Zhong @ 2013-11-15 7:36 UTC (permalink / raw)
To: PowerPC email list; +Cc: Paul Mackerras
This is seen when CONFIG_SMP is not enabled:
arch/powerpc/platforms/powernv/rng.c: In function 'rng_init_per_cpu':
arch/powerpc/platforms/powernv/rng.c:74: error: implicit declaration of function 'cpu_to_chip_id'
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
arch/powerpc/platforms/powernv/rng.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c
index 8844628..04430a7 100644
--- a/arch/powerpc/platforms/powernv/rng.c
+++ b/arch/powerpc/platforms/powernv/rng.c
@@ -59,6 +59,7 @@ int powernv_get_random_long(unsigned long *v)
}
EXPORT_SYMBOL_GPL(powernv_get_random_long);
+#ifdef CONFIG_SMP
static __init void rng_init_per_cpu(struct powernv_rng *rng,
struct device_node *dn)
{
@@ -75,6 +76,13 @@ static __init void rng_init_per_cpu(struct powernv_rng *rng,
}
}
}
+#else
+static __init void rng_init_per_cpu(struct powernv_rng *rng,
+ struct device_node *dn)
+{
+ per_cpu(powernv_rng, 0) = rng;
+}
+#endif
static __init int rng_create(struct device_node *dn)
{
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH powerpc] Fix compiling error in powernv/rng.c
2013-11-15 7:36 [RFC PATCH powerpc] Fix compiling error in powernv/rng.c Li Zhong
@ 2013-11-19 4:04 ` Michael Ellerman
2013-11-19 9:24 ` Li Zhong
0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2013-11-19 4:04 UTC (permalink / raw)
To: Li Zhong; +Cc: PowerPC email list, Paul Mackerras
On Fri, Nov 15, 2013 at 03:36:04PM +0800, Li Zhong wrote:
> This is seen when CONFIG_SMP is not enabled:
>
> arch/powerpc/platforms/powernv/rng.c: In function 'rng_init_per_cpu':
> arch/powerpc/platforms/powernv/rng.c:74: error: implicit declaration of function 'cpu_to_chip_id'
Hi Li,
We try whenever possible to avoid adding #ifdefs in C code.
Also on a multi chip system where there are multiple RNGs, your code for
UP will not necessarily choose the RNG on the same core as the cpu.
I have a different fix that I will send.
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH powerpc] Fix compiling error in powernv/rng.c
2013-11-19 4:04 ` Michael Ellerman
@ 2013-11-19 9:24 ` Li Zhong
0 siblings, 0 replies; 3+ messages in thread
From: Li Zhong @ 2013-11-19 9:24 UTC (permalink / raw)
To: Michael Ellerman; +Cc: PowerPC email list, Paul Mackerras
On Tue, 2013-11-19 at 15:04 +1100, Michael Ellerman wrote:
> On Fri, Nov 15, 2013 at 03:36:04PM +0800, Li Zhong wrote:
> > This is seen when CONFIG_SMP is not enabled:
> >
> > arch/powerpc/platforms/powernv/rng.c: In function 'rng_init_per_cpu':
> > arch/powerpc/platforms/powernv/rng.c:74: error: implicit declaration of function 'cpu_to_chip_id'
>
> Hi Li,
>
> We try whenever possible to avoid adding #ifdefs in C code.
>
> Also on a multi chip system where there are multiple RNGs, your code for
> UP will not necessarily choose the RNG on the same core as the cpu.
OK, thank you for the review, Michael.
Just try to make sure I understand it:
So even in UP, we could have multiple rng sources, and we should try to
use the source which has the same chip_id as the logical cpu?
Thanks, Zhong
> I have a different fix that I will send.
>
> cheers
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-19 9:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-15 7:36 [RFC PATCH powerpc] Fix compiling error in powernv/rng.c Li Zhong
2013-11-19 4:04 ` Michael Ellerman
2013-11-19 9:24 ` Li Zhong
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).