[PATCH] drm/ast: Do not enable PCI resources multiple times

Jocelyn Falempe jfalempe at redhat.com
Thu Jul 13 07:13:05 UTC 2023


On 12/07/2023 15:08, Thomas Zimmermann wrote:
> Remove ast_init_pci_config() as the ast driver already enables the PCI
> resources by calling pcim_enable_device().
> 
> Suggested-by: Sui Jingfeng <suijingfeng at loongson.cn>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
>   drivers/gpu/drm/ast/ast_main.c | 21 ---------------------
>   1 file changed, 21 deletions(-)
> 

looks good to me.
indeed pcim_enable_device() call pci_enable_resources() which set
PCI_COMMAND_MEMORY and PCI_COMMAND_IO flags.

Reviewed-by: Jocelyn Falempe <jfalempe at redhat.com>


Best regards,

-- 

Jocelyn


> diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
> index 8bfbdfd86d77..dae365ed3969 100644
> --- a/drivers/gpu/drm/ast/ast_main.c
> +++ b/drivers/gpu/drm/ast/ast_main.c
> @@ -35,23 +35,6 @@
>   
>   #include "ast_drv.h"
>   
> -static int ast_init_pci_config(struct pci_dev *pdev)
> -{
> -	int err;
> -	u16 pcis04;
> -
> -	err = pci_read_config_word(pdev, PCI_COMMAND, &pcis04);
> -	if (err)
> -		goto out;
> -
> -	pcis04 |= PCI_COMMAND_MEMORY | PCI_COMMAND_IO;
> -
> -	err = pci_write_config_word(pdev, PCI_COMMAND, pcis04);
> -
> -out:
> -	return pcibios_err_to_errno(err);
> -}
> -
>   static bool ast_is_vga_enabled(struct drm_device *dev)
>   {
>   	struct ast_device *ast = to_ast_device(dev);
> @@ -483,10 +466,6 @@ struct ast_device *ast_device_create(const struct drm_driver *drv,
>   			return ERR_PTR(-EIO);
>   	}
>   
> -	ret = ast_init_pci_config(pdev);
> -	if (ret)
> -		return ERR_PTR(ret);
> -
>   	if (!ast_is_vga_enabled(dev)) {
>   		drm_info(dev, "VGA not enabled on entry, requesting chip POST\n");
>   		need_post = true;



More information about the dri-devel mailing list