linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 3/9] net: xfrm: use __this_cpu_read per-cpu helper
@ 2012-11-09  2:20 Shan Wei
  2012-11-09 20:12 ` Christoph Lameter
  0 siblings, 1 reply; 3+ messages in thread
From: Shan Wei @ 2012-11-09  2:20 UTC (permalink / raw)
  To: steffen.klassert, David Miller, NetDev, Herbert Xu,
	Kernel-Maillist, cl, Shan Wei

From: Shan Wei <davidshan@tencent.com>


Signed-off-by: Shan Wei <davidshan@tencent.com>
---
v3 fix compile warning:
net/xfrm/xfrm_ipcomp.c: In function 'ipcomp_alloc_tfms':
net/xfrm/xfrm_ipcomp.c:285: warning: assignment from incompatible pointer type

---
 net/xfrm/xfrm_ipcomp.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
index e5246fb..898c899 100644
--- a/net/xfrm/xfrm_ipcomp.c
+++ b/net/xfrm/xfrm_ipcomp.c
@@ -276,18 +276,15 @@ static struct crypto_comp * __percpu *ipcomp_alloc_tfms(const char *alg_name)
 	struct crypto_comp * __percpu *tfms;
 	int cpu;
 
-	/* This can be any valid CPU ID so we don't need locking. */
-	cpu = raw_smp_processor_id();
 
 	list_for_each_entry(pos, &ipcomp_tfms_list, list) {
 		struct crypto_comp *tfm;
 
-		tfms = pos->tfms;
-		tfm = *per_cpu_ptr(tfms, cpu);
+		tfm = (struct crypto_comp *) __this_cpu_read(pos->tfms);
 
 		if (!strcmp(crypto_comp_name(tfm), alg_name)) {
 			pos->users++;
-			return tfms;
+			return pos->tfms;
 		}
 	}
 
-- 
1.7.1

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

* Re: [PATCH v3 3/9] net: xfrm: use __this_cpu_read per-cpu helper
  2012-11-09  2:20 [PATCH v3 3/9] net: xfrm: use __this_cpu_read per-cpu helper Shan Wei
@ 2012-11-09 20:12 ` Christoph Lameter
  2012-11-12  1:45   ` Shan Wei
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Lameter @ 2012-11-09 20:12 UTC (permalink / raw)
  To: Shan Wei
  Cc: steffen.klassert, David Miller, NetDev, Herbert Xu, Kernel-Maillist

On Fri, 9 Nov 2012, Shan Wei wrote:

> v3 fix compile warning:
> net/xfrm/xfrm_ipcomp.c: In function 'ipcomp_alloc_tfms':
> net/xfrm/xfrm_ipcomp.c:285: warning: assignment from incompatible pointer type

Why exactly is the pointer type not compatible? Looks like we have a
problem here.


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

* Re: [PATCH v3 3/9] net: xfrm: use __this_cpu_read per-cpu helper
  2012-11-09 20:12 ` Christoph Lameter
@ 2012-11-12  1:45   ` Shan Wei
  0 siblings, 0 replies; 3+ messages in thread
From: Shan Wei @ 2012-11-12  1:45 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: steffen.klassert, David Miller, NetDev, Herbert Xu, Kernel-Maillist

Christoph Lameter said, at 2012/11/10 4:12:
> On Fri, 9 Nov 2012, Shan Wei wrote:
> 
>> v3 fix compile warning:
>> net/xfrm/xfrm_ipcomp.c: In function 'ipcomp_alloc_tfms':
>> net/xfrm/xfrm_ipcomp.c:285: warning: assignment from incompatible pointer type
> 
> Why exactly is the pointer type not compatible? Looks like we have a
> problem here.
> 

pos->tfms(struct crypto_comp **tfms) is a double pointer that point to struct crypto_comp.
returned value is a pointer that point to struct crypto_comp;
So, we need to dereference and then read.

+ tfm = __this_cpu_read(*pos->tfms);

I will update this patch in v4 to fix it.

Thanks~

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

end of thread, other threads:[~2012-11-12  1:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-09  2:20 [PATCH v3 3/9] net: xfrm: use __this_cpu_read per-cpu helper Shan Wei
2012-11-09 20:12 ` Christoph Lameter
2012-11-12  1:45   ` Shan Wei

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