From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: Rameshwar Prasad Sahu <rsahu-qTEPVZfXA3Y@public.gmane.org>,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
jcm-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
patches-qTEPVZfXA3Y@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3] dmaengine: xgene-dma: Fix sparse wannings and coccinelle warnings
Date: Fri, 17 Apr 2015 10:49:32 +0200 [thread overview]
Message-ID: <2380806.YAnOxsf686@wuerfel> (raw)
In-Reply-To: <1429212673-22254-1-git-send-email-rsahu-qTEPVZfXA3Y@public.gmane.org>
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 <fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Rameshwar Prasad Sahu <rsahu-qTEPVZfXA3Y@public.gmane.org>
Looks good now,
Reviewed-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
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 devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-04-17 8:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-16 19:31 [PATCH v3] dmaengine: xgene-dma: Fix sparse wannings and coccinelle warnings Rameshwar Prasad Sahu
[not found] ` <1429212673-22254-1-git-send-email-rsahu-qTEPVZfXA3Y@public.gmane.org>
2015-04-17 8:49 ` Arnd Bergmann [this message]
2015-04-17 9:11 ` Rameshwar Sahu
2015-04-17 9:56 ` Arnd Bergmann
2015-04-17 18:29 ` Vinod Koul
2015-04-20 3:08 ` Rameshwar Sahu
2015-04-27 3:13 ` Vinod Koul
2015-04-27 5:20 ` Fengguang Wu
2015-06-12 0:36 ` Christopher Li
2015-06-12 1:00 ` Fengguang Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2380806.YAnOxsf686@wuerfel \
--to=arnd-r2ngtmty4d4@public.gmane.org \
--cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=jcm-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=patches-qTEPVZfXA3Y@public.gmane.org \
--cc=rsahu-qTEPVZfXA3Y@public.gmane.org \
--cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).