From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754966AbbJGRdc (ORCPT ); Wed, 7 Oct 2015 13:33:32 -0400 Received: from down.free-electrons.com ([37.187.137.238]:50218 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754556AbbJGRdV (ORCPT ); Wed, 7 Oct 2015 13:33:21 -0400 Date: Wed, 7 Oct 2015 18:33:17 +0100 From: Maxime Ripard To: Vinod Koul Cc: Nicolas Ferre , Alexandre Belloni , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ludovic Desroches , Cyrille Pitchen Subject: Re: [PATCH 1/2] dmaengine: hdmac: factorise memset descriptor allocation Message-ID: <20151007173317.GG2278@lukather> References: <1443711158-18495-1-git-send-email-maxime.ripard@free-electrons.com> <1443711158-18495-2-git-send-email-maxime.ripard@free-electrons.com> <20151007135412.GB3320@vkoul-mobl.iind.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yQbNiKLmgenwUfTN" Content-Disposition: inline In-Reply-To: <20151007135412.GB3320@vkoul-mobl.iind.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --yQbNiKLmgenwUfTN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Vinod, On Wed, Oct 07, 2015 at 02:54:13PM +0100, Vinod Koul wrote: > On Thu, Oct 01, 2015 at 04:52:37PM +0200, Maxime Ripard wrote: >=20 > > +static struct at_desc *atc_create_memset_desc(struct dma_chan *chan, > > + dma_addr_t psrc, > > + dma_addr_t pdst, > > + size_t len) > > +{ > > + struct at_dma_chan *atchan =3D to_at_dma_chan(chan); > > + struct at_desc *desc; > > + size_t xfer_count; > > + > > + u32 ctrla =3D ATC_SRC_WIDTH(2) | > > + ATC_DST_WIDTH(2); >=20 > why is this over two lines :) >=20 > > + u32 ctrlb =3D ATC_DEFAULT_CTRLB | ATC_IEN | > > + ATC_SRC_ADDR_MODE_FIXED | > > + ATC_DST_ADDR_MODE_INCR | > > + ATC_FC_MEM2MEM; > > + > > + xfer_count =3D len >> 2; > > + if (xfer_count > ATC_BTSIZE_MAX) { > > + dev_err(chan2dev(chan), "%s: buffer is too big\n", > > + __func__); > > + return NULL; > > + } >=20 > This is fine, but this is driver limitation. We should really split the > txn to multiple descriptors here.. Both these things are actually just copy from the previous code. I can probably fix the first style issue in this patch, but splitting the memset descriptors should go in a separate patch. >=20 > > @@ -914,46 +953,26 @@ atc_prep_dma_memset(struct dma_chan *chan, dma_ad= dr_t dest, int value, > > return NULL; > > } > > =20 > > - xfer_count =3D len >> 2; > > - if (xfer_count > ATC_BTSIZE_MAX) { > > - dev_err(chan2dev(chan), "%s: buffer is too big\n", > > + vaddr =3D dma_pool_alloc(atdma->memset_pool, GFP_ATOMIC, &paddr); >=20 > Mostly people use _zalloc variant, any reason why you don't want that Not necessarily, but I don't need zeroed memory either, since I overwrite the content right after the allocation. Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com --yQbNiKLmgenwUfTN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWFVddAAoJEBx+YmzsjxAg47oP/iixvlU4FJ0HJsD/yL2jXqXF mX0i2mh6/LMgd+krA9DJ+jsq1QVpQOlu3FAu0dd4H63JOvEMJZ3FaRmOo/X13gsy VFMt47wxgclZAJIFMRE2ImlDZJnjd7xoLOUJYOmY6t6TCZZH741aaKkxL3/w4nAQ Ia9IlIJqh+xayq+H27fuRFgVPjOs8TWSmuf23In6oSUdeOm1sqpAHxR7Ot8BTWZm rKYKSs+kzFj1t4ysEkbZBFY/YWFTdNFe0iQyqMVyG/7euFPFqyAbuVKx6tmZmrQU sxKXX8Jn5nQlmyAYKm/O4CfY6140bzffaLa7eoQYJuUoYvzuwmaUe2kBby696sN3 Q5VTVyteOBkYtfUMDmj6Z4F31PClJEwcO/Ttqu27H5WH4dIvXUIKc6BuIyHiYPl4 RYQDuqIme0d4OUTQynQsoFUbvWxuxWAM0EknxZUiraL61dF+QZTbcrlmdNU+bJPd KTp2KUs1ulc1UamAfGc8ERG+h7dOJwxYwkjM2zcjSmU1y4OvOdKm1SSX6rTUFTWf PNS5AvQI5fkCUzrIggi1oY2eSGVo1LV+fqMIlQT0iGofCDN7Hl0C9SgS4LGv6lrN w5I0kLy0HNbRUHA/Q6FZ2wLCga7kqaTWSHbHZENNfutYddf1HYbrSorarN8owX9M VDIFOBlfdi4X4CPyRFug =eIGR -----END PGP SIGNATURE----- --yQbNiKLmgenwUfTN--