Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp16809563ybl; Wed, 1 Jan 2020 14:25:33 -0800 (PST) X-Google-Smtp-Source: APXvYqxqAllld5No6PWxnnsVvKcRK7O0b97bGz3ijmEzLJExHUji/rnitVeKS091rNxdmxuPBvjo X-Received: by 2002:a9d:6857:: with SMTP id c23mr72848447oto.351.1577917533515; Wed, 01 Jan 2020 14:25:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577917533; cv=none; d=google.com; s=arc-20160816; b=aOTE+XsHZaxGWcMYfB/fG+L5l6XW+pDs8kFJhCi7UREeh43vAElrj8DaWd0KnM2w6E WmGpL6b4ygM0YFLKhhhfBvbpzlYCheegiHTzYlLdrL4Xjv2EhCvIDerMz1cK6ERCgE7u a6XUTpxSm9PnjSDXsH36OzPHjwQhLN7XQ/UornFLuYEKqidfUmuxgNZ9cGQFfLyMcrqa 8vabpH2f6ZAmR2kJM1RxWiAE4Xs2t1QVSZ3pCfi3CKDM+iZz5vh/OTHG81cBrfXrFSxB o8Bm95sfsGZivq8aTZMOa9HTRijQ9GfOnBwymAIMnsCPUZ2yxE+OWomjUaleqVwzh9dm OBJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=RFTAzj1L4OMM0HsPlEZRKXOxF1CLEaJuxKoPuwgN/Qo=; b=zupwRg6iEk+FyikXr+alZEW3TfHhaS2h1JMfkgJF+E0vwutJkp8eCFKztrYLTrnlsI nKGYLVfuzgay51WaxULADtopLSZEpzPAft88xco2aeuyBdAyZOooD5wyPSGWN5eQ/awL 1Xp+Rf0EjK8k+9h6S7hTLRJmLwRqexnnY+2j6qwzahzZ/0xy8Gbd1IELMoFEM/zD8QWt GLkC3UubNz03n4YHfXf2Lpnv+XH8rUaikwcoEFuiq6GcoKkY8LeWN1A4pNNMG6FFN89+ Oik4F7ctQsVNTzW3zYNlMisgfvZsVkITMUqZacB1wtdoIqQvlQrQo2h8JrnnN5IHVJaS JsFA== 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 h2si27488203otn.100.2020.01.01.14.25.07; Wed, 01 Jan 2020 14:25:33 -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 S1727426AbgAAWUe convert rfc822-to-8bit (ORCPT + 99 others); Wed, 1 Jan 2020 17:20:34 -0500 Received: from mail-yb1-f194.google.com ([209.85.219.194]:46099 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727290AbgAAWUd (ORCPT ); Wed, 1 Jan 2020 17:20:33 -0500 Received: by mail-yb1-f194.google.com with SMTP id k128so5673734ybc.13; Wed, 01 Jan 2020 14:20:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=PjjfS+Y9kWHtQ/q+KDR0uj94xEE/rL5CDqpi3YaNtqU=; b=HObaKxZsqAfpFaP/g+jeekpFqKzDxqWKoWOa/V6W+lxwkCRoF27UpqGxnojyjHRaTV QqXUuHsWZtI5vQockPQC1LzzBjN/Y169M3LJmjoDsHTTKY04VPGmauMAvIb9J67izvca bbwxLfdU+qagweNl3Vhriiq/hAI9LuhfgPvYvxSbh4CljDGmT/Khz9uEi8CWtUV8zZgs L8GDm3aMMqHfnSxd56ydDGWHbyzqN/FwSpEOug2eMmC0nHOo+0kOVaJSeVXErjuNv8Q2 QlKKutN3ZNc+1LnUCHOzkLSSVG61Is02QurFPuMiTDKqQnWdd0+qEpALEBz8D9ZR4CqJ Lx7g== X-Gm-Message-State: APjAAAVUcEDg6SwvdzLSFsK/FaTnGwzYvfu4ROC+VnsBheoUr8MN0jLo Cw4bCPs+yFmB9yk7hcJEli9JX7kQaQ7j7v0DDi0= X-Received: by 2002:a5b:2cc:: with SMTP id h12mr41443609ybp.316.1577917232632; Wed, 01 Jan 2020 14:20:32 -0800 (PST) MIME-Version: 1.0 References: <1577900990-8588-1-git-send-email-Julia.Lawall@inria.fr> <1577900990-8588-9-git-send-email-Julia.Lawall@inria.fr> In-Reply-To: <1577900990-8588-9-git-send-email-Julia.Lawall@inria.fr> From: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Date: Wed, 1 Jan 2020 23:25:57 +0100 Message-ID: Subject: Re: [PATCH 08/10] MIPS: use resource_size To: Julia Lawall Cc: Ralf Baechle , kernel-janitors@vger.kernel.org, Paul Burton , James Hogan , "open list:BROADCOM NVRAM DRIVER" , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 1, 2020 at 7:26 PM Julia Lawall wrote: > > 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(); > Reviewed-by: Philippe Mathieu-Daudé Thanks Julia!