2014-02-25 07:40:45

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 1/8] lib: Include appropriate header file in lib/iommu-helper.c

Include appropriate header file include/linux/iommu-helper.h in
lib/iommu-helper.c because it has prototype declaration of function
defined in lib/iommu-helper.c.

This eliminates the following warning in lib/iommu-helper.c:
lib/iommu-helper.c:9:5: warning: no previous prototype for ‘iommu_is_span_boundary’ [-Wmissing-prototypes]
lib/iommu-helper.c:19:15: warning: no previous prototype for ‘iommu_area_alloc’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
lib/iommu-helper.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c
index c27e269..41d35fb 100644
--- a/lib/iommu-helper.c
+++ b/lib/iommu-helper.c
@@ -5,6 +5,7 @@
#include <linux/export.h>
#include <linux/bitmap.h>
#include <linux/bug.h>
+#include <linux/iommu-helper.h>

int iommu_is_span_boundary(unsigned int index, unsigned int nr,
unsigned long shift,
--
1.7.9.5


2014-02-25 07:41:47

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 2/8] lib: Mark function as static in lib/lru_cache.c

Mark function as static in lib/lru_cache.c because it is not used
outside this file.

This eliminates the following warning in lib/lru_cache.c:
lib/lru_cache.c:172:6: warning: no previous prototype for ‘lc_free_by_index’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
lib/lru_cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/lru_cache.c b/lib/lru_cache.c
index 4a83ecd..6111cd1 100644
--- a/lib/lru_cache.c
+++ b/lib/lru_cache.c
@@ -169,7 +169,7 @@ out_fail:
return NULL;
}

-void lc_free_by_index(struct lru_cache *lc, unsigned i)
+static void lc_free_by_index(struct lru_cache *lc, unsigned i)
{
void *p = lc->lc_element[i];
WARN_ON(!p);
--
1.7.9.5

2014-02-25 07:44:44

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 3/8] lib: Move prototype declaration to header file include/linux/swiotlb.h

Move prototype declaration of function to header file
include/linux/swiotlb.h from arch/ia64/hp/common/hwsw_iommu.c,
arch/ia64/hp/common/sba_iommu.c and arch/x86/pci/sta2x11-fixup.c because
it is used by more than one file.

This eliminates the following warning in lib/swiotlb.c:
lib/swiotlb.c:240:1: warning: no previous prototype for ‘swiotlb_late_init_with_default_size’ [-Wmissing-prototypes]
lib/swiotlb.c:537:13: warning: no previous prototype for ‘map_single’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
arch/ia64/hp/common/hwsw_iommu.c | 3 ---
arch/ia64/hp/common/sba_iommu.c | 2 --
arch/x86/pci/sta2x11-fixup.c | 1 -
include/linux/swiotlb.h | 4 +++-
4 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/ia64/hp/common/hwsw_iommu.c b/arch/ia64/hp/common/hwsw_iommu.c
index 1e4cae5..b14cab1 100644
--- a/arch/ia64/hp/common/hwsw_iommu.c
+++ b/arch/ia64/hp/common/hwsw_iommu.c
@@ -20,9 +20,6 @@

extern struct dma_map_ops sba_dma_ops, swiotlb_dma_ops;

-/* swiotlb declarations & definitions: */
-extern int swiotlb_late_init_with_default_size (size_t size);
-
/*
* Note: we need to make the determination of whether or not to use
* the sw I/O TLB based purely on the device structure. Anything else
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 8e858b5..b341994 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -46,8 +46,6 @@

#include <asm/acpi-ext.h>

-extern int swiotlb_late_init_with_default_size (size_t size);
-
#define PFX "IOC: "

/*
diff --git a/arch/x86/pci/sta2x11-fixup.c b/arch/x86/pci/sta2x11-fixup.c
index 9d8a509..a39000b 100644
--- a/arch/x86/pci/sta2x11-fixup.c
+++ b/arch/x86/pci/sta2x11-fixup.c
@@ -28,7 +28,6 @@
#include <linux/list.h>

#define STA2X11_SWIOTLB_SIZE (4*1024*1024)
-extern int swiotlb_late_init_with_default_size(size_t default_size);

/*
* We build a list of bus numbers that are under the ConneXt. The
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index a5ffd32..7f419b6 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -27,7 +27,9 @@ int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
extern unsigned long swiotlb_nr_tbl(void);
unsigned long swiotlb_size_or_default(void);
extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);
-
+int swiotlb_late_init_with_default_size (size_t );
+phys_addr_t map_single(struct device *hwdev, phys_addr_t phys, size_t size,
+ enum dma_data_direction dir);
/*
* Enumeration for sync targets
*/
--
1.7.9.5

