Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753882AbbDQIu0 (ORCPT ); Fri, 17 Apr 2015 04:50:26 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:59425 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751048AbbDQIuL (ORCPT ); Fri, 17 Apr 2015 04:50:11 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Rameshwar Prasad Sahu , vinod.koul@intel.com, dan.j.williams@intel.com, devicetree@vger.kernel.org, jcm@redhat.com, patches@apm.com, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org Subject: Re: [PATCH v3] dmaengine: xgene-dma: Fix sparse wannings and coccinelle warnings Date: Fri, 17 Apr 2015 10:49:32 +0200 Message-ID: <2380806.YAnOxsf686@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1429212673-22254-1-git-send-email-rsahu@apm.com> References: <1429212673-22254-1-git-send-email-rsahu@apm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:Z6c8hAuF16L2KRcYdM5OPu5Ob7qCfN6uIsvx5JZKiPAC+fDO4Bl zgBtaLl/Vj+99ZmYbi3J3eeo6yZKrBDGU/CERL7KZL01/O2Uq3ZRjFfFdp+IcorHUDV5HsT NszFgrg2HDf77k2gKSIwCdqkPSDhogFS77bMAo0mSFujpEsC7fQVvcsQwRg370wkA5nSgeC WUtKfAQrFMzyQvDVZrr/A== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2488 Lines: 77 On Friday 17 April 2015 01:01:13 Rameshwar Prasad Sahu wrote: > v3 changes: > * Minor changes in length setting in DMA descriptor > > v2 changes: > * Code cleanup > * Changed way of setting DMA descriptors for big-endian > > This patch fixes compilation sparse warnings like incorrect type in assignment > (different base types), cast to restricted __le64, symbol > '__UNIQUE_ID_author__COUNTER__' has multiple initializers etc and > coccinelle warnings (No need to set .owner here. The core will do it.) > > This patch is based on slave-dma / for-linus branch. > (commit: 9f2fd0dfa594d857fbdaeda523ff7a46f16567f5 [26/28] > dmaengine: Add support for APM X-Gene SoC DMA engine driver) > > Reported-by: kbuild test robot > Signed-off-by: Rameshwar Prasad Sahu Looks good now, Reviewed-by: Arnd Bergmann There is one small enhancement that you could still do and I'll shut up after that ;-) > > -static void *xgene_dma_lookup_ext8(u64 *desc, int idx) > +static __le64 *xgene_dma_lookup_ext8(struct xgene_dma_desc_hw *desc, int idx) > { > - return (idx % 2) ? (desc + idx - 1) : (desc + idx + 1); > + switch (idx) { > + case 0: > + return &desc->m1; > + case 1: > + return &desc->m0; > + case 2: > + return &desc->m3; > + case 3: > + return &desc->m2; > + default: > + pr_err("Invalid dma descriptor index\n"); > + } > + > + return NULL; > } > ... > /* Set 1st to 5th source addresses */ > for (i = 0; i < src_cnt; i++) { > len = *nbytes; > - xgene_dma_set_src_buffer((i == 0) ? (desc1 + 8) : > + xgene_dma_set_src_buffer((i == 0) ? &desc1->m1 : > xgene_dma_lookup_ext8(desc2, i - 1), > &len, &src[i]); > - XGENE_DMA_DESC_MULTI_SET(desc1, scf[i], i); > + desc1->m2 |= cpu_to_le64((scf[i] << ((i + 1) * 8))); > } If you just unroll this loop, you get code that is smaller and easier to understand: /* Set 1st to 5th source addresses */ xgene_dma_set_src_buffer(&desc1->m1, &len, &src[0]); xgene_dma_set_src_buffer(&desc2->m0, &len, &src[1]); xgene_dma_set_src_buffer(&desc2->m3, &len, &src[2]); xgene_dma_set_src_buffer(&desc2->m2, &len, &src[3]); desc1->m2 |= cpu_to_le64(scf[0] | scf[1] << 8 | scf[2] << 16 | scf[3] << 24); Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/