On Tue, Jun 26, 2018 at 3:26 PM, Frieder Schrempf <frieder.schrempf@xxxxxxxxx> wrote: > On 08.06.2018 22:27, Andy Shevchenko wrote: >> On Fri, Jun 8, 2018 at 2:54 PM, Yogesh Narayan Gaur >> <yogeshnarayan.gaur@xxxxxxx> wrote: >>> +static int fsl_qspi_check_buswidth(struct fsl_qspi *q, u8 width) { >>> + switch (width) { >>> + case 1: >>> + case 2: >>> + case 4: >>> + return 0; >>> + } >> if (!is_power_of_2(width) || width >= 8) >> return -E...; >> >> return 0; >> >> ? > Your proposition is a bit shorter, but I think it's slightly harder to read. OK. >>> + >>> + return -ENOTSUPP; >>> +} >>> + for (i = 0; i < op->data.nbytes; i += 4) { >>> + u32 val = 0; >>> + >>> + memcpy(&val, op->data.buf.out + i, >>> + min_t(unsigned int, op->data.nbytes - i, 4)); >> You may easily avoid this conditional on each iteration. > Do you mean something like this, or are there better ways? > > u32 val = 0; > > for (i = 0; i < ALIGN_DOWN(op->data.nbytes, 4); i += 4) > { > memcpy(&val, op->data.buf.out + i, 4); > val = fsl_qspi_endian_xchg(q, val); > qspi_writel(q, val, base + QUADSPI_TBDR); > } > > memcpy(&val, op->data.buf.out + i, op->data.nbytes); > val = fsl_qspi_endian_xchg(q, val); > qspi_writel(q, val, base + QUADSPI_TBDR); Something like this, though last part should go under if (IS_ALIGNED(...)) (My comment was about moving out an invariant conditional) >>> + val = fsl_qspi_endian_xchg(q, val); >>> + qspi_writel(q, val, base + QUADSPI_TBDR); >>> + } >>> +MODULE_AUTHOR("Freescale Semiconductor Inc."); MODULE_AUTHOR("Boris >>> +Brezillion <boris.brezillon@xxxxxxxxxxx>"); MODULE_AUTHOR("Frieder >>> +Schrempf <frieder.schrempf@xxxxxxxxx>"); MODULE_LICENSE("GPL v2"); >> Wrong indentation. > What is wrong? Some newlines are missing here between the MODULE_ macros, > but in my original patch it seems correct. It should be like MODULE_FOO(...); MODULE_BAR(...); MODULE_BAZ(...); One macro — one line. -- With Best Regards, Andy Shevchenko -- 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