Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2997665pxb; Sat, 23 Oct 2021 13:11:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqS6zjbRGeuHbK/bEFTWy3KP5zefq7mDKDoQ+hba+qWRNa+9b0HT7H7gecLGE0sWTmZ3Wn X-Received: by 2002:a17:90b:1e4d:: with SMTP id pi13mr14340994pjb.67.1635019864774; Sat, 23 Oct 2021 13:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635019864; cv=none; d=google.com; s=arc-20160816; b=rMjme40dI/UaZ6vdqE/gtKvgfe7tr5nzKbQD0bPNRvJq8jkSOLncoaEFbn7x7SUNfE AgbEthR8WvbZbguax7aLzLxjlX1VzXWpwRkY/Jf/RQ8+THHzeAqSW+OsVHM5/f00vCj+ 60hTHfs7yQLftgQBKihMMPsAZCi1bTVcXo83JZrRPGCx4iWzWL6o3jAH+9015QOW3Jsp y48c4kUmT+7p8lq8QNECGszKbPVfWpIXGWbFBqthlTbEcZ1F1+1wYNFcmModdasBgdiV 7y3xgmk5rPEcBZrQkBz1lJA2aAt51iIilinnhttuT8MzckUZ2MlOEV+kLwhwC98rg0YB RhSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=7r17rsm5fNsqIE2XtlHOJy57rmmUVvnFCKQ6EbEIl9s=; b=eXean0RFDUf4srRXNydeUnzLPmSN27cWQnqmvwTP4cVceFD6YjXa7eujKSoy/JoklW fVbM6xVzwY5yPwoWqSGLBqwjdWcO+07tFXr1TMYNM5OKEm6QW1Qm2LY+Hp9Ce+QpzAw+ 2e67DXuLPLOR0ZtYX+hLUYVuLWHPldiTv7M0V6a1B2YXlFu1a2JfCaVOP/Z9rJQOJqgU vYIgJtpsJjhVOqDnFWcwotFz63jkkQVQW7qcpY9UhXpDy4xRelmgBYIOdVLjGgarbyB/ /1TrQcQOGpNDEt5KVUcKImL+lbwlods6MC90uaILJ8FAHvgQpypUyhLTq+HQ6YYg9mI4 5zYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t20si16829503pgv.302.2021.10.23.13.10.49; Sat, 23 Oct 2021 13:11:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230359AbhJWULg (ORCPT + 99 others); Sat, 23 Oct 2021 16:11:36 -0400 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:61356 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbhJWULg (ORCPT ); Sat, 23 Oct 2021 16:11:36 -0400 Received: from [192.168.1.18] ([92.140.161.106]) by smtp.orange.fr with ESMTPA id eNKMmCzHkTdRTeNKMmKPAW; Sat, 23 Oct 2021 22:09:16 +0200 X-ME-Helo: [192.168.1.18] X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sat, 23 Oct 2021 22:09:16 +0200 X-ME-IP: 92.140.161.106 Subject: Re: [PATCH] coresight: Use devm_bitmap_zalloc when applicable To: Joe Perches , mathieu.poirier@linaro.org, suzuki.poulose@arm.com, mike.leach@linaro.org, leo.yan@linaro.org, alexander.shishkin@linux.intel.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <663d3820f118c37a81529b3362b95e09c8e75e9f.camel@perches.com> From: Christophe JAILLET Message-ID: Date: Sat, 23 Oct 2021 22:09:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <663d3820f118c37a81529b3362b95e09c8e75e9f.camel@perches.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 23/10/2021 à 21:36, Joe Perches a écrit : > On Sat, 2021-10-23 at 21:24 +0200, Christophe JAILLET wrote: >> 'drvdata->chs.guaranteed' is a bitmap. So use 'devm_bitmap_kzalloc()' to >> simplify code, improve the semantic and avoid some open-coded arithmetic >> in allocator arguments. > [] >> diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c > [] >> @@ -862,7 +862,6 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) >> struct stm_drvdata *drvdata; >> struct resource *res = &adev->res; >> struct resource ch_res; >> - size_t bitmap_size; >> struct coresight_desc desc = { 0 }; >> >> desc.name = coresight_alloc_device_name(&stm_devs, dev); >> @@ -904,9 +903,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) >> else >> drvdata->numsp = stm_num_stimulus_port(drvdata); >> >> - bitmap_size = BITS_TO_LONGS(drvdata->numsp) * sizeof(long); >> - >> - guaranteed = devm_kzalloc(dev, bitmap_size, GFP_KERNEL); >> + guaranteed = devm_bitmap_zalloc(dev, drvdata->numsp, GFP_KERNEL); >> if (!guaranteed) >> return -ENOMEM; >> drvdata->chs.guaranteed = guaranteed; > > guaranteed is also pretty useless > I agree, but removing it would make the line with devm_bitmap_zalloc() 86 chars. This would not be consistent with the rest of the file and would (IMHO) require splitting. Let see if the maintainer prefer saving one additional line of code, or keeping the logic in place. CJ