mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/1] bitmap: Remove dead code, i.e. bitmap_copy_le()
@ 2023-08-17 16:20 Andy Shevchenko
  2023-08-29  1:18 ` Yury Norov
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2023-08-17 16:20 UTC (permalink / raw)
  To: Yury Norov, linux-kernel; +Cc: Andy Shevchenko, Rasmus Villemoes

Besides the fact it's not used anywhere it should be implemented
differently, i.e. via helpers from linux/byteorder/generic.h.
Yet the helpers themselves need to be introduced first.

Also note, the function lacks of the test cases, they must be provided.

Hence, drop the current dead code for good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/bitmap.h |  5 -----
 lib/bitmap.c           | 23 -----------------------
 2 files changed, 28 deletions(-)

diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 03644237e1ef..1516ff979315 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -220,11 +220,6 @@ 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
-void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits);
-#else
-#define bitmap_copy_le bitmap_copy
-#endif
 int bitmap_print_to_pagebuf(bool list, char *buf,
 				   const unsigned long *maskp, int nmaskbits);
 
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 24284caadbcc..935e0f96e785 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -1360,29 +1360,6 @@ int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order)
 }
 EXPORT_SYMBOL(bitmap_allocate_region);
 
-/**
- * bitmap_copy_le - copy a bitmap, putting the bits into little-endian order.
- * @dst:   destination buffer
- * @src:   bitmap to copy
- * @nbits: number of bits in the bitmap
- *
- * Require nbits % BITS_PER_LONG == 0.
- */
-#ifdef __BIG_ENDIAN
-void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits)
-{
-	unsigned int i;
-
-	for (i = 0; i < nbits/BITS_PER_LONG; i++) {
-		if (BITS_PER_LONG == 64)
-			dst[i] = cpu_to_le64(src[i]);
-		else
-			dst[i] = cpu_to_le32(src[i]);
-	}
-}
-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),
-- 
2.40.0.1.gaa8946217a0b


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] bitmap: Remove dead code, i.e. bitmap_copy_le()
  2023-08-17 16:20 [PATCH v1 1/1] bitmap: Remove dead code, i.e. bitmap_copy_le() Andy Shevchenko
@ 2023-08-29  1:18 ` Yury Norov
  0 siblings, 0 replies; 2+ messages in thread
From: Yury Norov @ 2023-08-29  1:18 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Rasmus Villemoes

On Thu, Aug 17, 2023 at 07:20:54PM +0300, Andy Shevchenko wrote:
> Besides the fact it's not used anywhere it should be implemented
> differently, i.e. via helpers from linux/byteorder/generic.h.
> Yet the helpers themselves need to be introduced first.
> 
> Also note, the function lacks of the test cases, they must be provided.
> 
> Hence, drop the current dead code for good.
 
It was added in 2008 for UWB subsystem, removed in 2019 by Greg with a note
that UWB an obsolete; and bitmap_copy_le() looks like a leftover. So I think
you're right, it's worth to drop it.

I'll add the patch in the next pull request.

Thanks,
Yury

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  include/linux/bitmap.h |  5 -----
>  lib/bitmap.c           | 23 -----------------------
>  2 files changed, 28 deletions(-)
> 
> diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
> index 03644237e1ef..1516ff979315 100644
> --- a/include/linux/bitmap.h
> +++ b/include/linux/bitmap.h
> @@ -220,11 +220,6 @@ 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
> -void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits);
> -#else
> -#define bitmap_copy_le bitmap_copy
> -#endif
>  int bitmap_print_to_pagebuf(bool list, char *buf,
>  				   const unsigned long *maskp, int nmaskbits);
>  
> diff --git a/lib/bitmap.c b/lib/bitmap.c
> index 24284caadbcc..935e0f96e785 100644
> --- a/lib/bitmap.c
> +++ b/lib/bitmap.c
> @@ -1360,29 +1360,6 @@ int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order)
>  }
>  EXPORT_SYMBOL(bitmap_allocate_region);
>  
> -/**
> - * bitmap_copy_le - copy a bitmap, putting the bits into little-endian order.
> - * @dst:   destination buffer
> - * @src:   bitmap to copy
> - * @nbits: number of bits in the bitmap
> - *
> - * Require nbits % BITS_PER_LONG == 0.
> - */
> -#ifdef __BIG_ENDIAN
> -void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits)
> -{
> -	unsigned int i;
> -
> -	for (i = 0; i < nbits/BITS_PER_LONG; i++) {
> -		if (BITS_PER_LONG == 64)
> -			dst[i] = cpu_to_le64(src[i]);
> -		else
> -			dst[i] = cpu_to_le32(src[i]);
> -	}
> -}
> -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),
> -- 
> 2.40.0.1.gaa8946217a0b

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-29  1:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-17 16:20 [PATCH v1 1/1] bitmap: Remove dead code, i.e. bitmap_copy_le() Andy Shevchenko
2023-08-29  1:18 ` Yury Norov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®