[PATCH 02/21] dm: pci: Update the PCI read_config() method to const dev *

Simon Glass sjg at chromium.org
Mon Jan 27 16:49:37 CET 2020


At present this method uses a non-const udevice pointer, but the call
should not modify the device. Use a const pointer.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/misc/p2sb_emul.c           |  5 +++--
 drivers/misc/swap_case.c           |  9 +++++----
 drivers/pci/pci-aardvark.c         |  2 +-
 drivers/pci/pci-emul-uclass.c      |  2 +-
 drivers/pci/pci-rcar-gen2.c        |  4 ++--
 drivers/pci/pci-rcar-gen3.c        |  2 +-
 drivers/pci/pci-uclass.c           | 14 ++++++++------
 drivers/pci/pci_mpc85xx.c          |  2 +-
 drivers/pci/pci_mvebu.c            |  2 +-
 drivers/pci/pci_sandbox.c          |  2 +-
 drivers/pci/pci_sh7751.c           |  2 +-
 drivers/pci/pci_tegra.c            |  2 +-
 drivers/pci/pci_x86.c              |  5 +++--
 drivers/pci/pcie_dw_mvebu.c        |  2 +-
 drivers/pci/pcie_dw_ti.c           |  2 +-
 drivers/pci/pcie_ecam_generic.c    | 11 ++++++-----
 drivers/pci/pcie_fsl.c             |  2 +-
 drivers/pci/pcie_imx.c             |  2 +-
 drivers/pci/pcie_intel_fpga.c      |  4 ++--
 drivers/pci/pcie_layerscape.c      |  4 ++--
 drivers/pci/pcie_layerscape_gen4.c |  2 +-
 drivers/pci/pcie_mediatek.c        |  4 ++--
 drivers/pci/pcie_phytium.c         |  7 +++----
 drivers/pci/pcie_xilinx.c          |  4 ++--
 drivers/power/acpi_pmc/pmc_emul.c  |  2 +-
 include/pci.h                      | 22 ++++++++++++----------
 26 files changed, 64 insertions(+), 57 deletions(-)

diff --git a/drivers/misc/p2sb_emul.c b/drivers/misc/p2sb_emul.c
index c3795c59c0..a6ee9a235e 100644
--- a/drivers/misc/p2sb_emul.c
+++ b/drivers/misc/p2sb_emul.c
@@ -48,8 +48,9 @@ struct p2sb_emul_priv {
 	u8 regs[16];
 };
 
