Re: [PATCH] i2c: allow building emev2 without slave mode again

Wolfram Sang
2015-12-13T09:09:59Z

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

> > > The slave_cb callback function is supposed to set the 'value'
> > > here,
> >
> > Only if a master wants to READ from us.
>
> Right, and can this never fail?

Exactly. The slave can stretch the clock if the value to be sent to the
master needs some processing first, but it must deliver something.

> With my current code to turn i2c_slave_event() into an empty inline function
> in case of !CONFIG_I2C_SLAVE, the compiler knows that "value" is uninitialized
> at the point where we write it to the register, and warns about it.

I overlooked that your first patch changed this code, sorry. Now I see
the problem.

What about not ifdeffing the inline function and keep the build error
whenever someone uses it without I2C_SLAVE being selected?

Thanks,

Wolfram

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