public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 01/19] dm: i2c: Add a dm_ prefix to driver model bus speed functions
Date: Fri, 06 Feb 2015 08:12:50 +0100	[thread overview]
Message-ID: <54D46972.3010102@denx.de> (raw)
In-Reply-To: <1423197710-1568-2-git-send-email-sjg@chromium.org>

Hello Simon,

Am 06.02.2015 05:41, schrieb Simon Glass:
> 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>
> ---
>
> Changes in v2:
> - Use a dm_ prefix for remaining conflicting I2C functions
>
>   common/cmd_i2c.c         |  4 ++--
>   drivers/i2c/i2c-uclass.c | 11 +++--------
>   include/i2c.h            |  8 ++++----
>   test/dm/i2c.c            |  6 +++---
>   4 files changed, 12 insertions(+), 17 deletions(-)

Thanks!

Acked-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
>
> diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
> index 7c3ad00..fe8f77a 100644
> --- a/common/cmd_i2c.c
> +++ b/common/cmd_i2c.c
> @@ -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
> diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c
> index eafa457..a6991bf 100644
> --- a/drivers/i2c/i2c-uclass.c
> +++ b/drivers/i2c/i2c-uclass.c
> @@ -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)
> diff --git a/include/i2c.h b/include/i2c.h
> index 27fe00f..1635e9a 100644
> --- a/include/i2c.h
> +++ b/include/i2c.h
> @@ -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
> diff --git a/test/dm/i2c.c b/test/dm/i2c.c
> index ef88372..541b73b 100644
> --- a/test/dm/i2c.c
> +++ b/test/dm/i2c.c
> @@ -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));
>
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2015-02-06  7:12 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06  4:41 [U-Boot] [PATCH v2 0/19] dm: Convert boards to Kconfig for driver model Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 01/19] dm: i2c: Add a dm_ prefix to driver model bus speed functions Simon Glass
2015-02-06  7:12   ` Heiko Schocher [this message]
2015-02-11 19:44     ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 02/19] dm: i2c: Make API accessible even without CONFIG_DM Simon Glass
2015-02-06  7:15   ` Heiko Schocher
2015-02-11 19:45     ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 03/19] dm: Add Kconfig for driver/demo Simon Glass
2015-02-09  3:51   ` Masahiro Yamada
2015-02-11 19:45     ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 04/19] dm: Expand and complete Kconfig in drivers/ Simon Glass
2015-02-09  3:46   ` Masahiro Yamada
2015-02-11 19:45     ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 05/19] dm: Add Kconfig options for driver model SPL support Simon Glass
2015-02-11 19:45   ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 06/19] dm: test: Add a Kconfig file Simon Glass
2015-02-09  3:51   ` Masahiro Yamada
2015-02-11 19:45     ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 07/19] dm: Add CMD_DM and CMD_DEMO to Kconfig Simon Glass
2015-02-09  4:10   ` Masahiro Yamada
2015-02-11 19:45     ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 08/19] dm: Move Raspberry Pi driver model CONFIGs " Simon Glass
2015-02-11 19:45   ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 09/19] dm: exynos: Move " Simon Glass
2015-02-11 19:45   ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 10/19] dm: x86: " Simon Glass
2015-02-11 19:46   ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 11/19] dm: tegra: " Simon Glass
2015-02-11 19:46   ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 12/19] dm: at91: snapper: " Simon Glass
2015-02-09  3:43   ` Masahiro Yamada
2015-02-10  5:04     ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 13/19] dm: omap3: " Simon Glass
2015-02-09  5:35   ` Masahiro Yamada
2015-02-10  5:04     ` Simon Glass
2015-02-11 19:46       ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 14/19] dm: sandbox: " Simon Glass
2015-02-11 19:46   ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 15/19] dm: sunxi: " Simon Glass
2015-02-07  4:22   ` Ian Campbell
2015-02-07 15:12     ` Simon Glass
2015-02-11 19:46       ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 16/19] dm: mx6: " Simon Glass
2015-02-11 19:47   ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 17/19] dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN " Simon Glass
2015-02-18 13:44   ` Alexey Brodkin
2015-02-19 14:06     ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 18/19] dm: socfpga: Move driver model CONFIGs " Simon Glass
2015-02-06 23:36   ` Dinh Nguyen
2015-02-07  0:11     ` Simon Glass
2015-02-09  7:29       ` Stefan Roese
2015-02-09 16:45         ` Dinh Nguyen
2015-02-09 17:04           ` Marek Vasut
2015-02-11 19:47             ` Simon Glass
2015-02-06  4:41 ` [U-Boot] [PATCH v2 19/19] dm: Drop unused driver model config_defaults Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54D46972.3010102@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox