Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp315059ybl; Tue, 28 Jan 2020 03:47:05 -0800 (PST) X-Google-Smtp-Source: APXvYqwMc2/EJCk2YoBPOINlobSHU81QE+39O1lgEiZOwK5NscqX3exRj2eynUMn07C6M8/4TyhZ X-Received: by 2002:aca:b183:: with SMTP id a125mr2544740oif.83.1580212025103; Tue, 28 Jan 2020 03:47:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580212025; cv=none; d=google.com; s=arc-20160816; b=RnQTe495dyHSdJh16W69YJUS5I1hQTf2NVmErpbFhuYKQ3IDLdwFcsdCnvQOmUg3zY 4vPXerKwSUD/hPTuEGomEALUtCNdt5BpCQFKdye83RgAsGMg2//nd5rJKsyGY6s7rGnt QH3J7Xz+OhD7PNHo+cmYmOKIeDjsZMOeqdGqRYFPNKxw975p1cF6uB8Ib3gb5eilZ04I JbYZVC2YUEAcdJp7O1XgQfWOXS3OTt3En28PPCgEGUurqVLvFN85InRK6Ugasxgxujen W9ebN1zFPAQANUBkNWiTLXOasQ02ENbMjdbloA+1BksvFwSMLsPC6vyGgxEBMlVcQO21 X1iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=+gF3sCPxab2SAby8JY+yxGzbgXONDIgHtKWHRMt1Vmw=; b=ryE1EDI9zZJOuT60wRk61/Oo+5pxpM71t37fXnnqCmG3JdO3RlD3Rg2embpUewivXj EU1J4DC0j7thYhtYZWR4rfXOvTGygZ56irX7fMCWvS5zQP+KRb9MQ3IisMl/sopaoaGL j1WsCtelQASjoFI9sh88fv1Dh0i+DLbSdaibvIRY00NgzjG/M/XpUIhOIQqBnKaNuQYC PZEjvY4QBx7CqF5EFikmsl8icEBJiKSgZzWDvlYzPcmQP+R0AOagWCP7zjgR6mV0JoCp TqI1zmG9veQ/D/oChoKithRnH0l5Xrb6BgMOm4+EvB0FcJGyG9EYxG1qXcwNxS9q4pgE uyeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ijsPN1f6; 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 e24si8988614oti.247.2020.01.28.03.46.52; Tue, 28 Jan 2020 03:47:05 -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=@kernel.org header.s=default header.b=ijsPN1f6; 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 S1726108AbgA1Lox (ORCPT + 99 others); Tue, 28 Jan 2020 06:44:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:38778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725941AbgA1Lox (ORCPT ); Tue, 28 Jan 2020 06:44:53 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0283224684; Tue, 28 Jan 2020 11:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580211892; bh=E7sSxi9rEy9lj8TVZnfhNZG9e0AVuStsXP4sldUxT4Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ijsPN1f6iteMPvBro/SwB7dEVl3seXEWeB2zfYTOVkE1nDJtOwJjS23a1CkDbQ3ZO A7wtuCSmPJO2W0fJ08rbudp+K20sw0w0JIFUMtWNGYg+1Xqzk/zZb45aRAwF0GIxgO KHKecvvnQLkBroKWsOysi+JR6xpIBT/6ApGqxrio= Date: Tue, 28 Jan 2020 12:44:50 +0100 From: Greg Kroah-Hartman To: Naresh Kamboju Cc: Sasha Levin , Andy Shevchenko , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Shaohua Li , linux-raid@vger.kernel.org, Dmitry Torokhov , linux-input@vger.kernel.org, Andrew Morton , Yury Norov , open list , mika.westerberg@linux.intel.com, Joe Perches , linux- stable , lkft-triage@lists.linaro.org Subject: Re: [PATCH v4 3/5] bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free() Message-ID: <20200128114450.GA2672297@kroah.com> References: <20180630201750.2588-1-andriy.shevchenko@linux.intel.com> <20180630201750.2588-4-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 28, 2020 at 05:08:27PM +0530, Naresh Kamboju wrote: > On Sun, 1 Jul 2018 at 01:49, Andy Shevchenko > wrote: > > > > A lot of code become ugly because of open coding allocations for bitmaps. > > > > Introduce three helpers to allow users be more clear of intention > > and keep their code neat. > > > > Note, due to multiple circular dependencies we may not provide > > the helpers as inliners. For now we keep them exported and, perhaps, > > at some point in the future we will sort out header inclusion and > > inheritance. > > > > Signed-off-by: Andy Shevchenko > > --- > > include/linux/bitmap.h | 8 ++++++++ > > lib/bitmap.c | 19 +++++++++++++++++++ > > 2 files changed, 27 insertions(+) > > > > diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h > > index 1ee46f492267..acf5e8df3504 100644 > > --- a/include/linux/bitmap.h > > +++ b/include/linux/bitmap.h > > @@ -104,6 +104,14 @@ > > * contain all bit positions from 0 to 'bits' - 1. > > */ > > > > +/* > > + * Allocation and deallocation of bitmap. > > + * Provided in lib/bitmap.c to avoid circular dependency. > > + */ > > +extern unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags); > > +extern unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags); > > +extern void bitmap_free(const unsigned long *bitmap); > > + > > /* > > * lib/bitmap.c provides these functions: > > */ > > diff --git a/lib/bitmap.c b/lib/bitmap.c > > index 33e95cd359a2..09acf2fd6a35 100644 > > --- a/lib/bitmap.c > > +++ b/lib/bitmap.c > > @@ -13,6 +13,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > > > @@ -1125,6 +1126,24 @@ void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int n > > EXPORT_SYMBOL(bitmap_copy_le); > > #endif > > > > +unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags) > > +{ > > + return kmalloc_array(BITS_TO_LONGS(nbits), sizeof(unsigned long), flags); > > +} > > +EXPORT_SYMBOL(bitmap_alloc); > > + > > +unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags) > > +{ > > + return bitmap_alloc(nbits, flags | __GFP_ZERO); > > +} > > +EXPORT_SYMBOL(bitmap_zalloc); > > + > > +void bitmap_free(const unsigned long *bitmap) > > +{ > > + kfree(bitmap); > > +} > > +EXPORT_SYMBOL(bitmap_free); > > + > > #if BITS_PER_LONG == 64 > > /** > > * bitmap_from_arr32 - copy the contents of u32 array of bits to bitmap > > stable-rc 4.14 build failed due to these build error, Yeah, sorry, I noticed this right before I had to leave for a few hours. I'll go fix this up now... greg k-h