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

From: Wolfram Sang
Date: Sun Dec 13 2015 - 04:11:01 EST



> > > 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: signature.asc
Description: Digital signature