mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: "Eric Bénard" <eric@eukrea.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/4] i2c: implement i2c_get_adapter()
Date: Tue, 25 May 2010 00:01:22 +0200	[thread overview]
Message-ID: <4BFAF732.8010904@pengutronix.de> (raw)
In-Reply-To: <1274708768-20607-2-git-send-email-eric@eukrea.com>


[-- Attachment #1.1: Type: text/plain, Size: 2809 bytes --]

Hello,

Eric Bénard wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

You have to add you S-o-b, if the patch goes through your hands.

Cheers, Marc
> ---
> v2 : add i2c_get_adapter to include/i2c/i2c.h
> 
>  drivers/i2c/i2c.c |   24 +++++++++++++++++++++++-
>  include/i2c/i2c.h |    2 ++
>  2 files changed, 25 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
> index 32fd026..1fa114a 100644
> --- a/drivers/i2c/i2c.c
> +++ b/drivers/i2c/i2c.c
> @@ -39,7 +39,7 @@ struct boardinfo {
>  };
>  
>  static LIST_HEAD(board_list);
> -
> +static LIST_HEAD(adapter_list);
>  
>  /**
>   * i2c_transfer - execute a single or combined I2C message
> @@ -327,6 +327,23 @@ static void scan_boardinfo(struct i2c_adapter *adapter)
>  }
>  
>  /**
> + *
> + * i2c_get_adapter - get an i2c adapter from its busnum
> + *
> + * @param	busnum	the desired bus number
> + *
> + */
> +struct i2c_adapter *i2c_get_adapter(int busnum)
> +{
> +	struct i2c_adapter *adap;
> +
> +	list_for_each_entry(adap, &adapter_list, list)
> +		if (adap->nr == busnum)
> +			return adap;
> +	return NULL;
> +}
> +
> +/**
>   * i2c_register_master - register I2C master controller
>   *
>   * @param	master	initialized master, originally from i2c_alloc_master()
> @@ -345,6 +362,11 @@ static void scan_boardinfo(struct i2c_adapter *adapter)
>   */
>  int i2c_add_numbered_adapter(struct i2c_adapter *adapter)
>  {
> +	if (i2c_get_adapter(adapter->nr))
> +		return -EBUSY;
> +
> +	list_add_tail(&adapter_list, &adapter->list);
> +
>  	/* populate children from any i2c device tables */
>  	scan_boardinfo(adapter);
>  
> diff --git a/include/i2c/i2c.h b/include/i2c/i2c.h
> index 0760fdc..c031bbb 100644
> --- a/include/i2c/i2c.h
> +++ b/include/i2c/i2c.h
> @@ -66,6 +66,7 @@ struct i2c_adapter {
>  	struct device_d		*dev;	/* ptr to device */
>  	int			nr;	/* bus number */
>  	int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
> +	struct list_head	list;
>  };
>  
>  
> @@ -120,6 +121,7 @@ static inline int i2c_register_board_info(int busnum,
>  }
>  #endif
>  extern int i2c_add_numbered_adapter(struct i2c_adapter *adapter);
> +struct i2c_adapter *i2c_get_adapter(int busnum);
>  
>  extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
>  extern int i2c_master_send(struct i2c_client *client, const char *buf, int count);


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2010-05-24 22:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-24 13:46 [PATCH 1/4] i2c-imx: change log level for No ACK Eric Bénard
2010-05-24 13:46 ` [PATCH 2/4] i2c: implement i2c_get_adapter() Eric Bénard
2010-05-24 13:46   ` [PATCH 3/4] commands: add i2c commands Eric Bénard
2010-05-24 13:46     ` [PATCH 4/4] eukrea_cpuimx27: add fb support Eric Bénard
2010-05-24 22:12     ` [PATCH 3/4] commands: add i2c commands Marc Kleine-Budde
2010-05-25  6:45       ` Sascha Hauer
2010-05-25  7:03     ` Sascha Hauer
2010-05-24 22:01   ` Marc Kleine-Budde [this message]

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=4BFAF732.8010904@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=eric@eukrea.com \
    /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