Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5478167rdb; Wed, 13 Dec 2023 09:41:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRJlJ0U10ViUbEUSZGYveD6jDYGfI36V7CNKP+MiURVejfV2Ui9/R7pm4iJ2y7Ff3muK7P X-Received: by 2002:a05:6a20:1604:b0:190:3b35:5999 with SMTP id l4-20020a056a20160400b001903b355999mr11054128pzj.9.1702489284085; Wed, 13 Dec 2023 09:41:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702489284; cv=none; d=google.com; s=arc-20160816; b=p1OvMCYaE+bF16jjZmBLFrOXArmhXaqWr41RdiKPG4ebp4qTs8Y4beW//mDYl5SFOC D9G7cyfAB7sQBIPWlO+/nt6USKR4VOD7dqxv+/6nRPi2KJMBzP01C+ThrFqJzx41akSG YoRAogF10qdfv8To7Jw8qtrDSrNfMKeC5AWP816Tf9YW9eNZ4FwC0yqPTmwWJFnmhJqE z6RbXWWMJVGuzzNnDTFmSQ9+N4pPULdX7fnvWCBchpFV+sIY3ANXUxQdng4c7GvemQa6 RpcLmcbYni0RUMahGIzIz30B1YWvu4rKkoVZU8uuywRhmpHNICNaI+xYgafBT1DSX9LK dYrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=yDONe2Alkohl+m5aYdxHuWkVZNkm6meJRO4aFoEOgaU=; fh=G+eo8IlRNaoDiiB8mKLWod6IGSQAPc5ZOO5rG6Ewne8=; b=wEesfArYiNCI3kGOsSi4Mme1ySQu8iPXOrK2iFGqelbNlEtLMiXalQNT2cckzgM93f lzLSTh3Ll1U8bBrXyfOm5VAkKIOXqQBQrKNm9xtEaAqJpEmtyX8+GsdmGe+r021Xs8W3 EZo9cm2SGgsOjxD9Boxn+7fL2tgAWgn7Q20YYmbUQeGbP5PCbQBPMlAlY5j/ZTPQFYMR TrkICFYjoWqfinz0IxsEr8kYXB3vV1tcYTqC4lwhC7dAaOO8LOXOu5kY6+LLU5f2sRO5 jkrd3fDP4PFD3Dqk6iZfvsCuIth4oGnsIemWB573Uaz3/DUPvXSyRX2tTu3FE8tESkXw epJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=8MOjHk5Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u6-20020a6540c6000000b005c60319035dsi9577373pgp.835.2023.12.13.09.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 09:41:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=8MOjHk5Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 7305A803C940; Wed, 13 Dec 2023 09:41:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441991AbjLMRlC (ORCPT + 99 others); Wed, 13 Dec 2023 12:41:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442031AbjLMRkv (ORCPT ); Wed, 13 Dec 2023 12:40:51 -0500 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41B6A106; Wed, 13 Dec 2023 09:40:57 -0800 (PST) Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3BDEgvjv018470; Wed, 13 Dec 2023 18:40:23 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=selector1; bh=yDONe2A lkohl+m5aYdxHuWkVZNkm6meJRO4aFoEOgaU=; b=8MOjHk5YLzIMALgn8F6f2c/ onkNpZ1Oi3WlnG/fhp+9ywgOBE4d4PvjclIHl4PEEdgqQ3L7tbRNNb5TQ1aaiebq eEOmqyrpFU61C4F9AxlSvjx+ATS5Zob2EAoF8P++LCj8G8xH+/9LxLI8G9aoddjU Otkj5/tU2srm7h1obJ+JXiexM/c1gJzHrK4jSH0PYW8YJvvVd2SSjIzz+I+o/d/H Y1hDQIQcgQR3WPKB63+cqxApaNparvE3Ndkazd37285zRjInsrXi5m2rgoFBYmQd rWoJpt662vbSIozKaCEzNWkCDj1JDsqS34tZvBMWFwHolEX9GfUZsyRbojLRXYQ= = Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uvehmhyym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 18:40:23 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id AB804100057; Wed, 13 Dec 2023 18:40:22 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 7631A2680BE; Wed, 13 Dec 2023 18:40:22 +0100 (CET) Received: from localhost (10.252.16.151) 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.27; Wed, 13 Dec 2023 18:40:22 +0100 From: Amelie Delaunay To: Vinod Koul , Fenghua Yu , Dave Jiang CC: , Amelie Delaunay , , Subject: [PATCH] dmaengine: add channel device name to channel registration Date: Wed, 13 Dec 2023 18:40:21 +0100 Message-ID: <20231213174021.3074759-1-amelie.delaunay@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.252.16.151] X-ClientProxiedBy: EQNCAS1NODE3.st.com (10.75.129.80) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-13_11,2023-12-13_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 13 Dec 2023 09:41:21 -0800 (PST) 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 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