Re: [PATCH V2 2/5] spi: core: add spi_replace_transfers method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 11.12.2015, at 15:37, Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
> 
> On Mon, Dec 7, 2015 at 5:21 PM,  <kernel@xxxxxxxxxxxxxxxx> 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux