Re: [PATCH 2/2] regmap: spi: Support asynchronous I/O for SPI

From: Stephen Boyd
Date: Mon Jan 28 2013 - 20:47:23 EST


On 01/28/13 17:39, Mark Brown wrote:
> On Mon, Jan 28, 2013 at 11:38:50AM -0800, Stephen Boyd wrote:
>> On 01/27/13 06:12, Mark Brown wrote:
>>> +static int regmap_spi_async_write(void *context,
>>> + const void *reg, size_t reg_len,
>>> + const void *val, size_t val_len,
>>> + struct regmap_async *a)
>>> +{
>>> + struct regmap_async_spi *async = (void *)a;
>> Can you use container_of() here?
> We could but I tend not to if the interface strictly requires that the
> pointers be type punnable.

What is the interface requiring strict type punning here? async_write?

I just hope we don't move the fields around in the regmap_async_spi
struct and then this code silently breaks. I hope the compiler is smart
enough to skip doing any math if we used container_of() with the current
struct layout.

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/