All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: "Uwe Kleine-König"
	<u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3] i2c: new bus driver for efm32
Date: Mon, 24 Mar 2014 18:01:31 +0100	[thread overview]
Message-ID: <20140324170131.GB7524@katana> (raw)
In-Reply-To: <1395414236-22647-1-git-send-email-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2337 bytes --]

> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/i2c-efm32.txt
> @@ -0,0 +1,34 @@
> +* Energymicro efm32 i2c controller
> +
> +Required properties :
> +
> + - reg : Offset and length of the register set for the device
> + - compatible : should be "efm32,i2c"

Ehrm, come to think of it, shouldn't that actually be "energymicro, efm32-i2c"
or similar to match the "vendor,product" pattern?

> +config I2C_EFM32
> +	tristate "EFM32 I2C controller"
> +	depends on OF && (ARCH_EFM32 || COMPILE_TEST)

Is EFM32 DT only? Do we need the dependency on OF?

> +	help
> +	  This driver supports the i2c block found in Energy Micro's EFM32
> +	  SoCs.
> +

...

> +static void efm32_i2c_send_next_byte(struct efm32_i2c_ddata *ddata)
> +{
> +	struct i2c_msg *cur_msg = &ddata->msgs[ddata->current_msg];

Missing newline.

> +	if (ddata->current_word >= cur_msg->len) {
> +		/* cur_msg completely transferred */
> +		ddata->current_word = 0;
> +		ddata->current_msg += 1;
> +
> +		if (ddata->current_msg >= ddata->num_msgs) {
> +			efm32_i2c_write32(ddata, REG_CMD, REG_CMD_STOP);
> +			complete(&ddata->done);
> +		} else {
> +			efm32_i2c_send_next_msg(ddata);
> +		}
> +	} else {
> +		efm32_i2c_write32(ddata, REG_TXDATA,
> +				cur_msg->buf[ddata->current_word++]);
> +	}
> +}
> +

...


> +static int efm32_i2c_master_xfer(struct i2c_adapter *adap,
> +		struct i2c_msg *msgs, int num)
> +{
> +	struct efm32_i2c_ddata *ddata = i2c_get_adapdata(adap);
> +	int ret;
> +
> +	if (ddata->msgs)
> +		return -EBUSY;
> +
> +	ddata->msgs = msgs;
> +	ddata->num_msgs = num;
> +	ddata->current_word = 0;
> +	ddata->current_msg = 0;
> +	ddata->retval = -EIO;
> +
> +	reinit_completion(&ddata->done);
> +
> +	dev_dbg(&ddata->adapter.dev, "state: %08x, status: %08x\n",
> +			efm32_i2c_read32(ddata, REG_STATE),
> +			efm32_i2c_read32(ddata, REG_STATUS));
> +
> +	efm32_i2c_send_next_msg(ddata);
> +
> +	wait_for_completion(&ddata->done);
> +
> +	if (ddata->current_msg >= ddata->num_msgs)
> +		ret = ddata->num_msgs;
> +	else
> +		ret = ddata->retval;
> +
> +	ddata->msgs = NULL;

Setting NULL should not be needed?

> +
> +	return ret;
> +}
> +

And checkpatch said:

