Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp467877lqr; Wed, 5 Jun 2024 11:02:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWO5GI9SjsORnyg4YSAFHgPGkY2FqIsUBG04U7m51pKVSCcMzNAPKLfH4HVs8DFIbr1L2q6sD1xaXFtKuBaRnyfRQxP4GvuBpQmkfoYpw== X-Google-Smtp-Source: AGHT+IHTXEXHkSVLSPjVXUSwoDD9ZBAgbf0FEW/GdElzJiiQnOK9f69yINXsNCmAQpbbrXKSHI92 X-Received: by 2002:ae9:e30c:0:b0:795:1e4d:ba0f with SMTP id af79cd13be357-79523fd5d46mr328282385a.65.1717610543012; Wed, 05 Jun 2024 11:02:23 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-79524ef7be2si71662985a.100.2024.06.05.11.02.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 11:02:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=e5+hFL4Y; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-203009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203009-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DC4F71C23A56 for ; Wed, 5 Jun 2024 18:02:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8179F195819; Wed, 5 Jun 2024 18:00:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="e5+hFL4Y" Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2053.outbound.protection.outlook.com [40.107.22.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8B7F15F400; Wed, 5 Jun 2024 18:00:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.53 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610423; cv=fail; b=nGH4YSTSVwE4a8TDZDc4qHDsvB/7wN+0LjqIeJJBLSxmpBqhwY9Dg0YiaSoE6NdezuDNKAnwZKS1QgCZtLhGzU2tPRK2M87rNmKr5mDeGgLmE/eTw79AkZe6Bn6szlETp8lGwYTGPjAmvPjL7cpLKxdKpYFAe5tlK12F5A3c0qQ= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610423; c=relaxed/simple; bh=O9EVhi3TeN5zT/4WkjkrfWI8UMsHSxzKXn+S3LoAP4Q=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=fOqiuMIfFVswcr4gIY1sJ97EJ0N1o7ym+F/TAadxlBhtTqk3xPgMCqsK+6KEGstWPbPu8mgPbIE6OcI6g1ahfyaeFQH2H9p8FzUaYDXzxgPN1Dpc2lWGcf4PdNsJpTNaH8om6ufe7x9lY3BH1+XiI7CwRAktIWspzhHxE2crwwQ= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=e5+hFL4Y; arc=fail smtp.client-ip=40.107.22.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nOCjIbbvVAhD5KPd1sPNfwgijuSR8lxD8nEciv5HPKToGSpaCqd+aIq/kTi1Q4B8VljCYHKNe4l2pWiEahkdTN6BIfJEIRkHRD/rGD5Djm1TYHH/xpEV6vufuUOGn4KXLwg4P/VhjPkWyxRUpkTYFLCTXsi4licx9+kTDn3g8NhwCGnr//Bygujt0UCD52jYeCAAyPA4D73LqeynAQYoAT5UjCPGXhzLzJI/v8o70ssrj4qQnqlWFW0jYS2Nqjf0kAI5pbSUBoXFVetTpXVru+aRuEOLEsRzaDuiEQY9B3GpQ5YVaxXa6Cdv+vJk6Yc9LAol74JPPL5A2dAc+4wuBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EdLTSyBduHLvZcwqEyzwK2jqKez8VPETjfSihES13oM=; b=TpPodAOVEUd3QV1HlwxgKI/Hu8Ov2qN/ywAA+SoEc+NGd68mts52qiSZjmnPK8aJxToNnNq53ijeowLt7ld+F7as6cpIQKSJ28DpqOmoQwkCFSbs/NYVOSuN6cZLdNoAjBtvYmZkbfmE6gf/334u6kxtRd5/gJTWtT0FMEqqtJxZE7IftXWQgYVubIuHc7A3BJEWcbnB4r50X115zoNTN9cLX82m7MxJhDzzb9fWBLqR8w4NBil0r/pfX6JQX5LVvJm6NerSJsLxpwBj+HvaKzwuio5pAnfmNprWvU+pyWvx+YM9NoCDZIJPhqrqXdFrS/VhYvRliangQpPIlRqXRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EdLTSyBduHLvZcwqEyzwK2jqKez8VPETjfSihES13oM=; b=e5+hFL4YPAdFBo71elunCVEGhQVj+ikxbrkhIhomLUQGu7nx1rwMBVqaYy3rReReFipfUHThEcUW5LY1DvZBSMO7y4HEViq48ky8ijobI5rmgI10W56dedArEVtH8U9z1pk9BEZzfqydFE80DKTZys6CKFcN5LTnA5ULtLAAMtM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by VI1PR04MB6832.eurprd04.prod.outlook.com (2603:10a6:803:139::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.30; Wed, 5 Jun 2024 18:00:17 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7633.021; Wed, 5 Jun 2024 18:00:16 +0000 Date: Wed, 5 Jun 2024 14:00:03 -0400 From: Frank Li To: Dave Stevenson Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Vinod Koul , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Ulf Hansson , Mark Brown , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Vladimir Murzin , Phil Elwell , Stefan Wahren , Serge Semin , devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, iommu@lists.linux.dev, linux-sound@vger.kernel.org, Stefan Wahren Subject: Re: [PATCH 07/18] dmaengine: bcm2385: drop info parameters Message-ID: References: <20240524182702.1317935-1-dave.stevenson@raspberrypi.com> <20240524182702.1317935-8-dave.stevenson@raspberrypi.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240524182702.1317935-8-dave.stevenson@raspberrypi.com> X-ClientProxiedBy: BY3PR05CA0050.namprd05.prod.outlook.com (2603:10b6:a03:39b::25) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB6832:EE_ X-MS-Office365-Filtering-Correlation-Id: a155639c-b35e-4177-21d6-08dc85895ae3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|7416005|376005|52116005|1800799015|38350700005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Y+kp+4QmMaMd8b+p6Klox8Rszs7IqsXLcYUjvhSBjzvvOAyT/J03xlZiScOV?= =?us-ascii?Q?szf1LhpyBm5Y3wMBph/urrL5qlEdPdHEbuMaGumz0vcu+ma2KwpnZAOset3H?= =?us-ascii?Q?028yDTDfGpdGPTHnxG/jsYYMuLVHavFH679s6ApsaTuJHoWAhDiJaXZkbMnl?= =?us-ascii?Q?yRBDnglSbZknXj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?Q?GsNwaACHpPf6TpQgcr0K5MJSL7iaT4UtV6U4/8c+E/G8X9eFw4U+VGE3P0v/?= =?us-ascii?Q?uLmWf4LlJvP9vTw23NhIpCMXClbkh6OGBcOEXb7Aw3WEGZhQ5yvp/8rkb0ID?= =?us-ascii?Q?Fn4BFMguxdQcYX6zCqjBCW5nOeD6s2Ei5QCJag5AgOJ9RvXd2o7r0YjxL5oJ?= =?us-ascii?Q?I02U7SF69nsl9vFSOEVdlRCrUQj/w7xcYSy/B6X/xDIe2q2JZBPQQUjw2Wf+?= =?us-ascii?Q?0SGnMoG/GXVFV7iLBc72hH4XDgTGESktBNMzJARACDG3Xw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(7416005)(376005)(52116005)(1800799015)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?fejAJSkvIRXZbawls78o7bArRkb61dy6oosNJOJvCBXwxAIdiilX2ghBslTK?= =?us-ascii?Q?FmXp7Hr2Ux8qGVz30QVW2DdGCu06x8788V3DXsVbEhkjFq9psNOOnPWlcj2S?= =?us-ascii?Q?053iud7Fu4VetDm/AQV7Mp4DO8dm0eS/sYz+6XWM+FXSkrcERx3ZL/nl3LdJ?= =?us-ascii?Q?vhUdggqe0zzqzaVjNMTPfuvBDLzOMGYYxQEMAFwVgUTv7jwC3IPxmSPPDDWM?= =?us-ascii?Q?cEMgs6jqBAmQ8GiltJuuWW+sktHAcnB4vi2cOmFiO2zxlkMqigcp+2PDlnNC?= =?us-ascii?Q?l7LGLgCO0LZju0mryS6YIvtQQou4KccRV/6azE2W9SGsRXQiqibo/KeIQOFN?= =?us-ascii?Q?5RMiHE0qkqtr4EaVNFWx55j9gNA7xPKDFR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13MnsOTlv8/A1+oIvng8A9lPv1PLiefuuRnA5FpN6EpbJjktfzpmCt?= =?us-ascii?Q?tTiFj/JN/EepvVpzWHCiuMDRfPnNpMgRbbj4chXQYxasYZ3F8/bBsyBhPi7i?= =?us-ascii?Q?8oQlDoHcRnifqQiNGsJ6y0YD/npg2ruM6N9KyEqNhFUHN6owrilfaXmtHF9n?= =?us-ascii?Q?OL9/vlTjl8663za9ogfY2YpdDl9UW7efd7KLQ00z1k/GGiMb++BhlPJ4Vs0h?= =?us-ascii?Q?wCr+QyOtSYTtE/oqga4WTYOwq6gE6OyVhuX5eAJRMR7RA6M8yv1y7FTaYU9C?= =?us-ascii?Q?8xg8uhJ6BhKrCahDNCkuQVDTOItssgL2JIvX6OXc?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a155639c-b35e-4177-21d6-08dc85895ae3 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2024 18:00:16.3793 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WYPOse00GzPAZdSkA6ItI67LPNJybSxrE5SWyhP0eSUqvnfNBx5w+lksYHzofgHOJk22fGrhCQOyDpqnsQkDhg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6832 On Fri, May 24, 2024 at 07:26:51PM +0100, Dave Stevenson wrote: > From: Stefan Wahren > > The parameters info and finalextrainfo are platform specific. So drop > them by generating them within bcm2835_dma_create_cb_chain(). Drop 'info' and 'finalextrainfo' because these can be generated by bcm2835_dma_create_cb_chain(). > > Signed-off-by: Stefan Wahren > Signed-off-by: Dave Stevenson > --- > drivers/dma/bcm2835-dma.c | 83 +++++++++++++++++++-------------------- > 1 file changed, 40 insertions(+), 43 deletions(-) > > diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c > index d6c5a2762a46..e2f9c8692e6b 100644 > --- a/drivers/dma/bcm2835-dma.c > +++ b/drivers/dma/bcm2835-dma.c > @@ -287,13 +287,11 @@ static void bcm2835_dma_desc_free(struct virt_dma_desc *vd) > container_of(vd, struct bcm2835_desc, vd)); > } > > -static void bcm2835_dma_create_cb_set_length( > - struct bcm2835_chan *chan, > - struct bcm2835_dma_cb *control_block, > - size_t len, > - size_t period_len, > - size_t *total_len, > - u32 finalextrainfo) > +static bool > +bcm2835_dma_create_cb_set_length(struct bcm2835_chan *chan, > + struct bcm2835_dma_cb *control_block, > + size_t len, size_t period_len, > + size_t *total_len) Can you document this function, what's return value means? look like if need extrainfo? > { > size_t max_len = bcm2835_dma_max_frame_length(chan); > > @@ -302,7 +300,7 @@ static void bcm2835_dma_create_cb_set_length( > > /* finished if we have no period_length */ > if (!period_len) > - return; > + return false; > > /* > * period_len means: that we need to generate > @@ -316,7 +314,7 @@ static void bcm2835_dma_create_cb_set_length( > if (*total_len + control_block->length < period_len) { > /* update number of bytes in this period so far */ > *total_len += control_block->length; > - return; > + return false; > } > > /* calculate the length that remains to reach period_length */ > @@ -325,8 +323,7 @@ static void bcm2835_dma_create_cb_set_length( > /* reset total_length for next period */ > *total_len = 0; > > - /* add extrainfo bits in info */ > - control_block->info |= finalextrainfo; > + return true; > } > > static inline size_t bcm2835_dma_count_frames_for_sg( > @@ -352,7 +349,6 @@ static inline size_t bcm2835_dma_count_frames_for_sg( > * @chan: the @dma_chan for which we run this > * @direction: the direction in which we transfer > * @cyclic: it is a cyclic transfer > - * @info: the default info bits to apply per controlblock > * @frames: number of controlblocks to allocate > * @src: the src address to assign > * @dst: the dst address to assign > @@ -360,22 +356,24 @@ static inline size_t bcm2835_dma_count_frames_for_sg( > * @period_len: the period length when to apply @finalextrainfo > * in addition to the last transfer > * this will also break some control-blocks early > - * @finalextrainfo: additional bits in last controlblock > - * (or when period_len is reached in case of cyclic) > * @gfp: the GFP flag to use for allocation > + * @flags > */ > static struct bcm2835_desc *bcm2835_dma_create_cb_chain( > struct dma_chan *chan, enum dma_transfer_direction direction, > - bool cyclic, u32 info, u32 finalextrainfo, size_t frames, > - dma_addr_t src, dma_addr_t dst, size_t buf_len, > - size_t period_len, gfp_t gfp) > + bool cyclic, size_t frames, dma_addr_t src, dma_addr_t dst, > + size_t buf_len, size_t period_len, gfp_t gfp, unsigned long flags) > { > + struct bcm2835_dmadev *od = to_bcm2835_dma_dev(chan->device); > struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); > size_t len = buf_len, total_len; > size_t frame; > struct bcm2835_desc *d; > struct bcm2835_cb_entry *cb_entry; > struct bcm2835_dma_cb *control_block; > + u32 extrainfo = bcm2835_dma_prepare_cb_extra(c, direction, cyclic, > + false, flags); > + bool zero_page = false; > > if (!frames) > return NULL; > @@ -389,6 +387,14 @@ static struct bcm2835_desc *bcm2835_dma_create_cb_chain( > d->dir = direction; > d->cyclic = cyclic; > > + switch (direction) { > + case DMA_MEM_TO_MEM: > + case DMA_DEV_TO_MEM: > + break; > + default: > + zero_page = src == od->zero_page; > + } > + > /* > * Iterate over all frames, create a control block > * for each frame and link them together. > @@ -402,7 +408,8 @@ static struct bcm2835_desc *bcm2835_dma_create_cb_chain( > > /* fill in the control block */ > control_block = cb_entry->cb; > - control_block->info = info; > + control_block->info = bcm2835_dma_prepare_cb_info(c, direction, > + zero_page); > control_block->src = src; > control_block->dst = dst; > control_block->stride = 0; > @@ -410,10 +417,12 @@ static struct bcm2835_desc *bcm2835_dma_create_cb_chain( > /* set up length in control_block if requested */ > if (buf_len) { > /* calculate length honoring period_length */ > - bcm2835_dma_create_cb_set_length( > - c, control_block, > - len, period_len, &total_len, > - cyclic ? finalextrainfo : 0); > + if (bcm2835_dma_create_cb_set_length(c, control_block, > + len, period_len, > + &total_len)) { > + /* add extrainfo bits in info */ > + control_block->info |= extrainfo; > + } > > /* calculate new remaining length */ > len -= control_block->length; > @@ -434,7 +443,9 @@ static struct bcm2835_desc *bcm2835_dma_create_cb_chain( > } > > /* the last frame requires extra flags */ > - d->cb_list[d->frames - 1].cb->info |= finalextrainfo; > + extrainfo = bcm2835_dma_prepare_cb_extra(c, direction, cyclic, true, > + flags); > + d->cb_list[d->frames - 1].cb->info |= extrainfo; > > /* detect a size missmatch */ > if (buf_len && (d->size != buf_len)) > @@ -682,9 +693,6 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_memcpy( > { > struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); > struct bcm2835_desc *d; > - u32 info = bcm2835_dma_prepare_cb_info(c, DMA_MEM_TO_MEM, false); > - u32 extra = bcm2835_dma_prepare_cb_extra(c, DMA_MEM_TO_MEM, false, > - true, 0); > size_t max_len = bcm2835_dma_max_frame_length(c); > size_t frames; > > @@ -696,9 +704,8 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_memcpy( > frames = bcm2835_dma_frames_for_length(len, max_len); > > /* allocate the CB chain - this also fills in the pointers */ > - d = bcm2835_dma_create_cb_chain(chan, DMA_MEM_TO_MEM, false, > - info, extra, frames, > - src, dst, len, 0, GFP_KERNEL); > + d = bcm2835_dma_create_cb_chain(chan, DMA_MEM_TO_MEM, false, frames, > + src, dst, len, 0, GFP_KERNEL, 0); > if (!d) > return NULL; > > @@ -714,8 +721,6 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_slave_sg( > struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); > struct bcm2835_desc *d; > dma_addr_t src = 0, dst = 0; > - u32 info = bcm2835_dma_prepare_cb_info(c, direction, false); > - u32 extra = bcm2835_dma_prepare_cb_extra(c, direction, false, true, 0); > size_t frames; > > if (!is_slave_direction(direction)) { > @@ -738,10 +743,8 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_slave_sg( > frames = bcm2835_dma_count_frames_for_sg(c, sgl, sg_len); > > /* allocate the CB chain */ > - d = bcm2835_dma_create_cb_chain(chan, direction, false, > - info, extra, > - frames, src, dst, 0, 0, > - GFP_NOWAIT); > + d = bcm2835_dma_create_cb_chain(chan, direction, false, frames, src, > + dst, 0, 0, GFP_NOWAIT, 0); > if (!d) > return NULL; > > @@ -757,13 +760,9 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( > size_t period_len, enum dma_transfer_direction direction, > unsigned long flags) > { > - struct bcm2835_dmadev *od = to_bcm2835_dma_dev(chan->device); > struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); > struct bcm2835_desc *d; > dma_addr_t src, dst; > - u32 info = bcm2835_dma_prepare_cb_info(c, direction, > - buf_addr == od->zero_page); > - u32 extra = bcm2835_dma_prepare_cb_extra(c, direction, true, true, 0); > size_t max_len = bcm2835_dma_max_frame_length(c); > size_t frames; > > @@ -814,10 +813,8 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic( > * note that we need to use GFP_NOWAIT, as the ALSA i2s dmaengine > * implementation calls prep_dma_cyclic with interrupts disabled. > */ > - d = bcm2835_dma_create_cb_chain(chan, direction, true, > - info, extra, > - frames, src, dst, buf_len, > - period_len, GFP_NOWAIT); > + d = bcm2835_dma_create_cb_chain(chan, direction, true, frames, src, dst, > + buf_len, period_len, GFP_NOWAIT, flags); > if (!d) > return NULL; > > -- > 2.34.1 >