Skip to contentSkip to conversation

net: liquidio: Remove redundant pci_clear_master

PATCH Applied Cai Huoqing 4 participants 11 messages Mar 23, 2023 – Mar 24, 2023

Subsystems (13)
lore
Share & tools
lore
#0 lore raw

PATCH 1/8 net: liquidio: Remove redundant pci_clear_master

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device, like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)

{
	u16 pci_command;

	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
	if (pci_command & PCI_COMMAND_MASTER) {
		pci_command &= ~PCI_COMMAND_MASTER;
		pci_write_config_word(dev, PCI_COMMAND, pci_command);
	}

	pcibios_disable_device(dev);
}.

And dev->is_busmaster is set to 0 in pci_disable_device.

---
 drivers/net/ethernet/cavium/liquidio/lio_main.c    | 1 -
 drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 1 -
 2 files changed, 2 deletions(-)
drivers/net/ethernet/cavium/liquidio/lio_main.c +0 -1
index fd7c80edb6e8..9bd1d2d7027d 100644
@@ -1129,7 +1129,6 @@ static void octeon_destroy_resources(struct octeon_device *oct)
 
 		fallthrough;
 	case OCT_DEV_PCI_ENABLE_DONE:
-		pci_clear_master(oct->pci_dev);
 		/* Disable the device, releasing the PCI INT */
 		pci_disable_device(oct->pci_dev);
 
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +0 -1
index ac196883f07e..e2921aec3da0 100644
@@ -577,7 +577,6 @@ static void octeon_destroy_resources(struct octeon_device *oct)
 
 		fallthrough;
 	case OCT_DEV_PCI_ENABLE_DONE:
-		pci_clear_master(oct->pci_dev);
 		/* Disable the device, releasing the PCI INT */
 		pci_disable_device(oct->pci_dev);
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/8 net: hisilicon: Remove redundant pci_clear_master

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device, like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)

{
	u16 pci_command;

	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
	if (pci_command & PCI_COMMAND_MASTER) {
		pci_command &= ~PCI_COMMAND_MASTER;
		pci_write_config_word(dev, PCI_COMMAND, pci_command);
	}

	pcibios_disable_device(dev);
}.

And dev->is_busmaster is set to 0 in pci_disable_device.

---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c   | 7 ++-----
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 6 ++----
 2 files changed, 4 insertions(+), 9 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +2 -5
index 07ad5f35219e..c3851a6e10c0 100644
@@ -11365,7 +11365,7 @@ static int hclge_pci_init(struct hclge_dev *hdev)
 	if (!hw->hw.io_base) {
 		dev_err(&pdev->dev, "Can't map configuration register space\n");
 		ret = -ENOMEM;
-		goto err_clr_master;
+		goto err_release_regions;
 	}
 
 	ret = hclge_dev_mem_map(hdev);
@@ -11378,8 +11378,7 @@ static int hclge_pci_init(struct hclge_dev *hdev)
 
 err_unmap_io_base:
 	pcim_iounmap(pdev, hdev->hw.hw.io_base);
-err_clr_master:
-	pci_clear_master(pdev);
+err_release_regions:
 	pci_release_regions(pdev);
 err_disable_device:
 	pci_disable_device(pdev);
@@ -11396,7 +11395,6 @@ static void hclge_pci_uninit(struct hclge_dev *hdev)
 
 	pcim_iounmap(pdev, hdev->hw.hw.io_base);
 	pci_free_irq_vectors(pdev);
-	pci_clear_master(pdev);
 	pci_release_mem_regions(pdev);
 	pci_disable_device(pdev);
 }
@@ -11743,7 +11741,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
 	hclge_devlink_uninit(hdev);
 err_pci_uninit:
 	pcim_iounmap(pdev, hdev->hw.hw.io_base);
-	pci_clear_master(pdev);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
 out:
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +2 -4
index e84e5be8e59e..f24046250341 100644
@@ -2598,7 +2598,7 @@ static int hclgevf_pci_init(struct hclgevf_dev *hdev)
 	if (!hw->hw.io_base) {
 		dev_err(&pdev->dev, "can't map configuration register space\n");
 		ret = -ENOMEM;
-		goto err_clr_master;
+		goto err_release_regions;
 	}
 
 	ret = hclgevf_dev_mem_map(hdev);
