From patchwork Tue Jul 2 15:37:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2813521 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A8BD69F3EB for ; Tue, 2 Jul 2013 15:38:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 775F720179 for ; Tue, 2 Jul 2013 15:38:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9FDCA20176 for ; Tue, 2 Jul 2013 15:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753295Ab3GBPiJ (ORCPT ); Tue, 2 Jul 2013 11:38:09 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:63704 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753194Ab3GBPiI (ORCPT ); Tue, 2 Jul 2013 11:38:08 -0400 Received: from axis700.grange (dslb-178-009-253-215.pools.arcor-ip.net [178.9.253.215]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0M4VfU-1U1vxa2NVE-00yxS7; Tue, 02 Jul 2013 17:37:58 +0200 Received: by axis700.grange (Postfix, from userid 1000) id 1C90A40BB4; Tue, 2 Jul 2013 17:37:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 13AE840BB3; Tue, 2 Jul 2013 17:37:58 +0200 (CEST) Date: Tue, 2 Jul 2013 17:37:58 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-sh@vger.kernel.org cc: "Koul, Vinod" , Magnus Damm , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH] DMA: shdma: fix CHCLR register address calculation Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:rQbIwGp8xqxoC0KnPjvYDt+gz5URqlv6wQls5vdN0Mc Z6yLIUu27OFM7R5y2w4d6IM+T/VevCPAN35ns7nutcw256BQSs +d8BzTiWS+D17vWDSR3J2s+X/X9BmCcg7Kw8XdyfbPbEnm+exd 2VqNv3tJ0BW3gTys5Zk/J/0P6D8wvJzQ+ZufJygvE07wWFzZJO wcDUKd06suaA8nHSmPS/sZ26PDeFj/UgHPUWxgdkqkvHjj/s3J U7ySagPUF/ckoN2TclisO+SSMELmhnCEiRibIafhEEUFq9A4Zb rXvDSgKMllTcds46MeezOF2JR7YMpFz7ykaMzCX79G9e5q0IQI e5MmPe4g8mCYDS7VLRdFUTFHy9dLre5vqBwTttXH/dxru0P2wF pIuKQBQvuSNxQ== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP struct sh_dmae_device::chan_reg is a pointer to u32, therefore when adding offsets to it care should be taken to add offsets in sizeof(u32) units, not in bytes. This patch corrects such a bug. While at it we also remove the redundant parameter of the affected function. Signed-off-by: Guennadi Liakhovetski --- This is a theoretical fix, I don't have a test-case for it, but the original calculation does seem to be buggy to me. Reviews and tests are welcome. drivers/dma/sh/shdma.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c index 98b2693..c7950be 100644 --- a/drivers/dma/sh/shdma.c +++ b/drivers/dma/sh/shdma.c @@ -51,12 +51,12 @@ static DEFINE_SPINLOCK(sh_dmae_lock); static LIST_HEAD(sh_dmae_devices); -static void chclr_write(struct sh_dmae_chan *sh_dc, u32 data) +static void channel_clear(struct sh_dmae_chan *sh_dc) { struct sh_dmae_device *shdev = to_sh_dev(sh_dc); - __raw_writel(data, shdev->chan_reg + - shdev->pdata->channel[sh_dc->shdma_chan.id].chclr_offset); + __raw_writel(0, shdev->chan_reg + + shdev->pdata->channel[sh_dc->shdma_chan.id].chclr_offset / sizeof(u32)); } static void sh_dmae_writel(struct sh_dmae_chan *sh_dc, u32 data, u32 reg) @@ -135,7 +135,7 @@ static int sh_dmae_rst(struct sh_dmae_device *shdev) for (i = 0; i < shdev->pdata->channel_num; i++) { struct sh_dmae_chan *sh_chan = shdev->chan[i]; if (sh_chan) - chclr_write(sh_chan, 0); + channel_clear(sh_chan); } }