Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp256351rdb; Thu, 21 Dec 2023 08:18:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeSvDhWiFfYXELcuoGOGcnEmc7XvnhBA8K1f/KhivXElafDyeiv/LdDJurDjQND29xr9oF X-Received: by 2002:a05:6a20:6115:b0:185:a90d:363d with SMTP id m21-20020a056a20611500b00185a90d363dmr926874pzb.2.1703175482387; Thu, 21 Dec 2023 08:18:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703175482; cv=none; d=google.com; s=arc-20160816; b=hheDI+FGYc8Ug9jvS+t+i4Q4vhw2jAsItuD29/qbG//dFevH7sOvrWJcS4rHASSyQR LLguHv3leH73gPHXtym+7sC2MBkr0UsRVw4q7NydHNryd+7U+ildn7LJAjHURH805O/7 Fj1F/8DQa7rBqlJgqZfygWb/ompGuI6+ghKMbcjqRkIavI716DLFvE8dEwcyP1S9vRwE zCSdeo+gaND5CoSW0bd0C/HA2ATdaTcX83/p8wHklLkoMMikiVfTwbWwZPWKk3Wk7oqs gW6AB2KnExia19bPF2NHxDmMseGbLrnICi/weZq+xuoA/BP7OFOifoph6EX7Ko2N57gC hYAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8BdLwgOJVsZ1Pewoxwrj72P7zS4mZ2CwRFQ2yDongWk=; fh=a6VphbD9BiiB+KRjqOZlM72FkK3FmbSm0tNbp2FcBGM=; b=IV2EHYV2TJLYrFlwuiNAWXEJo70mYHx8vLaM7hfpeTkdWe3kYZqflAhsxJvNMAuQd6 UdxEYM3gH4wT1N6dnLK9oaPgWoqOQdXdNwl9Q6EATfx4/i+JSlcqKDof2pXHxuvS4X5j JrQ8Va7qfwMchX2mqbEjC5lLy22fNJLr5lm3TAxbXhFSFoGGQBeLmAFBZeleG0nAfVlL Ph+R/3QH/eKcFD7UXyajnS/hNBAJZkV3znv4oMsz/q6zHhHNwRPpaoTc6HqcPwr53xlQ px7Nc54yNY/7zIR4CsAYsy5v+CrYxDzd9rwalxq5EAh2zGs9pUCQpoQuus5icvAVr8mz HlIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=THy9I8gu; spf=pass (google.com: domain of linux-kernel+bounces-8747-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8747-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z64-20020a636543000000b005cdbf27fdd1si1728615pgb.684.2023.12.21.08.18.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 08:18:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8747-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=THy9I8gu; spf=pass (google.com: domain of linux-kernel+bounces-8747-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8747-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BAD79B26391 for ; Thu, 21 Dec 2023 16:16:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DE426281D; Thu, 21 Dec 2023 16:13:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="THy9I8gu" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9267C55E64; Thu, 21 Dec 2023 16:13:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67F58C433C7; Thu, 21 Dec 2023 16:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703175236; bh=n2/uLWpjh2wZRMXJuKHDXAa3gaxHUDqxFQmjrE23LiQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=THy9I8gu3LEqHP46W6i8JJ2kcs3okxkg/u6YwaNdGX27WJg2fX3jQkRMCiCSCVJW/ FUDio7aZg+gnXb3yWkktt+KDUTylPLHEROk+DyW806DspK8fu+KfYMc70x8awwnOce cba8cRIMJh7DJTfgBTRH35gzFCu2aR1gckJljCpRJUqEuhYXIeTPx9CNSQHd5oxU7v rdt0SLDB+D+OS2TEdTWj5WGk3D8fdUDWWLxpP19puvs8bONpJQbeEt7/QHarOgqWDI NO8zBCMtUQCsWGwPWWQ+Se4RQVOKzRo9ct9pomRwoGerVtf8LJuapH9N5gz+exdOn+ jF8bkMQjKhZbw== Date: Thu, 21 Dec 2023 21:43:51 +0530 From: Vinod Koul To: Amelie Delaunay Cc: Fenghua Yu , Dave Jiang , linux-stm32@st-md-mailman.stormreply.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dmaengine: add channel device name to channel registration Message-ID: References: <20231213174021.3074759-1-amelie.delaunay@foss.st.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231213174021.3074759-1-amelie.delaunay@foss.st.com> On 13-12-23, 18:40, Amelie Delaunay wrote: > Channel device name is used for sysfs, but also by dmatest filter function. > > With dynamic channel registration, channels can be registered after dma > controller registration. Users may want to have specific channel names. > > If name is NULL, the channel name relies on previous implementation, > dmachan. lgtm, where is the user for this..? > > Signed-off-by: Amelie Delaunay > --- > drivers/dma/dmaengine.c | 16 ++++++++++------ > drivers/dma/idxd/dma.c | 2 +- > include/linux/dmaengine.h | 3 ++- > 3 files changed, 13 insertions(+), 8 deletions(-) > > diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c > index b7388ae62d7f..7848428da2d6 100644 > --- a/drivers/dma/dmaengine.c > +++ b/drivers/dma/dmaengine.c > @@ -1037,7 +1037,8 @@ static int get_dma_id(struct dma_device *device) > } > > static int __dma_async_device_channel_register(struct dma_device *device, > - struct dma_chan *chan) > + struct dma_chan *chan, > + const char *name) > { > int rc; > > @@ -1066,8 +1067,10 @@ static int __dma_async_device_channel_register(struct dma_device *device, > chan->dev->device.parent = device->dev; > chan->dev->chan = chan; > chan->dev->dev_id = device->dev_id; > - dev_set_name(&chan->dev->device, "dma%dchan%d", > - device->dev_id, chan->chan_id); > + if (!name) > + dev_set_name(&chan->dev->device, "dma%dchan%d", device->dev_id, chan->chan_id); > + else > + dev_set_name(&chan->dev->device, name); > rc = device_register(&chan->dev->device); > if (rc) > goto err_out_ida; > @@ -1087,11 +1090,12 @@ static int __dma_async_device_channel_register(struct dma_device *device, > } > > int dma_async_device_channel_register(struct dma_device *device, > - struct dma_chan *chan) > + struct dma_chan *chan, > + const char *name) > { > int rc; > > - rc = __dma_async_device_channel_register(device, chan); > + rc = __dma_async_device_channel_register(device, chan, name); > if (rc < 0) > return rc; > > @@ -1200,7 +1204,7 @@ int dma_async_device_register(struct dma_device *device) > > /* represent channels in sysfs. Probably want devs too */ > list_for_each_entry(chan, &device->channels, device_node) { > - rc = __dma_async_device_channel_register(device, chan); > + rc = __dma_async_device_channel_register(device, chan, NULL); > if (rc < 0) > goto err_out; > } > diff --git a/drivers/dma/idxd/dma.c b/drivers/dma/idxd/dma.c > index 47a01893cfdb..101a265567a9 100644 > --- a/drivers/dma/idxd/dma.c > +++ b/drivers/dma/idxd/dma.c > @@ -269,7 +269,7 @@ static int idxd_register_dma_channel(struct idxd_wq *wq) > desc->txd.tx_submit = idxd_dma_tx_submit; > } > > - rc = dma_async_device_channel_register(dma, chan); > + rc = dma_async_device_channel_register(dma, chan, NULL); > if (rc < 0) { > kfree(idxd_chan); > return rc; > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h > index 3df70d6131c8..cbad92cc3e0b 100644 > --- a/include/linux/dmaengine.h > +++ b/include/linux/dmaengine.h > @@ -1574,7 +1574,8 @@ int dma_async_device_register(struct dma_device *device); > int dmaenginem_async_device_register(struct dma_device *device); > void dma_async_device_unregister(struct dma_device *device); > int dma_async_device_channel_register(struct dma_device *device, > - struct dma_chan *chan); > + struct dma_chan *chan, > + const char *name); > void dma_async_device_channel_unregister(struct dma_device *device, > struct dma_chan *chan); > void dma_run_dependencies(struct dma_async_tx_descriptor *tx); > -- > 2.25.1 -- ~Vinod