> On 11.12.2015, at 15:37, Andy Shevchenko <[email protected]> wrote:
>
> On Mon, Dec 7, 2015 at 5:21 PM, <[email protected]> wrote:
>> +/* Core methods for spi_message alterations */
>> +
>> +static void __spi_replace_transfers_release(struct spi_master *master,
>> + struct spi_message *msg,
>> + void *res)
>> +{
>> + struct spi_replaced_transfers *srt = res;
>
> srt sounds magic
> rxfer might be better?
srt = Spi_Replaced_Transfer - if you like rxfer better I can replace it.
>
>> + int i;
>
> unsigned int i; or size_t to be in align with inserted field.
will do.
>> + int i;
>
> Ditto.
>
>> +
>> + /* allocate the structure using spi_res */
>> + srt = spi_res_alloc(msg->spi, __spi_replace_transfers_release,
>> + insert * sizeof(struct spi_transfer)
>> + + sizeof(struct spi_replaced_transfers)
>> + + extradatasize,
>> + 0);
>> + if (!srt)
>> + return NULL;
>
> ERR_PTR for this API seems better to have.
Can do that.
>> + srt->inserted = insert;
>> + for (i = insert - 1; i >= 0 ; i--) {
>
> This is classical pattern for
>
> while (--insert >= 0) {
> }
did it slightly differently as size_t is always >= 0 -
the main reason for using int here...
Martin
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html