2014-02-25 07:46:25

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 4/8] lib: Add prototype declarations in lib/clz_ctz.c

Add prototype declarations of functions in lib/clz_ctz.c. These
functions are required by GCC builtins and hence can not be removed
despite of their unreferenced appearance in kernel source.

This eliminates the following warning in lib/clz_ctz.c:
lib/clz_ctz.c:16:12: warning: no previous prototype for ‘__ctzsi2’ [-Wmissing-prototypes]
lib/clz_ctz.c:22:12: warning: no previous prototype for ‘__clzsi2’ [-Wmissing-prototypes]
lib/clz_ctz.c:44:12: warning: no previous prototype for ‘__clzdi2’ [-Wmissing-prototypes]
lib/clz_ctz.c:50:12: warning: no previous prototype for ‘__ctzdi2’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
lib/clz_ctz.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/lib/clz_ctz.c b/lib/clz_ctz.c
index a8f8379..2e11e48 100644
--- a/lib/clz_ctz.c
+++ b/lib/clz_ctz.c
@@ -6,6 +6,9 @@
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
+ * The functions in this file aren't called directly, but are required by
+ * GCC builtins such as __builtin_ctz, and therefore they can't be removed
+ * despite appearing unreferenced in kernel source.
*
* __c[lt]z[sd]i2 can be overridden by linking arch-specific versions.
*/
@@ -13,18 +16,22 @@
#include <linux/export.h>
#include <linux/kernel.h>

+int __weak __ctzsi2(int val);
int __weak __ctzsi2(int val)
{
return __ffs(val);
}
EXPORT_SYMBOL(__ctzsi2);

+int __weak __clzsi2(int val);
int __weak __clzsi2(int val)
{
return 32 - fls(val);
}
EXPORT_SYMBOL(__clzsi2);

+int __weak __clzdi2(long val);
+int __weak __ctzdi2(long val);
#if BITS_PER_LONG == 32

int __weak __clzdi2(long val)
--
1.7.9.5

2014-02-25 07:50:08

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 5/8] lib: Include appropriate header file in lib/decompress_inflate.c

Include appropriate header file include/linux/decompress/inflate.h in
lib/decompress_inflate.c because it has prototype declaration of
function defined in lib/decompress_inflate.c.

Also, fix the guard around the header file
include/linux/decompress/inflate.h to use a more unique guard symbol.
This avoids conflict with the INFLATE_H defined by
zlib_inflate/inflate.h.

This eliminates the following warning in lib/decompress_inflate.c:
lib/decompress_inflate.c:35:17: warning: no previous prototype for ‘gunzip’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
include/linux/decompress/inflate.h | 4 ++--
lib/decompress_inflate.c | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h
index 8c0aef1..1d0aede 100644
--- a/include/linux/decompress/inflate.h
+++ b/include/linux/decompress/inflate.h
@@ -1,5 +1,5 @@
-#ifndef INFLATE_H
-#define INFLATE_H
+#ifndef LINUX_DECOMPRESS_INFLATE_H
+#define LINUX_DECOMPRESS_INFLATE_H

