Re: [PATCH 2/2] staging: exfat: cleanup spacing for casts

2019-09-07 Thread Joe Perches
On Sat, 2019-09-07 at 18:58 +, 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;


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: exfat: cleanup spacing for casts

2019-09-07 Thread Valentin Vidic
Fixes checkpatch.pl warnings:

  CHECK: No space is necessary after a cast

Signed-off-by: Valentin Vidic 
---
 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 <= 0x; i += 2) {
-   uni = GET16(((u8 *) tmp_bh->b_data) + i);
+   uni = GET16(((u8 *)tmp_bh->b_data) + i);
 
checksum = ((checksum & 1) ? 0x8000 : 0) +
   (checksum >> 1)