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: 178903 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp2643768ilf; Fri, 8 Nov 2019 04:42:05 -0800 (PST) X-Google-Smtp-Source: APXvYqw2u4SPTo05rk3B20zk5XujF4Ev7kYz3wLb25ujBFEeLC5QogX0/yv1Py4lhjKbya9lD79i X-Received: by 2002:a17:906:194a:: with SMTP id b10mr8484449eje.123.1573216924985; Fri, 08 Nov 2019 04:42:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573216924; cv=none; d=google.com; s=arc-20160816; b=uDm4UhkK730gG6Zt4/K0btJT6JxFgtgKqy9s2L+VvRMgAKN3RbbANTdcEDwVcCdLkU DE9vXVWDTbPZMSnmHUnET1I8w490cR5tAw69+NdwKGeRY22DpMzdCbmFPJ0l7XJO0qvi lwgdU6NYG+gWthb+t91eeshwpxMss1MTwB0215h8OExAFHlKzGyP3gbPbZDci7mBcOJU +U9jhesFJVA50lkN+A2OjqUZmYNxA8TLpSilwXMtVbVdm+qCF0Dgh15WKZgyW19/OuFg 3IIYu0+bOhaOQTpsG7efV4rJrWkuFkG8f2SNPyyvOtAQgtCUb7e/+ALZTv4YDMPmyKaI A/0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=22yogZY8jyZoPkxsCBQlNGZ4kRUtmO2FQfuKV4jBNIQ=; b=PgWZzMPyAzPvVTpmYnrWdyqF2S/Sa0eWej4w1DMnRImhEgj36ipTf85xSomG+ja9lt YhBkh+rd8r9YaLwexe5m2CAsioyPLFBdaTxUEsIxy63QEH9cd78HsAyzcrr8iEdgurZp ioQJpX36+CFWZCLX1iPw/V+5Gd3+7y68aaiTapU1/CaYVGwAKEXJLnaOdWGxnvOiFLqe Ss9NqxJai0UdEBD8Owl1n1g1A/B4RFoVpP5+b6cpmARJvTKztFe0s15VnQkU0ItbVUfU NMT2EULoiyhcHMxXWeZ7ZRXGlajjg8jJgsP8bmBwv9eWWXdqsWQ1JcS5qdV9rnRoUkJ6 +9Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=UpmHfW2V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si4641441edn.266.2019.11.08.04.42.04; Fri, 08 Nov 2019 04:42:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=UpmHfW2V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbfKHMl7 (ORCPT + 26 others); Fri, 8 Nov 2019 07:41:59 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:25269 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbfKHMl7 (ORCPT ); Fri, 8 Nov 2019 07:41:59 -0500 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.17.1 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)