From patchwork Fri Nov 8 12:41:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11234723 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1E411575 for ; Fri, 8 Nov 2019 12:41:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7A30121D7E for ; Fri, 8 Nov 2019 12:41:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="UpmHfW2V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A30121D7E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8A0776B0005; Fri, 8 Nov 2019 07:41:55 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 850DF6B0006; Fri, 8 Nov 2019 07:41:55 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73FB16B0007; Fri, 8 Nov 2019 07:41:55 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0025.hostedemail.com [216.40.44.25]) by kanga.kvack.org (Postfix) with ESMTP id 5FA686B0005 for ; Fri, 8 Nov 2019 07:41:55 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 0C5B9248D for ; Fri, 8 Nov 2019 12:41:55 +0000 (UTC) X-FDA: 76133072190.01.thing86_84f814fa4d25b X-Spam-Summary: 2,0,0,5e88e5feef7ce977,d41d8cd98f00b204,yamada.masahiro@socionext.com,:linux-kernel@vger.kernel.org:akpm@linux-foundation.org::yamada.masahiro@socionext.com:arnd@arndb.de:linux-arch@vger.kernel.org,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1437:1534:1541:1711:1730:1747:1777:1792:1801:1981:2194:2199:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3871:3872:3873:4321:4605:5007:6261:6653:7903:9040:9149:10004:11026:11473:11658:11914:12043:12296:12297:12555:12895:12986:13069:13311:13357:14181:14384:14394:14721:21080:21451:21627:30003:30029:30054:30070,0,RBL:210.131.2.78:@socionext.com:.lbl8.mailshell.net-62.14.10.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fs,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: thing86_84f814fa4d25b X-Filterd-Recvd-Size: 3297 Received: from conuserg-11.nifty.com (conuserg-11.nifty.com [210.131.2.78]) by imf14.hostedemail.com (Postfix) with SMTP for ; Fri, 8 Nov 2019 12:41:53 +0000 (UTC) Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id xA8CfZiN020169; Fri, 8 Nov 2019 21:41:36 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com xA8CfZiN020169 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1573216896; bh=22yogZY8jyZoPkxsCBQlNGZ4kRUtmO2FQfuKV4jBNIQ=; h=From:To:Cc:Subject:Date:From; b=UpmHfW2VombLNqyRYQdMOxRzsUOkQnTeaQzeIJxSOdD9D45KH1oipBsMF/KUPQxTz Aa2jfWi8Qj5AQJXn4tNLJuh+Neet/mxBnzEqYE6CBT/AU/J0rrfx3lEfyCkCyj3+e/ zMOQdwQ8+QfIndyoDtt4JtROzDaCBuaFp/KU4X/779IJ66oLS9SUiZh8/iLsb1VrbL QHSXbi4lZGo1xO3J3Akc6sMh2+/he1YOcP/cB9P1S2LMWj7l6OUkp9obP3G8lPD08I Hv//tCtRO5JcTSJMyrcUZ9QAtNAZdL/kLDUHpLVeTn+3gKQZfZg7WNUYva0Kzm4O9V xWX0Mnhqx5C8A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kernel@vger.kernel.org, Andrew Morton , linux-mm@kvack.org Cc: Masahiro Yamada , Arnd Bergmann , linux-arch@vger.kernel.org Subject: [PATCH] mm: fixmap: convert __set_fixmap_offset() to an inline function Date: Fri, 8 Nov 2019 21:41:33 +0900 Message-Id: <20191108124133.31751-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: I just stopped by the ugly variable name, ________addr. (8 underscores!) If this is just a matter of casting to (unsigned long), this variable is unneeded since you can do like this: ({ \ __set_fixmap(idx, phys, flags); \ (unsigned long)(fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1))); \ }) However, I'd rather like to change it to an inline function since it is more readable, and the parameter types are clearer. Signed-off-by: Masahiro Yamada --- include/asm-generic/fixmap.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h index 8cc7b09c1bc7..de4c36912529 100644 --- a/include/asm-generic/fixmap.h +++ b/include/asm-generic/fixmap.h @@ -70,14 +70,14 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr) __set_fixmap(idx, 0, FIXMAP_PAGE_CLEAR) #endif -/* Return a pointer with offset calculated */ -#define __set_fixmap_offset(idx, phys, flags) \ -({ \ - unsigned long ________addr; \ - __set_fixmap(idx, phys, flags); \ - ________addr = fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \ - ________addr; \ -}) +/* Return a virtual address with offset calculated */ +static inline unsigned long __set_fixmap_offset(enum fixed_addresses idx, + phys_addr_t phys, + pgprot_t flags) +{ + __set_fixmap(idx, phys, flags); + return fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); +} #define set_fixmap_offset(idx, phys) \ __set_fixmap_offset(idx, phys, FIXMAP_PAGE_NORMAL)