device/i2c_bus: allow i2c_bus and i2c_simple to coexist

If one wants to implement both i2c_bus.h and i2c_simple.h APIs
the compilation unit needs to be guarded or coordinated carefully
with different compilation units. Instead, name the i2c_bus
functions with _dev such that it indicates that they operate on
struct device. One other change to allow i2c_bus.h to be built in
non-ramstage environments is to ensure DEVTREE_CONST is used for
the dev field in struct bus.

BUG=b:72121803

Change-Id: I267e27e62c95013e8ff8b0728dbe9e7b523de453
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/23370
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Aaron Durbin
2018-01-22 21:24:35 -07:00
parent 11284d7d43
commit 439cee9098
4 changed files with 16 additions and 16 deletions

View File

@@ -44,7 +44,7 @@ struct bus *i2c_link(struct device *const dev)
return link;
}
int i2c_readb(struct device *const dev)
int i2c_dev_readb(struct device *const dev)
{
struct device *const busdev = i2c_busdev(dev);
if (!busdev)
@@ -74,7 +74,7 @@ int i2c_readb(struct device *const dev)
}
}
int i2c_writeb(struct device *const dev, uint8_t val)
int i2c_dev_writeb(struct device *const dev, uint8_t val)
{
struct device *const busdev = i2c_busdev(dev);
if (!busdev)
@@ -97,7 +97,7 @@ int i2c_writeb(struct device *const dev, uint8_t val)
}
}
int i2c_readb_at(struct device *const dev, uint8_t off)
int i2c_dev_readb_at(struct device *const dev, uint8_t off)
{
struct device *const busdev = i2c_busdev(dev);
if (!busdev)
@@ -135,8 +135,8 @@ int i2c_readb_at(struct device *const dev, uint8_t off)
}
}
int i2c_writeb_at(struct device *const dev,
const uint8_t off, const uint8_t val)
int i2c_dev_writeb_at(struct device *const dev,
const uint8_t off, const uint8_t val)
{
struct device *const busdev = i2c_busdev(dev);
if (!busdev)