int gunzip(unsigned char *inbuf, int len,
int(*fill)(void*, unsigned int),
diff --git a/lib/decompress_inflate.c b/lib/decompress_inflate.c
index d619b28..0edfd74 100644
--- a/lib/decompress_inflate.c
+++ b/lib/decompress_inflate.c
@@ -19,6 +19,7 @@
#include "zlib_inflate/inflate.h"

#include "zlib_inflate/infutil.h"
+#include <linux/decompress/inflate.h>

#endif /* STATIC */

--
1.7.9.5

2014-02-25 07:51:27

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 6/8] lib: Include appropriate header file in lib/libcrc32c.c

Include appropriate header file include/linux/crc32c.h in
lib/libcrc32c.c because it has prototype declaration of function defined
in lib/libcrc32c.c.

This eliminates the following warning in lib/libcrc32c.c:
lib/libcrc32c.c:42:5: warning: no previous prototype for ‘crc32c’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
lib/libcrc32c.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/lib/libcrc32c.c b/lib/libcrc32c.c
index 244f548..793a6a3 100644
--- a/lib/libcrc32c.c
+++ b/lib/libcrc32c.c
@@ -36,6 +36,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/crc32c.h>

static struct crypto_shash *tfm;

--
1.7.9.5

2014-02-25 07:52:08

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 7/8] lib: Include appropriate header file in lib/decompress_unxz.c

Include appropriate header file include/linux/decompress/unxz.h in
lib/decompress_unxz.c because it has prototype declaration of function
defined in lib/decompress_unxz.c.

This eliminates the following warning in lib/decompress_unxz.c:
lib/decompress_unxz.c:251:17: warning: no previous prototype for ‘unxz’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
lib/decompress_unxz.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/lib/decompress_unxz.c b/lib/decompress_unxz.c
index 9f34eb5..db22fcc 100644
--- a/lib/decompress_unxz.c
+++ b/lib/decompress_unxz.c
@@ -237,6 +237,8 @@ void *memmove(void *dest, const void *src, size_t size)

#endif /* XZ_PREBOOT */

+#include <linux/decompress/unxz.h>
+
/* Size of the input and output buffers in multi-call mode */
#define XZ_IOBUF_SIZE 4096

--
1.7.9.5

2014-02-25 07:53:30

by Rashika Kheria

[permalink] [raw]
Subject: [PATCH 8/8] lib: Mark function as static in lib/decompress_unlzo.c

Mark function as static in lib/decompress_unlzo.c because it is not used
outside this file.

