[PATCH] drm/radeon: Avoid externs & do not initialize globals to 0 in radeon_drv.c

Alex Deucher alexdeucher at gmail.com
Fri Jul 21 15:44:56 UTC 2023


On Sat, Jul 15, 2023 at 11:26 AM Srinivasan Shanmugam
<srinivasan.shanmugam at amd.com> wrote:
>
> Fixes the following:
>
>  - WARNING: externs should be avoided in .c files
>  - ERROR: do not initialise globals to 0
>  - WARNING: Missing a blank line after declarations
>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/radeon/radeon_drv.c | 51 ++++++++---------------------
>  drivers/gpu/drm/radeon/radeon_drv.h | 13 ++++++++
>  2 files changed, 27 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index e4374814f0ef..aa02697e5ea3 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -113,59 +113,32 @@
>  #define KMS_DRIVER_MAJOR       2
>  #define KMS_DRIVER_MINOR       50
>  #define KMS_DRIVER_PATCHLEVEL  0
> -int radeon_suspend_kms(struct drm_device *dev, bool suspend,
> -                      bool fbcon, bool freeze);
> -int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
> -extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int crtc,
> -                                     unsigned int flags, int *vpos, int *hpos,
> -                                     ktime_t *stime, ktime_t *etime,
> -                                     const struct drm_display_mode *mode);
> -extern bool radeon_is_px(struct drm_device *dev);
> -int radeon_mode_dumb_mmap(struct drm_file *filp,
> -                         struct drm_device *dev,
> -                         uint32_t handle, uint64_t *offset_p);
> -int radeon_mode_dumb_create(struct drm_file *file_priv,
> -                           struct drm_device *dev,
> -                           struct drm_mode_create_dumb *args);
> -
> -/* atpx handler */
> -#if defined(CONFIG_VGA_SWITCHEROO)
> -void radeon_register_atpx_handler(void);
> -void radeon_unregister_atpx_handler(void);
> -bool radeon_has_atpx_dgpu_power_cntl(void);
> -bool radeon_is_atpx_hybrid(void);
> -#else
> -static inline void radeon_register_atpx_handler(void) {}
> -static inline void radeon_unregister_atpx_handler(void) {}
> -static inline bool radeon_has_atpx_dgpu_power_cntl(void) { return false; }
> -static inline bool radeon_is_atpx_hybrid(void) { return false; }
> -#endif
>
>  int radeon_no_wb;
>  int radeon_modeset = -1;
>  int radeon_dynclks = -1;
> -int radeon_r4xx_atom = 0;
> +int radeon_r4xx_atom;
>  int radeon_agpmode = -1;
> -int radeon_vram_limit = 0;
> +int radeon_vram_limit;
>  int radeon_gart_size = -1; /* auto */
> -int radeon_benchmarking = 0;
> -int radeon_testing = 0;
> -int radeon_connector_table = 0;
> +int radeon_benchmarking;
> +int radeon_testing;
> +int radeon_connector_table;
>  int radeon_tv = 1;
>  int radeon_audio = -1;
> -int radeon_disp_priority = 0;
> -int radeon_hw_i2c = 0;
> +int radeon_disp_priority;
> +int radeon_hw_i2c;
>  int radeon_pcie_gen2 = -1;
>  int radeon_msi = -1;
>  int radeon_lockup_timeout = 10000;
> -int radeon_fastfb = 0;
> +int radeon_fastfb;
>  int radeon_dpm = -1;
>  int radeon_aspm = -1;
>  int radeon_runtime_pm = -1;
> -int radeon_hard_reset = 0;
> +int radeon_hard_reset;
>  int radeon_vm_size = 8;
>  int radeon_vm_block_size = -1;
> -int radeon_deep_color = 0;
> +int radeon_deep_color;
>  int radeon_use_pflipirq = 2;
>  int radeon_bapm = -1;
>  int radeon_backlight = -1;
> @@ -384,6 +357,7 @@ radeon_pci_shutdown(struct pci_dev *pdev)
>  static int radeon_pmops_suspend(struct device *dev)
>  {
>         struct drm_device *drm_dev = dev_get_drvdata(dev);
> +
>         return radeon_suspend_kms(drm_dev, true, true, false);
>  }
>
> @@ -404,12 +378,14 @@ static int radeon_pmops_resume(struct device *dev)
>  static int radeon_pmops_freeze(struct device *dev)
>  {
>         struct drm_device *drm_dev = dev_get_drvdata(dev);
> +
>         return radeon_suspend_kms(drm_dev, false, true, true);
>  }
>
>  static int radeon_pmops_thaw(struct device *dev)
>  {
>         struct drm_device *drm_dev = dev_get_drvdata(dev);
> +
>         return radeon_resume_kms(drm_dev, false, true);
>  }
>
> @@ -494,6 +470,7 @@ long radeon_drm_ioctl(struct file *filp,
>         struct drm_file *file_priv = filp->private_data;
>         struct drm_device *dev;
>         long ret;
> +
>         dev = file_priv->minor->dev;
>         ret = pm_runtime_get_sync(dev->dev);
>         if (ret < 0) {
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h
> index 2ffe0975ee54..34a1c73d3938 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.h
> +++ b/drivers/gpu/drm/radeon/radeon_drv.h
> @@ -124,4 +124,17 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv);
>  void radeon_driver_postclose_kms(struct drm_device *dev,
>                                  struct drm_file *file_priv);
>
> +/* atpx handler */
> +#if defined(CONFIG_VGA_SWITCHEROO)
> +void radeon_register_atpx_handler(void);
> +void radeon_unregister_atpx_handler(void);
> +bool radeon_has_atpx_dgpu_power_cntl(void);
> +bool radeon_is_atpx_hybrid(void);
> +#else
> +static inline void radeon_register_atpx_handler(void) {}
> +static inline void radeon_unregister_atpx_handler(void) {}
> +static inline bool radeon_has_atpx_dgpu_power_cntl(void) { return false; }
> +static inline bool radeon_is_atpx_hybrid(void) { return false; }
> +#endif
> +
>  #endif                         /* __RADEON_DRV_H__ */
> --
> 2.25.1
>


More information about the amd-gfx mailing list