-static int sandbox_p2sb_emul_read_config(struct udevice *emul, uint offset,
-					 ulong *valuep, enum pci_size_t size)
+static int sandbox_p2sb_emul_read_config(const struct udevice *emul,
+					 uint offset, ulong *valuep,
+					 enum pci_size_t size)
 {
 	struct p2sb_emul_platdata *plat = dev_get_platdata(emul);
 
diff --git a/drivers/misc/swap_case.c b/drivers/misc/swap_case.c
index 11189d16c8..97e2afa676 100644
--- a/drivers/misc/swap_case.c
+++ b/drivers/misc/swap_case.c
@@ -51,7 +51,7 @@ struct swap_case_priv {
 	char mem_text[MEM_TEXT_SIZE];
 };
 
-static int sandbox_swap_case_use_ea(struct udevice *dev)
+static int sandbox_swap_case_use_ea(const struct udevice *dev)
 {
 	return !!ofnode_get_property(dev->node, "use-ea", NULL);
 }
@@ -82,7 +82,7 @@ static const u32 ea_regs[] = {
 	PCI_CAP_EA_SIZE_HI,
 };
 
-static int sandbox_swap_case_read_ea(struct udevice *emul, uint offset,
+static int sandbox_swap_case_read_ea(const struct udevice *emul, uint offset,
 				     ulong *valuep, enum pci_size_t size)
 {
 	u32 reg;
@@ -95,8 +95,9 @@ static int sandbox_swap_case_read_ea(struct udevice *emul, uint offset,
 	return 0;
 }
 
-static int sandbox_swap_case_read_config(struct udevice *emul, uint offset,
-					 ulong *valuep, enum pci_size_t size)
+static int sandbox_swap_case_read_config(const struct udevice *emul,
+					 uint offset, ulong *valuep,
+					 enum pci_size_t size)
 {
 	struct swap_case_platdata *plat = dev_get_platdata(emul);
 
diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c
index aa0b4bc845..f1527ac667 100644
--- a/drivers/pci/pci-aardvark.c
+++ b/drivers/pci/pci-aardvark.c
@@ -297,7 +297,7 @@ static int pcie_advk_check_pio_status(struct pcie_advk *pcie,
  *
  * Return: 0 on success
  */
-static int pcie_advk_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pcie_advk_read_config(const struct udevice *bus, pci_dev_t bdf,
 				 uint offset, ulong *valuep,
 				 enum pci_size_t size)
 {
diff --git a/drivers/pci/pci-emul-uclass.c b/drivers/pci/pci-emul-uclass.c
index 0f63e491a7..9486e1cb96 100644
--- a/drivers/pci/pci-emul-uclass.c
+++ b/drivers/pci/pci-emul-uclass.c
@@ -15,7 +15,7 @@ struct sandbox_pci_emul_priv {
 	int dev_count;
 };
 
-int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn,
+int sandbox_pci_get_emul(const struct udevice *bus, pci_dev_t find_devfn,
 			 struct udevice **containerp, struct udevice **emulp)
 {
 	struct pci_emul_uc_priv *upriv;
diff --git a/drivers/pci/pci-rcar-gen2.c b/drivers/pci/pci-rcar-gen2.c
index d913d53f3c..014d870478 100644
--- a/drivers/pci/pci-rcar-gen2.c
+++ b/drivers/pci/pci-rcar-gen2.c
@@ -107,7 +107,7 @@ static int rcar_gen2_pci_addr_valid(pci_dev_t d, uint offset)
 	return 0;
 }
 
-static u32 get_bus_address(struct udevice *dev, pci_dev_t bdf, u32 offset)
+static u32 get_bus_address(const struct udevice *dev, pci_dev_t bdf, u32 offset)
 {
 	struct rcar_gen2_pci_priv *priv = dev_get_priv(dev);
 
@@ -126,7 +126,7 @@ static u32 setup_bus_address(struct udevice *dev, pci_dev_t bdf, u32 offset)
 	return get_bus_address(dev, bdf, offset);
 }
 
-static int rcar_gen2_pci_read_config(struct udevice *dev, pci_dev_t bdf,
+static int rcar_gen2_pci_read_config(const struct udevice *dev, pci_dev_t bdf,
 				     uint offset, ulong *value,
 				     enum pci_size_t size)
 {
diff --git a/drivers/pci/pci-rcar-gen3.c b/drivers/pci/pci-rcar-gen3.c
index 52ca13b70c..4ea7930613 100644
--- a/drivers/pci/pci-rcar-gen3.c
+++ b/drivers/pci/pci-rcar-gen3.c
@@ -204,7 +204,7 @@ static int rcar_gen3_pcie_addr_valid(pci_dev_t d, uint where)
 	return 0;
 }
 
-static int rcar_gen3_pcie_read_config(struct udevice *dev, pci_dev_t bdf,
+static int rcar_gen3_pcie_read_config(const struct udevice *dev, pci_dev_t bdf,
 				      uint where, ulong *val,
 				      enum pci_size_t size)
 {
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 5be2dfd0bf..78d4129572 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -124,7 +124,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf,
 	}
 };
 
-int pci_bus_find_devfn(struct udevice *bus, pci_dev_t find_devfn,
+int pci_bus_find_devfn(const struct udevice *bus, pci_dev_t find_devfn,
 		       struct udevice **devp)
 {
 	struct udevice *dev;
@@ -551,8 +551,9 @@ int pci_auto_config_devices(struct udevice *bus)
 }
 
 int pci_generic_mmap_write_config(
-	struct udevice *bus,
-	int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
+	const struct udevice *bus,
+	int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset,
+		      void **addrp),
 	pci_dev_t bdf,
 	uint offset,
 	ulong value,
@@ -579,8 +580,9 @@ int pci_generic_mmap_write_config(
 }
 
 int pci_generic_mmap_read_config(
-	struct udevice *bus,
-	int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
+	const struct udevice *bus,
+	int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset,
+		      void **addrp),
 	pci_dev_t bdf,
 	uint offset,
 	ulong *valuep,
@@ -1054,7 +1056,7 @@ static int pci_uclass_child_post_bind(struct udevice *dev)
 	return 0;
 }
 
-static int pci_bridge_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pci_bridge_read_config(const struct udevice *bus, pci_dev_t bdf,
 				  uint offset, ulong *valuep,
 				  enum pci_size_t size)
 {
diff --git a/drivers/pci/pci_mpc85xx.c b/drivers/pci/pci_mpc85xx.c
index e58ab60ee0..8dff68dbd0 100644
--- a/drivers/pci/pci_mpc85xx.c
+++ b/drivers/pci/pci_mpc85xx.c
@@ -15,7 +15,7 @@ struct mpc85xx_pci_priv {
 	void __iomem		*cfg_data;
 };
 
-static int mpc85xx_pci_dm_read_config(struct udevice *dev, pci_dev_t bdf,
+static int mpc85xx_pci_dm_read_config(const struct udevice *dev, pci_dev_t bdf,
 				      uint offset, ulong *value,
 				      enum pci_size_t size)
 {
diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
index f9b08f38a1..7d9ad34e9d 100644
--- a/drivers/pci/pci_mvebu.c
+++ b/drivers/pci/pci_mvebu.c
@@ -136,7 +136,7 @@ static inline struct mvebu_pcie *hose_to_pcie(struct pci_controller *hose)
 	return container_of(hose, struct mvebu_pcie, hose);
 }
 
-static int mvebu_pcie_read_config(struct udevice *bus, pci_dev_t bdf,
+static int mvebu_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
 				  uint offset, ulong *valuep,
 				  enum pci_size_t size)
 {
diff --git a/drivers/pci/pci_sandbox.c b/drivers/pci/pci_sandbox.c
index 2af2b79c05..fa4c476597 100644
--- a/drivers/pci/pci_sandbox.c
+++ b/drivers/pci/pci_sandbox.c
@@ -39,7 +39,7 @@ static int sandbox_pci_write_config(struct udevice *bus, pci_dev_t devfn,
 	return ops->write_config(emul, offset, value, size);
 }
 
-static int sandbox_pci_read_config(struct udevice *bus, pci_dev_t devfn,
+static int sandbox_pci_read_config(const struct udevice *bus, pci_dev_t devfn,
 				   uint offset, ulong *valuep,
 				   enum pci_size_t size)
 {
diff --git a/drivers/pci/pci_sh7751.c b/drivers/pci/pci_sh7751.c
index 53e1668c99..b39c6283db 100644
--- a/drivers/pci/pci_sh7751.c
+++ b/drivers/pci/pci_sh7751.c
@@ -85,7 +85,7 @@ static u32 get_bus_address(struct udevice *dev, pci_dev_t bdf, u32 offset)
 	return BIT(31) | (PCI_DEV(bdf) << 8) | (offset & ~3);
 }
 
-static int sh7751_pci_read_config(struct udevice *dev, pci_dev_t bdf,
+static int sh7751_pci_read_config(const struct udevice *dev, pci_dev_t bdf,
 				  uint offset, ulong *value,
 				  enum pci_size_t size)
 {
diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
index 56c08585e6..96d308f7bf 100644
--- a/drivers/pci/pci_tegra.c
+++ b/drivers/pci/pci_tegra.c
@@ -308,7 +308,7 @@ static int tegra_pcie_conf_address(struct tegra_pcie *pcie, pci_dev_t bdf,
 	}
 }
 
-static int pci_tegra_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pci_tegra_read_config(const struct udevice *bus, pci_dev_t bdf,
 				 uint offset, ulong *valuep,
 				 enum pci_size_t size)
 {
diff --git a/drivers/pci/pci_x86.c b/drivers/pci/pci_x86.c
index e76a9c6e44..8d036930e7 100644
--- a/drivers/pci/pci_x86.c
+++ b/drivers/pci/pci_x86.c
@@ -8,8 +8,9 @@
 #include <pci.h>
 #include <asm/pci.h>
 
-static int _pci_x86_read_config(struct udevice *bus, pci_dev_t bdf, uint offset,
-				ulong *valuep, enum pci_size_t size)
+static int _pci_x86_read_config(const struct udevice *bus, pci_dev_t bdf,
+				uint offset, ulong *valuep,
+				enum pci_size_t size)
 {
 	return pci_x86_read_config(bdf, offset, valuep, size);
 }
diff --git a/drivers/pci/pcie_dw_mvebu.c b/drivers/pci/pcie_dw_mvebu.c
index 693591e375..1f216e1c68 100644
--- a/drivers/pci/pcie_dw_mvebu.c
+++ b/drivers/pci/pcie_dw_mvebu.c
@@ -240,7 +240,7 @@ static int pcie_dw_addr_valid(pci_dev_t d, int first_busno)
  *
  * Return: 0 on success
  */
-static int pcie_dw_mvebu_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pcie_dw_mvebu_read_config(const struct udevice *bus, pci_dev_t bdf,
 				     uint offset, ulong *valuep,
 				     enum pci_size_t size)
 {
diff --git a/drivers/pci/pcie_dw_ti.c b/drivers/pci/pcie_dw_ti.c
index b37fc2de7f..433640d3e7 100644
--- a/drivers/pci/pcie_dw_ti.c
+++ b/drivers/pci/pcie_dw_ti.c
@@ -289,7 +289,7 @@ static int pcie_dw_addr_valid(pci_dev_t d, int first_busno)
  *
  * Return: 0 on success
  */
-static int pcie_dw_ti_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pcie_dw_ti_read_config(const struct udevice *bus, pci_dev_t bdf,
 				  uint offset, ulong *valuep,
 				  enum pci_size_t size)
 {
diff --git a/drivers/pci/pcie_ecam_generic.c b/drivers/pci/pcie_ecam_generic.c
index 00644edd26..c875f3a5b7 100644
--- a/drivers/pci/pcie_ecam_generic.c
+++ b/drivers/pci/pcie_ecam_generic.c
@@ -35,8 +35,9 @@ struct generic_ecam_pcie {
  * code. Otherwise the address to access will be written to the pointer pointed
  * to by @paddress.
  */
-static int pci_generic_ecam_conf_address(struct udevice *bus, pci_dev_t bdf,
-					    uint offset, void **paddress)
+static int pci_generic_ecam_conf_address(const struct udevice *bus,
+					 pci_dev_t bdf, uint offset,
+					 void **paddress)
 {
 	struct generic_ecam_pcie *pcie = dev_get_priv(bus);
 	void *addr;
@@ -63,9 +64,9 @@ static int pci_generic_ecam_conf_address(struct udevice *bus, pci_dev_t bdf,
  * space of the device identified by the bus, device & function numbers in @bdf
  * on the PCI bus @bus.
  */
-static int pci_generic_ecam_read_config(struct udevice *bus, pci_dev_t bdf,
-				   uint offset, ulong *valuep,
-				   enum pci_size_t size)
+static int pci_generic_ecam_read_config(const struct udevice *bus,
+					pci_dev_t bdf, uint offset,
+					ulong *valuep, enum pci_size_t size)
 {
 	return pci_generic_mmap_read_config(bus, pci_generic_ecam_conf_address,
 					    bdf, offset, valuep, size);
diff --git a/drivers/pci/pcie_fsl.c b/drivers/pci/pcie_fsl.c
index ab25aeee73..f516ec0576 100644
--- a/drivers/pci/pcie_fsl.c
+++ b/drivers/pci/pcie_fsl.c
@@ -42,7 +42,7 @@ static int fsl_pcie_addr_valid(struct fsl_pcie *pcie, pci_dev_t bdf)
 	return 0;
 }
 
-static int fsl_pcie_read_config(struct udevice *bus, pci_dev_t bdf,
+static int fsl_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
 				uint offset, ulong *valuep,
 				enum pci_size_t size)
 {
diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index 3621636cb2..8e1713a2d1 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -748,7 +748,7 @@ void pci_init_board(void)
 	imx_pcie_init();
 }
 #else
-static int imx_pcie_dm_read_config(struct udevice *dev, pci_dev_t bdf,
+static int imx_pcie_dm_read_config(const struct udevice *dev, pci_dev_t bdf,
 				   uint offset, ulong *value,
 				   enum pci_size_t size)
 {
diff --git a/drivers/pci/pcie_intel_fpga.c b/drivers/pci/pcie_intel_fpga.c
index a5ea4888f3..a1f6e95e69 100644
--- a/drivers/pci/pcie_intel_fpga.c
+++ b/drivers/pci/pcie_intel_fpga.c
@@ -226,7 +226,7 @@ static int tlp_cfg_dword_write(struct intel_fpga_pcie *pcie, pci_dev_t bdf,
 	return tlp_read_packet(pcie, NULL);
 }
 
-int intel_fpga_rp_conf_addr(struct udevice *bus, pci_dev_t bdf,
+int intel_fpga_rp_conf_addr(const struct udevice *bus, pci_dev_t bdf,
 			    uint offset, void **paddress)
 {
 	struct intel_fpga_pcie *pcie = dev_get_priv(bus);
@@ -326,7 +326,7 @@ static int _pcie_intel_fpga_write_config(struct intel_fpga_pcie *pcie,
 				   byte_en, data);
 }
 
-static int pcie_intel_fpga_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pcie_intel_fpga_read_config(const struct udevice *bus, pci_dev_t bdf,
 				       uint offset, ulong *valuep,
 				       enum pci_size_t size)
 {
diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c
index 2ab67d1fc9..8b313e9278 100644
--- a/drivers/pci/pcie_layerscape.c
+++ b/drivers/pci/pcie_layerscape.c
@@ -243,7 +243,7 @@ static int ls_pcie_addr_valid(struct ls_pcie *pcie, pci_dev_t bdf)
 	return 0;
 }
 
-int ls_pcie_conf_address(struct udevice *bus, pci_dev_t bdf,
+int ls_pcie_conf_address(const struct udevice *bus, pci_dev_t bdf,
 			 uint offset, void **paddress)
 {
 	struct ls_pcie *pcie = dev_get_priv(bus);
@@ -271,7 +271,7 @@ int ls_pcie_conf_address(struct udevice *bus, pci_dev_t bdf,
 	return 0;
 }
 
-static int ls_pcie_read_config(struct udevice *bus, pci_dev_t bdf,
+static int ls_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
 			       uint offset, ulong *valuep,
 			       enum pci_size_t size)
 {
diff --git a/drivers/pci/pcie_layerscape_gen4.c b/drivers/pci/pcie_layerscape_gen4.c
index 1fd8761bbc..cec61fa7d6 100644
--- a/drivers/pci/pcie_layerscape_gen4.c
+++ b/drivers/pci/pcie_layerscape_gen4.c
@@ -227,7 +227,7 @@ void *ls_pcie_g4_conf_address(struct ls_pcie_g4 *pcie, pci_dev_t bdf,
 	return pcie->cfg + offset;
 }
 
-static int ls_pcie_g4_read_config(struct udevice *bus, pci_dev_t bdf,
+static int ls_pcie_g4_read_config(const struct udevice *bus, pci_dev_t bdf,
 				  uint offset, ulong *valuep,
 				  enum pci_size_t size)
 {
diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
index a0dcb258b0..0b412aca0e 100644
--- a/drivers/pci/pcie_mediatek.c
+++ b/drivers/pci/pcie_mediatek.c
@@ -66,7 +66,7 @@ struct mtk_pcie {
 	struct list_head ports;
 };
 
-static int mtk_pcie_config_address(struct udevice *udev, pci_dev_t bdf,
+static int mtk_pcie_config_address(const struct udevice *udev, pci_dev_t bdf,
 				   uint offset, void **paddress)
 {
 	struct mtk_pcie *pcie = dev_get_priv(udev);
@@ -77,7 +77,7 @@ static int mtk_pcie_config_address(struct udevice *udev, pci_dev_t bdf,
 	return 0;
 }
 
-static int mtk_pcie_read_config(struct udevice *bus, pci_dev_t bdf,
+static int mtk_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
 				uint offset, ulong *valuep,
 				enum pci_size_t size)
 {
diff --git a/drivers/pci/pcie_phytium.c b/drivers/pci/pcie_phytium.c
index 92e281e7c2..51b2171f9f 100644
--- a/drivers/pci/pcie_phytium.c
+++ b/drivers/pci/pcie_phytium.c
@@ -75,9 +75,8 @@ static int phytium_pci_skip_dev(pci_dev_t parent)
  * code. Otherwise the address to access will be written to the pointer pointed
  * to by @paddress.
  */
-static int pci_phytium_conf_address(struct udevice *bus, pci_dev_t bdf,
-				    uint offset,
-				    void **paddress)
+static int pci_phytium_conf_address(const struct udevice *bus, pci_dev_t bdf,
+				    uint offset, void **paddress)
 {
 	struct phytium_pcie *pcie = dev_get_priv(bus);
 	void *addr;
@@ -119,7 +118,7 @@ static int pci_phytium_conf_address(struct udevice *bus, pci_dev_t bdf,
  * space of the device identified by the bus, device & function numbers in @bdf
  * on the PCI bus @bus.
  */
-static int pci_phytium_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pci_phytium_read_config(const struct udevice *bus, pci_dev_t bdf,
 				   uint offset, ulong *valuep,
 				   enum pci_size_t size)
 {
diff --git a/drivers/pci/pcie_xilinx.c b/drivers/pci/pcie_xilinx.c
index 44a5f1e1f4..05787ae144 100644
--- a/drivers/pci/pcie_xilinx.c
+++ b/drivers/pci/pcie_xilinx.c
@@ -54,7 +54,7 @@ static bool pcie_xilinx_link_up(struct xilinx_pcie *pcie)
  *
  * Return: 0 on success, else -ENODEV
  */
-static int pcie_xilinx_config_address(struct udevice *udev, pci_dev_t bdf,
+static int pcie_xilinx_config_address(const struct udevice *udev, pci_dev_t bdf,
 				      uint offset, void **paddress)
 {
 	struct xilinx_pcie *pcie = dev_get_priv(udev);
@@ -97,7 +97,7 @@ static int pcie_xilinx_config_address(struct udevice *udev, pci_dev_t bdf,
  *
  * Return: 0 on success, else -ENODEV or -EINVAL
  */
-static int pcie_xilinx_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pcie_xilinx_read_config(const struct udevice *bus, pci_dev_t bdf,
 				   uint offset, ulong *valuep,
 				   enum pci_size_t size)
 {
diff --git a/drivers/power/acpi_pmc/pmc_emul.c b/drivers/power/acpi_pmc/pmc_emul.c
index 15cc7acaf3..dfff335e54 100644
--- a/drivers/power/acpi_pmc/pmc_emul.c
+++ b/drivers/power/acpi_pmc/pmc_emul.c
@@ -42,7 +42,7 @@ struct pmc_emul_priv {
 	u8 regs[MEMMAP_SIZE];
 };
 
-static int sandbox_pmc_emul_read_config(struct udevice *emul, uint offset,
+static int sandbox_pmc_emul_read_config(const struct udevice *emul, uint offset,
 					ulong *valuep, enum pci_size_t size)
 {
 	struct pmc_emul_platdata *plat = dev_get_platdata(emul);
diff --git a/include/pci.h b/include/pci.h
index 8c761d8da3..40e3c3fc6f 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -899,8 +899,8 @@ struct dm_pci_ops {
 	 * @size:	Access size
 	 * @return 0 if OK, -ve on error
 	 */
-	int (*read_config)(struct udevice *bus, pci_dev_t bdf, uint offset,
-			   ulong *valuep, enum pci_size_t size);
+	int (*read_config)(const struct udevice *bus, pci_dev_t bdf,
+			   uint offset, ulong *valuep, enum pci_size_t size);
 	/**
 	 * write_config() - Write a PCI configuration value
 	 *
@@ -974,7 +974,7 @@ int dm_pci_bus_find_bdf(pci_dev_t bdf, struct udevice **devp);
  * @devp:	Returns the device for this address, if found
  * @return 0 if OK, -ENODEV if not found
  */
-int pci_bus_find_devfn(struct udevice *bus, pci_dev_t find_devfn,
+int pci_bus_find_devfn(const struct udevice *bus, pci_dev_t find_devfn,
 		       struct udevice **devp);
 
 /**
@@ -1155,8 +1155,9 @@ int pci_read_config8(pci_dev_t pcidev, int offset, u8 *valuep);
  * Return: 0 on success, else -EINVAL
  */
 int pci_generic_mmap_write_config(
-	struct udevice *bus,
-	int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
+	const struct udevice *bus,
+	int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset,
+		      void **addrp),
 	pci_dev_t bdf,
 	uint offset,
 	ulong value,
@@ -1180,8 +1181,9 @@ int pci_generic_mmap_write_config(
  * Return: 0 on success, else -EINVAL
  */
 int pci_generic_mmap_read_config(
-	struct udevice *bus,
-	int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
+	const struct udevice *bus,
+	int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset,
+		      void **addrp),
 	pci_dev_t bdf,
 	uint offset,
 	ulong *valuep,
@@ -1523,8 +1525,8 @@ struct dm_pci_emul_ops {
 	 * @size:	Access size
 	 * @return 0 if OK, -ve on error
 	 */
-	int (*read_config)(struct udevice *dev, uint offset, ulong *valuep,
-			   enum pci_size_t size);
+	int (*read_config)(const struct udevice *dev, uint offset,
+			   ulong *valuep, enum pci_size_t size);
 	/**
 	 * write_config() - Write a PCI configuration value
 	 *
@@ -1609,7 +1611,7 @@ struct dm_pci_emul_ops {
  * @emulp:	Returns emulated device if found
  * @return 0 if found, -ENODEV if not found
  */
-int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn,
+int sandbox_pci_get_emul(const struct udevice *bus, pci_dev_t find_devfn,
 			 struct udevice **containerp, struct udevice **emulp);
 
 /**
-- 
2.25.0.341.g760bfbb309-goog



More information about the U-Boot mailing list