@@ -2609,8 +2609,7 @@ static int hclgevf_pci_init(struct hclgevf_dev *hdev)
 
 err_unmap_io_base:
 	pci_iounmap(pdev, hdev->hw.hw.io_base);
-err_clr_master:
-	pci_clear_master(pdev);
+err_release_regions:
 	pci_release_regions(pdev);
 err_disable_device:
 	pci_disable_device(pdev);
@@ -2626,7 +2625,6 @@ static void hclgevf_pci_uninit(struct hclgevf_dev *hdev)
 		devm_iounmap(&pdev->dev, hdev->hw.hw.mem_base);
 
 	pci_iounmap(pdev, hdev->hw.hw.io_base);
-	pci_clear_master(pdev);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
 }
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/8 net: cxgb4vf: Remove redundant pci_clear_master

In reply to Cai Huoqing

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device, like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)

{
	u16 pci_command;

	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
	if (pci_command & PCI_COMMAND_MASTER) {
		pci_command &= ~PCI_COMMAND_MASTER;
		pci_write_config_word(dev, PCI_COMMAND, pci_command);
	}

	pcibios_disable_device(dev);
}.

And dev->is_busmaster is set to 0 in pci_disable_device.

---
 drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +0 -2
index 63b2bd084130..9ba0864592e8 100644
@@ -3258,7 +3258,6 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
 
 err_release_regions:
 	pci_release_regions(pdev);
-	pci_clear_master(pdev);
 
 err_disable_device:
 	pci_disable_device(pdev);
@@ -3338,7 +3337,6 @@ static void cxgb4vf_pci_remove(struct pci_dev *pdev)
 	 * Disable the device and release its PCI resources.
 	 */
 	pci_disable_device(pdev);
-	pci_clear_master(pdev);
 	pci_release_regions(pdev);
 }
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH 4/8 net/fungible: Remove redundant pci_clear_master

In reply to Cai Huoqing

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device, like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)

{
	u16 pci_command;

	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
	if (pci_command & PCI_COMMAND_MASTER) {
		pci_command &= ~PCI_COMMAND_MASTER;
		pci_write_config_word(dev, PCI_COMMAND, pci_command);
	}

	pcibios_disable_device(dev);
}.

And dev->is_busmaster is set to 0 in pci_disable_device.

---
 drivers/net/ethernet/fungible/funcore/fun_dev.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/fungible/funcore/fun_dev.c +0 -2
index 3680f83feba2..a7fbd4cd560a 100644
@@ -746,7 +746,6 @@ void fun_dev_disable(struct fun_dev *fdev)
 	bitmap_free(fdev->irq_map);
 	pci_free_irq_vectors(pdev);
 
-	pci_clear_master(pdev);
 	pci_disable_device(pdev);
 
 	fun_unmap_bars(fdev);
@@ -821,7 +820,6 @@ int fun_dev_enable(struct fun_dev *fdev, struct pci_dev *pdev,
 disable_admin:
 	fun_disable_admin_queue(fdev);
 free_irq_mgr:
-	pci_clear_master(pdev);
 	bitmap_free(fdev->irq_map);
 free_irqs:
 	pci_free_irq_vectors(pdev);
Signature · 1 line
2.34.1
Acked-by on v1 4/8
#4 lore raw

Re: [PATCH 4/8] net/fungible: Remove redundant pci_clear_master

Quoted 17 lines · Cai Huoqing

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device, like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)

{
        u16 pci_command;

        pci_read_config_word(dev, PCI_COMMAND, &pci_command);
        if (pci_command & PCI_COMMAND_MASTER) {
                pci_command &= ~PCI_COMMAND_MASTER;
                pci_write_config_word(dev, PCI_COMMAND, pci_command);
        }

        pcibios_disable_device(dev);
}.
Quoted 3 lines

And dev->is_busmaster is set to 0 in pci_disable_device.

