Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1608556pxb; Thu, 4 Mar 2021 16:13:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+nec+eZXz9JhT+Rdi9xVBDzPI2161iyj1wONbyOU12MqNxIzIJ3e3cd+iDVDHyL/uohHl X-Received: by 2002:a5d:89d9:: with SMTP id a25mr5854943iot.69.1614903235802; Thu, 04 Mar 2021 16:13:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614903235; cv=none; d=google.com; s=arc-20160816; b=w0yibBv9NYi7jjhGBKoqy6tw81QN9J59EZPdhZZJkR88gDrOGtzEPSe51CgYT5K2gn 8qyOdAi6gBO7lPPGViSelxpn/k0a4WS4+snog0yl44Lb5qiZYYJfp2GcloIG5KYvsjHC 9IAiROI9WUEMJo73v7xFbaZBWfVFv3Oi5hUWyEJCncuR3laPytcN5yYys+uOhnqsSJCk 6YVDJXgm0e4pH6Fz75/NRdpLWKHghrZh/cL6CCRNoP0RgPvLxkGzDKZATwye8zA3lFH8 qDOPUDTo83b6V6ESvPBTIefFNIcClJhcHaO+Sb2fWE0Fx8WBcKxkrAUsaumUrTWkM4Zf 8O5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=Yux2pOxtlN8dl0QqnmWJls2+vowfn1z3UEOvrYHRM9Y=; b=eUwLDLRW1fipJVaZeVz4M2dXiLCmMmjacxBdzIbXSqn0lUsZ8JLvh25SXO7Vhi8whg 0GHJ0bx/1xrXhmIivN4TYyL+n1se9XjBjnJT+VKAojH4LTJi0pfufmg/pP+NDK1t1Zvp kiRUa0lk67W5N2++hEI4x/mrLdwkKK7euAxOXso+yZYiv9f7dXjN3miGV9oDCDZY9ttT CZs3V/oNnkxaWN/ZStciDqrNewljXRyGFNC6HhI5oIs+2V+gY6SlUPYgblvml9Ucv4gH W3oOS8JrH9QUAHF+chePMwqPtw0ANikRx5YTzdjW01fqBaSKtN77Z+JPIfz0sNnHruxK SCng== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f32si882224jav.9.2021.03.04.16.13.41; Thu, 04 Mar 2021 16:13:55 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240318AbhCDNBH (ORCPT + 99 others); Thu, 4 Mar 2021 08:01:07 -0500 Received: from mga04.intel.com ([192.55.52.120]:11881 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239330AbhCDNAp (ORCPT ); Thu, 4 Mar 2021 08:00:45 -0500 IronPort-SDR: aAFXd8LnZIpOYVKetIh9Kr9hjRSGb2S2EgPcpblRRze9kBHaDm5BEl0cY7sE91ZQSOHyuERnvk rmK9NC88KOcQ== X-IronPort-AV: E=McAfee;i="6000,8403,9912"; a="184997457" X-IronPort-AV: E=Sophos;i="5.81,222,1610438400"; d="scan'208";a="184997457" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2021 04:58:59 -0800 IronPort-SDR: ZZZ7kEP9y3axdZgEWfJ6N+AEIkqRNw1rEYbOirvsuFx78i3F73BDRCFNhnjHVuB84ghGHp+vYv Sgpl+OihZBqg== X-IronPort-AV: E=Sophos;i="5.81,222,1610438400"; d="scan'208";a="507370733" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2021 04:58:55 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lHnZ6-009sbW-EF; Thu, 04 Mar 2021 14:58:52 +0200 Date: Thu, 4 Mar 2021 14:58:52 +0200 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Joel Becker , Christoph Hellwig , Shuah Khan , Linus Walleij , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Geert Uytterhoeven , Kent Gibson , Jonathan Corbet , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v2 05/12] lib: bitmap: remove the 'extern' keyword from function declarations Message-ID: References: <20210304102452.21726-1-brgl@bgdev.pl> <20210304102452.21726-6-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210304102452.21726-6-brgl@bgdev.pl> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 04, 2021 at 11:24:45AM +0100, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > The 'extern' keyword doesn't have any benefits in header files. Remove it. Reviewed-by: Andy Shevchenko A few nitpicks below. > Signed-off-by: Bartosz Golaszewski > --- > include/linux/bitmap.h | 115 ++++++++++++++++++++--------------------- > 1 file changed, 57 insertions(+), 58 deletions(-) > > diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h > index 70a932470b2d..6939a8983026 100644 > --- a/include/linux/bitmap.h > +++ b/include/linux/bitmap.h > @@ -118,54 +118,53 @@ > * 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); > +unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags); > +unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags); > +void bitmap_free(const unsigned long *bitmap); > > /* > * lib/bitmap.c provides these functions: > */ > > -extern int __bitmap_equal(const unsigned long *bitmap1, > - const unsigned long *bitmap2, unsigned int nbits); > -extern bool __pure __bitmap_or_equal(const unsigned long *src1, > - const unsigned long *src2, > - const unsigned long *src3, > - unsigned int nbits); > -extern void __bitmap_complement(unsigned long *dst, const unsigned long *src, > - unsigned int nbits); > -extern void __bitmap_shift_right(unsigned long *dst, const unsigned long *src, > - unsigned int shift, unsigned int nbits); > -extern void __bitmap_shift_left(unsigned long *dst, const unsigned long *src, > - unsigned int shift, unsigned int nbits); > -extern void bitmap_cut(unsigned long *dst, const unsigned long *src, > - unsigned int first, unsigned int cut, > - unsigned int nbits); > -extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, > +int __bitmap_equal(const unsigned long *bitmap1, > + const unsigned long *bitmap2, unsigned int nbits); Logically better to have int __bitmap_equal(const unsigned long *bitmap1, const unsigned long *bitmap2, unsigned int nbits); > +bool __pure __bitmap_or_equal(const unsigned long *src1, > + const unsigned long *src2, > + const unsigned long *src3, > + unsigned int nbits); > +void __bitmap_complement(unsigned long *dst, const unsigned long *src, > + unsigned int nbits); > +void __bitmap_shift_right(unsigned long *dst, const unsigned long *src, > + unsigned int shift, unsigned int nbits); > +void __bitmap_shift_left(unsigned long *dst, const unsigned long *src, > + unsigned int shift, unsigned int nbits); > +void bitmap_cut(unsigned long *dst, const unsigned long *src, > + unsigned int first, unsigned int cut, unsigned int nbits); > +int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, > + const unsigned long *bitmap2, unsigned int nbits); > +void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, > + const unsigned long *bitmap2, unsigned int nbits); > +void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, > + const unsigned long *bitmap2, unsigned int nbits); > +int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, > + const unsigned long *bitmap2, unsigned int nbits); > +void __bitmap_replace(unsigned long *dst, > + const unsigned long *old, const unsigned long *new, > + const unsigned long *mask, unsigned int nbits); > +int __bitmap_intersects(const unsigned long *bitmap1, > const unsigned long *bitmap2, unsigned int nbits); > -extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, > - const unsigned long *bitmap2, unsigned int nbits); > -extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, > - const unsigned long *bitmap2, unsigned int nbits); > -extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, > - const unsigned long *bitmap2, unsigned int nbits); > -extern void __bitmap_replace(unsigned long *dst, > - const unsigned long *old, const unsigned long *new, > - const unsigned long *mask, unsigned int nbits); > -extern int __bitmap_intersects(const unsigned long *bitmap1, > - const unsigned long *bitmap2, unsigned int nbits); > -extern int __bitmap_subset(const unsigned long *bitmap1, > - const unsigned long *bitmap2, unsigned int nbits); > -extern int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits); > -extern void __bitmap_set(unsigned long *map, unsigned int start, int len); > -extern void __bitmap_clear(unsigned long *map, unsigned int start, int len); > - > -extern unsigned long bitmap_find_next_zero_area_off(unsigned long *map, > - unsigned long size, > - unsigned long start, > - unsigned int nr, > - unsigned long align_mask, > - unsigned long align_offset); > +int __bitmap_subset(const unsigned long *bitmap1, > + const unsigned long *bitmap2, unsigned int nbits); > +int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits); > +void __bitmap_set(unsigned long *map, unsigned int start, int len); > +void __bitmap_clear(unsigned long *map, unsigned int start, int len); > + > +unsigned long bitmap_find_next_zero_area_off(unsigned long *map, > + unsigned long size, > + unsigned long start, > + unsigned int nr, > + unsigned long align_mask, > + unsigned long align_offset); > > /** > * bitmap_find_next_zero_area - find a contiguous aligned zero area > @@ -190,33 +189,33 @@ bitmap_find_next_zero_area(unsigned long *map, > align_mask, 0); > } > > -extern int bitmap_parse(const char *buf, unsigned int buflen, > +int bitmap_parse(const char *buf, unsigned int buflen, > unsigned long *dst, int nbits); Can be int bitmap_parse(const char *buf, unsigned int buflen, unsigned long *dst, int nbits); And I wonder why nbits here is signed. > -extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, > +int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, > unsigned long *dst, int nbits); Ditto. > -extern int bitmap_parselist(const char *buf, unsigned long *maskp, > +int bitmap_parselist(const char *buf, unsigned long *maskp, > int nmaskbits); Now can be one line. > -extern int bitmap_parselist_user(const char __user *ubuf, unsigned int ulen, > +int bitmap_parselist_user(const char __user *ubuf, unsigned int ulen, > unsigned long *dst, int nbits); > -extern void bitmap_remap(unsigned long *dst, const unsigned long *src, > +void bitmap_remap(unsigned long *dst, const unsigned long *src, > const unsigned long *old, const unsigned long *new, unsigned int nbits); > -extern int bitmap_bitremap(int oldbit, > +int bitmap_bitremap(int oldbit, > const unsigned long *old, const unsigned long *new, int bits); More logical int bitmap_bitremap(int oldbit, const unsigned long *old, const unsigned long *new, int bits); Or even int bitmap_bitremap(int oldbit, const unsigned long *old, const unsigned long *new, int bits); > -extern void bitmap_onto(unsigned long *dst, const unsigned long *orig, > +void bitmap_onto(unsigned long *dst, const unsigned long *orig, > const unsigned long *relmap, unsigned int bits); > -extern void bitmap_fold(unsigned long *dst, const unsigned long *orig, > +void bitmap_fold(unsigned long *dst, const unsigned long *orig, > unsigned int sz, unsigned int nbits); > -extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order); > -extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order); > -extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order); > +int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order); > +void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order); > +int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order); > > #ifdef __BIG_ENDIAN > -extern void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits); > +void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits); > #else > #define bitmap_copy_le bitmap_copy > #endif > -extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int ord, unsigned int nbits); > -extern int bitmap_print_to_pagebuf(bool list, char *buf, > +unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int ord, unsigned int nbits); > +int bitmap_print_to_pagebuf(bool list, char *buf, > const unsigned long *maskp, int nmaskbits); > > #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) > @@ -265,9 +264,9 @@ static inline void bitmap_copy_clear_tail(unsigned long *dst, > * therefore conversion is not needed when copying data from/to arrays of u32. > */ > #if BITS_PER_LONG == 64 > -extern void bitmap_from_arr32(unsigned long *bitmap, const u32 *buf, > +void bitmap_from_arr32(unsigned long *bitmap, const u32 *buf, > unsigned int nbits); One line? > -extern void bitmap_to_arr32(u32 *buf, const unsigned long *bitmap, > +void bitmap_to_arr32(u32 *buf, const unsigned long *bitmap, > unsigned int nbits); Ditto. > #else > #define bitmap_from_arr32(bitmap, buf, nbits) \ > -- > 2.29.1 > -- With Best Regards, Andy Shevchenko