WARNING: braces {} are not necessary for any arm of this statement
#345: FILE: drivers/i2c/busses/i2c-efm32.c:239:
+		if (cur_msg->flags & I2C_M_RD) {
...

Thanks,

   Wolfram


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: wsa@the-dreams.de (Wolfram Sang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] i2c: new bus driver for efm32
Date: Mon, 24 Mar 2014 18:01:31 +0100	[thread overview]
Message-ID: <20140324170131.GB7524@katana> (raw)
In-Reply-To: <1395414236-22647-1-git-send-email-u.kleine-koenig@pengutronix.de>

> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/i2c-efm32.txt
> @@ -0,0 +1,34 @@
> +* Energymicro efm32 i2c controller
> +
> +Required properties :
> +
> + - reg : Offset and length of the register set for the device
> + - compatible : should be "efm32,i2c"

Ehrm, come to think of it, shouldn't that actually be "energymicro, efm32-i2c"
or similar to match the "vendor,product" pattern?

> +config I2C_EFM32
> +	tristate "EFM32 I2C controller"
> +	depends on OF && (ARCH_EFM32 || COMPILE_TEST)

Is EFM32 DT only? Do we need the dependency on OF?

> +	help
> +	  This driver supports the i2c block found in Energy Micro's EFM32
> +	  SoCs.
> +

...

> +static void efm32_i2c_send_next_byte(struct efm32_i2c_ddata *ddata)
> +{
> +	struct i2c_msg *cur_msg = &ddata->msgs[ddata->current_msg];

Missing newline.

> +	if (ddata->current_word >= cur_msg->len) {
> +		/* cur_msg completely transferred */
> +		ddata->current_word = 0;
> +		ddata->current_msg += 1;
> +
> +		if (ddata->current_msg >= ddata->num_msgs) {
> +			efm32_i2c_write32(ddata, REG_CMD, REG_CMD_STOP);
> +			complete(&ddata->done);
> +		} else {
> +			efm32_i2c_send_next_msg(ddata);
> +		}
> +	} else {
> +		efm32_i2c_write32(ddata, REG_TXDATA,
> +				cur_msg->buf[ddata->current_word++]);
> +	}
> +}
> +

...


> +static int efm32_i2c_master_xfer(struct i2c_adapter *adap,
> +		struct i2c_msg *msgs, int num)
> +{
> +	struct efm32_i2c_ddata *ddata = i2c_get_adapdata(adap);
> +	int ret;
> +
> +	if (ddata->msgs)
> +		return -EBUSY;
> +
> +	ddata->msgs = msgs;
> +	ddata->num_msgs = num;
> +	ddata->current_word = 0;
> +	ddata->current_msg = 0;
> +	ddata->retval = -EIO;
> +
> +	reinit_completion(&ddata->done);
> +
> +	dev_dbg(&ddata->adapter.dev, "state: %08x, status: %08x\n",
> +			efm32_i2c_read32(ddata, REG_STATE),
> +			efm32_i2c_read32(ddata, REG_STATUS));
> +
> +	efm32_i2c_send_next_msg(ddata);
> +
> +	wait_for_completion(&ddata->done);
> +
> +	if (ddata->current_msg >= ddata->num_msgs)
> +		ret = ddata->num_msgs;
> +	else
> +		ret = ddata->retval;
> +
> +	ddata->msgs = NULL;

Setting NULL should not be needed?

> +
> +	return ret;
> +}
> +

And checkpatch said:

WARNING: braces {} are not necessary for any arm of this statement
#345: FILE: drivers/i2c/busses/i2c-efm32.c:239:
+		if (cur_msg->flags & I2C_M_RD) {
...

Thanks,

   Wolfram

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140324/fa97762e/attachment.sig>

  parent reply	other threads:[~2014-03-24 17:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-21 15:03 [PATCH v3] i2c: new bus driver for efm32 Uwe Kleine-König
2014-03-21 15:03 ` Uwe Kleine-König
     [not found] ` <1395414236-22647-1-git-send-email-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-24 17:01   ` Wolfram Sang [this message]
2014-03-24 17:01     ` Wolfram Sang
2014-03-24 18:41     ` Uwe Kleine-König
2014-03-24 18:41       ` Uwe Kleine-König
     [not found]       ` <20140324184114.GK23076-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-24 19:08         ` Wolfram Sang
2014-03-24 19:08           ` Wolfram Sang
2014-03-25  9:07     ` Uwe Kleine-König
2014-03-25  9:07       ` Uwe Kleine-König
     [not found]       ` <20140325090700.GL23076-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-25  9:11         ` Wolfram Sang
2014-03-25  9:11           ` Wolfram Sang
     [not found]           ` <CAO=4fJM9y6yML77oJ3uW2Wz=nEhm=xA-bKoMHd8DXdxw0z8p7Q@mail.gmail.com>
     [not found]             ` <CAO=4fJM9y6yML77oJ3uW2Wz=nEhm=xA-bKoMHd8DXdxw0z8p7Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-25 12:00               ` Wolfram Sang
2014-03-25 12:00                 ` Wolfram Sang
2014-03-25 14:01           ` Joe Perches
2014-03-25 14:01             ` Joe Perches

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=20140324170131.GB7524@katana \
    --to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.