Quoted 27 lines
---
 drivers/net/ethernet/fungible/funcore/fun_dev.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/fungible/funcore/fun_dev.c +0 -3
index 3680f83feba2..a7fbd4cd560a 100644
@@ -746,7 +746,6 @@ void fun_dev_disable(struct fun_dev *fdev)
        bitmap_free(fdev->irq_map);
        pci_free_irq_vectors(pdev);
 
-       pci_clear_master(pdev);
        pci_disable_device(pdev);
 
        fun_unmap_bars(fdev);
@@ -821,7 +820,6 @@ int fun_dev_enable(struct fun_dev *fdev, struct pci_dev *pdev,
 disable_admin:
        fun_disable_admin_queue(fdev);
 free_irq_mgr:
-       pci_clear_master(pdev);
        bitmap_free(fdev->irq_map);
 free_irqs:
        pci_free_irq_vectors(pdev);
--

2.34.1

#5 lore raw

PATCH 5/8 net/mlx5: Remove redundant pci_clear_master

In reply to Cai Huoqing

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device, like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)

{
	u16 pci_command;

	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
	if (pci_command & PCI_COMMAND_MASTER) {
		pci_command &= ~PCI_COMMAND_MASTER;
		pci_write_config_word(dev, PCI_COMMAND, pci_command);
	}

	pcibios_disable_device(dev);
}.

And dev->is_busmaster is set to 0 in pci_disable_device.

---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +0 -2
index d39c3476b6d1..597174ceadc9 100644
@@ -918,7 +918,6 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct pci_dev *pdev,
 	return 0;
 
 err_clr_master:
-	pci_clear_master(dev->pdev);
 	release_bar(dev->pdev);
 err_disable:
 	mlx5_pci_disable_device(dev);
@@ -933,7 +932,6 @@ static void mlx5_pci_close(struct mlx5_core_dev *dev)
 	 */
 	mlx5_drain_health_wq(dev);
 	iounmap(dev->iseg);
-	pci_clear_master(dev->pdev);
 	release_bar(dev->pdev);
 	mlx5_pci_disable_device(dev);
 }
Signature · 1 line
2.34.1
#6 lore raw

PATCH 6/8 net: mana: Remove redundant pci_clear_master

In reply to Cai Huoqing

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device, like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)

{
	u16 pci_command;

	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
	if (pci_command & PCI_COMMAND_MASTER) {
		pci_command &= ~PCI_COMMAND_MASTER;
		pci_write_config_word(dev, PCI_COMMAND, pci_command);
	}

	pcibios_disable_device(dev);
}.

And dev->is_busmaster is set to 0 in pci_disable_device.

---
 drivers/net/ethernet/microsoft/mana/gdma_main.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/microsoft/mana/gdma_main.c +0 -2
index f9b8f372ec8a..8f3f78b68592 100644
@@ -1439,7 +1439,6 @@ static int mana_gd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 release_region:
 	pci_release_regions(pdev);
 disable_dev:
-	pci_clear_master(pdev);
 	pci_disable_device(pdev);
 	dev_err(&pdev->dev, "gdma probe failed: err = %d\n", err);
 	return err;
@@ -1458,7 +1457,6 @@ static void mana_gd_remove(struct pci_dev *pdev)
 	vfree(gc);
 
 	pci_release_regions(pdev);
-	pci_clear_master(pdev);
 	pci_disable_device(pdev);
 }
 
Signature · 1 line
2.34.1
#7 lore raw

PATCH 7/8 ionic: Remove redundant pci_clear_master

In reply to Cai Huoqing

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device, like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)

{
	u16 pci_command;

	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
	if (pci_command & PCI_COMMAND_MASTER) {
		pci_command &= ~PCI_COMMAND_MASTER;
		pci_write_config_word(dev, PCI_COMMAND, pci_command);
	}

	pcibios_disable_device(dev);
}.

And dev->is_busmaster is set to 0 in pci_disable_device.

---
 drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +0 -1
index e508f8eb43bf..b8678da1cce5 100644
@@ -392,7 +392,6 @@ static void ionic_remove(struct pci_dev *pdev)
 	ionic_port_reset(ionic);
 	ionic_reset(ionic);
 	ionic_dev_teardown(ionic);
