Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2542823lqo; Mon, 20 May 2024 08:54:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWAnjYJI8ce3ktk1UVbX9raD+7NQIAlKEYDFuNd61c+e7cajX93nSICmj26kAHRMvlLiDmfgB7KrNs8icyNSokbwKUu7ej1DclD/l6xWw== X-Google-Smtp-Source: AGHT+IFVq8so8vt2eqSv9FOL3hCLTG6aA+ybkd99XItnVA0EfoiUFq2sNv+SX5D0Lp8K9pX0giH5 X-Received: by 2002:a05:6808:8c2:b0:3c9:6d2b:cd9 with SMTP id 5614622812f47-3c99704c2ecmr27724530b6e.16.1716220456158; Mon, 20 May 2024 08:54:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716220456; cv=pass; d=google.com; s=arc-20160816; b=aEOMFplZ7CMxfkhPJjn5+YB3/p5hyDtk2eQsBh+AAOM+gUVVwmpGfuezGYs8Sg5GAO zkKegHIYTR6ZRfGVg1KtvfvI/eVfcFgbmPOGpbK2SMRTxIQvXgZCiTUv3EDmRWGVWgS8 QGUU5zzvJav/Z4OhOF3pjBA9o6WKghKzvT2uyFeofLhKQbHCW1fMUV4DO4l2WllCU9Tf C5d858EFxsqHcm523BFRvuuVN5j2GkzVzyW/yyUl1qvEdLDP7GgKtZVzCi0e63JBI9nQ /9ulBkg8wEbXa8Nff60UcKYMf7CIzrryj3wnx7q64u8RkLqS926iHp0zJpgGSxXr1VnI nJLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=IOYWpx+7FTJlYFtMjUGlHKbBuJPgpevIoZcXKDKHnVE=; fh=GMVtMPLlwt/lj9i49KuTObjDq8olvs384ecnCjKLSCY=; b=ctdWQ0siQfgRjXzW2361b0e9XXst/BJCv7Hayq5VDNERRXTo2RdzNjWRkbzwbJVwl7 pRjEqxe3wXEMvJXnlv0oqMYrxVl8ZzTXHs12twK2aoHItz+SfNJIx8i5wVIXjjB+HV2I GFb6pO8P0vzFhew/H96yg8ua5YPH2Q9sFzeuxx6Yq0XkMIy45wyyy1RP2u22wUWk/yUo vcZ1oCrnkG3ktlMJWdObne8M0gdaukPQVh+gRjI7N/7JCr4S3g53+vcFTotkAAGCFnxX 1O+cDuGds05AM+EDKIU4UHuxHve4h+qsliwjFqMvlGT3ucBBrgZPvYrmQdmtDX5pI9ao 4kaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=8E7ZbTo5; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-183941-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183941-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com 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-792bf30b7e9si486160585a.334.2024.05.20.08.54.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 08:54:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183941-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=@foss.st.com header.s=selector1 header.b=8E7ZbTo5; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-183941-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183941-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.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 CB7A11C211E7 for ; Mon, 20 May 2024 15:54:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D926137C24; Mon, 20 May 2024 15:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="8E7ZbTo5" Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (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 A8D8E7C0B2; Mon, 20 May 2024 15:53:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716220395; cv=none; b=SmVayFeKdxlaCseuZWJe959IvEX+9saA9Y8mKieycm+6qHh5SWNqSlIp+jfy1yG2plderhjHCPqiPcOCHIWu4m1sU/DJaVRrnwOswENeA6FzXaDBGwp958dAUHNX4+hr3x96IlBEzWfus0gBGIsffyYzFbi7s4XqhM0H121HIQo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716220395; c=relaxed/simple; bh=qad6qskwZYQn+D5N1xzwJq/c78GJYvm0C1sRMaB+DyM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mge+A5TLdt5SZ7t4m6HlNSEF7SIBtDWJXJuJ5MNKAupbpmiHosgSc4QXbQ84NBGpQvjAT4bMDKdVKTd+8dzfhFsY1vsg5+o+aslTc0VndiRoYEYNZ8lobophfUxXyI8FX7Qnaq5z0f72InVbw4zIUZZx4QOIIZAWDMnMOxeT7A8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=8E7ZbTo5; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44KEih6Z004173; Mon, 20 May 2024 17:52:52 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=IOYWpx+7FTJlYFtMjUGlHKbBuJPgpevIoZcXKDKHnVE=; b=8E 7ZbTo5FyL2wWZLBseJhm5fI2+QQK56U/gxcLCcGqlICBytt8jeYt7YVZEwm81PCs bUk62MnLyhngzwsxnlKnEahjARVQGYxVVuVDtui6ycVnoX3kJvlxvnuM2J9dxBT/ 9tw09k5S3SCtqMamPW8CxTzaQmxFn+JUaDNnD9/ZDdoM/Oa2YZ2C1Onf1pmAqXF1 ykhcVth8p1awoWrQwy+ewiw8VydNPE6KwrOJcjT2FvyCoebnLmP6O1qYQ4HSJcKw 7f3aK6ujnh7oTGQWefW2RJua2BGwOkV/YlfRdveNyPvKMOAmHFMkntiUEeYxTksj vGXXJiOOzjwuPwPQ0JwA== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3y6n6hfpeg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 May 2024 17:52:52 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 720084002D; Mon, 20 May 2024 17:52:46 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 9E5F9226FBD; Mon, 20 May 2024 17:52:00 +0200 (CEST) Received: from localhost (10.252.8.132) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 20 May 2024 17:52:00 +0200 From: Amelie Delaunay To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , , Amelie Delaunay Subject: [PATCH v3 10/12] dmaengine: add channel device name to channel registration Date: Mon, 20 May 2024 17:49:46 +0200 Message-ID: <20240520154948.690697-11-amelie.delaunay@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240520154948.690697-1-amelie.delaunay@foss.st.com> References: <20240520154948.690697-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-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-20_09,2024-05-17_03,2024-05-17_01 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. 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 491b22240221..c380a4dda77a 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; @@ -1203,7 +1207,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 cd835eabd31b..dbecd699237e 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 752dbde4cec1..73537fddbb52 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -1575,7 +1575,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