On Mon, Feb 12, 2024 at 05:26:41PM -0600, David Lechner wrote: > This adds a new spi_optimize_message() function that can be used to > optimize SPI messages that are used more than once. Peripheral drivers > that use the same message multiple times can use this API to perform SPI > message validation and controller-specific optimizations once and then > reuse the message while avoiding the overhead of revalidating the > message on each spi_(a)sync() call. This looks basically fine. Some small comments: > +/** > + * __spi_unoptimize_message - shared implementation of spi_unoptimize_message() > + * and spi_maybe_unoptimize_message() > + * @msg: the message to unoptimize There's no need for kerneldoc for internal only functions and it can make the generated documentation a bit confusing for users. Just skip the /** for /*. > +static int __spi_optimize_message(struct spi_device *spi, > + struct spi_message *msg, > + bool pre_optimized) > +{ > + struct spi_controller *ctlr = spi->controller; > + int ret; > + > + ret = __spi_validate(spi, msg); > + if (ret) > + return ret; > + > + if (ctlr->optimize_message) { > + ret = ctlr->optimize_message(msg); > + if (ret) > + return ret; > + } > + > + msg->pre_optimized = pre_optimized; It would probably be clearer to name the parameter pre_optimising rather than pre_optimized, as it is the logic is a bit confusing. Either that or some comments. A similar issue applies on the cleanup path.
Attachment:
signature.asc
Description: PGP signature