Fixes checkpatch.pl warnings:
CHECK: spaces preferred around that '-' (ctx:VxV)
CHECK: spaces preferred around that '+' (ctx:VxV)
CHECK: spaces preferred around that '*' (ctx:VxV)
CHECK: spaces preferred around that '|' (ctx:VxV)
Signed-off-by: Valentin Vidic <[email protected]>
---
drivers/staging/exfat/exfat.h | 2 +-
drivers/staging/exfat/exfat_core.c | 76 ++++++++++++++---------------
drivers/staging/exfat/exfat_super.c | 44 ++++++++---------
3 files changed, 61 insertions(+), 61 deletions(-)
diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h
index 0aa14dea4e09..6c12f2d79f4d 100644
--- a/drivers/staging/exfat/exfat.h
+++ b/drivers/staging/exfat/exfat.h
@@ -159,7 +159,7 @@
/* Upcase table macro */
#define HIGH_INDEX_BIT (8)
#define HIGH_INDEX_MASK (0xFF00)
-#define LOW_INDEX_BIT (16-HIGH_INDEX_BIT)
+#define LOW_INDEX_BIT (16 - HIGH_INDEX_BIT)
#define UTBL_ROW_COUNT BIT(LOW_INDEX_BIT)
#define UTBL_COL_COUNT BIT(HIGH_INDEX_BIT)
diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
index 995358cc7c79..8fb4ce16010c 100644
--- a/drivers/staging/exfat/exfat_core.c
+++ b/drivers/staging/exfat/exfat_core.c
@@ -230,7 +230,7 @@ s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc,
hint_clu = p_chain->dir;
if (hint_clu == CLUSTER_32(~0)) {
- hint_clu = test_alloc_bitmap(sb, p_fs->clu_srch_ptr-2);
+ hint_clu = test_alloc_bitmap(sb, p_fs->clu_srch_ptr - 2);
if (hint_clu == CLUSTER_32(~0))
return 0;
} else if (hint_clu >= p_fs->num_clusters) {
@@ -242,7 +242,7 @@ s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc,
p_chain->dir = CLUSTER_32(~0);
- while ((new_clu = test_alloc_bitmap(sb, hint_clu-2)) != CLUSTER_32(~0)) {
+ while ((new_clu = test_alloc_bitmap(sb, hint_clu - 2)) != CLUSTER_32(~0)) {
if (new_clu != hint_clu) {
if (p_chain->flags == 0x03) {
exfat_chain_cont_cluster(sb, p_chain->dir,
@@ -251,7 +251,7 @@ s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc,
}
}
- if (set_alloc_bitmap(sb, new_clu-2) != FFS_SUCCESS)
+ if (set_alloc_bitmap(sb, new_clu - 2) != FFS_SUCCESS)
return -1;
num_clusters++;
@@ -324,7 +324,7 @@ void fat_free_cluster(struct super_block *sb, struct chain_t *p_chain,
if (do_relse) {
sector = START_SECTOR(clu);
for (i = 0; i < p_fs->sectors_per_clu; i++)
- buf_release(sb, sector+i);
+ buf_release(sb, sector + i);
}
prev = clu;
@@ -367,10 +367,10 @@ void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain,
if (do_relse) {
sector = START_SECTOR(clu);
for (i = 0; i < p_fs->sectors_per_clu; i++)
- buf_release(sb, sector+i);
+ buf_release(sb, sector + i);
}
- if (clr_alloc_bitmap(sb, clu-2) != FFS_SUCCESS)
+ if (clr_alloc_bitmap(sb, clu - 2) != FFS_SUCCESS)
break;
clu++;
@@ -384,10 +384,10 @@ void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain,
if (do_relse) {
sector = START_SECTOR(clu);
for (i = 0; i < p_fs->sectors_per_clu; i++)
- buf_release(sb, sector+i);
+ buf_release(sb, sector + i);
}
- if (clr_alloc_bitmap(sb, clu-2) != FFS_SUCCESS)
+ if (clr_alloc_bitmap(sb, clu - 2) != FFS_SUCCESS)
break;
if (FAT_read(sb, clu, &clu) == -1)
@@ -491,7 +491,7 @@ void exfat_chain_cont_cluster(struct super_block *sb, u32 chain, s32 len)
return;
while (len > 1) {
- if (FAT_write(sb, chain, chain+1) < 0)
+ if (FAT_write(sb, chain, chain + 1) < 0)
break;
chain++;
len--;
@@ -538,7 +538,7 @@ s32 load_alloc_bitmap(struct super_block *sb)
p_fs->map_clu = GET32_A(ep->start_clu);
map_size = (u32) GET64_A(ep->size);
- p_fs->map_sectors = ((map_size-1) >> p_bd->sector_size_bits) + 1;
+ p_fs->map_sectors = ((map_size - 1) >> p_bd->sector_size_bits) + 1;
p_fs->vol_amap = kmalloc_array(p_fs->map_sectors,
sizeof(struct buffer_head *),
@@ -550,7 +550,7 @@ s32 load_alloc_bitmap(struct super_block *sb)
for (j = 0; j < p_fs->map_sectors; j++) {
p_fs->vol_amap[j] = NULL;
- ret = sector_read(sb, sector+j, &(p_fs->vol_amap[j]), 1);
+ ret = sector_read(sb, sector + j, &(p_fs->vol_amap[j]), 1);
if (ret != FFS_SUCCESS) {
/* release all buffers and free vol_amap */
i = 0;
@@ -728,7 +728,7 @@ static s32 __load_upcase_table(struct super_block *sb, sector_t sector,
sector++;
for (i = 0; i < p_bd->sector_size && index <= 0xFFFF; i += 2) {
- uni = GET16(((u8 *) tmp_bh->b_data)+i);
+ uni = GET16(((u8 *) tmp_bh->b_data) + i);
checksum = ((checksum & 1) ? 0x80000000 : 0) +
(checksum >> 1) + *(((u8 *)tmp_bh->b_data) +
@@ -798,7 +798,7 @@ static s32 __load_default_upcase_table(struct super_block *sb)
return FFS_MEMORYERR;
memset(upcase_table, 0, UTBL_COL_COUNT * sizeof(u16 *));
- for (i = 0; index <= 0xFFFF && i < NUM_UPCASE*2; i += 2) {
+ for (i = 0; index <= 0xFFFF && i < NUM_UPCASE * 2; i += 2) {
uni = GET16(uni_upcase + i);
if (skip) {
pr_debug("skip from 0x%X ", index);
@@ -875,7 +875,7 @@ s32 load_upcase_table(struct super_block *sb)
tbl_size = (u32) GET64_A(ep->size);
sector = START_SECTOR(tbl_clu);
- num_sectors = ((tbl_size-1) >> p_bd->sector_size_bits) + 1;
+ num_sectors = ((tbl_size - 1) >> p_bd->sector_size_bits) + 1;
if (__load_upcase_table(sb, sector, num_sectors,
GET32_A(ep->checksum)) != FFS_SUCCESS)
break;
@@ -919,10 +919,10 @@ u32 fat_get_entry_type(struct dentry_t *p_entry)
else if (ep->attr == ATTR_EXTEND)
return TYPE_EXTEND;
- else if ((ep->attr & (ATTR_SUBDIR|ATTR_VOLUME)) == ATTR_VOLUME)
+ else if ((ep->attr & (ATTR_SUBDIR | ATTR_VOLUME)) == ATTR_VOLUME)
return TYPE_VOLUME;
- else if ((ep->attr & (ATTR_SUBDIR|ATTR_VOLUME)) == ATTR_SUBDIR)
+ else if ((ep->attr & (ATTR_SUBDIR | ATTR_VOLUME)) == ATTR_SUBDIR)
return TYPE_DIR;
return TYPE_FILE;
@@ -1269,7 +1269,7 @@ s32 exfat_init_dir_entry(struct super_block *sb, struct chain_t *p_dir,
if (!file_ep)
return FFS_MEDIAERR;
- strm_ep = (struct strm_dentry_t *)get_entry_in_dir(sb, p_dir, entry+1,
+ strm_ep = (struct strm_dentry_t *)get_entry_in_dir(sb, p_dir, entry + 1,
§or);
if (!strm_ep)
return FFS_MEDIAERR;
@@ -1327,7 +1327,7 @@ static s32 fat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir,
if (!ext_ep)
return FFS_MEDIAERR;
- init_ext_entry(ext_ep, i+0x40, chksum, uniname);
+ init_ext_entry(ext_ep, i + 0x40, chksum, uniname);
buf_modify(sb, sector);
}
@@ -1354,7 +1354,7 @@ static s32 exfat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir,
file_ep->num_ext = (u8)(num_entries - 1);
buf_modify(sb, sector);
- strm_ep = (struct strm_dentry_t *)get_entry_in_dir(sb, p_dir, entry+1,
+ strm_ep = (struct strm_dentry_t *)get_entry_in_dir(sb, p_dir, entry + 1,
§or);
if (!strm_ep)
return FFS_MEDIAERR;
@@ -1409,13 +1409,13 @@ void init_ext_entry(struct ext_dentry_t *ep, s32 order, u8 chksum, u16 *uniname)
for (i = 0; i < 10; i += 2) {
if (!end) {
- SET16(ep->unicode_0_4+i, *uniname);
+ SET16(ep->unicode_0_4 + i, *uniname);
if (*uniname == 0x0)
end = true;
else
uniname++;
} else {
- SET16(ep->unicode_0_4+i, 0xFFFF);
+ SET16(ep->unicode_0_4 + i, 0xFFFF);
}
}
@@ -1476,7 +1476,7 @@ void init_name_entry(struct name_dentry_t *ep, u16 *uniname)
ep->flags = 0x0;
for (i = 0; i < 30; i++, i++) {
- SET16_A(ep->unicode_0_14+i, *uniname);
+ SET16_A(ep->unicode_0_14 + i, *uniname);
if (*uniname == 0x0)
break;
uniname++;
@@ -1491,8 +1491,8 @@ void fat_delete_dir_entry(struct super_block *sb, struct chain_t *p_dir,
struct dentry_t *ep;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
- for (i = num_entries-1; i >= order; i--) {
- ep = get_entry_in_dir(sb, p_dir, entry-i, §or);
+ for (i = num_entries - 1; i >= order; i--) {
+ ep = get_entry_in_dir(sb, p_dir, entry - i, §or);
if (!ep)
return;
@@ -1510,7 +1510,7 @@ void exfat_delete_dir_entry(struct super_block *sb, struct chain_t *p_dir,
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
for (i = order; i < num_entries; i++) {
- ep = get_entry_in_dir(sb, p_dir, entry+i, §or);
+ ep = get_entry_in_dir(sb, p_dir, entry + i, §or);
if (!ep)
return;
@@ -1540,7 +1540,7 @@ void update_dir_checksum(struct super_block *sb, struct chain_t *p_dir,
CS_DIR_ENTRY);
for (i = 1; i < num_entries; i++) {
- ep = get_entry_in_dir(sb, p_dir, entry+i, NULL);
+ ep = get_entry_in_dir(sb, p_dir, entry + i, NULL);
if (!ep) {
buf_unlock(sb, sector);
return;
@@ -1732,7 +1732,7 @@ struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb,
goto err_out;
if (type == ES_ALL_ENTRIES)
- num_entries = ((struct file_dentry_t *)ep)->num_ext+1;
+ num_entries = ((struct file_dentry_t *)ep)->num_ext + 1;
else
num_entries = type;
@@ -1998,7 +1998,7 @@ s32 search_deleted_or_unused_entry(struct super_block *sb,
if (p_dir->dir == CLUSTER_32(0)) /* FAT16 root_dir */
i = dentry % dentries_per_clu;
else
- i = dentry & (dentries_per_clu-1);
+ i = dentry & (dentries_per_clu - 1);
for (; i < dentries_per_clu; i++, dentry++) {
ep = get_entry_in_dir(sb, &clu, i, NULL);
@@ -2028,7 +2028,7 @@ s32 search_deleted_or_unused_entry(struct super_block *sb,
p_fs->hint_uentry.entry = -1;
if (p_fs->vol_type == EXFAT)
- return dentry - (num_entries-1);
+ return dentry - (num_entries - 1);
else
return dentry;
}
@@ -2127,7 +2127,7 @@ s32 find_empty_entry(struct inode *inode, struct chain_t *p_dir, s32 num_entries
}
}
- i_size_write(inode, i_size_read(inode)+p_fs->cluster_size);
+ i_size_write(inode, i_size_read(inode) + p_fs->cluster_size);
EXFAT_I(inode)->mmu_private += p_fs->cluster_size;
EXFAT_I(inode)->fid.size += p_fs->cluster_size;
EXFAT_I(inode)->fid.flags = p_dir->flags;
@@ -2201,7 +2201,7 @@ s32 fat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir,
ext_ep = (struct ext_dentry_t *) ep;
if (ext_ep->order > 0x40) {
order = (s32)(ext_ep->order - 0x40);
- uniname = p_uniname->name + 13 * (order-1);
+ uniname = p_uniname->name + 13 * (order - 1);
} else {
order = (s32) ext_ep->order;
uniname -= 13;
@@ -2209,13 +2209,13 @@ s32 fat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir,
len = extract_uni_name_from_ext_entry(ext_ep, entry_uniname, order);
- unichar = *(uniname+len);
- *(uniname+len) = 0x0;
+ unichar = *(uniname + len);
+ *(uniname + len) = 0x0;
if (nls_uniname_cmp(sb, uniname, entry_uniname))
is_feasible_entry = false;
- *(uniname+len) = unichar;
+ *(uniname + len) = unichar;
}
has_ext_entry = true;
} else if (entry_type == TYPE_UNUSED) {
@@ -2301,7 +2301,7 @@ s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir,
p_fs->hint_uentry.clu.flags = clu.flags;
}
if ((num_empty >= num_entries) || (entry_type == TYPE_UNUSED))
- p_fs->hint_uentry.entry = dentry - (num_empty-1);
+ p_fs->hint_uentry.entry = dentry - (num_empty - 1);
}
if (entry_type == TYPE_UNUSED)
@@ -2341,8 +2341,8 @@ s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir,
len = extract_uni_name_from_name_entry(name_ep,
entry_uniname, order);
- unichar = *(uniname+len);
- *(uniname+len) = 0x0;
+ unichar = *(uniname + len);
+ *(uniname + len) = 0x0;
if (nls_uniname_cmp(sb, uniname, entry_uniname)) {
is_feasible_entry = false;
@@ -2353,7 +2353,7 @@ s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir,
return dentry - (num_ext_entries);
}
- *(uniname+len) = unichar;
+ *(uniname + len) = unichar;
}
} else {
is_feasible_entry = false;
diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index 60dfea73a7a4..131f60a07bb9 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -605,7 +605,7 @@ static int ffsLookupFile(struct inode *inode, char *path, struct file_id_t *fid)
ret = FFS_MEDIAERR;
goto out;
}
- ep2 = ep+1;
+ ep2 = ep + 1;
} else {
ep = get_entry_in_dir(sb, &dir, dentry, NULL);
if (!ep) {
@@ -757,7 +757,7 @@ static int ffsReadFile(struct inode *inode, struct file_id_t *fid, void *buffer,
fid->hint_last_clu = clu;
/* byte offset in cluster */
- offset = (s32)(fid->rwoffset & (p_fs->cluster_size-1));
+ offset = (s32)(fid->rwoffset & (p_fs->cluster_size - 1));
/* sector offset in cluster */
sec_offset = offset >> p_bd->sector_size_bits;
@@ -858,7 +858,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
if (fid->size == 0)
num_clusters = 0;
else
- num_clusters = (s32)((fid->size-1) >>
+ num_clusters = (s32)((fid->size - 1) >>
p_fs->cluster_size_bits) + 1;
write_bytes = 0;
@@ -899,7 +899,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
num_alloc = (s32)((count - 1) >>
p_fs->cluster_size_bits) + 1;
new_clu.dir = (last_clu == CLUSTER_32(~0)) ?
- CLUSTER_32(~0) : last_clu+1;
+ CLUSTER_32(~0) : last_clu + 1;
new_clu.size = 0;
new_clu.flags = fid->flags;
@@ -969,7 +969,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
}
} else {
if ((offset > 0) ||
- ((fid->rwoffset+oneblkwrite) < fid->size)) {
+ ((fid->rwoffset + oneblkwrite) < fid->size)) {
if (sector_read(sb, LogSector, &tmp_bh, 1) !=
FFS_SUCCESS)
goto err_out;
@@ -1008,7 +1008,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
ES_ALL_ENTRIES, &ep);
if (!es)
goto err_out;
- ep2 = ep+1;
+ ep2 = ep + 1;
} else {
ep = get_entry_in_dir(sb, &(fid->dir), fid->entry, §or);
if (!ep)
@@ -1103,11 +1103,11 @@ static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size)
fs_set_vol_flags(sb, VOL_DIRTY);
clu.dir = fid->start_clu;
- clu.size = (s32)((old_size-1) >> p_fs->cluster_size_bits) + 1;
+ clu.size = (s32)((old_size - 1) >> p_fs->cluster_size_bits) + 1;
clu.flags = fid->flags;
if (new_size > 0) {
- num_clusters = (s32)((new_size-1) >>
+ num_clusters = (s32)((new_size - 1) >>
p_fs->cluster_size_bits) + 1;
if (clu.flags == 0x03) {
@@ -1141,7 +1141,7 @@ static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size)
ret = FFS_MEDIAERR;
goto out;
}
- ep2 = ep+1;
+ ep2 = ep + 1;
} else {
ep = get_entry_in_dir(sb, &(fid->dir), fid->entry, §or);
if (!ep) {
@@ -1209,7 +1209,7 @@ static void update_parent_info(struct file_id_t *fid,
(parent_fid->start_clu != fid->dir.dir))) {
fid->dir.dir = parent_fid->start_clu;
fid->dir.flags = parent_fid->flags;
- fid->dir.size = ((parent_fid->size + (p_fs->cluster_size-1))
+ fid->dir.size = ((parent_fid->size + (p_fs->cluster_size - 1))
>> p_fs->cluster_size_bits);
}
}
@@ -1326,7 +1326,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,
if (num_entries < 0)
goto out;
p_fs->fs_func->delete_dir_entry(sb, p_dir, new_entry, 0,
- num_entries+1);
+ num_entries + 1);
}
out:
#ifdef CONFIG_EXFAT_DELAYED_SYNC
@@ -1381,7 +1381,7 @@ static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid)
remove_file(inode, &dir, dentry);
clu_to_free.dir = fid->start_clu;
- clu_to_free.size = (s32)((fid->size-1) >> p_fs->cluster_size_bits) + 1;
+ clu_to_free.size = (s32)((fid->size - 1) >> p_fs->cluster_size_bits) + 1;
clu_to_free.flags = fid->flags;
/* (2) free the clusters */
@@ -1561,7 +1561,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info)
ret = FFS_MEDIAERR;
goto out;
}
- ep2 = ep+1;
+ ep2 = ep + 1;
} else {
ep = get_entry_in_dir(sb, &(fid->dir), fid->entry, §or);
if (!ep) {
@@ -1685,7 +1685,7 @@ static int ffsWriteStat(struct inode *inode, struct dir_entry_t *info)
ret = FFS_MEDIAERR;
goto out;
}
- ep2 = ep+1;
+ ep2 = ep + 1;
} else {
/* for other than exfat */
ep = get_entry_in_dir(sb, &(fid->dir), fid->entry, §or);
@@ -2019,7 +2019,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry)
if (dir.dir == CLUSTER_32(0)) /* FAT16 root_dir */
i = dentry % dentries_per_clu;
else
- i = dentry & (dentries_per_clu-1);
+ i = dentry & (dentries_per_clu - 1);
for ( ; i < dentries_per_clu; i++, dentry++) {
ep = get_entry_in_dir(sb, &clu, i, §or);
@@ -2070,7 +2070,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry)
buf_unlock(sb, sector);
if (p_fs->vol_type == EXFAT) {
- ep = get_entry_in_dir(sb, &clu, i+1, NULL);
+ ep = get_entry_in_dir(sb, &clu, i + 1, NULL);
if (!ep) {
ret = FFS_MEDIAERR;
goto out;
@@ -2159,7 +2159,7 @@ static int ffsRemoveDir(struct inode *inode, struct file_id_t *fid)
down(&p_fs->v_sem);
clu_to_free.dir = fid->start_clu;
- clu_to_free.size = (s32)((fid->size-1) >> p_fs->cluster_size_bits) + 1;
+ clu_to_free.size = (s32)((fid->size - 1) >> p_fs->cluster_size_bits) + 1;
clu_to_free.flags = fid->flags;
if (!is_dir_empty(sb, &clu_to_free)) {
@@ -2247,7 +2247,7 @@ static int exfat_readdir(struct file *filp, struct dir_context *ctx)
*/
if (err == FFS_MEDIAERR) {
cpos += 1 << p_bd->sector_size_bits;
- cpos &= ~((1 << p_bd->sector_size_bits)-1);
+ cpos &= ~((1 << p_bd->sector_size_bits) - 1);
}
err = -EIO;
@@ -2265,7 +2265,7 @@ static int exfat_readdir(struct file *filp, struct dir_context *ctx)
inum = parent_ino(filp->f_path.dentry);
} else {
loff_t i_pos = ((loff_t) EXFAT_I(inode)->fid.start_clu << 32) |
- ((EXFAT_I(inode)->fid.rwoffset-1) & 0xffffffff);
+ ((EXFAT_I(inode)->fid.rwoffset - 1) & 0xffffffff);
struct inode *tmp = exfat_iget(sb, i_pos);
if (tmp) {
@@ -3089,7 +3089,7 @@ static int exfat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
if (inode->i_ino == EXFAT_ROOT_INO) {
if (sector <
(p_fs->dentries_in_root >>
- (p_bd->sector_size_bits-DENTRY_SIZE_BITS))) {
+ (p_bd->sector_size_bits - DENTRY_SIZE_BITS))) {
*phys = sector + p_fs->root_start_sector;
*mapped_blocks = 1;
}
@@ -3206,7 +3206,7 @@ static int exfat_write_begin(struct file *file, struct address_space *mapping,
&EXFAT_I(mapping->host)->mmu_private);
if (ret < 0)
- exfat_write_failed(mapping, pos+len);
+ exfat_write_failed(mapping, pos + len);
return ret;
}
@@ -3221,7 +3221,7 @@ static int exfat_write_end(struct file *file, struct address_space *mapping,
err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata);
if (err < len)
- exfat_write_failed(mapping, pos+len);
+ exfat_write_failed(mapping, pos + len);
if (!(err < 0) && !(fid->attr & ATTR_ARCHIVE)) {
inode->i_mtime = inode->i_ctime = current_time(inode);
--
2.20.1
Fixes checkpatch.pl warnings:
CHECK: No space is necessary after a cast
Signed-off-by: Valentin Vidic <[email protected]>
---
drivers/staging/exfat/exfat_core.c | 88 ++++++++++++++---------------
drivers/staging/exfat/exfat_super.c | 66 +++++++++++-----------
2 files changed, 77 insertions(+), 77 deletions(-)
diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
index 8fb4ce16010c..64b89ae5af84 100644
--- a/drivers/staging/exfat/exfat_core.c
+++ b/drivers/staging/exfat/exfat_core.c
@@ -204,7 +204,7 @@ s32 fat_alloc_cluster(struct super_block *sb, s32 num_alloc,
if ((--num_alloc) == 0) {
p_fs->clu_srch_ptr = new_clu;
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != (u32)~0)
p_fs->used_clusters += num_clusters;
return num_clusters;
@@ -215,7 +215,7 @@ s32 fat_alloc_cluster(struct super_block *sb, s32 num_alloc,
}
p_fs->clu_srch_ptr = new_clu;
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != (u32)~0)
p_fs->used_clusters += num_clusters;
return num_clusters;
@@ -273,7 +273,7 @@ s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc,
if ((--num_alloc) == 0) {
p_fs->clu_srch_ptr = hint_clu;
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != (u32)~0)
p_fs->used_clusters += num_clusters;
p_chain->size += num_clusters;
@@ -293,7 +293,7 @@ s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc,
}
p_fs->clu_srch_ptr = hint_clu;
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != (u32)~0)
p_fs->used_clusters += num_clusters;
p_chain->size += num_clusters;
@@ -337,7 +337,7 @@ void fat_free_cluster(struct super_block *sb, struct chain_t *p_chain,
} while (clu != CLUSTER_32(~0));
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != (u32)~0)
p_fs->used_clusters -= num_clusters;
}
@@ -396,7 +396,7 @@ void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain,
} while ((clu != CLUSTER_32(0)) && (clu != CLUSTER_32(~0)));
}
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != (u32)~0)
p_fs->used_clusters -= num_clusters;
}
@@ -473,7 +473,7 @@ s32 exfat_count_used_clusters(struct super_block *sb)
map_i = map_b = 0;
for (i = 2; i < p_fs->num_clusters; i += 8) {
- k = *(((u8 *) p_fs->vol_amap[map_i]->b_data) + map_b);
+ k = *(((u8 *)p_fs->vol_amap[map_i]->b_data) + map_b);
count += used_bit[k];
if ((++map_b) >= p_bd->sector_size) {
@@ -536,7 +536,7 @@ s32 load_alloc_bitmap(struct super_block *sb)
if (ep->flags == 0x0) {
p_fs->map_clu = GET32_A(ep->start_clu);
- map_size = (u32) GET64_A(ep->size);
+ map_size = (u32)GET64_A(ep->size);
p_fs->map_sectors = ((map_size - 1) >> p_bd->sector_size_bits) + 1;
@@ -601,7 +601,7 @@ s32 set_alloc_bitmap(struct super_block *sb, u32 clu)
sector = START_SECTOR(p_fs->map_clu) + i;
- exfat_bitmap_set((u8 *) p_fs->vol_amap[i]->b_data, b);
+ exfat_bitmap_set((u8 *)p_fs->vol_amap[i]->b_data, b);
return sector_write(sb, sector, p_fs->vol_amap[i], 0);
}
@@ -623,7 +623,7 @@ s32 clr_alloc_bitmap(struct super_block *sb, u32 clu)
sector = START_SECTOR(p_fs->map_clu) + i;
- exfat_bitmap_clear((u8 *) p_fs->vol_amap[i]->b_data, b);
+ exfat_bitmap_clear((u8 *)p_fs->vol_amap[i]->b_data, b);
return sector_write(sb, sector, p_fs->vol_amap[i], 0);
@@ -655,7 +655,7 @@ u32 test_alloc_bitmap(struct super_block *sb, u32 clu)
map_b = (clu >> 3) & p_bd->sector_size_mask;
for (i = 2; i < p_fs->num_clusters; i += 8) {
- k = *(((u8 *) p_fs->vol_amap[map_i]->b_data) + map_b);
+ k = *(((u8 *)p_fs->vol_amap[map_i]->b_data) + map_b);
if (clu_mask > 0) {
k |= clu_mask;
clu_mask = 0;
@@ -728,7 +728,7 @@ static s32 __load_upcase_table(struct super_block *sb, sector_t sector,
sector++;
for (i = 0; i < p_bd->sector_size && index <= 0xFFFF; i += 2) {
- uni = GET16(((u8 *) tmp_bh->b_data) + i);
+ uni = GET16(((u8 *)tmp_bh->b_data) + i);
checksum = ((checksum & 1) ? 0x80000000 : 0) +
(checksum >> 1) + *(((u8 *)tmp_bh->b_data) +
@@ -872,7 +872,7 @@ s32 load_upcase_table(struct super_block *sb)
continue;
tbl_clu = GET32_A(ep->start_clu);
- tbl_size = (u32) GET64_A(ep->size);
+ tbl_size = (u32)GET64_A(ep->size);
sector = START_SECTOR(tbl_clu);
num_sectors = ((tbl_size - 1) >> p_bd->sector_size_bits) + 1;
@@ -908,7 +908,7 @@ void free_upcase_table(struct super_block *sb)
u32 fat_get_entry_type(struct dentry_t *p_entry)
{
- struct dos_dentry_t *ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
if (*(ep->name) == 0x0)
return TYPE_UNUSED;
@@ -930,7 +930,7 @@ u32 fat_get_entry_type(struct dentry_t *p_entry)
u32 exfat_get_entry_type(struct dentry_t *p_entry)
{
- struct file_dentry_t *ep = (struct file_dentry_t *) p_entry;
+ struct file_dentry_t *ep = (struct file_dentry_t *)p_entry;
if (ep->type == 0x0) {
return TYPE_UNUSED;
@@ -975,7 +975,7 @@ u32 exfat_get_entry_type(struct dentry_t *p_entry)
void fat_set_entry_type(struct dentry_t *p_entry, u32 type)
{
- struct dos_dentry_t *ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
if (type == TYPE_UNUSED)
*(ep->name) = 0x0;
@@ -998,7 +998,7 @@ void fat_set_entry_type(struct dentry_t *p_entry, u32 type)
void exfat_set_entry_type(struct dentry_t *p_entry, u32 type)
{
- struct file_dentry_t *ep = (struct file_dentry_t *) p_entry;
+ struct file_dentry_t *ep = (struct file_dentry_t *)p_entry;
if (type == TYPE_UNUSED) {
ep->type = 0x0;
@@ -1028,30 +1028,30 @@ void exfat_set_entry_type(struct dentry_t *p_entry, u32 type)
u32 fat_get_entry_attr(struct dentry_t *p_entry)
{
- struct dos_dentry_t *ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
- return (u32) ep->attr;
+ return (u32)ep->attr;
}
u32 exfat_get_entry_attr(struct dentry_t *p_entry)
{
- struct file_dentry_t *ep = (struct file_dentry_t *) p_entry;
+ struct file_dentry_t *ep = (struct file_dentry_t *)p_entry;
- return (u32) GET16_A(ep->attr);
+ return (u32)GET16_A(ep->attr);
}
void fat_set_entry_attr(struct dentry_t *p_entry, u32 attr)
{
- struct dos_dentry_t *ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
- ep->attr = (u8) attr;
+ ep->attr = (u8)attr;
}
void exfat_set_entry_attr(struct dentry_t *p_entry, u32 attr)
{
- struct file_dentry_t *ep = (struct file_dentry_t *) p_entry;
+ struct file_dentry_t *ep = (struct file_dentry_t *)p_entry;
- SET16_A(ep->attr, (u16) attr);
+ SET16_A(ep->attr, (u16)attr);
}
u8 fat_get_entry_flag(struct dentry_t *p_entry)
@@ -1061,7 +1061,7 @@ u8 fat_get_entry_flag(struct dentry_t *p_entry)
u8 exfat_get_entry_flag(struct dentry_t *p_entry)
{
- struct strm_dentry_t *ep = (struct strm_dentry_t *) p_entry;
+ struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry;
return ep->flags;
}
@@ -1072,14 +1072,14 @@ void fat_set_entry_flag(struct dentry_t *p_entry, u8 flags)
void exfat_set_entry_flag(struct dentry_t *p_entry, u8 flags)
{
- struct strm_dentry_t *ep = (struct strm_dentry_t *) p_entry;
+ struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry;
ep->flags = flags;
}
u32 fat_get_entry_clu0(struct dentry_t *p_entry)
{
- struct dos_dentry_t *ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
return ((u32)GET16_A(ep->start_clu_hi) << 16) |
GET16_A(ep->start_clu_lo);
@@ -1087,7 +1087,7 @@ u32 fat_get_entry_clu0(struct dentry_t *p_entry)
u32 exfat_get_entry_clu0(struct dentry_t *p_entry)
{
- struct strm_dentry_t *ep = (struct strm_dentry_t *) p_entry;
+ struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry;
return GET32_A(ep->start_clu);
}
@@ -1111,7 +1111,7 @@ u64 fat_get_entry_size(struct dentry_t *p_entry)
{
struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
- return (u64) GET32_A(ep->size);
+ return (u64)GET32_A(ep->size);
}
u64 exfat_get_entry_size(struct dentry_t *p_entry)
@@ -1125,7 +1125,7 @@ void fat_set_entry_size(struct dentry_t *p_entry, u64 size)
{
struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
- SET32_A(ep->size, (u32) size);
+ SET32_A(ep->size, (u32)size);
}
void exfat_set_entry_size(struct dentry_t *p_entry, u64 size)
@@ -1384,14 +1384,14 @@ void init_dos_entry(struct dos_dentry_t *ep, u32 type, u32 start_clu)
{
struct timestamp_t tm, *tp;
- fat_set_entry_type((struct dentry_t *) ep, type);
+ fat_set_entry_type((struct dentry_t *)ep, type);
SET16_A(ep->start_clu_lo, CLUSTER_16(start_clu));
SET16_A(ep->start_clu_hi, CLUSTER_16(start_clu >> 16));
SET32_A(ep->size, 0);
tp = tm_current(&tm);
- fat_set_entry_time((struct dentry_t *) ep, tp, TM_CREATE);
- fat_set_entry_time((struct dentry_t *) ep, tp, TM_MODIFY);
+ fat_set_entry_time((struct dentry_t *)ep, tp, TM_CREATE);
+ fat_set_entry_time((struct dentry_t *)ep, tp, TM_MODIFY);
SET16_A(ep->access_date, 0);
ep->create_time_ms = 0;
}
@@ -1401,8 +1401,8 @@ void init_ext_entry(struct ext_dentry_t *ep, s32 order, u8 chksum, u16 *uniname)
int i;
bool end = false;
- fat_set_entry_type((struct dentry_t *) ep, TYPE_EXTEND);
- ep->order = (u8) order;
+ fat_set_entry_type((struct dentry_t *)ep, TYPE_EXTEND);
+ ep->order = (u8)order;
ep->sysid = 0;
ep->checksum = chksum;
SET16_A(ep->start_clu, 0);
@@ -1535,7 +1535,7 @@ void update_dir_checksum(struct super_block *sb, struct chain_t *p_dir,
buf_lock(sb, sector);
- num_entries = (s32) file_ep->num_ext + 1;
+ num_entries = (s32)file_ep->num_ext + 1;
chksum = calc_checksum_2byte((void *)file_ep, DENTRY_SIZE, 0,
CS_DIR_ENTRY);
@@ -1749,7 +1749,7 @@ struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb,
es->offset = off;
es->alloc_flag = p_dir->flags;
- pos = (struct dentry_t *) &(es->__buf);
+ pos = (struct dentry_t *)&(es->__buf);
while (num_entries) {
/*
@@ -2190,7 +2190,7 @@ s32 fat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir,
if (is_feasible_entry && has_ext_entry)
return dentry;
- dos_ep = (struct dos_dentry_t *) ep;
+ dos_ep = (struct dos_dentry_t *)ep;
if (!nls_dosname_cmp(sb, p_dosname->name, dos_ep->name))
return dentry;
}
@@ -2198,12 +2198,12 @@ s32 fat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir,
has_ext_entry = false;
} else if (entry_type == TYPE_EXTEND) {
if (is_feasible_entry) {
- ext_ep = (struct ext_dentry_t *) ep;
+ ext_ep = (struct ext_dentry_t *)ep;
if (ext_ep->order > 0x40) {
order = (s32)(ext_ep->order - 0x40);
uniname = p_uniname->name + 13 * (order - 1);
} else {
- order = (s32) ext_ep->order;
+ order = (s32)ext_ep->order;
uniname -= 13;
}
@@ -2310,7 +2310,7 @@ s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir,
num_empty = 0;
if ((entry_type == TYPE_FILE) || (entry_type == TYPE_DIR)) {
- file_ep = (struct file_dentry_t *) ep;
+ file_ep = (struct file_dentry_t *)ep;
if ((type == TYPE_ALL) || (type == entry_type)) {
num_ext_entries = file_ep->num_ext;
is_feasible_entry = true;
@@ -2388,11 +2388,11 @@ s32 fat_count_ext_entries(struct super_block *sb, struct chain_t *p_dir,
{
s32 count = 0;
u8 chksum;
- struct dos_dentry_t *dos_ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *dos_ep = (struct dos_dentry_t *)p_entry;
struct ext_dentry_t *ext_ep;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
- chksum = calc_checksum_1byte((void *) dos_ep->name, DOS_NAME_LENGTH, 0);
+ chksum = calc_checksum_1byte((void *)dos_ep->name, DOS_NAME_LENGTH, 0);
for (entry--; entry >= 0; entry--) {
ext_ep = (struct ext_dentry_t *)get_entry_in_dir(sb, p_dir,
diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index 131f60a07bb9..1cb0ec06c54e 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -379,7 +379,7 @@ static int ffsMountVol(struct super_block *sb)
p_fs->PBR_sector = 0;
- p_pbr = (struct pbr_sector_t *) tmp_bh->b_data;
+ p_pbr = (struct pbr_sector_t *)tmp_bh->b_data;
/* check the validity of PBR */
if (GET16_A(p_pbr->signature) != PBR_SIGNATURE) {
@@ -502,7 +502,7 @@ static int ffsGetVolInfo(struct super_block *sb, struct vol_info_t *info)
/* acquire the lock for file system critical section */
down(&p_fs->v_sem);
- if (p_fs->used_clusters == (u32) ~0)
+ if (p_fs->used_clusters == (u32)~0)
p_fs->used_clusters = p_fs->fs_func->count_used_clusters(sb);
info->FatType = p_fs->vol_type;
@@ -812,7 +812,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
{
bool modified = false;
s32 offset, sec_offset, clu_offset;
- s32 num_clusters, num_alloc, num_alloced = (s32) ~0;
+ s32 num_clusters, num_alloc, num_alloced = (s32)~0;
int ret = 0;
u32 clu, last_clu;
sector_t LogSector, sector = 0;
@@ -1225,7 +1225,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,
struct dentry_t *ep;
struct super_block *sb = old_parent_inode->i_sb;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
- u8 *new_path = (u8 *) new_dentry->d_name.name;
+ u8 *new_path = (u8 *)new_dentry->d_name.name;
struct inode *new_inode = new_dentry->d_inode;
int num_entries;
struct file_id_t *new_fid = NULL;
@@ -1593,7 +1593,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info)
info->ModifyTimestamp.Second = tm.sec;
info->ModifyTimestamp.MilliSecond = 0;
- memset((char *) &info->AccessTimestamp, 0, sizeof(struct date_time_t));
+ memset((char *)&info->AccessTimestamp, 0, sizeof(struct date_time_t));
*(uni_name.name) = 0x0;
/* XXX this is very bad for exfat cuz name is already included in es.
@@ -2093,7 +2093,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry)
fid->hint_last_clu = clu.dir;
}
- fid->rwoffset = (s64) ++dentry;
+ fid->rwoffset = (s64)(++dentry);
if (p_fs->dev_ejected)
ret = FFS_MEDIAERR;
@@ -2119,7 +2119,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry)
*(dir_entry->Name) = '\0';
- fid->rwoffset = (s64) ++dentry;
+ fid->rwoffset = (s64)(++dentry);
if (p_fs->dev_ejected)
ret = FFS_MEDIAERR;
@@ -2264,7 +2264,7 @@ static int exfat_readdir(struct file *filp, struct dir_context *ctx)
} else if (!memcmp(de.ShortName, DOS_PAR_DIR_NAME, DOS_NAME_LENGTH)) {
inum = parent_ino(filp->f_path.dentry);
} else {
- loff_t i_pos = ((loff_t) EXFAT_I(inode)->fid.start_clu << 32) |
+ loff_t i_pos = ((loff_t)EXFAT_I(inode)->fid.start_clu << 32) |
((EXFAT_I(inode)->fid.rwoffset - 1) & 0xffffffff);
struct inode *tmp = exfat_iget(sb, i_pos);
@@ -2325,7 +2325,7 @@ struct inode *inode = filp->f_path.dentry->d_inode;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if (get_user(flags, (int __user *) arg))
+ if (get_user(flags, (int __user *)arg))
return -EFAULT;
__lock_super(sb);
@@ -2361,7 +2361,7 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
pr_debug("%s entered\n", __func__);
- err = ffsCreateFile(dir, (u8 *) dentry->d_name.name, FM_REGULAR, &fid);
+ err = ffsCreateFile(dir, (u8 *)dentry->d_name.name, FM_REGULAR, &fid);
if (err) {
if (err == FFS_INVALIDPATH)
err = -EINVAL;
@@ -2378,11 +2378,11 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
INC_IVERSION(dir);
dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
- (void) exfat_sync_inode(dir);
+ (void)exfat_sync_inode(dir);
else
mark_inode_dirty(dir);
- i_pos = ((loff_t) fid.dir.dir << 32) | (fid.entry & 0xffffffff);
+ i_pos = ((loff_t)fid.dir.dir << 32) | (fid.entry & 0xffffffff);
inode = exfat_build_inode(sb, &fid, i_pos);
if (IS_ERR(inode)) {
@@ -2412,7 +2412,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname,
if (qname->len == 0)
return -ENOENT;
- err = ffsLookupFile(dir, (u8 *) qname->name, fid);
+ err = ffsLookupFile(dir, (u8 *)qname->name, fid);
if (err)
return -ENOENT;
@@ -2447,7 +2447,7 @@ static struct dentry *exfat_lookup(struct inode *dir, struct dentry *dentry,
goto error;
}
- i_pos = ((loff_t) fid.dir.dir << 32) | (fid.entry & 0xffffffff);
+ i_pos = ((loff_t)fid.dir.dir << 32) | (fid.entry & 0xffffffff);
inode = exfat_build_inode(sb, &fid, i_pos);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
@@ -2542,7 +2542,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
INC_IVERSION(dir);
dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
- (void) exfat_sync_inode(dir);
+ (void)exfat_sync_inode(dir);
else
mark_inode_dirty(dir);
@@ -2565,14 +2565,14 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry,
struct file_id_t fid;
loff_t i_pos;
int err;
- u64 len = (u64) strlen(target);
+ u64 len = (u64)strlen(target);
u64 ret;
__lock_super(sb);
pr_debug("%s entered\n", __func__);
- err = ffsCreateFile(dir, (u8 *) dentry->d_name.name, FM_SYMLINK, &fid);
+ err = ffsCreateFile(dir, (u8 *)dentry->d_name.name, FM_SYMLINK, &fid);
if (err) {
if (err == FFS_INVALIDPATH)
err = -EINVAL;
@@ -2585,7 +2585,7 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry,
goto out;
}
- err = ffsWriteFile(dir, &fid, (char *) target, len, &ret);
+ err = ffsWriteFile(dir, &fid, (char *)target, len, &ret);
if (err) {
ffsRemoveFile(dir, &fid);
@@ -2600,11 +2600,11 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry,
INC_IVERSION(dir);
dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
- (void) exfat_sync_inode(dir);
+ (void)exfat_sync_inode(dir);
else
mark_inode_dirty(dir);
- i_pos = ((loff_t) fid.dir.dir << 32) | (fid.entry & 0xffffffff);
+ i_pos = ((loff_t)fid.dir.dir << 32) | (fid.entry & 0xffffffff);
inode = exfat_build_inode(sb, &fid, i_pos);
if (IS_ERR(inode)) {
@@ -2642,7 +2642,7 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
pr_debug("%s entered\n", __func__);
- err = ffsCreateDir(dir, (u8 *) dentry->d_name.name, &fid);
+ err = ffsCreateDir(dir, (u8 *)dentry->d_name.name, &fid);
if (err) {
if (err == FFS_INVALIDPATH)
err = -EINVAL;
@@ -2659,12 +2659,12 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
INC_IVERSION(dir);
dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
- (void) exfat_sync_inode(dir);
+ (void)exfat_sync_inode(dir);
else
mark_inode_dirty(dir);
inc_nlink(dir);
- i_pos = ((loff_t) fid.dir.dir << 32) | (fid.entry & 0xffffffff);
+ i_pos = ((loff_t)fid.dir.dir << 32) | (fid.entry & 0xffffffff);
inode = exfat_build_inode(sb, &fid, i_pos);
if (IS_ERR(inode)) {
@@ -2713,7 +2713,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
INC_IVERSION(dir);
dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
- (void) exfat_sync_inode(dir);
+ (void)exfat_sync_inode(dir);
else
mark_inode_dirty(dir);
drop_nlink(dir);
@@ -2771,17 +2771,17 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime =
current_time(new_dir);
if (IS_DIRSYNC(new_dir))
- (void) exfat_sync_inode(new_dir);
+ (void)exfat_sync_inode(new_dir);
else
mark_inode_dirty(new_dir);
- i_pos = ((loff_t) EXFAT_I(old_inode)->fid.dir.dir << 32) |
+ i_pos = ((loff_t)EXFAT_I(old_inode)->fid.dir.dir << 32) |
(EXFAT_I(old_inode)->fid.entry & 0xffffffff);
exfat_detach(old_inode);
exfat_attach(old_inode, i_pos);
if (IS_DIRSYNC(new_dir))
- (void) exfat_sync_inode(old_inode);
+ (void)exfat_sync_inode(old_inode);
else
mark_inode_dirty(old_inode);
@@ -2793,7 +2793,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
INC_IVERSION(old_dir);
old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
if (IS_DIRSYNC(old_dir))
- (void) exfat_sync_inode(old_dir);
+ (void)exfat_sync_inode(old_dir);
else
mark_inode_dirty(old_dir);
@@ -2917,7 +2917,7 @@ static void exfat_truncate(struct inode *inode, loff_t old_size)
inode->i_ctime = inode->i_mtime = current_time(inode);
if (IS_DIRSYNC(inode))
- (void) exfat_sync_inode(inode);
+ (void)exfat_sync_inode(inode);
else
mark_inode_dirty(inode);
@@ -3503,7 +3503,7 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
struct vol_info_t info;
- if (p_fs->used_clusters == (u32) ~0) {
+ if (p_fs->used_clusters == (u32)~0) {
if (ffsGetVolInfo(sb, &info) == FFS_MEDIAERR)
return -EIO;
@@ -3678,7 +3678,7 @@ static int parse_options(char *options, int silent, int *debug,
opts->fs_uid = current_uid();
opts->fs_gid = current_gid();
opts->fs_fmask = opts->fs_dmask = current->fs->umask;
- opts->allow_utime = (unsigned short) -1;
+ opts->allow_utime = (unsigned short)-1;
opts->codepage = exfat_default_codepage;
opts->iocharset = exfat_default_iocharset;
opts->casesensitive = 0;
@@ -3770,7 +3770,7 @@ static int parse_options(char *options, int silent, int *debug,
}
out:
- if (opts->allow_utime == (unsigned short) -1)
+ if (opts->allow_utime == (unsigned short)-1)
opts->allow_utime = ~opts->fs_dmask & 0022;
return 0;
@@ -3817,7 +3817,7 @@ static int exfat_read_root(struct inode *inode)
i_size_write(inode, info.Size);
inode->i_blocks = ((i_size_read(inode) + (p_fs->cluster_size - 1))
& ~((loff_t)p_fs->cluster_size - 1)) >> 9;
- EXFAT_I(inode)->i_pos = ((loff_t) p_fs->root_dir << 32) | 0xffffffff;
+ EXFAT_I(inode)->i_pos = ((loff_t)p_fs->root_dir << 32) | 0xffffffff;
EXFAT_I(inode)->mmu_private = i_size_read(inode);
exfat_save_attr(inode, ATTR_SUBDIR);
--
2.20.1
On Sat, 2019-09-07 at 18:58 +0000, Valentin Vidic wrote:
> Fixes checkpatch.pl warnings:
>
> CHECK: No space is necessary after a cast
Please always try to improve the code rather
than shutup checkpatch warnings.
> diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
[]
> @@ -204,7 +204,7 @@ s32 fat_alloc_cluster(struct super_block *sb, s32 num_alloc,
>
> if ((--num_alloc) == 0) {
> p_fs->clu_srch_ptr = new_clu;
> - if (p_fs->used_clusters != (u32) ~0)
> + if (p_fs->used_clusters != (u32)~0)
Probably better as UINT_MAX
etc...
> @@ -3678,7 +3678,7 @@ static int parse_options(char *options, int silent, int *debug,
> opts->fs_uid = current_uid();
> opts->fs_gid = current_gid();
> opts->fs_fmask = opts->fs_dmask = current->fs->umask;
> - opts->allow_utime = (unsigned short) -1;
> + opts->allow_utime = (unsigned short)-1;
and maybe U16_MAX
> @@ -3770,7 +3770,7 @@ static int parse_options(char *options, int silent, int *debug,
> }
>
> out:
> - if (opts->allow_utime == (unsigned short) -1)
> + if (opts->allow_utime == (unsigned short)-1)
> opts->allow_utime = ~opts->fs_dmask & 0022;
>
> return 0;
Use constants and fix checkpatch.pl warnings:
CHECK: No space is necessary after a cast
Signed-off-by: Valentin Vidic <[email protected]>
---
v2: Use constants where possible
drivers/staging/exfat/exfat_core.c | 94 ++++++++++++++---------------
drivers/staging/exfat/exfat_super.c | 66 ++++++++++----------
2 files changed, 80 insertions(+), 80 deletions(-)
diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
index 8fb4ce16010c..6eee2aa06bd7 100644
--- a/drivers/staging/exfat/exfat_core.c
+++ b/drivers/staging/exfat/exfat_core.c
@@ -204,7 +204,7 @@ s32 fat_alloc_cluster(struct super_block *sb, s32 num_alloc,
if ((--num_alloc) == 0) {
p_fs->clu_srch_ptr = new_clu;
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != UINT_MAX)
p_fs->used_clusters += num_clusters;
return num_clusters;
@@ -215,7 +215,7 @@ s32 fat_alloc_cluster(struct super_block *sb, s32 num_alloc,
}
p_fs->clu_srch_ptr = new_clu;
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != UINT_MAX)
p_fs->used_clusters += num_clusters;
return num_clusters;
@@ -273,7 +273,7 @@ s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc,
if ((--num_alloc) == 0) {
p_fs->clu_srch_ptr = hint_clu;
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != UINT_MAX)
p_fs->used_clusters += num_clusters;
p_chain->size += num_clusters;
@@ -293,7 +293,7 @@ s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc,
}
p_fs->clu_srch_ptr = hint_clu;
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != UINT_MAX)
p_fs->used_clusters += num_clusters;
p_chain->size += num_clusters;
@@ -337,7 +337,7 @@ void fat_free_cluster(struct super_block *sb, struct chain_t *p_chain,
} while (clu != CLUSTER_32(~0));
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != UINT_MAX)
p_fs->used_clusters -= num_clusters;
}
@@ -396,7 +396,7 @@ void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain,
} while ((clu != CLUSTER_32(0)) && (clu != CLUSTER_32(~0)));
}
- if (p_fs->used_clusters != (u32) ~0)
+ if (p_fs->used_clusters != UINT_MAX)
p_fs->used_clusters -= num_clusters;
}
@@ -473,7 +473,7 @@ s32 exfat_count_used_clusters(struct super_block *sb)
map_i = map_b = 0;
for (i = 2; i < p_fs->num_clusters; i += 8) {
- k = *(((u8 *) p_fs->vol_amap[map_i]->b_data) + map_b);
+ k = *(((u8 *)p_fs->vol_amap[map_i]->b_data) + map_b);
count += used_bit[k];
if ((++map_b) >= p_bd->sector_size) {
@@ -536,7 +536,7 @@ s32 load_alloc_bitmap(struct super_block *sb)
if (ep->flags == 0x0) {
p_fs->map_clu = GET32_A(ep->start_clu);
- map_size = (u32) GET64_A(ep->size);
+ map_size = (u32)GET64_A(ep->size);
p_fs->map_sectors = ((map_size - 1) >> p_bd->sector_size_bits) + 1;
@@ -601,7 +601,7 @@ s32 set_alloc_bitmap(struct super_block *sb, u32 clu)
sector = START_SECTOR(p_fs->map_clu) + i;
- exfat_bitmap_set((u8 *) p_fs->vol_amap[i]->b_data, b);
+ exfat_bitmap_set((u8 *)p_fs->vol_amap[i]->b_data, b);
return sector_write(sb, sector, p_fs->vol_amap[i], 0);
}
@@ -623,7 +623,7 @@ s32 clr_alloc_bitmap(struct super_block *sb, u32 clu)
sector = START_SECTOR(p_fs->map_clu) + i;
- exfat_bitmap_clear((u8 *) p_fs->vol_amap[i]->b_data, b);
+ exfat_bitmap_clear((u8 *)p_fs->vol_amap[i]->b_data, b);
return sector_write(sb, sector, p_fs->vol_amap[i], 0);
@@ -655,7 +655,7 @@ u32 test_alloc_bitmap(struct super_block *sb, u32 clu)
map_b = (clu >> 3) & p_bd->sector_size_mask;
for (i = 2; i < p_fs->num_clusters; i += 8) {
- k = *(((u8 *) p_fs->vol_amap[map_i]->b_data) + map_b);
+ k = *(((u8 *)p_fs->vol_amap[map_i]->b_data) + map_b);
if (clu_mask > 0) {
k |= clu_mask;
clu_mask = 0;
@@ -728,7 +728,7 @@ static s32 __load_upcase_table(struct super_block *sb, sector_t sector,
sector++;
for (i = 0; i < p_bd->sector_size && index <= 0xFFFF; i += 2) {
- uni = GET16(((u8 *) tmp_bh->b_data) + i);
+ uni = GET16(((u8 *)tmp_bh->b_data) + i);
checksum = ((checksum & 1) ? 0x80000000 : 0) +
(checksum >> 1) + *(((u8 *)tmp_bh->b_data) +
@@ -872,7 +872,7 @@ s32 load_upcase_table(struct super_block *sb)
continue;
tbl_clu = GET32_A(ep->start_clu);
- tbl_size = (u32) GET64_A(ep->size);
+ tbl_size = (u32)GET64_A(ep->size);
sector = START_SECTOR(tbl_clu);
num_sectors = ((tbl_size - 1) >> p_bd->sector_size_bits) + 1;
@@ -908,7 +908,7 @@ void free_upcase_table(struct super_block *sb)
u32 fat_get_entry_type(struct dentry_t *p_entry)
{
- struct dos_dentry_t *ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
if (*(ep->name) == 0x0)
return TYPE_UNUSED;
@@ -930,7 +930,7 @@ u32 fat_get_entry_type(struct dentry_t *p_entry)
u32 exfat_get_entry_type(struct dentry_t *p_entry)
{
- struct file_dentry_t *ep = (struct file_dentry_t *) p_entry;
+ struct file_dentry_t *ep = (struct file_dentry_t *)p_entry;
if (ep->type == 0x0) {
return TYPE_UNUSED;
@@ -975,7 +975,7 @@ u32 exfat_get_entry_type(struct dentry_t *p_entry)
void fat_set_entry_type(struct dentry_t *p_entry, u32 type)
{
- struct dos_dentry_t *ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
if (type == TYPE_UNUSED)
*(ep->name) = 0x0;
@@ -998,7 +998,7 @@ void fat_set_entry_type(struct dentry_t *p_entry, u32 type)
void exfat_set_entry_type(struct dentry_t *p_entry, u32 type)
{
- struct file_dentry_t *ep = (struct file_dentry_t *) p_entry;
+ struct file_dentry_t *ep = (struct file_dentry_t *)p_entry;
if (type == TYPE_UNUSED) {
ep->type = 0x0;
@@ -1028,30 +1028,30 @@ void exfat_set_entry_type(struct dentry_t *p_entry, u32 type)
u32 fat_get_entry_attr(struct dentry_t *p_entry)
{
- struct dos_dentry_t *ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
- return (u32) ep->attr;
+ return (u32)ep->attr;
}
u32 exfat_get_entry_attr(struct dentry_t *p_entry)
{
- struct file_dentry_t *ep = (struct file_dentry_t *) p_entry;
+ struct file_dentry_t *ep = (struct file_dentry_t *)p_entry;
- return (u32) GET16_A(ep->attr);
+ return (u32)GET16_A(ep->attr);
}
void fat_set_entry_attr(struct dentry_t *p_entry, u32 attr)
{
- struct dos_dentry_t *ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
- ep->attr = (u8) attr;
+ ep->attr = (u8)attr;
}
void exfat_set_entry_attr(struct dentry_t *p_entry, u32 attr)
{
- struct file_dentry_t *ep = (struct file_dentry_t *) p_entry;
+ struct file_dentry_t *ep = (struct file_dentry_t *)p_entry;
- SET16_A(ep->attr, (u16) attr);
+ SET16_A(ep->attr, (u16)attr);
}
u8 fat_get_entry_flag(struct dentry_t *p_entry)
@@ -1061,7 +1061,7 @@ u8 fat_get_entry_flag(struct dentry_t *p_entry)
u8 exfat_get_entry_flag(struct dentry_t *p_entry)
{
- struct strm_dentry_t *ep = (struct strm_dentry_t *) p_entry;
+ struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry;
return ep->flags;
}
@@ -1072,14 +1072,14 @@ void fat_set_entry_flag(struct dentry_t *p_entry, u8 flags)
void exfat_set_entry_flag(struct dentry_t *p_entry, u8 flags)
{
- struct strm_dentry_t *ep = (struct strm_dentry_t *) p_entry;
+ struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry;
ep->flags = flags;
}
u32 fat_get_entry_clu0(struct dentry_t *p_entry)
{
- struct dos_dentry_t *ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
return ((u32)GET16_A(ep->start_clu_hi) << 16) |
GET16_A(ep->start_clu_lo);
@@ -1087,7 +1087,7 @@ u32 fat_get_entry_clu0(struct dentry_t *p_entry)
u32 exfat_get_entry_clu0(struct dentry_t *p_entry)
{
- struct strm_dentry_t *ep = (struct strm_dentry_t *) p_entry;
+ struct strm_dentry_t *ep = (struct strm_dentry_t *)p_entry;
return GET32_A(ep->start_clu);
}
@@ -1111,7 +1111,7 @@ u64 fat_get_entry_size(struct dentry_t *p_entry)
{
struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
- return (u64) GET32_A(ep->size);
+ return (u64)GET32_A(ep->size);
}
u64 exfat_get_entry_size(struct dentry_t *p_entry)
@@ -1125,7 +1125,7 @@ void fat_set_entry_size(struct dentry_t *p_entry, u64 size)
{
struct dos_dentry_t *ep = (struct dos_dentry_t *)p_entry;
- SET32_A(ep->size, (u32) size);
+ SET32_A(ep->size, (u32)size);
}
void exfat_set_entry_size(struct dentry_t *p_entry, u64 size)
@@ -1384,14 +1384,14 @@ void init_dos_entry(struct dos_dentry_t *ep, u32 type, u32 start_clu)
{
struct timestamp_t tm, *tp;
- fat_set_entry_type((struct dentry_t *) ep, type);
+ fat_set_entry_type((struct dentry_t *)ep, type);
SET16_A(ep->start_clu_lo, CLUSTER_16(start_clu));
SET16_A(ep->start_clu_hi, CLUSTER_16(start_clu >> 16));
SET32_A(ep->size, 0);
tp = tm_current(&tm);
- fat_set_entry_time((struct dentry_t *) ep, tp, TM_CREATE);
- fat_set_entry_time((struct dentry_t *) ep, tp, TM_MODIFY);
+ fat_set_entry_time((struct dentry_t *)ep, tp, TM_CREATE);
+ fat_set_entry_time((struct dentry_t *)ep, tp, TM_MODIFY);
SET16_A(ep->access_date, 0);
ep->create_time_ms = 0;
}
@@ -1401,8 +1401,8 @@ void init_ext_entry(struct ext_dentry_t *ep, s32 order, u8 chksum, u16 *uniname)
int i;
bool end = false;
- fat_set_entry_type((struct dentry_t *) ep, TYPE_EXTEND);
- ep->order = (u8) order;
+ fat_set_entry_type((struct dentry_t *)ep, TYPE_EXTEND);
+ ep->order = (u8)order;
ep->sysid = 0;
ep->checksum = chksum;
SET16_A(ep->start_clu, 0);
@@ -1535,7 +1535,7 @@ void update_dir_checksum(struct super_block *sb, struct chain_t *p_dir,
buf_lock(sb, sector);
- num_entries = (s32) file_ep->num_ext + 1;
+ num_entries = (s32)file_ep->num_ext + 1;
chksum = calc_checksum_2byte((void *)file_ep, DENTRY_SIZE, 0,
CS_DIR_ENTRY);
@@ -1749,7 +1749,7 @@ struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb,
es->offset = off;
es->alloc_flag = p_dir->flags;
- pos = (struct dentry_t *) &(es->__buf);
+ pos = (struct dentry_t *)&es->__buf;
while (num_entries) {
/*
@@ -2190,7 +2190,7 @@ s32 fat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir,
if (is_feasible_entry && has_ext_entry)
return dentry;
- dos_ep = (struct dos_dentry_t *) ep;
+ dos_ep = (struct dos_dentry_t *)ep;
if (!nls_dosname_cmp(sb, p_dosname->name, dos_ep->name))
return dentry;
}
@@ -2198,12 +2198,12 @@ s32 fat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir,
has_ext_entry = false;
} else if (entry_type == TYPE_EXTEND) {
if (is_feasible_entry) {
- ext_ep = (struct ext_dentry_t *) ep;
+ ext_ep = (struct ext_dentry_t *)ep;
if (ext_ep->order > 0x40) {
order = (s32)(ext_ep->order - 0x40);
uniname = p_uniname->name + 13 * (order - 1);
} else {
- order = (s32) ext_ep->order;
+ order = (s32)ext_ep->order;
uniname -= 13;
}
@@ -2310,7 +2310,7 @@ s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir,
num_empty = 0;
if ((entry_type == TYPE_FILE) || (entry_type == TYPE_DIR)) {
- file_ep = (struct file_dentry_t *) ep;
+ file_ep = (struct file_dentry_t *)ep;
if ((type == TYPE_ALL) || (type == entry_type)) {
num_ext_entries = file_ep->num_ext;
is_feasible_entry = true;
@@ -2388,11 +2388,11 @@ s32 fat_count_ext_entries(struct super_block *sb, struct chain_t *p_dir,
{
s32 count = 0;
u8 chksum;
- struct dos_dentry_t *dos_ep = (struct dos_dentry_t *) p_entry;
+ struct dos_dentry_t *dos_ep = (struct dos_dentry_t *)p_entry;
struct ext_dentry_t *ext_ep;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
- chksum = calc_checksum_1byte((void *) dos_ep->name, DOS_NAME_LENGTH, 0);
+ chksum = calc_checksum_1byte((void *)dos_ep->name, DOS_NAME_LENGTH, 0);
for (entry--; entry >= 0; entry--) {
ext_ep = (struct ext_dentry_t *)get_entry_in_dir(sb, p_dir,
@@ -3064,7 +3064,7 @@ s32 fat16_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
p_fs->vol_flag = VOL_CLEAN;
p_fs->clu_srch_ptr = 2;
- p_fs->used_clusters = (u32)~0;
+ p_fs->used_clusters = UINT_MAX;
p_fs->fs_func = &fat_fs_func;
@@ -3117,7 +3117,7 @@ s32 fat32_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
p_fs->vol_flag = VOL_CLEAN;
p_fs->clu_srch_ptr = 2;
- p_fs->used_clusters = (u32)~0;
+ p_fs->used_clusters = UINT_MAX;
p_fs->fs_func = &fat_fs_func;
@@ -3192,7 +3192,7 @@ s32 exfat_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
p_fs->vol_flag = (u32)GET16(p_bpb->vol_flags);
p_fs->clu_srch_ptr = 2;
- p_fs->used_clusters = (u32)~0;
+ p_fs->used_clusters = UINT_MAX;
p_fs->fs_func = &exfat_fs_func;
diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index 131f60a07bb9..610f20683611 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -379,7 +379,7 @@ static int ffsMountVol(struct super_block *sb)
p_fs->PBR_sector = 0;
- p_pbr = (struct pbr_sector_t *) tmp_bh->b_data;
+ p_pbr = (struct pbr_sector_t *)tmp_bh->b_data;
/* check the validity of PBR */
if (GET16_A(p_pbr->signature) != PBR_SIGNATURE) {
@@ -502,7 +502,7 @@ static int ffsGetVolInfo(struct super_block *sb, struct vol_info_t *info)
/* acquire the lock for file system critical section */
down(&p_fs->v_sem);
- if (p_fs->used_clusters == (u32) ~0)
+ if (p_fs->used_clusters == UINT_MAX)
p_fs->used_clusters = p_fs->fs_func->count_used_clusters(sb);
info->FatType = p_fs->vol_type;
@@ -812,7 +812,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
{
bool modified = false;
s32 offset, sec_offset, clu_offset;
- s32 num_clusters, num_alloc, num_alloced = (s32) ~0;
+ s32 num_clusters, num_alloc, num_alloced = (s32)~0;
int ret = 0;
u32 clu, last_clu;
sector_t LogSector, sector = 0;
@@ -1225,7 +1225,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,
struct dentry_t *ep;
struct super_block *sb = old_parent_inode->i_sb;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
- u8 *new_path = (u8 *) new_dentry->d_name.name;
+ u8 *new_path = (u8 *)new_dentry->d_name.name;
struct inode *new_inode = new_dentry->d_inode;
int num_entries;
struct file_id_t *new_fid = NULL;
@@ -1593,7 +1593,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info)
info->ModifyTimestamp.Second = tm.sec;
info->ModifyTimestamp.MilliSecond = 0;
- memset((char *) &info->AccessTimestamp, 0, sizeof(struct date_time_t));
+ memset((char *)&info->AccessTimestamp, 0, sizeof(struct date_time_t));
*(uni_name.name) = 0x0;
/* XXX this is very bad for exfat cuz name is already included in es.
@@ -2093,7 +2093,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry)
fid->hint_last_clu = clu.dir;
}
- fid->rwoffset = (s64) ++dentry;
+ fid->rwoffset = (s64)(++dentry);
if (p_fs->dev_ejected)
ret = FFS_MEDIAERR;
@@ -2119,7 +2119,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry)
*(dir_entry->Name) = '\0';
- fid->rwoffset = (s64) ++dentry;
+ fid->rwoffset = (s64)(++dentry);
if (p_fs->dev_ejected)
ret = FFS_MEDIAERR;
@@ -2264,7 +2264,7 @@ static int exfat_readdir(struct file *filp, struct dir_context *ctx)
} else if (!memcmp(de.ShortName, DOS_PAR_DIR_NAME, DOS_NAME_LENGTH)) {
inum = parent_ino(filp->f_path.dentry);
} else {
- loff_t i_pos = ((loff_t) EXFAT_I(inode)->fid.start_clu << 32) |
+ loff_t i_pos = ((loff_t)EXFAT_I(inode)->fid.start_clu << 32) |
((EXFAT_I(inode)->fid.rwoffset - 1) & 0xffffffff);
struct inode *tmp = exfat_iget(sb, i_pos);
@@ -2325,7 +2325,7 @@ struct inode *inode = filp->f_path.dentry->d_inode;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if (get_user(flags, (int __user *) arg))
+ if (get_user(flags, (int __user *)arg))
return -EFAULT;
__lock_super(sb);
@@ -2361,7 +2361,7 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
pr_debug("%s entered\n", __func__);
- err = ffsCreateFile(dir, (u8 *) dentry->d_name.name, FM_REGULAR, &fid);
+ err = ffsCreateFile(dir, (u8 *)dentry->d_name.name, FM_REGULAR, &fid);
if (err) {
if (err == FFS_INVALIDPATH)
err = -EINVAL;
@@ -2378,11 +2378,11 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
INC_IVERSION(dir);
dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
- (void) exfat_sync_inode(dir);
+ (void)exfat_sync_inode(dir);
else
mark_inode_dirty(dir);
- i_pos = ((loff_t) fid.dir.dir << 32) | (fid.entry & 0xffffffff);
+ i_pos = ((loff_t)fid.dir.dir << 32) | (fid.entry & 0xffffffff);
inode = exfat_build_inode(sb, &fid, i_pos);
if (IS_ERR(inode)) {
@@ -2412,7 +2412,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname,
if (qname->len == 0)
return -ENOENT;
- err = ffsLookupFile(dir, (u8 *) qname->name, fid);
+ err = ffsLookupFile(dir, (u8 *)qname->name, fid);
if (err)
return -ENOENT;
@@ -2447,7 +2447,7 @@ static struct dentry *exfat_lookup(struct inode *dir, struct dentry *dentry,
goto error;
}
- i_pos = ((loff_t) fid.dir.dir << 32) | (fid.entry & 0xffffffff);
+ i_pos = ((loff_t)fid.dir.dir << 32) | (fid.entry & 0xffffffff);
inode = exfat_build_inode(sb, &fid, i_pos);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
@@ -2542,7 +2542,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
INC_IVERSION(dir);
dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
- (void) exfat_sync_inode(dir);
+ (void)exfat_sync_inode(dir);
else
mark_inode_dirty(dir);
@@ -2565,14 +2565,14 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry,
struct file_id_t fid;
loff_t i_pos;
int err;
- u64 len = (u64) strlen(target);
+ u64 len = (u64)strlen(target);
u64 ret;
__lock_super(sb);
pr_debug("%s entered\n", __func__);
- err = ffsCreateFile(dir, (u8 *) dentry->d_name.name, FM_SYMLINK, &fid);
+ err = ffsCreateFile(dir, (u8 *)dentry->d_name.name, FM_SYMLINK, &fid);
if (err) {
if (err == FFS_INVALIDPATH)
err = -EINVAL;
@@ -2585,7 +2585,7 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry,
goto out;
}
- err = ffsWriteFile(dir, &fid, (char *) target, len, &ret);
+ err = ffsWriteFile(dir, &fid, (char *)target, len, &ret);
if (err) {
ffsRemoveFile(dir, &fid);
@@ -2600,11 +2600,11 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry,
INC_IVERSION(dir);
dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
- (void) exfat_sync_inode(dir);
+ (void)exfat_sync_inode(dir);
else
mark_inode_dirty(dir);
- i_pos = ((loff_t) fid.dir.dir << 32) | (fid.entry & 0xffffffff);
+ i_pos = ((loff_t)fid.dir.dir << 32) | (fid.entry & 0xffffffff);
inode = exfat_build_inode(sb, &fid, i_pos);
if (IS_ERR(inode)) {
@@ -2642,7 +2642,7 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
pr_debug("%s entered\n", __func__);
- err = ffsCreateDir(dir, (u8 *) dentry->d_name.name, &fid);
+ err = ffsCreateDir(dir, (u8 *)dentry->d_name.name, &fid);
if (err) {
if (err == FFS_INVALIDPATH)
err = -EINVAL;
@@ -2659,12 +2659,12 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
INC_IVERSION(dir);
dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
- (void) exfat_sync_inode(dir);
+ (void)exfat_sync_inode(dir);
else
mark_inode_dirty(dir);
inc_nlink(dir);
- i_pos = ((loff_t) fid.dir.dir << 32) | (fid.entry & 0xffffffff);
+ i_pos = ((loff_t)fid.dir.dir << 32) | (fid.entry & 0xffffffff);
inode = exfat_build_inode(sb, &fid, i_pos);
if (IS_ERR(inode)) {
@@ -2713,7 +2713,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
INC_IVERSION(dir);
dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
- (void) exfat_sync_inode(dir);
+ (void)exfat_sync_inode(dir);
else
mark_inode_dirty(dir);
drop_nlink(dir);
@@ -2771,17 +2771,17 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime =
current_time(new_dir);
if (IS_DIRSYNC(new_dir))
- (void) exfat_sync_inode(new_dir);
+ (void)exfat_sync_inode(new_dir);
else
mark_inode_dirty(new_dir);
- i_pos = ((loff_t) EXFAT_I(old_inode)->fid.dir.dir << 32) |
+ i_pos = ((loff_t)EXFAT_I(old_inode)->fid.dir.dir << 32) |
(EXFAT_I(old_inode)->fid.entry & 0xffffffff);
exfat_detach(old_inode);
exfat_attach(old_inode, i_pos);
if (IS_DIRSYNC(new_dir))
- (void) exfat_sync_inode(old_inode);
+ (void)exfat_sync_inode(old_inode);
else
mark_inode_dirty(old_inode);
@@ -2793,7 +2793,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
INC_IVERSION(old_dir);
old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
if (IS_DIRSYNC(old_dir))
- (void) exfat_sync_inode(old_dir);
+ (void)exfat_sync_inode(old_dir);
else
mark_inode_dirty(old_dir);
@@ -2917,7 +2917,7 @@ static void exfat_truncate(struct inode *inode, loff_t old_size)
inode->i_ctime = inode->i_mtime = current_time(inode);
if (IS_DIRSYNC(inode))
- (void) exfat_sync_inode(inode);
+ (void)exfat_sync_inode(inode);
else
mark_inode_dirty(inode);
@@ -3503,7 +3503,7 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
struct vol_info_t info;
- if (p_fs->used_clusters == (u32) ~0) {
+ if (p_fs->used_clusters == UINT_MAX) {
if (ffsGetVolInfo(sb, &info) == FFS_MEDIAERR)
return -EIO;
@@ -3678,7 +3678,7 @@ static int parse_options(char *options, int silent, int *debug,
opts->fs_uid = current_uid();
opts->fs_gid = current_gid();
opts->fs_fmask = opts->fs_dmask = current->fs->umask;
- opts->allow_utime = (unsigned short) -1;
+ opts->allow_utime = U16_MAX;
opts->codepage = exfat_default_codepage;
opts->iocharset = exfat_default_iocharset;
opts->casesensitive = 0;
@@ -3770,7 +3770,7 @@ static int parse_options(char *options, int silent, int *debug,
}
out:
- if (opts->allow_utime == (unsigned short) -1)
+ if (opts->allow_utime == U16_MAX)
opts->allow_utime = ~opts->fs_dmask & 0022;
return 0;
@@ -3817,7 +3817,7 @@ static int exfat_read_root(struct inode *inode)
i_size_write(inode, info.Size);
inode->i_blocks = ((i_size_read(inode) + (p_fs->cluster_size - 1))
& ~((loff_t)p_fs->cluster_size - 1)) >> 9;
- EXFAT_I(inode)->i_pos = ((loff_t) p_fs->root_dir << 32) | 0xffffffff;
+ EXFAT_I(inode)->i_pos = ((loff_t)p_fs->root_dir << 32) | 0xffffffff;
EXFAT_I(inode)->mmu_private = i_size_read(inode);
exfat_save_attr(inode, ATTR_SUBDIR);
--
2.20.1
On Sat, Sep 07, 2019 at 09:45:41PM +0000, Valentin Vidic wrote:
> Use constants and fix checkpatch.pl warnings:
>
> CHECK: No space is necessary after a cast
This really should be two different patches, one for the constant
changes, and one for the space issues. Can you break this up and resend
the whole series?
thanks,
greg k-h