public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	Greg KH <greg@kroah.com>, Jean Delvare <khali@linux-fr.org>,
	Dimitris Papastamos <dp@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@ti.com>, Samuel Oritz <sameo@linux.intel.com>,
	Graeme Gregory <gg@slimlogic.co.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] regmap: Add SPI bus support
Date: Fri, 15 Jul 2011 10:01:36 +0100	[thread overview]
Message-ID: <4E2001F0.4050402@cam.ac.uk> (raw)
In-Reply-To: <20110715050939.GM32716@opensource.wolfsonmicro.com>

On 07/15/11 06:09, Mark Brown wrote:
> On Thu, Jul 14, 2011 at 11:04:27PM -0600, Grant Likely wrote:
>> On Thu, Jul 14, 2011 at 10:39 PM, Mark Brown
>> <broonie@opensource.wolfsonmicro.com> wrote:
> 
> [Regmap API I2C bus code.]
>>> There was a bit about this in the cover mail - it's the interace
>>> stability issue again, the plan is to move them once we're more
>>> confident that the interface used will stay stable.
> 
>> I've got no problem with churn in drivers/spi, and I'm fine to have
>> changes in drivers/spi merged via other trees if it means the code is
>> in the logical place.
> 
> Can I add an ack from you for that?  If/when it does get merged I'd
> appreciate it if you pushed any code to me for review.
> 
>>>>       struct spi_transfer t[2] = { {.tx_buf = reg, .len = reg_len},
>>>>                                    {.tx_buf = val, .len = val_len}};
> 
>>>> Then the memset() and t[0]/t[1] lines can all be culled.
> 
>>> That does the init to zero?
> 
>> You might want to double check, but I believe it gets implemented as a
>> memcpy of a static initializer.
> 
> Hrm, given that neither of us is 100% sure I think it's safer to leave
> it written out long hand and avoid confusing anyone else.

It does the init to zero. The relevant bit of the spec is designated initializers.

See c99 spec (draft here as I'm not paying for it ;) WG14/N1124
6.7.8 

Clause 19: The initialization shall occur in initializer list order, each initializer provided for a
particular subobject overriding any previously listed initializer for the same subobject;130)
all subobjects that are not initialized explicitly shall be initialized implicitly the same as
objects that have static storage duration.

So here they will be initialized the same as static objects. For completeness that's
covered in clause 10:
If an object that has automatic storage duration is not initialized explicitly, its value is
indeterminate. If an object that has static storage duration is not initialized explicitly,
then:
— if it has pointer type, it is initialized to a null pointer;
— if it has arithmetic type, it is initialized to (positive or unsigned) zero;
— if it is an aggregate, every member is initialized (recursively) according to these rules;
— if it is a union, the first named member is initialized (recursively) according to these
rules.


Jonathan

  reply	other threads:[~2011-07-15  9:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-09  4:49 [PATCH 0/4] regmap: Generic I2C and SPI register map library Mark Brown
2011-07-09  4:50 ` [PATCH 1/4] regmap: Add generic non-memory mapped register access API Mark Brown
2011-07-09  4:50   ` [PATCH 2/4] regmap: Add I2C bus support Mark Brown
2011-07-09 11:53     ` Wolfram Sang
2011-07-09 14:08       ` Mark Brown
2011-07-09 14:57         ` Wolfram Sang
2011-07-10  2:59           ` Mark Brown
2011-07-10  9:03             ` Wolfram Sang
2011-07-09  4:50   ` [PATCH 3/4] regmap: Add SPI " Mark Brown
2011-07-15  2:53     ` Grant Likely
2011-07-15  4:39       ` Mark Brown
2011-07-15  5:04         ` Grant Likely
2011-07-15  5:09           ` Mark Brown
2011-07-15  9:01             ` Jonathan Cameron [this message]
2011-07-15 18:30               ` Grant Likely
2011-07-09  4:50   ` [PATCH 4/4] regulator: Convert tps65023 to use regmap API Mark Brown
2011-07-15  2:53     ` Grant Likely
2011-07-15  4:48       ` Mark Brown
2011-07-15 18:29         ` Grant Likely
2011-07-16  1:47           ` Mark Brown
2011-07-16  2:06             ` Grant Likely
2011-07-16  2:13               ` Mark Brown
2011-07-09  5:44   ` [PATCH 1/4] regmap: Add generic non-memory mapped register access API Greg KH
2011-07-15  2:53   ` Grant Likely
2011-07-15  3:25     ` Mark Brown
2011-07-15  3:30       ` Grant Likely
  -- strict thread matches above, loose matches on Subject: below --
2011-07-15  6:22 [PATCH 0/4] regmap: Generic I2C and SPI register map library Mark Brown
2011-07-15  6:23 ` [PATCH 1/4] regmap: Add generic non-memory mapped register access API Mark Brown
2011-07-15  6:23   ` [PATCH 3/4] regmap: Add SPI bus support Mark Brown
2011-07-16  2:48 [PATCH 0/4] regmap: Generic I2C and SPI register map library Mark Brown
2011-07-16  2:48 ` [PATCH 1/4] regmap: Add generic non-memory mapped register access API Mark Brown
2011-07-16  2:48   ` [PATCH 3/4] regmap: Add SPI bus support Mark Brown
2011-07-18 10:04 [PATCH 0/4] regmap: Generic I2C and SPI register map library Mark Brown
2011-07-18 10:07 ` [PATCH 1/4] regmap: Add generic non-memory mapped register access API Mark Brown
2011-07-18 10:07   ` [PATCH 3/4] regmap: Add SPI bus support Mark Brown
2011-07-19 21:51     ` Grant Likely
2011-07-20 10:33       ` Mark Brown

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=4E2001F0.4050402@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dp@opensource.wolfsonmicro.com \
    --cc=gg@slimlogic.co.uk \
    --cc=grant.likely@secretlab.ca \
    --cc=greg@kroah.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=sameo@linux.intel.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