From patchwork Thu Aug 27 17:26:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rabin Vincent X-Patchwork-Id: 7086421 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BDECF9F372 for ; Thu, 27 Aug 2015 17:30:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD3CE209C0 for ; Thu, 27 Aug 2015 17:30:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B50D209B3 for ; Thu, 27 Aug 2015 17:30:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZV0xL-0003gr-2T; Thu, 27 Aug 2015 17:27:19 +0000 Received: from mail-lb0-x22c.google.com ([2a00:1450:4010:c04::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZV0xH-0003cj-CZ for linux-arm-kernel@lists.infradead.org; Thu, 27 Aug 2015 17:27:16 +0000 Received: by lbcbn3 with SMTP id bn3so15764614lbc.2 for ; Thu, 27 Aug 2015 10:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=7+CJpwVFEjZbSK9tbysTvTtYXKnxGP+nEiIySqIDltA=; b=xxogTgsnZBQj+BJfow1sW4iLpgD5dqTYhK/zW6ynRIHyemRR12a6AIoPOekLOK2w0v /FmLlEluEGNpq3Y6yFpNUgV0JZwymwIKcukDvbVoRDS7r4JLMFlB+Jdax98yveaX0oez HNzGG7ma9odmvVMyOe7/x0SxJBRxq4OSgTRd3N+CxLD1vxaVbZ26wwnC2JBzwLgaTsjl fSKuZrH+jj8XITOu++73Y6ZjKaGWqmKpMiO72HNbDgZn5YluYswBRfk33VLBUg4kpz2S 8mzCSOazrnCWQE7I4ZbcadvwKimECJPY8TVCaSEspZp0TGs0fNdlVODi2EqGQzbWAC/M sHnw== X-Received: by 10.112.55.33 with SMTP id o1mr2810503lbp.96.1440696413008; Thu, 27 Aug 2015 10:26:53 -0700 (PDT) Received: from debian (h249n21-ld-c-a31.ias.bredband.telia.com. [78.70.84.249]) by smtp.gmail.com with ESMTPSA id b5sm736258laa.34.2015.08.27.10.26.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Aug 2015 10:26:52 -0700 (PDT) Date: Thu, 27 Aug 2015 19:26:48 +0200 From: Rabin Vincent To: yalin wang Subject: Re: [PATCH] arm: insn: use set_fixmap_offset to make it more clear Message-ID: <20150827172605.GA5251@debian> References: <1440552266-19940-1-git-send-email-yalin.wang2010@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1440552266-19940-1-git-send-email-yalin.wang2010@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150827_102715_612810_00BE5531 X-CRM114-Status: GOOD ( 15.34 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wangnan0@huawei.com, linux@arm.linux.org.uk, keescook@chromium.org, nico@linaro.org, will.deacon@arm.com, linux-kernel@vger.kernel.org, masami.hiramatsu.pt@hitachi.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Aug 26, 2015 at 09:24:26AM +0800, yalin wang wrote: > A little change to patch_map() function, > use set_fixmap_offset() to make code more clear. > > Signed-off-by: yalin wang > --- > arch/arm/kernel/patch.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c > index 69bda1a..5779105 100644 > --- a/arch/arm/kernel/patch.c > +++ b/arch/arm/kernel/patch.c > @@ -36,9 +36,8 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) > else > __acquire(&patch_lock); > > - set_fixmap(fixmap, page_to_phys(page)); > - > - return (void *) (__fix_to_virt(fixmap) + (uintaddr & ~PAGE_MASK)); > + return (void *)set_fixmap_offset(fixmap, page_to_phys(page) + > + (uintaddr & ~PAGE_MASK)); > } Perhaps a temporary variable to make it clearerer? Something like this: diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c index 69bda1a..0b8e594 100644 --- a/arch/arm/kernel/patch.c +++ b/arch/arm/kernel/patch.c @@ -23,6 +23,7 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) unsigned int uintaddr = (uintptr_t) addr; bool module = !core_kernel_text(uintaddr); struct page *page; + phys_addr_t phys; if (module && IS_ENABLED(CONFIG_DEBUG_SET_MODULE_RONX)) page = vmalloc_to_page(addr); @@ -36,9 +37,8 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) else __acquire(&patch_lock); - set_fixmap(fixmap, page_to_phys(page)); - - return (void *) (__fix_to_virt(fixmap) + (uintaddr & ~PAGE_MASK)); + phys = page_to_phys(page) + (uintaddr & ~PAGE_MASK); + return (void *) set_fixmap_offset(fixmap, phys); } static void __kprobes patch_unmap(int fixmap, unsigned long *flags)