[PATCH 03/21] dm: pci: Update a few more interfaces for const udevice *
Simon Glass
sjg at chromium.org
Mon Jan 27 16:49:38 CET 2020
Tidy up a few places where const * should be used.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
drivers/pci/pci-uclass.c | 18 +++++++++---------
include/fdtdec.h | 2 +-
include/pci.h | 16 ++++++++--------
lib/fdtdec.c | 2 +-
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 78d4129572..5f318120e1 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -43,7 +43,7 @@ struct udevice *pci_get_controller(struct udevice *dev)
return dev;
}
-pci_dev_t dm_pci_get_bdf(struct udevice *dev)
+pci_dev_t dm_pci_get_bdf(const struct udevice *dev)
{
struct pci_child_platdata *pplat = dev_get_parent_platdata(dev);
struct udevice *bus = dev->parent;
@@ -349,7 +349,7 @@ int dm_pci_write_config32(struct udevice *dev, int offset, u32 value)
return dm_pci_write_config(dev, offset, value, PCI_SIZE_32);
}
-int pci_bus_read_config(struct udevice *bus, pci_dev_t bdf, int offset,
+int pci_bus_read_config(const struct udevice *bus, pci_dev_t bdf, int offset,
unsigned long *valuep, enum pci_size_t size)
{
struct dm_pci_ops *ops;
@@ -373,10 +373,10 @@ int pci_read_config(pci_dev_t bdf, int offset, unsigned long *valuep,
return pci_bus_read_config(bus, bdf, offset, valuep, size);
}
-int dm_pci_read_config(struct udevice *dev, int offset, unsigned long *valuep,
- enum pci_size_t size)
+int dm_pci_read_config(const struct udevice *dev, int offset,
+ unsigned long *valuep, enum pci_size_t size)
{
- struct udevice *bus;
+ const struct udevice *bus;
for (bus = dev; device_is_on_pci_bus(bus);)
bus = bus->parent;
@@ -423,7 +423,7 @@ int pci_read_config8(pci_dev_t bdf, int offset, u8 *valuep)
return 0;
}
-int dm_pci_read_config8(struct udevice *dev, int offset, u8 *valuep)
+int dm_pci_read_config8(const struct udevice *dev, int offset, u8 *valuep)
{
unsigned long value;
int ret;
@@ -436,7 +436,7 @@ int dm_pci_read_config8(struct udevice *dev, int offset, u8 *valuep)
return 0;
}
-int dm_pci_read_config16(struct udevice *dev, int offset, u16 *valuep)
+int dm_pci_read_config16(const struct udevice *dev, int offset, u16 *valuep)
{
unsigned long value;
int ret;
@@ -449,7 +449,7 @@ int dm_pci_read_config16(struct udevice *dev, int offset, u16 *valuep)
return 0;
}
-int dm_pci_read_config32(struct udevice *dev, int offset, u32 *valuep)
+int dm_pci_read_config32(const struct udevice *dev, int offset, u32 *valuep)
{
unsigned long value;
int ret;
@@ -1203,7 +1203,7 @@ int pci_get_regions(struct udevice *dev, struct pci_region **iop,
return (*iop != NULL) + (*memp != NULL) + (*prefp != NULL);
}
-u32 dm_pci_read_bar32(struct udevice *dev, int barnum)
+u32 dm_pci_read_bar32(const struct udevice *dev, int barnum)
{
u32 addr;
int bar;
diff --git a/include/fdtdec.h b/include/fdtdec.h
index c8a143db5f..166f29c55b 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -441,7 +441,7 @@ int fdtdec_get_pci_vendev(const void *blob, int node,
* @param bar returns base address of the pci device's registers
* @return 0 if ok, negative on error
*/
-int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr,
+int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr,
u32 *bar);
/**
diff --git a/include/pci.h b/include/pci.h
index 40e3c3fc6f..50ca249f2d 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -924,7 +924,7 @@ struct dm_pci_ops {
* @dev: Device to check
* @return bus/device/function value (see PCI_BDF())
*/
-pci_dev_t dm_pci_get_bdf(struct udevice *dev);
+pci_dev_t dm_pci_get_bdf(const struct udevice *dev);
/**
* pci_bind_bus_devices() - scan a PCI bus and bind devices
@@ -1067,7 +1067,7 @@ int dm_pci_hose_probe_bus(struct udevice *bus);
* @size: Access size
* @return 0 if OK, -ve on error
*/
-int pci_bus_read_config(struct udevice *bus, pci_dev_t bdf, int offset,
+int pci_bus_read_config(const struct udevice *bus, pci_dev_t bdf, int offset,
unsigned long *valuep, enum pci_size_t size);
/**
@@ -1102,12 +1102,12 @@ int pci_bus_clrset_config32(struct udevice *bus, pci_dev_t bdf, int offset,
* Driver model PCI config access functions. Use these in preference to others
* when you have a valid device
*/
-int dm_pci_read_config(struct udevice *dev, int offset, unsigned long *valuep,
- enum pci_size_t size);
+int dm_pci_read_config(const struct udevice *dev, int offset,
+ unsigned long *valuep, enum pci_size_t size);
-int dm_pci_read_config8(struct udevice *dev, int offset, u8 *valuep);
-int dm_pci_read_config16(struct udevice *dev, int offset, u16 *valuep);
-int dm_pci_read_config32(struct udevice *dev, int offset, u32 *valuep);
+int dm_pci_read_config8(const struct udevice *dev, int offset, u8 *valuep);
+int dm_pci_read_config16(const struct udevice *dev, int offset, u16 *valuep);
+int dm_pci_read_config32(const struct udevice *dev, int offset, u32 *valuep);
int dm_pci_write_config(struct udevice *dev, int offset, unsigned long value,
enum pci_size_t size);
@@ -1313,7 +1313,7 @@ void dm_pci_write_bar32(struct udevice *dev, int barnum, u32 addr);
* @barnum: Bar number to read (numbered from 0)
* @return: value of BAR
*/
-u32 dm_pci_read_bar32(struct udevice *dev, int barnum);
+u32 dm_pci_read_bar32(const struct udevice *dev, int barnum);
/**
* dm_pci_bus_to_phys() - convert a PCI bus address to a physical address
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 17051d409c..7fbb4c7ddc 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -224,7 +224,7 @@ int fdtdec_get_pci_vendev(const void *blob, int node, u16 *vendor, u16 *device)
return -ENOENT;
}
-int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr,
+int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr,
u32 *bar)
{
int barnum;
--
2.25.0.341.g760bfbb309-goog
More information about the U-Boot
mailing list