From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shan Wei Subject: [PATCH v4 3/9] net: xfrm: use __this_cpu_read per-cpu helper Date: Tue, 13 Nov 2012 09:52:09 +0800 Message-ID: <50A1A7C9.3060703@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit To: steffen.klassert@secunet.com, David Miller , NetDev , Herbert Xu , Kernel-Maillist , cl@linux-foundation.org, Shan Wei Return-path: Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org From: Shan Wei Signed-off-by: Shan Wei --- v4: derefrence pointer before reading to avoid compile warning. --- net/xfrm/xfrm_ipcomp.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c index e5246fb..2906d52 100644 --- a/net/xfrm/xfrm_ipcomp.c +++ b/net/xfrm/xfrm_ipcomp.c @@ -276,18 +276,16 @@ 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); + /* This can be any valid CPU ID so we don't need locking. */ + tfm = __this_cpu_read(*pos->tfms); if (!strcmp(crypto_comp_name(tfm), alg_name)) { pos->users++; - return tfms; + return pos->tfms; } } -- 1.7.1