Re: [PATCH] drivers: w1: make w1_slave::flags long to avoid casts

Michal Nazarewicz
2013-11-02T16:59:11Z

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

> 01.11.2013, 23:30, "Andrew Morton" <akpm@linux-foundation.org>:
>> set_bit() operates on longs.  So if we do
>>
>> struct foo { u32 a; u32 b; } f;
>> set_bit(0, (long *)&f.a);
>>
>> then we'll scribble on f.b on a big-endian 64-bit machine.

On Sat, Nov 02 2013, Рустафа Джамурахметов <zbr@ioremap.net> wrote:
> Argh, why would we just don't do that? Its in-memory field, it can be
> anything, I wouldn't be surprised if it even can be non-atomic because
> of proper locks already being held

If the driver does not require an atomic set_bit operation for setting
and testing the flag, feel free to prepare a patch replacing the whole
thing with a plain bool.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]