This eliminates the following warning in lib/decompress_unlzo.c:
lib/decompress_unlzo.c:54:24: warning: no previous prototype for ‘parse_header’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
---
lib/decompress_unlzo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c
index 960183d..7ae2c04 100644
--- a/lib/decompress_unlzo.c
+++ b/lib/decompress_unlzo.c
@@ -51,7 +51,7 @@ static const unsigned char lzop_magic[] = {
#define HEADER_SIZE_MIN (9 + 7 + 4 + 8 + 1 + 4)
#define HEADER_SIZE_MAX (9 + 7 + 1 + 8 + 8 + 4 + 1 + 255 + 4)

-STATIC inline int INIT parse_header(u8 *input, int *skip, int in_len)
+static inline int INIT parse_header(u8 *input, int *skip, int in_len)
{
int l;
u8 *parse = input;
--
1.7.9.5

2014-02-27 01:59:45

by Chanho Min

[permalink] [raw]
Subject: Re : [PATCH 4/8] lib: Add prototype declarations in lib/clz_ctz.c


> -----Original Message-----
> From: Rashika Kheria [mailto:[email protected]]
> Sent: Tuesday, February 25, 2014 4:46 PM
> To: [email protected]
> Cc: Andrew Morton; Rashika Kheria; Chanho Min; [email protected]
> Subject: [PATCH 4/8] lib: Add prototype declarations in lib/clz_ctz.c
>
> Add prototype declarations of functions in lib/clz_ctz.c. These
> functions are required by GCC builtins and hence can not be removed
> despite of their unreferenced appearance in kernel source.
>
> This eliminates the following warning in lib/clz_ctz.c:
> lib/clz_ctz.c:16:12: warning: no previous prototype for ??__ctzsi2?? [-Wmissing-prototypes]
> lib/clz_ctz.c:22:12: warning: no previous prototype for ??__clzsi2?? [-Wmissing-prototypes]
> lib/clz_ctz.c:44:12: warning: no previous prototype for ??__clzdi2?? [-Wmissing-prototypes]
> lib/clz_ctz.c:50:12: warning: no previous prototype for ??__ctzdi2?? [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>
Acked-by: Chanho Min <[email protected]>????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2014-02-28 13:04:33

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: Re: [PATCH 3/8] lib: Move prototype declaration to header file include/linux/swiotlb.h

On Tue, Feb 25, 2014 at 01:14:17PM +0530, Rashika Kheria wrote:
> Move prototype declaration of function to header file
> include/linux/swiotlb.h from arch/ia64/hp/common/hwsw_iommu.c,
> arch/ia64/hp/common/sba_iommu.c and arch/x86/pci/sta2x11-fixup.c because
> it is used by more than one file.
>
> This eliminates the following warning in lib/swiotlb.c:
> lib/swiotlb.c:240:1: warning: no previous prototype for ‘swiotlb_late_init_with_default_size’ [-Wmissing-prototypes]
> lib/swiotlb.c:537:13: warning: no previous prototype for ‘map_single’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <[email protected]>
> Reviewed-by: Josh Triplett <[email protected]>

One issue below. Did you compile check it on ia64 and arm?
I presume you did it on x86 right?


> ---
> arch/ia64/hp/common/hwsw_iommu.c | 3 ---
> arch/ia64/hp/common/sba_iommu.c | 2 --
> arch/x86/pci/sta2x11-fixup.c | 1 -
> include/linux/swiotlb.h | 4 +++-
> 4 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/arch/ia64/hp/common/hwsw_iommu.c b/arch/ia64/hp/common/hwsw_iommu.c
> index 1e4cae5..b14cab1 100644
> --- a/arch/ia64/hp/common/hwsw_iommu.c
> +++ b/arch/ia64/hp/common/hwsw_iommu.c
> @@ -20,9 +20,6 @@
>
> extern struct dma_map_ops sba_dma_ops, swiotlb_dma_ops;
>
> -/* swiotlb declarations & definitions: */
> -extern int swiotlb_late_init_with_default_size (size_t size);
> -
> /*
> * Note: we need to make the determination of whether or not to use
> * the sw I/O TLB based purely on the device structure. Anything else
> diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
> index 8e858b5..b341994 100644
> --- a/arch/ia64/hp/common/sba_iommu.c
> +++ b/arch/ia64/hp/common/sba_iommu.c
> @@ -46,8 +46,6 @@
>
> #include <asm/acpi-ext.h>
>
> -extern int swiotlb_late_init_with_default_size (size_t size);
> -
> #define PFX "IOC: "
>
> /*
> diff --git a/arch/x86/pci/sta2x11-fixup.c b/arch/x86/pci/sta2x11-fixup.c
> index 9d8a509..a39000b 100644
> --- a/arch/x86/pci/sta2x11-fixup.c
> +++ b/arch/x86/pci/sta2x11-fixup.c
> @@ -28,7 +28,6 @@
> #include <linux/list.h>
>
> #define STA2X11_SWIOTLB_SIZE (4*1024*1024)
> -extern int swiotlb_late_init_with_default_size(size_t default_size);
>
> /*
> * We build a list of bus numbers that are under the ConneXt. The
> diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
> index a5ffd32..7f419b6 100644
> --- a/include/linux/swiotlb.h
> +++ b/include/linux/swiotlb.h
> @@ -27,7 +27,9 @@ int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
> extern unsigned long swiotlb_nr_tbl(void);
> unsigned long swiotlb_size_or_default(void);
> extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);
> -
> +int swiotlb_late_init_with_default_size (size_t );

Your editor seems to have added an extra space!

> +phys_addr_t map_single(struct device *hwdev, phys_addr_t phys, size_t size,
> + enum dma_data_direction dir);
> /*
> * Enumeration for sync targets
> */
> --
> 1.7.9.5
>