Received: by 10.192.165.148 with SMTP id m20csp4093336imm; Tue, 8 May 2018 02:50:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq5okdEqnR70LcSK6SMJ7Z57lmrRdMPxY3GdPgVvNeAB9e4M5DdStvUWwbSu+EUuNykONWn X-Received: by 2002:a17:902:76c4:: with SMTP id j4-v6mr8747707plt.257.1525773042111; Tue, 08 May 2018 02:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525773042; cv=none; d=google.com; s=arc-20160816; b=dYEYx8Tq1l8HLshjn9r4n9cdOIucqnh5k+vMuR1461TJCBXRPhpIKsth/dowY2iZRd bFD5DmxUmu9DSI/AS5pHeu4qroQ0aClBthQp+2GBHbeGXfHuNfCVV+Jbmzh8SHZf8vDi xvGuvUSvZCLTnJARoViC2b/+U+RrvHRdOOIcmkJgrgCk7lUqte7AIfMf/Wi+3ugvRPmS X/v4y8Y44SaFIjYoYei770hKfgrK6LvhI5q5QpXE3CVF77/sKj0YcAhojDNisUuPuFmn C01A/YsQ1x7UvXH/nPxN3aRsnjNK5bc30ZNM8hqCtl2YN5ao++B1i8EUHgWeieceU7ZA +oAA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=bxpwrFDs2wT3qXUWh83hT2kDe+RJ+JCsaobsPAWSfpw=; b=cvGvl8/FtuHfu/Eaa30vEDWkL+CZLzlSAHBDFh4exnx6ZJynAGZAmDWBUg5cD6OFl6 bhZ7YZqa/mTm8i1kJQKg1siOMdSRYQULqYGEoHcjdVn8zaieMf+W+rb7WVA1Ucsjp4QE kC/fQQYTTkndeXfDoov+0wyo+QGHcxBEh/hpp+SVb1OERKdRmPKBfoZUUvDGHOja2hV8 rNrIKQcw0m/gxuuzLJ4sIS2DS1P9ZPNWPQSSTn45+UQzOBzSGcufs3sFA4b/o0F12zio 7G2eIIVDLEGBr90fyGJEcVLCx4cgMd95hW7SwcBCXHZH2IQF779PTCL1HT4Lluy1lDNh ilzw== 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 f9-v6si19313600pge.639.2018.05.08.02.50.27; Tue, 08 May 2018 02:50:42 -0700 (PDT) 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 S932261AbeEHJuP (ORCPT + 99 others); Tue, 8 May 2018 05:50:15 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55120 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754763AbeEHJuL (ORCPT ); Tue, 8 May 2018 05:50:11 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E3FC580D; Tue, 8 May 2018 02:50:10 -0700 (PDT) Received: from [10.1.210.88] (e110467-lin.cambridge.arm.com [10.1.210.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B31873F318; Tue, 8 May 2018 02:50:07 -0700 (PDT) Subject: Re: [PATCH 2/3] dma-debug: simplify counting of preallocated requests To: Christoph Hellwig , iommu@lists.linux-foundation.org Cc: linux-arch@vger.kernel.org, linux-xtensa@linux-xtensa.org, Michal Simek , Vincent Chen , linux-c6x-dev@linux-c6x.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, Greentime Hu , linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org, nios2-dev@lists.rocketboards.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org References: <20180424140235.9125-1-hch@lst.de> <20180424140235.9125-3-hch@lst.de> From: Robin Murphy Message-ID: Date: Tue, 8 May 2018 10:50:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180424140235.9125-3-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/04/18 15:02, Christoph Hellwig wrote: > Just keep a single variable with a descriptive name instead of two > with confusing names. Reviewed-by: Robin Murphy > Signed-off-by: Christoph Hellwig > --- > lib/dma-debug.c | 20 ++++---------------- > 1 file changed, 4 insertions(+), 16 deletions(-) > > diff --git a/lib/dma-debug.c b/lib/dma-debug.c > index 712a897174e4..075253cb613b 100644 > --- a/lib/dma-debug.c > +++ b/lib/dma-debug.c > @@ -132,7 +132,7 @@ static u32 min_free_entries; > static u32 nr_total_entries; > > /* number of preallocated entries requested by kernel cmdline */ > -static u32 req_entries; > +static u32 nr_prealloc_entries = PREALLOC_DMA_DEBUG_ENTRIES; > > /* debugfs dentry's for the stuff above */ > static struct dentry *dma_debug_dent __read_mostly; > @@ -1011,7 +1011,6 @@ void dma_debug_add_bus(struct bus_type *bus) > > static int dma_debug_init(void) > { > - u32 num_entries; > int i; > > /* Do not use dma_debug_initialized here, since we really want to be > @@ -1032,12 +1031,7 @@ static int dma_debug_init(void) > return 0; > } > > - if (req_entries) > - num_entries = req_entries; > - else > - num_entries = PREALLOC_DMA_DEBUG_ENTRIES; > - > - if (prealloc_memory(num_entries) != 0) { > + if (prealloc_memory(nr_prealloc_entries) != 0) { > pr_err("DMA-API: debugging out of memory error - disabled\n"); > global_disable = true; > > @@ -1068,16 +1062,10 @@ static __init int dma_debug_cmdline(char *str) > > static __init int dma_debug_entries_cmdline(char *str) > { > - int res; > - > if (!str) > return -EINVAL; > - > - res = get_option(&str, &req_entries); > - > - if (!res) > - req_entries = 0; > - > + if (!get_option(&str, &nr_prealloc_entries)) > + nr_prealloc_entries = PREALLOC_DMA_DEBUG_ENTRIES; > return 0; > } > >