Re: [PATCH v2 1/4] spi: Add 'last' flag to spi_transfer structure

2014-11-19 Thread Mark Brown
On Tue, Nov 18, 2014 at 11:55:46PM +0100, Beniamino Galvani wrote: > Would it be better to introduce something like: > static inline bool > spi_transfer_is_last(struct spi_master *master, struct spi_transfer *xfer) > { > return list_is_last(&xfer->transfer_list, > &master->cur_msg->trans

Re: [PATCH v2 1/4] spi: Add 'last' flag to spi_transfer structure

2014-11-18 Thread Beniamino Galvani
On Tue, Nov 18, 2014 at 02:06:58PM +, Mark Brown wrote: > It's incredibly sad to iterate through the entire list in order to find > the last entry, especially given that it's a doubly linked list and this > is a bit of a hot path. We should look at the previous entry for the > list head instea

Re: [PATCH v2 1/4] spi: Add 'last' flag to spi_transfer structure

2014-11-18 Thread Mark Brown
On Mon, Nov 17, 2014 at 11:47:48PM +0100, Beniamino Galvani wrote: > + list_for_each_entry(xfer, &master->cur_msg->transfers, transfer_list) { > + xfer->last = list_is_last(&xfer->transfer_list, > + &master->cur_msg->transfers); > + } It's

[PATCH v2 1/4] spi: Add 'last' flag to spi_transfer structure

2014-11-17 Thread Beniamino Galvani
Some drivers need to know whether the current transfer is the last in the message in order to properly handle CS. A common way to achieve this is to reimplement transfer_one_message() but this leads to undesirable code duplication. This patch adds a 'last' field to the spi_transfer structure and p