Messages in this thread |  | | From | Alexander Shishkin <> | Subject | Re: [QUEUED v20180920 05/16] stm class: Add a helper for writing data packets | Date | Wed, 03 Oct 2018 15:58:43 +0300 |
| |
Mathieu Poirier <mathieu.poirier@linaro.org> writes:
>> +static ssize_t notrace stm_write(struct stm_data *data, unsigned int master, >> + unsigned int channel, const char *buf, size_t count) >> +{ >> + ssize_t sz; >> + >> + sz = stm_data_write(data, master, channel, true, buf, count); >> + if (sz > 0) >> + data->packet(data, master, channel, STP_PACKET_FLAG, 0, 0, >> + buf); > > The original code the payload of a flag packet was '0' while in this patch > changes it to be anything. Some external tooling could be very confused.
I think the original intention was so: the 'size' field of ->packet() refers to how many bytes from the given 'payload' the callback should use. IOW, with size 0, buf may point to anything (still a valid pointer though). But that should have been documented better from the beginning, so you're completely right. I'll make a note to myself to go over the API bits and sort out stuff like that.
Thanks, -- Alex
|  |