From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96DB1C5DF60 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 11B74218AE for ; Fri, 8 Nov 2019 12:41:55 +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 11B74218AE 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) Received: by kanga.kvack.org (Postfix, from userid 40) id 850DF6B0006; Fri, 8 Nov 2019 07:41:55 -0500 (EST) 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-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-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) -- 2.17.1