From patchwork Wed Jun 15 06:14:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 881092 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5F6DFdh023854 for ; Wed, 15 Jun 2011 06:14:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751232Ab1FOGOE (ORCPT ); Wed, 15 Jun 2011 02:14:04 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:54726 "EHLO relmlor4.renesas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750947Ab1FOGOD (ORCPT ); Wed, 15 Jun 2011 02:14:03 -0400 Received: from relmlir3.idc.renesas.com ([10.200.68.153]) by relmlor4.idc.renesas.com ( SJSMS) with ESMTP id <0LMT00HDJINEZA90@relmlor4.idc.renesas.com> for linux-sh@vger.kernel.org; Wed, 15 Jun 2011 15:14:02 +0900 (JST) Received: from relmlac2.idc.renesas.com ([10.200.69.22]) by relmlir3.idc.renesas.com ( SJSMS) with ESMTP id <0LMT003CLINDS0C0@relmlir3.idc.renesas.com> for linux-sh@vger.kernel.org; Wed, 15 Jun 2011 15:14:02 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 1852128076; Wed, 15 Jun 2011 15:14:02 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 116CF28070; Wed, 15 Jun 2011 15:14:02 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac2.idc.renesas.com with ESMTP id RAL20381; Wed, 15 Jun 2011 15:14:02 +0900 Date: Wed, 15 Jun 2011 15:14:01 +0900 X-IronPort-AV: E=Sophos; i="4.65,369,1304262000"; d="scan'208"; a="32088496" Received: from unknown (HELO PG10870.renesas.com) ([172.30.8.159]) by relmlii1.idc.renesas.com with ESMTP; Wed, 15 Jun 2011 15:14:01 +0900 Message-id: To: Paul Mundt Cc: Magnus , Linux-SH , Guennadi , Kuninori Morimoto In-reply-to: References: From: Kuninori Morimoto Subject: [PATCH 2/5] dmaengine: shdma: add to_sh_dev define User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-2022-JP-2?B?U2Fuag==?= =?ISO-2022-JP-2?B?GyQoRCtXGyhC?=) APEL/10.6 Emacs/23.2 (i386-mingw-nt5.1.2600) MULE/6.0 (HANACHIRUSATO) MIME-version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-type: text/plain; charset=US-ASCII Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 15 Jun 2011 06:14:04 +0000 (UTC) This patch adds "to_sh_dev" macro, and clean up codes. Signed-off-by: Kuninori Morimoto --- drivers/dma/shdma.c | 13 ++++--------- drivers/dma/shdma.h | 2 ++ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index 8bb77b5..8748df3 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c @@ -130,8 +130,7 @@ static bool dmae_is_busy(struct sh_dmae_chan *sh_chan) static unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan, u32 chcr) { - struct sh_dmae_device *shdev = container_of(sh_chan->common.device, - struct sh_dmae_device, common); + struct sh_dmae_device *shdev = to_sh_dev(sh_chan); struct sh_dmae_pdata *pdata = shdev->pdata; int cnt = ((chcr & pdata->ts_low_mask) >> pdata->ts_low_shift) | ((chcr & pdata->ts_high_mask) >> pdata->ts_high_shift); @@ -144,8 +143,7 @@ static unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan, u32 chcr) static u32 log2size_to_chcr(struct sh_dmae_chan *sh_chan, int l2size) { - struct sh_dmae_device *shdev = container_of(sh_chan->common.device, - struct sh_dmae_device, common); + struct sh_dmae_device *shdev = to_sh_dev(sh_chan); struct sh_dmae_pdata *pdata = shdev->pdata; int i; @@ -209,8 +207,7 @@ static int dmae_set_chcr(struct sh_dmae_chan *sh_chan, u32 val) static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val) { - struct sh_dmae_device *shdev = container_of(sh_chan->common.device, - struct sh_dmae_device, common); + struct sh_dmae_device *shdev = to_sh_dev(sh_chan); struct sh_dmae_pdata *pdata = shdev->pdata; const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id]; void __iomem *addr = shdev->dmars; @@ -296,9 +293,7 @@ static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan) static const struct sh_dmae_slave_config *sh_dmae_find_slave( struct sh_dmae_chan *sh_chan, struct sh_dmae_slave *param) { - struct dma_device *dma_dev = sh_chan->common.device; - struct sh_dmae_device *shdev = container_of(dma_dev, - struct sh_dmae_device, common); + struct sh_dmae_device *shdev = to_sh_dev(sh_chan); struct sh_dmae_pdata *pdata = shdev->pdata; int i; diff --git a/drivers/dma/shdma.h b/drivers/dma/shdma.h index 7f5c58f..501265f 100644 --- a/drivers/dma/shdma.h +++ b/drivers/dma/shdma.h @@ -52,5 +52,7 @@ struct sh_dmae_device { #define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, common) #define to_sh_desc(lh) container_of(lh, struct sh_desc, node) #define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx) +#define to_sh_dev(chan) container_of(chan->common.device,\ + struct sh_dmae_device, common) #endif /* __DMA_SHDMA_H */