From patchwork Wed Dec 13 17:40:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 178210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp7948667dys; Wed, 13 Dec 2023 09:41:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeE27+Ta7PWY7fw/WWjfyiJgqaEN3j+/JJD6/+/tgc6haDS4s5HrqquwBfmq2Xy2dRPlhV X-Received: by 2002:a17:90a:ce85:b0:28a:fffc:1b58 with SMTP id g5-20020a17090ace8500b0028afffc1b58mr263303pju.18.1702489280399; Wed, 13 Dec 2023 09:41:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702489280; cv=none; d=google.com; s=arc-20160816; b=kb6CRDP45TBfHSRc/mUkZZPE0s4xHFRPL6PWe/nuWuEJx4PKZnY0wRk9lqhXkQU2qY GqsvXTwzKmleH7EnoqOIcSmoRr83g+k4vXfZzMKpbdtzsiTtjgte09xY18W8lS5PPdQb CGy8ZJyzk+0PCuL8YGUrhgMUgZUERRShApSRkqeMBXz/mi8xg0FmCdvWinziYF7z2p6J 9suBdxZaYfyDyOuXKCDaN/kX3VSTPap3UJ83GbHO/DodVKMmiiMmrYO7+ghsj4LFEnN1 2iMSaSdZYi7vFpLxDDIbqCsZO5zzW+oI2EP59et4OlnxGTgVJO4DwedCdF2+uixYZYPM 2/Eg== 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 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b12-20020a17090a800c00b002859d83de02si9948004pjn.139.2023.12.13.09.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 09:41:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; 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 2620:137:e000::3:3 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 962D880310E2; Wed, 13 Dec 2023 09:41:15 -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 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:15 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785189399288151100 X-GMAIL-MSGID: 1785189399288151100 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);