lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 11 Jul 2018 05:36:09 +0000 From: Robin Gong <yibin.gong@....com> To: Vinod <vkoul@...nel.org> CC: "dan.j.williams@...el.com" <dan.j.williams@...el.com>, "shawnguo@...nel.org" <shawnguo@...nel.org>, "s.hauer@...gutronix.de" <s.hauer@...gutronix.de>, Fabio Estevam <fabio.estevam@....com>, "linux@...linux.org.uk" <linux@...linux.org.uk>, "linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>, "kernel@...gutronix.de" <kernel@...gutronix.de>, "dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, dl-linux-imx <linux-imx@....com> Subject: RE: [PATCH v1 2/4] dmaengine: imx-sdma: add check_bd_buswidth() to kill the dulicated code > -----Original Message----- > From: Vinod [mailto:vkoul@...nel.org] > Sent: 2018年7月10日 23:31 > To: Robin Gong <yibin.gong@....com> > Cc: dan.j.williams@...el.com; shawnguo@...nel.org; > s.hauer@...gutronix.de; Fabio Estevam <fabio.estevam@....com>; > linux@...linux.org.uk; linux-arm-kernel@...ts.infradead.org; > kernel@...gutronix.de; dmaengine@...r.kernel.org; > linux-kernel@...r.kernel.org; dl-linux-imx <linux-imx@....com> > Subject: Re: [PATCH v1 2/4] dmaengine: imx-sdma: add check_bd_buswidth() to > kill the dulicated code > > On 11-07-18, 00:23, Robin Gong wrote: > > Add check_bd_buswidth() to minimize the code size. > > this looks mostly fine and I think this should be first patch.. Since no need to check bus width in memcpy case, I'll remove this patch too. > > > > > Signed-off-by: Robin Gong <yibin.gong@....com> > > --- > > drivers/dma/imx-sdma.c | 64 > > +++++++++++++++++++++++--------------------------- > > 1 file changed, 29 insertions(+), 35 deletions(-) > > > > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index > > 27ccabf..ed2267d 100644 > > --- a/drivers/dma/imx-sdma.c > > +++ b/drivers/dma/imx-sdma.c > > @@ -1326,6 +1326,33 @@ static struct sdma_desc > *sdma_transfer_init(struct sdma_channel *sdmac, > > return NULL; > > } > > > > +static int check_bd_buswidth(struct sdma_buffer_descriptor *bd, > > + struct sdma_channel *sdmac, int count, > > + dma_addr_t dma_dst, dma_addr_t dma_src) { > > + int ret = 0; > > + > > + switch (sdmac->word_size) { > > + case DMA_SLAVE_BUSWIDTH_4_BYTES: > > + bd->mode.command = 0; > > + if ((count | dma_dst | dma_src) & 3) > > + ret = -EINVAL; > > + break; > > empty line after each break please > > > + case DMA_SLAVE_BUSWIDTH_2_BYTES: > > + bd->mode.command = 2; > > + if ((count | dma_dst | dma_src) & 1) > > + ret = -EINVAL; > > + break; > > + case DMA_SLAVE_BUSWIDTH_1_BYTE: > > + bd->mode.command = 1; > > + break; > > + default: > > + return -EINVAL; > > + } > > + > > + return ret; > > +} > > + > -- > ~Vinod
Powered by blists - more mailing lists