Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp16661880ybl; Wed, 1 Jan 2020 10:27:30 -0800 (PST) X-Google-Smtp-Source: APXvYqwEVAyd7/laqqafJwLvRXNxZQCg3TingEot5i7BYsdVb9r91n+pHGM2v0tZokoIhi/ZUsul X-Received: by 2002:a05:6830:20cf:: with SMTP id z15mr87757888otq.277.1577903250181; Wed, 01 Jan 2020 10:27:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577903250; cv=none; d=google.com; s=arc-20160816; b=stcNHFDVSlXXpH16NxsZvBRwaeiNmXtGz4LU/y4e4jCb8QheNw3CVW9osf1GwBSnNW Ui3HHyL6LrNZltfw/cGT1AW1yecoLV+k5MbnPWx5GR5D37bPfV5jvGp8ZPK0JHNz2SBq W2L1X+eHIzWz9ibTfcjKSP8y8hVhW9y3yJMBiOVK3V8I9obOONyWCdJ/NrnIiJa85eUC Q5yEYgjNhJ7I92oVepDcDWM+VhQgNGqTvRT/nExEbu/N6gPCG01GyGk/uDfflvlp/a1u QVweAHKxuYwAa7up3vL174Fo/3QDJA48c3gJqsql2LVxXpbu5ifbmQCuIVj4bHC/bBiH 6UGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=58b4fzm4saPCcrR8iyP1npGP/K3f5gm9HXdYe1s6R9U=; b=y4fzDwMfFVuGEvNOL5Mud2CAB79lRkvxld6OzIqbmx/3VTf0GLyVShCycfp2GW2uVt XzULGeFNyS+JsRiyCYvd2On02/baY7cd4hwkmyhojHEExpJBqNMPyhWlfWu9bL9GeqL/ QsMh0L4kh2uxYW5N5g2BHDjUT+XVgcLScb/DdwGoKuvl4iysD7A7ZlqhbgyUkC7dt4Qe Gd+gxglJFTyuLKlehz3rWF6YgrFKB91W34LJ0Ve+pFtgcR5MtOleNHi8MQb+PDsOzCqu s367LLOTTixRTToKSnTJgex470UbtcRwat1gVDQ0pUKSQCavZbbyHXsf9u14JU8UguC8 tkag== ARC-Authentication-Results: i=1; mx.google.com; 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 t4si5287019otc.160.2020.01.01.10.27.16; Wed, 01 Jan 2020 10:27:30 -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; 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 S1727452AbgAAS0c (ORCPT + 99 others); Wed, 1 Jan 2020 13:26:32 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:13083 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727348AbgAAS0a (ORCPT ); Wed, 1 Jan 2020 13:26:30 -0500 X-IronPort-AV: E=Sophos;i="5.69,382,1571695200"; d="scan'208";a="334542279" Received: from palace.rsr.lip6.fr (HELO palace.lip6.fr) ([132.227.105.202]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/AES128-SHA256; 01 Jan 2020 19:26:25 +0100 From: Julia Lawall To: Ralf Baechle Cc: kernel-janitors@vger.kernel.org, Paul Burton , James Hogan , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/10] MIPS: use resource_size Date: Wed, 1 Jan 2020 18:49:48 +0100 Message-Id: <1577900990-8588-9-git-send-email-Julia.Lawall@inria.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1577900990-8588-1-git-send-email-Julia.Lawall@inria.fr> References: <1577900990-8588-1-git-send-email-Julia.Lawall@inria.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use resource_size rather than a verbose computation on the end and start fields. The semantic patch that makes these changes is as follows: (http://coccinelle.lip6.fr/) @@ struct resource ptr; @@ - (ptr.end - ptr.start + 1) + resource_size(&ptr) Signed-off-by: Julia Lawall --- arch/mips/kernel/setup.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index c3d4212b5f1d..701f4bc3046f 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -515,8 +515,7 @@ static void __init request_crashkernel(struct resource *res) ret = request_resource(res, &crashk_res); if (!ret) pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n", - (unsigned long)((crashk_res.end - - crashk_res.start + 1) >> 20), + (unsigned long)(resource_size(&crashk_res) >> 20), (unsigned long)(crashk_res.start >> 20)); } #else /* !defined(CONFIG_KEXEC) */ @@ -698,8 +697,7 @@ static void __init arch_mem_init(char **cmdline_p) mips_parse_crashkernel(); #ifdef CONFIG_KEXEC if (crashk_res.start != crashk_res.end) - memblock_reserve(crashk_res.start, - crashk_res.end - crashk_res.start + 1); + memblock_reserve(crashk_res.start, resource_size(&crashk_res)); #endif device_tree_init(); sparse_init();