-	pci_clear_master(pdev);
 	ionic_unmap_bars(ionic);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
Signature · 1 line
2.34.1
Acked-by on v1 7/8
#8 lore raw

Re: [PATCH 7/8] ionic: Remove redundant pci_clear_master

Quoted 16 lines · Cai Huoqing

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device, like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)

{
         u16 pci_command;

         pci_read_config_word(dev, PCI_COMMAND, &pci_command);
         if (pci_command & PCI_COMMAND_MASTER) {
                 pci_command &= ~PCI_COMMAND_MASTER;
                 pci_write_config_word(dev, PCI_COMMAND, pci_command);
         }

         pcibios_disable_device(dev);
}.
Quoted 3 lines

And dev->is_busmaster is set to 0 in pci_disable_device.

Thanks!
sln

Quoted 19 lines
---
  drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 1 -
  1 file changed, 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +0 -2
index e508f8eb43bf..b8678da1cce5 100644
@@ -392,7 +392,6 @@ static void ionic_remove(struct pci_dev *pdev)
         ionic_port_reset(ionic);
         ionic_reset(ionic);
         ionic_dev_teardown(ionic);
-       pci_clear_master(pdev);
         ionic_unmap_bars(ionic);
         pci_release_regions(pdev);
         pci_disable_device(pdev);
--

2.34.1

#9 lore raw

PATCH 8/8 ethernet: ec_bhf: Remove redundant pci_clear_master

In reply to Cai Huoqing

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device, like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)

{
	u16 pci_command;

	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
	if (pci_command & PCI_COMMAND_MASTER) {
		pci_command &= ~PCI_COMMAND_MASTER;
		pci_write_config_word(dev, PCI_COMMAND, pci_command);
	}

	pcibios_disable_device(dev);
}.

And dev->is_busmaster is set to 0 in pci_disable_device.

---
 drivers/net/ethernet/ec_bhf.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/ec_bhf.c +0 -2
index 46e3a05e9582..c2c5c589a5e3 100644
@@ -558,7 +558,6 @@ static int ec_bhf_probe(struct pci_dev *dev, const struct pci_device_id *id)
 err_release_regions:
 	pci_release_regions(dev);
 err_disable_dev:
-	pci_clear_master(dev);
 	pci_disable_device(dev);
 
 	return err;
@@ -577,7 +576,6 @@ static void ec_bhf_remove(struct pci_dev *dev)
 	free_netdev(net_dev);
 
 	pci_release_regions(dev);
-	pci_clear_master(dev);
 	pci_disable_device(dev);
 }
 
Signature · 1 line
2.34.1
#10 lore raw
In reply to Cai Huoqing
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 9 lines · On Thu, 23 Mar 2023 17:03:00 +0800 you wrote:

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device, like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)

{
	u16 pci_command;

[...]

Here is the summary with links:
- [1/8] net: liquidio: Remove redundant pci_clear_master

    https://git.kernel.org/netdev/net-next/c/fc5aba60c244
  - [2/8] net: hisilicon: Remove redundant pci_clear_master
    https://git.kernel.org/netdev/net-next/c/fc3e07e83e8e
  - [3/8] net: cxgb4vf: Remove redundant pci_clear_master
    https://git.kernel.org/netdev/net-next/c/aae964bb7800
  - [4/8] net/fungible: Remove redundant pci_clear_master
    https://git.kernel.org/netdev/net-next/c/8b91d5b62ce8
  - [5/8] net/mlx5: Remove redundant pci_clear_master
    https://git.kernel.org/netdev/net-next/c/5b6f4bd24c8d
  - [6/8] net: mana: Remove redundant pci_clear_master
    https://git.kernel.org/netdev/net-next/c/2d59af830752
  - [7/8] ionic: Remove redundant pci_clear_master
    https://git.kernel.org/netdev/net-next/c/f686e9592734
  - [8/8] ethernet: ec_bhf: Remove redundant pci_clear_master
    https://git.kernel.org/netdev/net-next/c/3228150ba688

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html