mbox series

[0/5] debugfs: Remove casts in debugfs_create_*() callers

Message ID 20191021145149.31657-1-geert+renesas@glider.be (mailing list archive)
Headers show
Series debugfs: Remove casts in debugfs_create_*() callers | expand

Message

Geert Uytterhoeven Oct. 21, 2019, 2:51 p.m. UTC
Hi all,

Casting parameters in debugfs_create_*() calls prevents the compiler
from performing some checks.

Hence this patch series removes superfluous casts, or reworks code to no
longer need the casts.

All patches can be applied independently, there are no dependencies.
Thanks for your comments!

Geert Uytterhoeven (5):
  crypto: nx - Improve debugfs_create_u{32,64}() handling for atomics
  cxgb4/cxgb4vf: Remove superfluous void * cast in debugfs_create_file()
    call
  drm/amdgpu: Remove superfluous void * cast in debugfs_create_file()
    call
  power: avs: smartreflex: Remove superfluous cast in
    debugfs_create_file() call
  ionic: Use debugfs_create_bool() to export bool

 drivers/crypto/nx/nx_debugfs.c                 | 18 +++++++++---------
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c    |  4 ++--
 .../ethernet/chelsio/cxgb4vf/cxgb4vf_main.c    |  2 +-
 .../ethernet/pensando/ionic/ionic_debugfs.c    |  3 +--
 drivers/power/avs/smartreflex.c                |  2 +-
 5 files changed, 14 insertions(+), 15 deletions(-)

Comments

Herbert Xu Oct. 25, 2019, 3:27 p.m. UTC | #1
On Mon, Oct 21, 2019 at 04:51:45PM +0200, Geert Uytterhoeven wrote:
> Variables of type atomic{,64}_t can be used fine with
> debugfs_create_u{32,64}, when passing a pointer to the embedded counter.
> This allows to get rid of the casts, which prevented compiler checks.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/crypto/nx/nx_debugfs.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)

Patch applied.  Thanks.
Rafael J. Wysocki Nov. 8, 2019, 11:24 a.m. UTC | #2
On Monday, October 21, 2019 4:51:48 PM CET Geert Uytterhoeven wrote:
> There is no need to cast a typed pointer to a void pointer when calling
> a function that accepts the latter.  Remove it, as the cast prevents
> further compiler checks.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Greg, have you taken this one by any chance?

> ---
>  drivers/power/avs/smartreflex.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
> index 4684e7df833a81e9..5376f3d22f31eade 100644
> --- a/drivers/power/avs/smartreflex.c
> +++ b/drivers/power/avs/smartreflex.c
> @@ -905,7 +905,7 @@ static int omap_sr_probe(struct platform_device *pdev)
>  	sr_info->dbg_dir = debugfs_create_dir(sr_info->name, sr_dbg_dir);
>  
>  	debugfs_create_file("autocomp", S_IRUGO | S_IWUSR, sr_info->dbg_dir,
> -			    (void *)sr_info, &pm_sr_fops);
> +			    sr_info, &pm_sr_fops);
>  	debugfs_create_x32("errweight", S_IRUGO, sr_info->dbg_dir,
>  			   &sr_info->err_weight);
>  	debugfs_create_x32("errmaxlimit", S_IRUGO, sr_info->dbg_dir,
>
Greg KH Nov. 8, 2019, 11:37 a.m. UTC | #3
On Fri, Nov 08, 2019 at 12:24:42PM +0100, Rafael J. Wysocki wrote:
> On Monday, October 21, 2019 4:51:48 PM CET Geert Uytterhoeven wrote:
> > There is no need to cast a typed pointer to a void pointer when calling
> > a function that accepts the latter.  Remove it, as the cast prevents
> > further compiler checks.
> > 
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> Greg, have you taken this one by any chance?

Nope, it's all yours!  :)
Rafael J. Wysocki Nov. 13, 2019, 11:02 a.m. UTC | #4
On Monday, October 21, 2019 4:51:48 PM CET Geert Uytterhoeven wrote:
> There is no need to cast a typed pointer to a void pointer when calling
> a function that accepts the latter.  Remove it, as the cast prevents
> further compiler checks.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/power/avs/smartreflex.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
> index 4684e7df833a81e9..5376f3d22f31eade 100644
> --- a/drivers/power/avs/smartreflex.c
> +++ b/drivers/power/avs/smartreflex.c
> @@ -905,7 +905,7 @@ static int omap_sr_probe(struct platform_device *pdev)
>  	sr_info->dbg_dir = debugfs_create_dir(sr_info->name, sr_dbg_dir);
>  
>  	debugfs_create_file("autocomp", S_IRUGO | S_IWUSR, sr_info->dbg_dir,
> -			    (void *)sr_info, &pm_sr_fops);
> +			    sr_info, &pm_sr_fops);
>  	debugfs_create_x32("errweight", S_IRUGO, sr_info->dbg_dir,
>  			   &sr_info->err_weight);
>  	debugfs_create_x32("errmaxlimit", S_IRUGO, sr_info->dbg_dir,
> 

Applying as 5.5 material, thanks!