Skip to contentSkip to conversation

drm/mgag200: Don't read-back PCI option register before writing

PATCH In review Thomas Zimmermann 2 participants 2 messages Jul 8, 2022 – Jul 11, 2022

Subsystems (3)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

PATCH 1/1 drm/mgag200: Don't read-back PCI option register before writing

Remove the read operation from mgag200_init_pci_options(). It was incorrectly added while refactoring the code. Reading the PCI option register clears the register's new value and subsequently leads to re-writing the old value.

Fixes ce19021fd99a ("drm/mgag200: Move PCI-option setup into model-specific code")
Cc Thomas Zimmermann <[email protected]>
Cc Jocelyn Falempe <[email protected]>
Cc Dave Airlie <[email protected]>
---
 drivers/gpu/drm/mgag200/mgag200_drv.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +0 -6
index 73e8e4e9e54b..251a1bb648cc 100644
@@ -28,12 +28,6 @@ int mgag200_init_pci_options(struct pci_dev *pdev, u32 option, u32 option2)
 	struct device *dev = &pdev->dev;
 	int err;
 
-	err = pci_read_config_dword(pdev, PCI_MGA_OPTION, &option);
-	if (err != PCIBIOS_SUCCESSFUL) {
-		dev_err(dev, "pci_read_config_dword(PCI_MGA_OPTION) failed: %d\n", err);
-		return pcibios_err_to_errno(err);
-	}
-
 	err = pci_write_config_dword(pdev, PCI_MGA_OPTION, option);
 	if (err != PCIBIOS_SUCCESSFUL) {
 		dev_err(dev, "pci_write_config_dword(PCI_MGA_OPTION) failed: %d\n", err);
Signature · 1 line
2.36.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Thomas Zimmermann

Remove the read operation from mgag200_init_pci_options(). It was incorrectly added while refactoring the code. Reading the PCI option register clears the register's new value and subsequently leads to re-writing the old value.

Looks good to me.

Quoted 27 lines
Fixes ce19021fd99a ("drm/mgag200: Move PCI-option setup into model-specific code")
Cc Thomas Zimmermann <[email protected]>
Cc Jocelyn Falempe <[email protected]>
Cc Dave Airlie <[email protected]>
---
  drivers/gpu/drm/mgag200/mgag200_drv.c | 6 ------
  1 file changed, 6 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +0 -6
index 73e8e4e9e54b..251a1bb648cc 100644
@@ -28,12 +28,6 @@ int mgag200_init_pci_options(struct pci_dev *pdev, u32 option, u32 option2)
  	struct device *dev = &pdev->dev;
  	int err;
 
-	err = pci_read_config_dword(pdev, PCI_MGA_OPTION, &option);
-	if (err != PCIBIOS_SUCCESSFUL) {
-		dev_err(dev, "pci_read_config_dword(PCI_MGA_OPTION) failed: %d\n", err);
-		return pcibios_err_to_errno(err);
-	}
-
  	err = pci_write_config_dword(pdev, PCI_MGA_OPTION, option);
  	if (err != PCIBIOS_SUCCESSFUL) {
  		dev_err(dev, "pci_write_config_dword(PCI_MGA_OPTION) failed: %d\n", err);