* [PATCH] drivers: staging: erofs: Fix styling issues
@ 2018-12-11 9:06 Aaron Strahlberger
2018-12-11 9:18 ` Gao Xiang
2018-12-11 12:51 ` [PATCH] drivers: staging: erofs: Fix styling issues Dan Carpenter
0 siblings, 2 replies; 21+ messages in thread
From: Aaron Strahlberger @ 2018-12-11 9:06 UTC (permalink / raw)
To: Gao Xiang
Cc: Chao Yu, linux-erofs, devel, linux-kernel, linux-kernel,
Aaron Strahlberger, Julius Wiedmann, Dominik Huber
Fixed following checkpatch.pl styling issues:
- 17x CHECK: Alignment should match open parenthesis
- 7x CHECK: Comparison to NULL could be written ...
- 1x CHECK: Lines should not end with a '('
- 1x CHECK: Please use a blank line after ...
Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
Signed-off-by: Dominik Huber <domi250@gmx.de>
---
drivers/staging/erofs/data.c | 65 ++++++++++++++++----------------
drivers/staging/erofs/dir.c | 12 +++---
drivers/staging/erofs/erofs_fs.h | 5 ++-
3 files changed, 42 insertions(+), 40 deletions(-)
diff --git a/drivers/staging/erofs/data.c b/drivers/staging/erofs/data.c
index 6384f73e5418..5a55f0bfdfbb 100644
--- a/drivers/staging/erofs/data.c
+++ b/drivers/staging/erofs/data.c
@@ -40,7 +40,7 @@ static inline void read_endio(struct bio *bio)
/* prio -- true is used for dir */
struct page *__erofs_get_meta_page(struct super_block *sb,
- erofs_blk_t blkaddr, bool prio, bool nofail)
+ erofs_blk_t blkaddr, bool prio, bool nofail)
{
struct inode *const bd_inode = sb->s_bdev->bd_inode;
struct address_space *const mapping = bd_inode->i_mapping;
@@ -53,7 +53,7 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
repeat:
page = find_or_create_page(mapping, blkaddr, gfp);
- if (unlikely(page == NULL)) {
+ if (unlikely(!page)) {
DBG_BUGON(nofail);
return ERR_PTR(-ENOMEM);
}
@@ -76,7 +76,7 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
}
__submit_bio(bio, REQ_OP_READ,
- REQ_META | (prio ? REQ_PRIO : 0));
+ REQ_META | (prio ? REQ_PRIO : 0));
lock_page(page);
@@ -107,8 +107,8 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
}
static int erofs_map_blocks_flatmode(struct inode *inode,
- struct erofs_map_blocks *map,
- int flags)
+ struct erofs_map_blocks *map,
+ int flags)
{
int err = 0;
erofs_blk_t nblocks, lastblk;
@@ -151,7 +151,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
map->m_flags |= EROFS_MAP_META;
} else {
errln("internal error @ nid: %llu (size %llu), m_la 0x%llx",
- vi->nid, inode->i_size, map->m_la);
+ vi->nid, inode->i_size, map->m_la);
DBG_BUGON(1);
err = -EIO;
goto err_out;
@@ -167,16 +167,17 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
#ifdef CONFIG_EROFS_FS_ZIP
extern int z_erofs_map_blocks_iter(struct inode *,
- struct erofs_map_blocks *, struct page **, int);
+ struct erofs_map_blocks *,
+ struct page **, int);
#endif
int erofs_map_blocks_iter(struct inode *inode,
- struct erofs_map_blocks *map,
- struct page **mpage_ret, int flags)
+ struct erofs_map_blocks *map,
+ struct page **mpage_ret, int flags)
{
/* by default, reading raw data never use erofs_map_blocks_iter */
if (unlikely(!is_inode_layout_compression(inode))) {
- if (*mpage_ret != NULL)
+ if (*mpage_ret)
put_page(*mpage_ret);
*mpage_ret = NULL;
@@ -192,27 +193,26 @@ int erofs_map_blocks_iter(struct inode *inode,
}
int erofs_map_blocks(struct inode *inode,
- struct erofs_map_blocks *map, int flags)
+ struct erofs_map_blocks *map, int flags)
{
if (unlikely(is_inode_layout_compression(inode))) {
struct page *mpage = NULL;
int err;
err = erofs_map_blocks_iter(inode, map, &mpage, flags);
- if (mpage != NULL)
+ if (mpage)
put_page(mpage);
return err;
}
return erofs_map_blocks_flatmode(inode, map, flags);
}
-static inline struct bio *erofs_read_raw_page(
- struct bio *bio,
- struct address_space *mapping,
- struct page *page,
- erofs_off_t *last_block,
- unsigned int nblocks,
- bool ra)
+static inline struct bio *erofs_read_raw_page(struct bio *bio,
+ struct address_space *mapping,
+ struct page *page,
+ erofs_off_t *last_block,
+ unsigned int nblocks,
+ bool ra)
{
struct inode *inode = mapping->host;
erofs_off_t current_block = (erofs_off_t)page->index;
@@ -232,15 +232,15 @@ static inline struct bio *erofs_read_raw_page(
}
/* note that for readpage case, bio also equals to NULL */
- if (bio != NULL &&
- /* not continuous */
- *last_block + 1 != current_block) {
+ if (bio &&
+ /* not continuous */
+ *last_block + 1 != current_block) {
submit_bio_retry:
__submit_bio(bio, REQ_OP_READ, 0);
bio = NULL;
}
- if (bio == NULL) {
+ if (!bio) {
struct erofs_map_blocks map = {
.m_la = blknr_to_addr(current_block),
};
@@ -307,7 +307,7 @@ static inline struct bio *erofs_read_raw_page(
nblocks = BIO_MAX_PAGES;
bio = erofs_grab_bio(inode->i_sb,
- blknr, nblocks, read_endio, false);
+ blknr, nblocks, read_endio, false);
if (IS_ERR(bio)) {
err = PTR_ERR(bio);
@@ -342,7 +342,7 @@ static inline struct bio *erofs_read_raw_page(
unlock_page(page);
/* if updated manually, continuous pages has a gap */
- if (bio != NULL)
+ if (bio)
submit_bio_out:
__submit_bio(bio, REQ_OP_READ, 0);
@@ -361,7 +361,7 @@ static int erofs_raw_access_readpage(struct file *file, struct page *page)
trace_erofs_readpage(page, true);
bio = erofs_read_raw_page(NULL, page->mapping,
- page, &last_block, 1, false);
+ page, &last_block, 1, false);
if (IS_ERR(bio))
return PTR_ERR(bio);
@@ -371,8 +371,9 @@ static int erofs_raw_access_readpage(struct file *file, struct page *page)
}
static int erofs_raw_access_readpages(struct file *filp,
- struct address_space *mapping,
- struct list_head *pages, unsigned int nr_pages)
+ struct address_space *mapping,
+ struct list_head *pages,
+ unsigned int nr_pages)
{
erofs_off_t last_block;
struct bio *bio = NULL;
@@ -389,13 +390,13 @@ static int erofs_raw_access_readpages(struct file *filp,
if (!add_to_page_cache_lru(page, mapping, page->index, gfp)) {
bio = erofs_read_raw_page(bio, mapping, page,
- &last_block, nr_pages, true);
+ &last_block, nr_pages, true);
/* all the page errors are ignored when readahead */
if (IS_ERR(bio)) {
pr_err("%s, readahead error at page %lu of nid %llu\n",
- __func__, page->index,
- EROFS_V(mapping->host)->nid);
+ __func__, page->index,
+ EROFS_V(mapping->host)->nid);
bio = NULL;
}
@@ -407,7 +408,7 @@ static int erofs_raw_access_readpages(struct file *filp,
DBG_BUGON(!list_empty(pages));
/* the rare case (end in gaps) */
- if (unlikely(bio != NULL))
+ if (unlikely(bio))
__submit_bio(bio, REQ_OP_READ, 0);
return 0;
}
diff --git a/drivers/staging/erofs/dir.c b/drivers/staging/erofs/dir.c
index d1cb0d78ab84..e83475260106 100644
--- a/drivers/staging/erofs/dir.c
+++ b/drivers/staging/erofs/dir.c
@@ -24,8 +24,8 @@ static const unsigned char erofs_filetype_table[EROFS_FT_MAX] = {
};
static int erofs_fill_dentries(struct dir_context *ctx,
- void *dentry_blk, unsigned int *ofs,
- unsigned int nameoff, unsigned int maxsize)
+ void *dentry_blk, unsigned int *ofs,
+ unsigned int nameoff, unsigned int maxsize)
{
struct erofs_dirent *de = dentry_blk;
const struct erofs_dirent *end = dentry_blk + nameoff;
@@ -66,8 +66,8 @@ static int erofs_fill_dentries(struct dir_context *ctx,
#endif
if (!dir_emit(ctx, de_name, de_namelen,
- le64_to_cpu(de->nid), d_type))
- /* stoped by some reason */
+ le64_to_cpu(de->nid), d_type))
+ /* stopped by some reason */
return 1;
++de;
*ofs += sizeof(struct erofs_dirent);
@@ -101,9 +101,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
nameoff = le16_to_cpu(de->nameoff);
if (unlikely(nameoff < sizeof(struct erofs_dirent) ||
- nameoff >= PAGE_SIZE)) {
+ nameoff >= PAGE_SIZE)) {
errln("%s, invalid de[0].nameoff %u",
- __func__, nameoff);
+ __func__, nameoff);
err = -EIO;
goto skip_this;
diff --git a/drivers/staging/erofs/erofs_fs.h b/drivers/staging/erofs/erofs_fs.h
index d4bffa2852b3..6a8c51d6ad61 100644
--- a/drivers/staging/erofs/erofs_fs.h
+++ b/drivers/staging/erofs/erofs_fs.h
@@ -38,9 +38,9 @@ struct erofs_super_block {
/* 80 */__u8 reserved2[48]; /* 128 bytes */
} __packed;
-#define __EROFS_BIT(_prefix, _cur, _pre) enum { \
+#define __EROFS_BIT(_prefix, _cur, _pre) (enum { \
_prefix ## _cur ## _BIT = _prefix ## _pre ## _BIT + \
- _prefix ## _pre ## _BITS }
+ _prefix ## _pre ## _BITS })
/*
* erofs inode data mapping:
@@ -58,6 +58,7 @@ enum {
EROFS_INODE_LAYOUT_INLINE,
EROFS_INODE_LAYOUT_MAX
};
+
#define EROFS_I_VERSION_BITS 1
#define EROFS_I_DATA_MAPPING_BITS 3
--
2.19.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] drivers: staging: erofs: Fix styling issues
2018-12-11 9:06 [PATCH] drivers: staging: erofs: Fix styling issues Aaron Strahlberger
@ 2018-12-11 9:18 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 0/5] " Aaron Strahlberger
2018-12-12 12:00 ` [PATCH v2] staging:erofs: Fix alignment issues Aaron Strahlberger
2018-12-11 12:51 ` [PATCH] drivers: staging: erofs: Fix styling issues Dan Carpenter
1 sibling, 2 replies; 21+ messages in thread
From: Gao Xiang @ 2018-12-11 9:18 UTC (permalink / raw)
To: Aaron Strahlberger
Cc: Chao Yu, linux-erofs, devel, linux-kernel, linux-kernel,
Julius Wiedmann, Dominik Huber, Greg Kroah-Hartman
Hi Aaron,
On 2018/12/11 17:06, Aaron Strahlberger wrote:
> Fixed following checkpatch.pl styling issues:
>
> - 17x CHECK: Alignment should match open parenthesis
> - 7x CHECK: Comparison to NULL could be written ...
> - 1x CHECK: Lines should not end with a '('
> - 1x CHECK: Please use a blank line after ...
>
> Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
> Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
> Signed-off-by: Dominik Huber <domi250@gmx.de>
Thanks for taking time to work on this submitted patch. :)
As a matter of practice, it is perfered to keep each patch
fixes one kind of these issues you found...separate into 4 patches could be better...
In addition, you need send to Greg Kroah-Hartman <gregkh@linuxfoundation.org>
for upstream...
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 0/5] drivers: staging: erofs: Fix styling issues
2018-12-11 9:18 ` Gao Xiang
@ 2018-12-11 10:54 ` Aaron Strahlberger
2018-12-11 10:54 ` [PATCH 1/5] drivers: staging: erofs: Fix alignment Aaron Strahlberger
` (4 more replies)
2018-12-12 12:00 ` [PATCH v2] staging:erofs: Fix alignment issues Aaron Strahlberger
1 sibling, 5 replies; 21+ messages in thread
From: Aaron Strahlberger @ 2018-12-11 10:54 UTC (permalink / raw)
To: Gao Xiang
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Aaron Strahlberger, Julius Wiedmann, Dominik Huber
Fixed several styling issues and one error, reported by checkpatch.pl.
Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
Signed-off-by: Dominik Huber <domi250@gmx.de>
Aaron Strahlberger (5):
drivers: staging: erofs: Fix alignment.
drivers: staging: erofs: Fix comparison to NULL issues.
drivers: staging: erofs: Fix spelling issue
drivers: staging: erofs: Fix parentheses error in macro
drivers: staging: erofs: Add blank line after function
drivers/staging/erofs/data.c | 65 ++++++++++++++++----------------
drivers/staging/erofs/dir.c | 12 +++---
drivers/staging/erofs/erofs_fs.h | 5 ++-
3 files changed, 42 insertions(+), 40 deletions(-)
--
2.19.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 1/5] drivers: staging: erofs: Fix alignment.
2018-12-11 10:54 ` [PATCH 0/5] " Aaron Strahlberger
@ 2018-12-11 10:54 ` Aaron Strahlberger
2018-12-11 11:19 ` Gao Xiang
2018-12-11 13:00 ` Dan Carpenter
2018-12-11 10:54 ` [PATCH 2/5] drivers: staging: erofs: Fix comparison to NULL issues Aaron Strahlberger
` (3 subsequent siblings)
4 siblings, 2 replies; 21+ messages in thread
From: Aaron Strahlberger @ 2018-12-11 10:54 UTC (permalink / raw)
To: Gao Xiang
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Aaron Strahlberger, Julius Wiedmann, Dominik Huber
Fix of 17 `CHECK: Alignment should match open parenthesis` checkpatch.pl
issues.
Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
Signed-off-by: Dominik Huber <domi250@gmx.de>
LocalWords: Alighnment
---
drivers/staging/erofs/data.c | 42 ++++++++++++++++++------------------
drivers/staging/erofs/dir.c | 8 +++----
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/drivers/staging/erofs/data.c b/drivers/staging/erofs/data.c
index 6384f73e5418..d1c0a7be6eb8 100644
--- a/drivers/staging/erofs/data.c
+++ b/drivers/staging/erofs/data.c
@@ -40,7 +40,7 @@ static inline void read_endio(struct bio *bio)
/* prio -- true is used for dir */
struct page *__erofs_get_meta_page(struct super_block *sb,
- erofs_blk_t blkaddr, bool prio, bool nofail)
+ erofs_blk_t blkaddr, bool prio, bool nofail)
{
struct inode *const bd_inode = sb->s_bdev->bd_inode;
struct address_space *const mapping = bd_inode->i_mapping;
@@ -76,7 +76,7 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
}
__submit_bio(bio, REQ_OP_READ,
- REQ_META | (prio ? REQ_PRIO : 0));
+ REQ_META | (prio ? REQ_PRIO : 0));
lock_page(page);
@@ -107,8 +107,8 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
}
static int erofs_map_blocks_flatmode(struct inode *inode,
- struct erofs_map_blocks *map,
- int flags)
+ struct erofs_map_blocks *map,
+ int flags)
{
int err = 0;
erofs_blk_t nblocks, lastblk;
@@ -151,7 +151,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
map->m_flags |= EROFS_MAP_META;
} else {
errln("internal error @ nid: %llu (size %llu), m_la 0x%llx",
- vi->nid, inode->i_size, map->m_la);
+ vi->nid, inode->i_size, map->m_la);
DBG_BUGON(1);
err = -EIO;
goto err_out;
@@ -192,27 +192,26 @@ int erofs_map_blocks_iter(struct inode *inode,
}
int erofs_map_blocks(struct inode *inode,
- struct erofs_map_blocks *map, int flags)
+ struct erofs_map_blocks *map, int flags)
{
if (unlikely(is_inode_layout_compression(inode))) {
struct page *mpage = NULL;
int err;
err = erofs_map_blocks_iter(inode, map, &mpage, flags);
- if (mpage != NULL)
+ if (mpage)
put_page(mpage);
return err;
}
return erofs_map_blocks_flatmode(inode, map, flags);
}
-static inline struct bio *erofs_read_raw_page(
- struct bio *bio,
- struct address_space *mapping,
- struct page *page,
- erofs_off_t *last_block,
- unsigned int nblocks,
- bool ra)
+static inline struct bio *erofs_read_raw_page(struct bio *bio,
+ struct address_space *mapping,
+ struct page *page,
+ erofs_off_t *last_block,
+ unsigned int nblocks,
+ bool ra)
{
struct inode *inode = mapping->host;
erofs_off_t current_block = (erofs_off_t)page->index;
@@ -307,7 +306,7 @@ static inline struct bio *erofs_read_raw_page(
nblocks = BIO_MAX_PAGES;
bio = erofs_grab_bio(inode->i_sb,
- blknr, nblocks, read_endio, false);
+ blknr, nblocks, read_endio, false);
if (IS_ERR(bio)) {
err = PTR_ERR(bio);
@@ -361,7 +360,7 @@ static int erofs_raw_access_readpage(struct file *file, struct page *page)
trace_erofs_readpage(page, true);
bio = erofs_read_raw_page(NULL, page->mapping,
- page, &last_block, 1, false);
+ page, &last_block, 1, false);
if (IS_ERR(bio))
return PTR_ERR(bio);
@@ -371,8 +370,9 @@ static int erofs_raw_access_readpage(struct file *file, struct page *page)
}
static int erofs_raw_access_readpages(struct file *filp,
- struct address_space *mapping,
- struct list_head *pages, unsigned int nr_pages)
+ struct address_space *mapping,
+ struct list_head *pages,
+ unsigned int nr_pages)
{
erofs_off_t last_block;
struct bio *bio = NULL;
@@ -389,13 +389,13 @@ static int erofs_raw_access_readpages(struct file *filp,
if (!add_to_page_cache_lru(page, mapping, page->index, gfp)) {
bio = erofs_read_raw_page(bio, mapping, page,
- &last_block, nr_pages, true);
+ &last_block, nr_pages, true);
/* all the page errors are ignored when readahead */
if (IS_ERR(bio)) {
pr_err("%s, readahead error at page %lu of nid %llu\n",
- __func__, page->index,
- EROFS_V(mapping->host)->nid);
+ __func__, page->index,
+ EROFS_V(mapping->host)->nid);
bio = NULL;
}
diff --git a/drivers/staging/erofs/dir.c b/drivers/staging/erofs/dir.c
index d1cb0d78ab84..49a4e7730df0 100644
--- a/drivers/staging/erofs/dir.c
+++ b/drivers/staging/erofs/dir.c
@@ -24,8 +24,8 @@ static const unsigned char erofs_filetype_table[EROFS_FT_MAX] = {
};
static int erofs_fill_dentries(struct dir_context *ctx,
- void *dentry_blk, unsigned int *ofs,
- unsigned int nameoff, unsigned int maxsize)
+ void *dentry_blk, unsigned int *ofs,
+ unsigned int nameoff, unsigned int maxsize)
{
struct erofs_dirent *de = dentry_blk;
const struct erofs_dirent *end = dentry_blk + nameoff;
@@ -101,9 +101,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
nameoff = le16_to_cpu(de->nameoff);
if (unlikely(nameoff < sizeof(struct erofs_dirent) ||
- nameoff >= PAGE_SIZE)) {
+ nameoff >= PAGE_SIZE)) {
errln("%s, invalid de[0].nameoff %u",
- __func__, nameoff);
+ __func__, nameoff);
err = -EIO;
goto skip_this;
--
2.19.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 2/5] drivers: staging: erofs: Fix comparison to NULL issues.
2018-12-11 10:54 ` [PATCH 0/5] " Aaron Strahlberger
2018-12-11 10:54 ` [PATCH 1/5] drivers: staging: erofs: Fix alignment Aaron Strahlberger
@ 2018-12-11 10:54 ` Aaron Strahlberger
2018-12-11 11:22 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 3/5] drivers: staging: erofs: Fix spelling issue Aaron Strahlberger
` (2 subsequent siblings)
4 siblings, 1 reply; 21+ messages in thread
From: Aaron Strahlberger @ 2018-12-11 10:54 UTC (permalink / raw)
To: Gao Xiang
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Aaron Strahlberger, Julius Wiedmann, Dominik Huber
Fix of 7 `CHECK: Comparison to NULL could be written ...` issues.
Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
Signed-off-by: Dominik Huber <domi250@gmx.de>
---
drivers/staging/erofs/data.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/erofs/data.c b/drivers/staging/erofs/data.c
index d1c0a7be6eb8..5a55f0bfdfbb 100644
--- a/drivers/staging/erofs/data.c
+++ b/drivers/staging/erofs/data.c
@@ -53,7 +53,7 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
repeat:
page = find_or_create_page(mapping, blkaddr, gfp);
- if (unlikely(page == NULL)) {
+ if (unlikely(!page)) {
DBG_BUGON(nofail);
return ERR_PTR(-ENOMEM);
}
@@ -167,16 +167,17 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
#ifdef CONFIG_EROFS_FS_ZIP
extern int z_erofs_map_blocks_iter(struct inode *,
- struct erofs_map_blocks *, struct page **, int);
+ struct erofs_map_blocks *,
+ struct page **, int);
#endif
int erofs_map_blocks_iter(struct inode *inode,
- struct erofs_map_blocks *map,
- struct page **mpage_ret, int flags)
+ struct erofs_map_blocks *map,
+ struct page **mpage_ret, int flags)
{
/* by default, reading raw data never use erofs_map_blocks_iter */
if (unlikely(!is_inode_layout_compression(inode))) {
- if (*mpage_ret != NULL)
+ if (*mpage_ret)
put_page(*mpage_ret);
*mpage_ret = NULL;
@@ -231,15 +232,15 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
}
/* note that for readpage case, bio also equals to NULL */
- if (bio != NULL &&
- /* not continuous */
- *last_block + 1 != current_block) {
+ if (bio &&
+ /* not continuous */
+ *last_block + 1 != current_block) {
submit_bio_retry:
__submit_bio(bio, REQ_OP_READ, 0);
bio = NULL;
}
- if (bio == NULL) {
+ if (!bio) {
struct erofs_map_blocks map = {
.m_la = blknr_to_addr(current_block),
};
@@ -341,7 +342,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
unlock_page(page);
/* if updated manually, continuous pages has a gap */
- if (bio != NULL)
+ if (bio)
submit_bio_out:
__submit_bio(bio, REQ_OP_READ, 0);
@@ -407,7 +408,7 @@ static int erofs_raw_access_readpages(struct file *filp,
DBG_BUGON(!list_empty(pages));
/* the rare case (end in gaps) */
- if (unlikely(bio != NULL))
+ if (unlikely(bio))
__submit_bio(bio, REQ_OP_READ, 0);
return 0;
}
--
2.19.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 3/5] drivers: staging: erofs: Fix spelling issue
2018-12-11 10:54 ` [PATCH 0/5] " Aaron Strahlberger
2018-12-11 10:54 ` [PATCH 1/5] drivers: staging: erofs: Fix alignment Aaron Strahlberger
2018-12-11 10:54 ` [PATCH 2/5] drivers: staging: erofs: Fix comparison to NULL issues Aaron Strahlberger
@ 2018-12-11 10:54 ` Aaron Strahlberger
2018-12-11 11:27 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 4/5] drivers: staging: erofs: Fix parentheses error in macro Aaron Strahlberger
2018-12-11 10:54 ` [PATCH 5/5] drivers: staging: erofs: Add blank line after function Aaron Strahlberger
4 siblings, 1 reply; 21+ messages in thread
From: Aaron Strahlberger @ 2018-12-11 10:54 UTC (permalink / raw)
To: Gao Xiang
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Aaron Strahlberger, Julius Wiedmann, Dominik Huber
Changed "stoped" to "stopped".
Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
Signed-off-by: Dominik Huber <domi250@gmx.de>
---
drivers/staging/erofs/dir.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/erofs/dir.c b/drivers/staging/erofs/dir.c
index 49a4e7730df0..e83475260106 100644
--- a/drivers/staging/erofs/dir.c
+++ b/drivers/staging/erofs/dir.c
@@ -66,8 +66,8 @@ static int erofs_fill_dentries(struct dir_context *ctx,
#endif
if (!dir_emit(ctx, de_name, de_namelen,
- le64_to_cpu(de->nid), d_type))
- /* stoped by some reason */
+ le64_to_cpu(de->nid), d_type))
+ /* stopped by some reason */
return 1;
++de;
*ofs += sizeof(struct erofs_dirent);
--
2.19.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 4/5] drivers: staging: erofs: Fix parentheses error in macro
2018-12-11 10:54 ` [PATCH 0/5] " Aaron Strahlberger
` (2 preceding siblings ...)
2018-12-11 10:54 ` [PATCH 3/5] drivers: staging: erofs: Fix spelling issue Aaron Strahlberger
@ 2018-12-11 10:54 ` Aaron Strahlberger
2018-12-11 11:06 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 5/5] drivers: staging: erofs: Add blank line after function Aaron Strahlberger
4 siblings, 1 reply; 21+ messages in thread
From: Aaron Strahlberger @ 2018-12-11 10:54 UTC (permalink / raw)
To: Gao Xiang
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Aaron Strahlberger, Julius Wiedmann, Dominik Huber
Fix of ERROR: Macros with complex values should be enclosed in parentheses
from checkpatch.pl
Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
Signed-off-by: Dominik Huber <domi250@gmx.de>
---
drivers/staging/erofs/erofs_fs.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/erofs/erofs_fs.h b/drivers/staging/erofs/erofs_fs.h
index d4bffa2852b3..892c913960c3 100644
--- a/drivers/staging/erofs/erofs_fs.h
+++ b/drivers/staging/erofs/erofs_fs.h
@@ -38,9 +38,9 @@ struct erofs_super_block {
/* 80 */__u8 reserved2[48]; /* 128 bytes */
} __packed;
-#define __EROFS_BIT(_prefix, _cur, _pre) enum { \
+#define __EROFS_BIT(_prefix, _cur, _pre) (enum { \
_prefix ## _cur ## _BIT = _prefix ## _pre ## _BIT + \
- _prefix ## _pre ## _BITS }
+ _prefix ## _pre ## _BITS })
/*
* erofs inode data mapping:
--
2.19.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 5/5] drivers: staging: erofs: Add blank line after function
2018-12-11 10:54 ` [PATCH 0/5] " Aaron Strahlberger
` (3 preceding siblings ...)
2018-12-11 10:54 ` [PATCH 4/5] drivers: staging: erofs: Fix parentheses error in macro Aaron Strahlberger
@ 2018-12-11 10:54 ` Aaron Strahlberger
4 siblings, 0 replies; 21+ messages in thread
From: Aaron Strahlberger @ 2018-12-11 10:54 UTC (permalink / raw)
To: Gao Xiang
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Aaron Strahlberger, Julius Wiedmann, Dominik Huber
Fix of checkpatch.pl issue:
CHECK: Please use a blank line after ... declarations
Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
Signed-off-by: Dominik Huber <domi250@gmx.de>
---
drivers/staging/erofs/erofs_fs.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/erofs/erofs_fs.h b/drivers/staging/erofs/erofs_fs.h
index 892c913960c3..6a8c51d6ad61 100644
--- a/drivers/staging/erofs/erofs_fs.h
+++ b/drivers/staging/erofs/erofs_fs.h
@@ -58,6 +58,7 @@ enum {
EROFS_INODE_LAYOUT_INLINE,
EROFS_INODE_LAYOUT_MAX
};
+
#define EROFS_I_VERSION_BITS 1
#define EROFS_I_DATA_MAPPING_BITS 3
--
2.19.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 4/5] drivers: staging: erofs: Fix parentheses error in macro
2018-12-11 10:54 ` [PATCH 4/5] drivers: staging: erofs: Fix parentheses error in macro Aaron Strahlberger
@ 2018-12-11 11:06 ` Gao Xiang
2018-12-11 15:48 ` Joe Perches
0 siblings, 1 reply; 21+ messages in thread
From: Gao Xiang @ 2018-12-11 11:06 UTC (permalink / raw)
To: Aaron Strahlberger
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Julius Wiedmann, Dominik Huber
Hi Aaron,
On 2018/12/11 18:54, Aaron Strahlberger wrote:
> Fix of ERROR: Macros with complex values should be enclosed in parentheses
> from checkpatch.pl
>
> Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
> Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
> Signed-off-by: Dominik Huber <domi250@gmx.de>
> ---
> drivers/staging/erofs/erofs_fs.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/erofs/erofs_fs.h b/drivers/staging/erofs/erofs_fs.h
> index d4bffa2852b3..892c913960c3 100644
> --- a/drivers/staging/erofs/erofs_fs.h
> +++ b/drivers/staging/erofs/erofs_fs.h
> @@ -38,9 +38,9 @@ struct erofs_super_block {
> /* 80 */__u8 reserved2[48]; /* 128 bytes */
> } __packed;
>
> -#define __EROFS_BIT(_prefix, _cur, _pre) enum { \
> +#define __EROFS_BIT(_prefix, _cur, _pre) (enum { \
> _prefix ## _cur ## _BIT = _prefix ## _pre ## _BIT + \
> - _prefix ## _pre ## _BITS }
> + _prefix ## _pre ## _BITS })
It seems not the valid C, here is the compiler error:
...
In file included from drivers/staging/erofs/internal.h:25:0,
from drivers/staging/erofs/xattr.h:16,
from drivers/staging/erofs/xattr.c:14:
drivers/staging/erofs/erofs_fs.h:41:43: error: expected identifier or ‘(’ before ‘enum’
#define __EROFS_BIT(_prefix, _cur, _pre) (enum { \
^
drivers/staging/erofs/erofs_fs.h:65:1: note: in expansion of macro ‘__EROFS_BIT’
__EROFS_BIT(EROFS_I_, DATA_MAPPING, VERSION);
^~~~~~~~~~~
make[3]: *** [scripts/Makefile.build:292: drivers/staging/erofs/xattr.o] Error 1
...
the __EROFS_BIT marco is used to define yyy_BIT according to xxx_BIT + xxx_BITS for cascade, eg.
__EROFS_BIT(EROFS_I_, DATA_MAPPING, VERSION);
it will defines EROFS_I_DATA_MAPPING_BIT = EROFS_I_VERSION_BIT + EROFS_I_VERSION_BITS;
__EROFS_BIT(EROFS_I_, FEATURE2, DATA_MAPPING);
it will defines EROFS_I_FEATURE2_BIT = EROFS_I_DATA_MAPPING_BIT + EROFS_I_DATA_MAPPING_BITS;
Thanks,
Gao Xiang
>
> /*
> * erofs inode data mapping:
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 1/5] drivers: staging: erofs: Fix alignment.
2018-12-11 10:54 ` [PATCH 1/5] drivers: staging: erofs: Fix alignment Aaron Strahlberger
@ 2018-12-11 11:19 ` Gao Xiang
2018-12-11 13:00 ` Dan Carpenter
1 sibling, 0 replies; 21+ messages in thread
From: Gao Xiang @ 2018-12-11 11:19 UTC (permalink / raw)
To: Aaron Strahlberger
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Julius Wiedmann, Dominik Huber
Hi Aaron,
On 2018/12/11 18:54, Aaron Strahlberger wrote:
> Fix of 17 `CHECK: Alignment should match open parenthesis` checkpatch.pl
> issues.
>
> Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
> Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
> Signed-off-by: Dominik Huber <domi250@gmx.de>
>
> LocalWords: Alighnment
What's this?
> ---
> drivers/staging/erofs/data.c | 42 ++++++++++++++++++------------------
> drivers/staging/erofs/dir.c | 8 +++----
> 2 files changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/staging/erofs/data.c b/drivers/staging/erofs/data.c
> index 6384f73e5418..d1c0a7be6eb8 100644
> --- a/drivers/staging/erofs/data.c
> +++ b/drivers/staging/erofs/data.c
> @@ -40,7 +40,7 @@ static inline void read_endio(struct bio *bio)
>
> /* prio -- true is used for dir */
> struct page *__erofs_get_meta_page(struct super_block *sb,
> - erofs_blk_t blkaddr, bool prio, bool nofail)
> + erofs_blk_t blkaddr, bool prio, bool nofail)
>
It seems your styling fix of data.c has been fixed in the latest staging-tree for a month,
could you have some time to take a look at the Greg's staging-tree again?
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/tree/drivers/staging/erofs/data.c?h=staging-next#n42
...
> diff --git a/drivers/staging/erofs/dir.c b/drivers/staging/erofs/dir.c
> index d1cb0d78ab84..49a4e7730df0 100644
> --- a/drivers/staging/erofs/dir.c
> +++ b/drivers/staging/erofs/dir.c
> @@ -24,8 +24,8 @@ static const unsigned char erofs_filetype_table[EROFS_FT_MAX] = {
> };
>
> static int erofs_fill_dentries(struct dir_context *ctx,
> - void *dentry_blk, unsigned int *ofs,
> - unsigned int nameoff, unsigned int maxsize)
> + void *dentry_blk, unsigned int *ofs,
> + unsigned int nameoff, unsigned int maxsize)
> {
> struct erofs_dirent *de = dentry_blk;
> const struct erofs_dirent *end = dentry_blk + nameoff;
> @@ -101,9 +101,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
> nameoff = le16_to_cpu(de->nameoff);
>
> if (unlikely(nameoff < sizeof(struct erofs_dirent) ||
> - nameoff >= PAGE_SIZE)) {
> + nameoff >= PAGE_SIZE)) {
> errln("%s, invalid de[0].nameoff %u",
> - __func__, nameoff);
> + __func__, nameoff);
Here is the only valid modification after I use "git am -k -3" to apply this on the latest staging tree...
Thanks,
Gao Xiang
>
> err = -EIO;
> goto skip_this;
> -- 2.19.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/5] drivers: staging: erofs: Fix comparison to NULL issues.
2018-12-11 10:54 ` [PATCH 2/5] drivers: staging: erofs: Fix comparison to NULL issues Aaron Strahlberger
@ 2018-12-11 11:22 ` Gao Xiang
0 siblings, 0 replies; 21+ messages in thread
From: Gao Xiang @ 2018-12-11 11:22 UTC (permalink / raw)
To: Aaron Strahlberger
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Julius Wiedmann, Dominik Huber
Hi Aaron,
On 2018/12/11 18:54, Aaron Strahlberger wrote:
> Fix of 7 `CHECK: Comparison to NULL could be written ...` issues.
>
> Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
> Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
> Signed-off-by: Dominik Huber <domi250@gmx.de>
> ---
> drivers/staging/erofs/data.c | 23 ++++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)
It has been fixed in the following upstreamed commit...
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/drivers/staging/erofs/data.c?h=staging-next&id=d1ab82443bed2b2562e5331d6aa53e3b878b16d0
and the "git am -k -3" log
[gaoxiang@138 linux-staging]$ git am -k -3 1.patch
Applying: Fix of 7 `CHECK: Comparison to NULL could be written ...` issues.
Using index info to reconstruct a base tree...
M drivers/staging/erofs/data.c
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 3/5] drivers: staging: erofs: Fix spelling issue
2018-12-11 10:54 ` [PATCH 3/5] drivers: staging: erofs: Fix spelling issue Aaron Strahlberger
@ 2018-12-11 11:27 ` Gao Xiang
0 siblings, 0 replies; 21+ messages in thread
From: Gao Xiang @ 2018-12-11 11:27 UTC (permalink / raw)
To: Aaron Strahlberger
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Julius Wiedmann, Dominik Huber
On 2018/12/11 18:54, Aaron Strahlberger wrote:
> Changed "stoped" to "stopped".
>
> Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
> Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
> Signed-off-by: Dominik Huber <domi250@gmx.de>
A typo fix... I'm not a native English speaker, help me if it has more typo errors...
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] drivers: staging: erofs: Fix styling issues
2018-12-11 9:06 [PATCH] drivers: staging: erofs: Fix styling issues Aaron Strahlberger
2018-12-11 9:18 ` Gao Xiang
@ 2018-12-11 12:51 ` Dan Carpenter
1 sibling, 0 replies; 21+ messages in thread
From: Dan Carpenter @ 2018-12-11 12:51 UTC (permalink / raw)
To: Aaron Strahlberger
Cc: Gao Xiang, devel, Julius Wiedmann, Chao Yu, linux-kernel,
Dominik Huber, linux-kernel, linux-erofs
Remove the "drivers: " from the patch prefix.
You're not working from the latest code. Write your patches on top of
staging-next or linux-next.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 1/5] drivers: staging: erofs: Fix alignment.
2018-12-11 10:54 ` [PATCH 1/5] drivers: staging: erofs: Fix alignment Aaron Strahlberger
2018-12-11 11:19 ` Gao Xiang
@ 2018-12-11 13:00 ` Dan Carpenter
1 sibling, 0 replies; 21+ messages in thread
From: Dan Carpenter @ 2018-12-11 13:00 UTC (permalink / raw)
To: Aaron Strahlberger
Cc: Gao Xiang, devel, Julius Wiedmann, linux-kernel,
Greg Kroah-Hartman, Chao Yu, linux-kernel, Dominik Huber,
linux-erofs
On Tue, Dec 11, 2018 at 11:54:39AM +0100, Aaron Strahlberger wrote:
> Fix of 17 `CHECK: Alignment should match open parenthesis` checkpatch.pl
> issues.
>
> Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
> Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
> Signed-off-by: Dominik Huber <domi250@gmx.de>
>
> LocalWords: Alighnment
^^^^^^^^^^^^^^^^^^^^^^^
Remove this.
Please wait at least a day before resending a patch.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 4/5] drivers: staging: erofs: Fix parentheses error in macro
2018-12-11 11:06 ` Gao Xiang
@ 2018-12-11 15:48 ` Joe Perches
2018-12-11 17:05 ` Gao Xiang
0 siblings, 1 reply; 21+ messages in thread
From: Joe Perches @ 2018-12-11 15:48 UTC (permalink / raw)
To: Gao Xiang, Aaron Strahlberger
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Julius Wiedmann, Dominik Huber
On Tue, 2018-12-11 at 19:06 +0800, Gao Xiang wrote:
> Hi Aaron,
>
> On 2018/12/11 18:54, Aaron Strahlberger wrote:
> > Fix of ERROR: Macros with complex values should be enclosed in parentheses
> > from checkpatch.pl
[]
> > diff --git a/drivers/staging/erofs/erofs_fs.h b/drivers/staging/erofs/erofs_fs.h
[]
> > @@ -38,9 +38,9 @@ struct erofs_super_block {
> > /* 80 */__u8 reserved2[48]; /* 128 bytes */
> > } __packed;
> >
> > -#define __EROFS_BIT(_prefix, _cur, _pre) enum { \
> > +#define __EROFS_BIT(_prefix, _cur, _pre) (enum { \
> > _prefix ## _cur ## _BIT = _prefix ## _pre ## _BIT + \
> > - _prefix ## _pre ## _BITS }
> > + _prefix ## _pre ## _BITS })
>
> It seems not the valid C, here is the compiler error:
>
> ...
>
> In file included from drivers/staging/erofs/internal.h:25:0,
> from drivers/staging/erofs/xattr.h:16,
> from drivers/staging/erofs/xattr.c:14:
> drivers/staging/erofs/erofs_fs.h:41:43: error: expected identifier or ‘(’ before ‘enum’
> #define __EROFS_BIT(_prefix, _cur, _pre) (enum { \
> ^
> drivers/staging/erofs/erofs_fs.h:65:1: note: in expansion of macro ‘__EROFS_BIT’
> __EROFS_BIT(EROFS_I_, DATA_MAPPING, VERSION);
> ^~~~~~~~~~~
> make[3]: *** [scripts/Makefile.build:292: drivers/staging/erofs/xattr.o] Error 1
>
> ...
>
>
> the __EROFS_BIT marco is used to define yyy_BIT according to xxx_BIT + xxx_BITS for cascade, eg.
>
> __EROFS_BIT(EROFS_I_, DATA_MAPPING, VERSION);
> it will defines EROFS_I_DATA_MAPPING_BIT = EROFS_I_VERSION_BIT + EROFS_I_VERSION_BITS;
>
> __EROFS_BIT(EROFS_I_, FEATURE2, DATA_MAPPING);
> it will defines EROFS_I_FEATURE2_BIT = EROFS_I_DATA_MAPPING_BIT + EROFS_I_DATA_MAPPING_BITS;
This macro is used only once and is merely obfuscation
for that one use. Please remove the macro and expand
it in the one place it is used.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 4/5] drivers: staging: erofs: Fix parentheses error in macro
2018-12-11 15:48 ` Joe Perches
@ 2018-12-11 17:05 ` Gao Xiang
2018-12-12 12:02 ` [PATCH v2] staging:erofs: Remove __EROFS_BIT macro Aaron Strahlberger
0 siblings, 1 reply; 21+ messages in thread
From: Gao Xiang @ 2018-12-11 17:05 UTC (permalink / raw)
To: Joe Perches
Cc: Gao Xiang, Aaron Strahlberger, devel, Julius Wiedmann,
linux-kernel, Greg Kroah-Hartman, linux-kernel, Dominik Huber,
linux-erofs
Hi Joe,
On 2018/12/11 23:48, Joe Perches wrote:
> This macro is used only once and is merely obfuscation
> for that one use. Please remove the macro and expand
> it in the one place it is used.
I am also considering to replace it in a plain way,
it will be more straight-forward to describe its on-disk format.
Thanks for your suggestion.
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2] staging:erofs: Fix alignment issues
2018-12-11 9:18 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 0/5] " Aaron Strahlberger
@ 2018-12-12 12:00 ` Aaron Strahlberger
2018-12-12 12:11 ` Gao Xiang
1 sibling, 1 reply; 21+ messages in thread
From: Aaron Strahlberger @ 2018-12-12 12:00 UTC (permalink / raw)
To: Gao Xiang
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Aaron Strahlberger, Julius Wiedmann, Dominik Huber
Fix of `CHECK: Alignment should match open parenthesis` issues, reported by
checkpatch.pl
Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
Signed-off-by: Dominik Huber <domi250@gmx.de>
---
drivers/staging/erofs/dir.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/erofs/dir.c b/drivers/staging/erofs/dir.c
index e44ca93dcdc6..e1955703ab8f 100644
--- a/drivers/staging/erofs/dir.c
+++ b/drivers/staging/erofs/dir.c
@@ -24,8 +24,8 @@ static const unsigned char erofs_filetype_table[EROFS_FT_MAX] = {
};
static int erofs_fill_dentries(struct dir_context *ctx,
- void *dentry_blk, unsigned int *ofs,
- unsigned int nameoff, unsigned int maxsize)
+ void *dentry_blk, unsigned int *ofs,
+ unsigned int nameoff, unsigned int maxsize)
{
struct erofs_dirent *de = dentry_blk;
const struct erofs_dirent *end = dentry_blk + nameoff;
@@ -69,8 +69,8 @@ static int erofs_fill_dentries(struct dir_context *ctx,
#endif
if (!dir_emit(ctx, de_name, de_namelen,
- le64_to_cpu(de->nid), d_type))
- /* stoped by some reason */
+ le64_to_cpu(de->nid), d_type))
+ /* stopped by some reason */
return 1;
++de;
*ofs += sizeof(struct erofs_dirent);
@@ -104,9 +104,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
nameoff = le16_to_cpu(de->nameoff);
if (unlikely(nameoff < sizeof(struct erofs_dirent) ||
- nameoff >= PAGE_SIZE)) {
+ nameoff >= PAGE_SIZE)) {
errln("%s, invalid de[0].nameoff %u",
- __func__, nameoff);
+ __func__, nameoff);
err = -EIO;
goto skip_this;
--
2.19.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2] staging:erofs: Remove __EROFS_BIT macro
2018-12-11 17:05 ` Gao Xiang
@ 2018-12-12 12:02 ` Aaron Strahlberger
2018-12-12 12:18 ` Gao Xiang
0 siblings, 1 reply; 21+ messages in thread
From: Aaron Strahlberger @ 2018-12-12 12:02 UTC (permalink / raw)
To: Gao Xiang
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Aaron Strahlberger, Julius Wiedmann, Dominik Huber
The `__EROFS_BIT` macro is used only once, do define the
`EROFS_I_DATA_MAPPING_BIT` constant. This Patch removes this
macro and expands it in the place it is used.
Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
Signed-off-by: Dominik Huber <domi250@gmx.de>
---
drivers/staging/erofs/erofs_fs.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/erofs/erofs_fs.h b/drivers/staging/erofs/erofs_fs.h
index d4bffa2852b3..da5562df847b 100644
--- a/drivers/staging/erofs/erofs_fs.h
+++ b/drivers/staging/erofs/erofs_fs.h
@@ -38,10 +38,6 @@ struct erofs_super_block {
/* 80 */__u8 reserved2[48]; /* 128 bytes */
} __packed;
-#define __EROFS_BIT(_prefix, _cur, _pre) enum { \
- _prefix ## _cur ## _BIT = _prefix ## _pre ## _BIT + \
- _prefix ## _pre ## _BITS }
-
/*
* erofs inode data mapping:
* 0 - inode plain without inline data A:
@@ -58,11 +54,14 @@ enum {
EROFS_INODE_LAYOUT_INLINE,
EROFS_INODE_LAYOUT_MAX
};
+
#define EROFS_I_VERSION_BITS 1
#define EROFS_I_DATA_MAPPING_BITS 3
#define EROFS_I_VERSION_BIT 0
-__EROFS_BIT(EROFS_I_, DATA_MAPPING, VERSION);
+enum {
+ EROFS_I_DATA_MAPPING_BIT = EROFS_I_VERSION_BIT + EROFS_I_VERSION_BITS
+}
struct erofs_inode_v1 {
/* 0 */__le16 i_advise;
--
2.19.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v2] staging:erofs: Fix alignment issues
2018-12-12 12:00 ` [PATCH v2] staging:erofs: Fix alignment issues Aaron Strahlberger
@ 2018-12-12 12:11 ` Gao Xiang
2018-12-12 12:29 ` Gao Xiang
0 siblings, 1 reply; 21+ messages in thread
From: Gao Xiang @ 2018-12-12 12:11 UTC (permalink / raw)
To: Aaron Strahlberger
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Julius Wiedmann, Dominik Huber, Miao Xie
Hi Aaron,
On 2018/12/12 20:00, Aaron Strahlberger wrote:
> Fix of `CHECK: Alignment should match open parenthesis` issues, reported by
> checkpatch.pl
>
> Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
> Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
> Signed-off-by: Dominik Huber <domi250@gmx.de>
> ---
> drivers/staging/erofs/dir.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/erofs/dir.c b/drivers/staging/erofs/dir.c
> index e44ca93dcdc6..e1955703ab8f 100644
> --- a/drivers/staging/erofs/dir.c
> +++ b/drivers/staging/erofs/dir.c
> @@ -24,8 +24,8 @@ static const unsigned char erofs_filetype_table[EROFS_FT_MAX] = {
> };
>
> static int erofs_fill_dentries(struct dir_context *ctx,
> - void *dentry_blk, unsigned int *ofs,
> - unsigned int nameoff, unsigned int maxsize)
> + void *dentry_blk, unsigned int *ofs,
> + unsigned int nameoff, unsigned int maxsize)
> {
> struct erofs_dirent *de = dentry_blk;
> const struct erofs_dirent *end = dentry_blk + nameoff;
> @@ -69,8 +69,8 @@ static int erofs_fill_dentries(struct dir_context *ctx,
> #endif
>
> if (!dir_emit(ctx, de_name, de_namelen,
> - le64_to_cpu(de->nid), d_type))
> - /* stoped by some reason */
> + le64_to_cpu(de->nid), d_type))
> + /* stopped by some reason */
It seems Greg has merged part of your previous patch,
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/drivers/staging/erofs?h=staging-testing&id=019ec6c14fbdfaeb361c84f68158fb9097f41004
Anyway, I can locally apply it by 3-way merge, and it looks good to me apart from that
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Thanks,
Gao Xiang
> return 1;
> ++de;
> *ofs += sizeof(struct erofs_dirent);
> @@ -104,9 +104,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
> nameoff = le16_to_cpu(de->nameoff);
>
> if (unlikely(nameoff < sizeof(struct erofs_dirent) ||
> - nameoff >= PAGE_SIZE)) {
> + nameoff >= PAGE_SIZE)) {
> errln("%s, invalid de[0].nameoff %u",
> - __func__, nameoff);
> + __func__, nameoff);
>
> err = -EIO;
> goto skip_this;
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] staging:erofs: Remove __EROFS_BIT macro
2018-12-12 12:02 ` [PATCH v2] staging:erofs: Remove __EROFS_BIT macro Aaron Strahlberger
@ 2018-12-12 12:18 ` Gao Xiang
0 siblings, 0 replies; 21+ messages in thread
From: Gao Xiang @ 2018-12-12 12:18 UTC (permalink / raw)
To: Aaron Strahlberger
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Julius Wiedmann, Dominik Huber
Hi Aaron,
On 2018/12/12 20:02, Aaron Strahlberger wrote:
> The `__EROFS_BIT` macro is used only once, do define the
> `EROFS_I_DATA_MAPPING_BIT` constant. This Patch removes this
> macro and expands it in the place it is used.
>
> Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
> Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
> Signed-off-by: Dominik Huber <domi250@gmx.de>
> ---
> drivers/staging/erofs/erofs_fs.h | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
> +
> #define EROFS_I_VERSION_BITS 1
> #define EROFS_I_DATA_MAPPING_BITS 3
>
> #define EROFS_I_VERSION_BIT 0
> -__EROFS_BIT(EROFS_I_, DATA_MAPPING, VERSION);
> +enum {
> + EROFS_I_DATA_MAPPING_BIT = EROFS_I_VERSION_BIT + EROFS_I_VERSION_BITS
> +}
Thanks for your patch. I have fixed it yesterday,
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/drivers/staging/erofs?h=staging-testing&id=ccd9c19c7ae165c70221b0a4927c31a56e395658
EROFS_I_DATA_MAPPING_BIT = EROFS_I_VERSION_BIT + EROFS_I_VERSION_BITS is not straight-forward as well for erofs on-disk format definition,
fix it to a plain number.
Thanks,
Gao Xiang
>
> struct erofs_inode_v1 {
> /* 0 */__le16 i_advise;
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2] staging:erofs: Fix alignment issues
2018-12-12 12:11 ` Gao Xiang
@ 2018-12-12 12:29 ` Gao Xiang
0 siblings, 0 replies; 21+ messages in thread
From: Gao Xiang @ 2018-12-12 12:29 UTC (permalink / raw)
To: Aaron Strahlberger
Cc: Greg Kroah-Hartman, Chao Yu, linux-erofs, devel, linux-kernel,
linux-kernel, Julius Wiedmann, Dominik Huber, Miao Xie
On 2018/12/12 20:11, Gao Xiang wrote:
> Hi Aaron,
>
> On 2018/12/12 20:00, Aaron Strahlberger wrote:
>> Fix of `CHECK: Alignment should match open parenthesis` issues, reported by
>> checkpatch.pl
>>
>> Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
>> Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
>> Signed-off-by: Dominik Huber <domi250@gmx.de>
>> ---
>> drivers/staging/erofs/dir.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/staging/erofs/dir.c b/drivers/staging/erofs/dir.c
>> index e44ca93dcdc6..e1955703ab8f 100644
>> --- a/drivers/staging/erofs/dir.c
>> +++ b/drivers/staging/erofs/dir.c
>> @@ -24,8 +24,8 @@ static const unsigned char erofs_filetype_table[EROFS_FT_MAX] = {
>> };
>>
>> static int erofs_fill_dentries(struct dir_context *ctx,
>> - void *dentry_blk, unsigned int *ofs,
>> - unsigned int nameoff, unsigned int maxsize)
>> + void *dentry_blk, unsigned int *ofs,
>> + unsigned int nameoff, unsigned int maxsize)
>> {
>> struct erofs_dirent *de = dentry_blk;
>> const struct erofs_dirent *end = dentry_blk + nameoff;
>> @@ -69,8 +69,8 @@ static int erofs_fill_dentries(struct dir_context *ctx,
>> #endif
>>
>> if (!dir_emit(ctx, de_name, de_namelen,
>> - le64_to_cpu(de->nid), d_type))
>> - /* stoped by some reason */
>> + le64_to_cpu(de->nid), d_type))
>> + /* stopped by some reason */
> It seems Greg has merged part of your previous patch,
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/drivers/staging/erofs?h=staging-testing&id=019ec6c14fbdfaeb361c84f68158fb9097f41004
>
> Anyway, I can locally apply it by 3-way merge, and it looks good to me apart from that
>
> Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
>
By the way, the subject line could be better as "staging: erofs: Fix alignment issues" rather than "staging:erofs: Fix alignment issues"
Thanks,
Gao Xiang
> Thanks,
> Gao Xiang
>
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2018-12-12 12:30 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-11 9:06 [PATCH] drivers: staging: erofs: Fix styling issues Aaron Strahlberger
2018-12-11 9:18 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 0/5] " Aaron Strahlberger
2018-12-11 10:54 ` [PATCH 1/5] drivers: staging: erofs: Fix alignment Aaron Strahlberger
2018-12-11 11:19 ` Gao Xiang
2018-12-11 13:00 ` Dan Carpenter
2018-12-11 10:54 ` [PATCH 2/5] drivers: staging: erofs: Fix comparison to NULL issues Aaron Strahlberger
2018-12-11 11:22 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 3/5] drivers: staging: erofs: Fix spelling issue Aaron Strahlberger
2018-12-11 11:27 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 4/5] drivers: staging: erofs: Fix parentheses error in macro Aaron Strahlberger
2018-12-11 11:06 ` Gao Xiang
2018-12-11 15:48 ` Joe Perches
2018-12-11 17:05 ` Gao Xiang
2018-12-12 12:02 ` [PATCH v2] staging:erofs: Remove __EROFS_BIT macro Aaron Strahlberger
2018-12-12 12:18 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 5/5] drivers: staging: erofs: Add blank line after function Aaron Strahlberger
2018-12-12 12:00 ` [PATCH v2] staging:erofs: Fix alignment issues Aaron Strahlberger
2018-12-12 12:11 ` Gao Xiang
2018-12-12 12:29 ` Gao Xiang
2018-12-11 12:51 ` [PATCH] drivers: staging: erofs: Fix styling issues Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).