device/i2c_bus: Constify i2c_busdev and i2c_link

Change-Id: If795087ecdaea24ad7834dcc6d5bf6a72f2aea8f
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63208
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
Matt DeVillier 2022-03-28 22:24:30 -05:00 committed by Felix Held
parent 77c1f5c035
commit 190086e664
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@
#include <device/i2c_bus.h> #include <device/i2c_bus.h>
#include <commonlib/endian.h> #include <commonlib/endian.h>
struct bus *i2c_link(struct device *const dev) struct bus *i2c_link(const struct device *const dev)
{ {
if (!dev || !dev->bus) if (!dev || !dev->bus)
return NULL; return NULL;

View File

@ -21,14 +21,14 @@ struct i2c_bus_operations {
* `->dev->ops->ops_i2c_bus` or `->dev->ops->ops_smbus_bus` are * `->dev->ops->ops_i2c_bus` or `->dev->ops->ops_smbus_bus` are
* not NULL. * not NULL.
*/ */
struct bus *i2c_link(struct device *); struct bus *i2c_link(const struct device *dev);
/* /*
* Shorthand for `i2c_link(dev)->dev`. * Shorthand for `i2c_link(dev)->dev`.
* *
* Returns NULL if i2c_link(dev) returns NULL. * Returns NULL if i2c_link(dev) returns NULL.
*/ */
static inline DEVTREE_CONST struct device *i2c_busdev(struct device *dev) static inline DEVTREE_CONST struct device *i2c_busdev(const struct device *dev)
{ {
struct bus *const link = i2c_link(dev); struct bus *const link = i2c_link(dev);
return link ? link->dev : NULL; return link ? link->dev : NULL;