]> git.sur5r.net Git - u-boot/commitdiff
dm: i2c: Add a dm_ prefix to driver model bus speed functions
authorSimon Glass <sjg@chromium.org>
Fri, 6 Feb 2015 04:41:32 +0000 (21:41 -0700)
committerSimon Glass <sjg@chromium.org>
Thu, 12 Feb 2015 17:35:33 +0000 (10:35 -0700)
As with i2c_read() and i2c_write(), add a dm_ prefix to the driver model
versions of these functions to avoid conflicts.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
common/cmd_i2c.c
drivers/i2c/i2c-uclass.c
include/i2c.h
test/dm/i2c.c

index 7c3ad00fdf03f30ee358cf4501717d6e657e5d18..fe8f77aaec04abdfcf740abb2d32e1f11f30e687 100644 (file)
@@ -1730,7 +1730,7 @@ static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const
 #endif
        if (argc == 1) {
 #ifdef CONFIG_DM_I2C
-               speed = i2c_get_bus_speed(bus);
+               speed = dm_i2c_get_bus_speed(bus);
 #else
                speed = i2c_get_bus_speed();
 #endif
@@ -1740,7 +1740,7 @@ static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const
                speed = simple_strtoul(argv[1], NULL, 10);
                printf("Setting bus speed to %d Hz\n", speed);
 #ifdef CONFIG_DM_I2C
-               ret = i2c_set_bus_speed(bus, speed);
+               ret = dm_i2c_set_bus_speed(bus, speed);
 #else
                ret = i2c_set_bus_speed(speed);
 #endif
index eafa457845df2371bff8a59ce8b20b7d2d32dd82..a6991bf875df70a771d88a5d27c19fccd0d4af90 100644 (file)
@@ -325,7 +325,7 @@ int dm_i2c_probe(struct udevice *bus, uint chip_addr, uint chip_flags,
        return ret;
 }
 
-int i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
+int dm_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
 {
        struct dm_i2c_ops *ops = i2c_get_ops(bus);
        struct dm_i2c_bus *i2c = bus->uclass_priv;
@@ -346,12 +346,7 @@ int i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
        return 0;
 }
 
-/*
- * i2c_get_bus_speed:
- *
- *  Returns speed of selected I2C bus in Hz
- */
-int i2c_get_bus_speed(struct udevice *bus)
+int dm_i2c_get_bus_speed(struct udevice *bus)
 {
        struct dm_i2c_ops *ops = i2c_get_ops(bus);
        struct dm_i2c_bus *i2c = bus->uclass_priv;
@@ -440,7 +435,7 @@ static int i2c_post_probe(struct udevice *dev)
        i2c->speed_hz = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
                                     "clock-frequency", 100000);
 
-       return i2c_set_bus_speed(dev, i2c->speed_hz);
+       return dm_i2c_set_bus_speed(dev, i2c->speed_hz);
 }
 
 static int i2c_post_bind(struct udevice *dev)
index 27fe00f17361763a42bc13f59e378d464c484dc6..1635e9ac06ca0e8432a35f99e5654a16c29e1de2 100644 (file)
@@ -125,21 +125,21 @@ int dm_i2c_probe(struct udevice *bus, uint chip_addr, uint chip_flags,
                 struct udevice **devp);
 
 /**
- * i2c_set_bus_speed() - set the speed of a bus
+ * dm_i2c_set_bus_speed() - set the speed of a bus
  *
  * @bus:       Bus to adjust
  * @speed:     Requested speed in Hz
  * @return 0 if OK, -EINVAL for invalid values
  */
-int i2c_set_bus_speed(struct udevice *bus, unsigned int speed);
+int dm_i2c_set_bus_speed(struct udevice *bus, unsigned int speed);
 
 /**
- * i2c_get_bus_speed() - get the speed of a bus
+ * dm_i2c_get_bus_speed() - get the speed of a bus
  *
  * @bus:       Bus to check
  * @return speed of selected I2C bus in Hz, -ve on error
  */
-int i2c_get_bus_speed(struct udevice *bus);
+int dm_i2c_get_bus_speed(struct udevice *bus);
 
 /**
  * i2c_set_chip_flags() - set flags for a chip
index ef88372d56361ab40186a34787cc6c7a8e0c40d4..541b73b8037e0134078cb0817abcf5d202d54c87 100644 (file)
@@ -67,10 +67,10 @@ static int dm_test_i2c_speed(struct dm_test_state *dms)
 
        ut_assertok(uclass_get_device_by_seq(UCLASS_I2C, busnum, &bus));
        ut_assertok(i2c_get_chip(bus, chip, 1, &dev));
-       ut_assertok(i2c_set_bus_speed(bus, 100000));
+       ut_assertok(dm_i2c_set_bus_speed(bus, 100000));
        ut_assertok(dm_i2c_read(dev, 0, buf, 5));
-       ut_assertok(i2c_set_bus_speed(bus, 400000));
-       ut_asserteq(400000, i2c_get_bus_speed(bus));
+       ut_assertok(dm_i2c_set_bus_speed(bus, 400000));
+       ut_asserteq(400000, dm_i2c_get_bus_speed(bus));
        ut_assertok(dm_i2c_read(dev, 0, buf, 5));
        ut_asserteq(-EINVAL, dm_i2c_write(dev, 0, buf, 5));