Hi,
This patch series fixes checkpatch warnings in xarray.h:
* Add identifier names for function definition arguments;
* Add missing blank line after declaration;
Vitor Massaru Iha (2):
xarray: Add identifier names for function definition arguments
xarray: Add missing blank line after declaration
include/linux/xarray.h | 88 +++++++++++++++++++++---------------------
1 file changed, 45 insertions(+), 43 deletions(-)
--
2.21.1
Fix several checkpatch warnings such as:
WARNING: function definition argument 'struct xarray *' should also have an identifier name
+void *xa_load(struct xarray *, unsigned long index);
Signed-off-by: Vitor Massaru Iha <[email protected]>
---
include/linux/xarray.h | 87 +++++++++++++++++++++---------------------
1 file changed, 44 insertions(+), 43 deletions(-)
diff --git a/include/linux/xarray.h b/include/linux/xarray.h
index f73e1775ded0..a7dec1ec0967 100644
--- a/include/linux/xarray.h
+++ b/include/linux/xarray.h
@@ -344,21 +344,21 @@ struct xarray {
*/
#define DEFINE_XARRAY_ALLOC1(name) DEFINE_XARRAY_FLAGS(name, XA_FLAGS_ALLOC1)
-void *xa_load(struct xarray *, unsigned long index);
-void *xa_store(struct xarray *, unsigned long index, void *entry, gfp_t);
-void *xa_erase(struct xarray *, unsigned long index);
-void *xa_store_range(struct xarray *, unsigned long first, unsigned long last,
- void *entry, gfp_t);
-bool xa_get_mark(struct xarray *, unsigned long index, xa_mark_t);
-void xa_set_mark(struct xarray *, unsigned long index, xa_mark_t);
-void xa_clear_mark(struct xarray *, unsigned long index, xa_mark_t);
-void *xa_find(struct xarray *xa, unsigned long *index,
- unsigned long max, xa_mark_t) __attribute__((nonnull(2)));
-void *xa_find_after(struct xarray *xa, unsigned long *index,
- unsigned long max, xa_mark_t) __attribute__((nonnull(2)));
-unsigned int xa_extract(struct xarray *, void **dst, unsigned long start,
- unsigned long max, unsigned int n, xa_mark_t);
-void xa_destroy(struct xarray *);
+void *xa_load(struct xarray *xa, unsigned long index);
+void *xa_store(struct xarray *xa, unsigned long index, void *entry, gfp_t gfp);
+void *xa_erase(struct xarray *xa, unsigned long index);
+void *xa_store_range(struct xarray *xa, unsigned long first, unsigned long last,
+ void *entry, gfp_t gfp);
+bool xa_get_mark(struct xarray *xa, unsigned long index, xa_mark_t mark);
+void xa_set_mark(struct xarray *xa, unsigned long index, xa_mark_t mark);
+void xa_clear_mark(struct xarray *xa, unsigned long index, xa_mark_t mark);
+void *xa_find(struct xarray *xa, unsigned long *index, unsigned long max,
+ xa_mark_t filter) __attribute__((nonnull(2)));
+void *xa_find_after(struct xarray *xa, unsigned long *index, unsigned long max,
+ xa_mark_t filter) __attribute__((nonnull(2)));
+unsigned int xa_extract(struct xarray *xa, void **dst, unsigned long start,
+ unsigned long max, unsigned int n, xa_mark_t filter);
+void xa_destroy(struct xarray *xa);
/**
* xa_init_flags() - Initialise an empty XArray with flags.
@@ -551,18 +551,19 @@ static inline bool xa_marked(const struct xarray *xa, xa_mark_t mark)
* may also re-enable interrupts if the XArray flags indicate the
* locking should be interrupt safe.
*/
-void *__xa_erase(struct xarray *, unsigned long index);
-void *__xa_store(struct xarray *, unsigned long index, void *entry, gfp_t);
-void *__xa_cmpxchg(struct xarray *, unsigned long index, void *old,
- void *entry, gfp_t);
-int __must_check __xa_insert(struct xarray *, unsigned long index,
- void *entry, gfp_t);
-int __must_check __xa_alloc(struct xarray *, u32 *id, void *entry,
- struct xa_limit, gfp_t);
-int __must_check __xa_alloc_cyclic(struct xarray *, u32 *id, void *entry,
- struct xa_limit, u32 *next, gfp_t);
-void __xa_set_mark(struct xarray *, unsigned long index, xa_mark_t);
-void __xa_clear_mark(struct xarray *, unsigned long index, xa_mark_t);
+void *__xa_erase(struct xarray *xa, unsigned long index);
+void *__xa_store(struct xarray *xa, unsigned long index,
+ void *entry, gfp_t gfp);
+void *__xa_cmpxchg(struct xarray *xa, unsigned long index, void *old,
+ void *entry, gfp_t gfp);
+int __must_check __xa_insert(struct xarray *xa, unsigned long index,
+ void *entry, gfp_t gfp);
+int __must_check __xa_alloc(struct xarray *xa, u32 *id, void *entry,
+ struct xa_limit limit, gfp_t gfp);
+int __must_check __xa_alloc_cyclic(struct xarray *xa, u32 *id, void *entry,
+ struct xa_limit limit, u32 *next, gfp_t gfp);
+void __xa_set_mark(struct xarray *xa, unsigned long index, xa_mark_t mark);
+void __xa_clear_mark(struct xarray *xa, unsigned long index, xa_mark_t mark);
/**
* xa_store_bh() - Store this entry in the XArray.
@@ -1137,8 +1138,8 @@ struct xa_node {
};
};
-void xa_dump(const struct xarray *);
-void xa_dump_node(const struct xa_node *);
+void xa_dump(const struct xarray *xa);
+void xa_dump_node(const struct xa_node *node);
#ifdef XA_DEBUG
#define XA_BUG_ON(xa, x) do { \
@@ -1489,21 +1490,21 @@ static inline bool xas_retry(struct xa_state *xas, const void *entry)
return true;
}
-void *xas_load(struct xa_state *);
-void *xas_store(struct xa_state *, void *entry);
-void *xas_find(struct xa_state *, unsigned long max);
-void *xas_find_conflict(struct xa_state *);
+void *xas_load(struct xa_state *xas);
+void *xas_store(struct xa_state *xas, void *entry);
+void *xas_find(struct xa_state *xas, unsigned long max);
+void *xas_find_conflict(struct xa_state *xas);
-bool xas_get_mark(const struct xa_state *, xa_mark_t);
-void xas_set_mark(const struct xa_state *, xa_mark_t);
-void xas_clear_mark(const struct xa_state *, xa_mark_t);
-void *xas_find_marked(struct xa_state *, unsigned long max, xa_mark_t);
-void xas_init_marks(const struct xa_state *);
+bool xas_get_mark(const struct xa_state *xas, xa_mark_t mark);
+void xas_set_mark(const struct xa_state *xas, xa_mark_t mark);
+void xas_clear_mark(const struct xa_state *xas, xa_mark_t mark);
+void *xas_find_marked(struct xa_state *xas, unsigned long max, xa_mark_t mark);
+void xas_init_marks(const struct xa_state *xas);
-bool xas_nomem(struct xa_state *, gfp_t);
-void xas_pause(struct xa_state *);
+bool xas_nomem(struct xa_state *xas, gfp_t gfp);
+void xas_pause(struct xa_state *xas);
-void xas_create_range(struct xa_state *);
+void xas_create_range(struct xa_state *xas);
/**
* xas_reload() - Refetch an entry from the xarray.
@@ -1721,8 +1722,8 @@ enum {
#define xas_for_each_conflict(xas, entry) \
while ((entry = xas_find_conflict(xas)))
-void *__xas_next(struct xa_state *);
-void *__xas_prev(struct xa_state *);
+void *__xas_next(struct xa_state *xas);
+void *__xas_prev(struct xa_state *xas);
/**
* xas_prev() - Move iterator to previous index.
--
2.21.1
Fix checkpatch warning: "WARNING: Missing a blank line after declarations"
in include/linux/xarray.h:1504
Signed-off-by: Vitor Massaru Iha <[email protected]>
---
include/linux/xarray.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/xarray.h b/include/linux/xarray.h
index a7dec1ec0967..61f83aca2326 100644
--- a/include/linux/xarray.h
+++ b/include/linux/xarray.h
@@ -1624,6 +1624,7 @@ static inline unsigned int xas_find_chunk(struct xa_state *xas, bool advance,
if (XA_CHUNK_SIZE == BITS_PER_LONG) {
if (offset < XA_CHUNK_SIZE) {
unsigned long data = *addr & (~0UL << offset);
+
if (data)
return __ffs(data);
}
--
2.21.1
On Tue, Mar 17, 2020 at 10:43:03PM -0300, Vitor Massaru Iha wrote:
> @@ -1624,6 +1624,7 @@ static inline unsigned int xas_find_chunk(struct xa_state *xas, bool advance,
> if (XA_CHUNK_SIZE == BITS_PER_LONG) {
> if (offset < XA_CHUNK_SIZE) {
> unsigned long data = *addr & (~0UL << offset);
> +
> if (data)
> return __ffs(data);
> }
Do you seriously think this makes the function in any way more legible?
Hi Matthew,
On Tue, 2020-03-17 at 18:55 -0700, Matthew Wilcox wrote:
> On Tue, Mar 17, 2020 at 10:43:03PM -0300, Vitor Massaru Iha wrote:
> > @@ -1624,6 +1624,7 @@ static inline unsigned int
> > xas_find_chunk(struct xa_state *xas, bool advance,
> > if (XA_CHUNK_SIZE == BITS_PER_LONG) {
> > if (offset < XA_CHUNK_SIZE) {
> > unsigned long data = *addr & (~0UL << offset);
> > +
> > if (data)
> > return __ffs(data);
> > }
>
> Do you seriously think this makes the function in any way more
> legible?
Sorry. I was in doubt whether it would actually improve. I did some
research in older patches and I found something like this.