Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1122771pxb; Tue, 9 Nov 2021 05:34:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6EUtJz0gCDtruknGqOonMaCXacFO764GQFZdkMfIe/MKXA3tgLvCPebcer67LO9O2FU1x X-Received: by 2002:a05:6e02:198e:: with SMTP id g14mr5272806ilf.204.1636464879839; Tue, 09 Nov 2021 05:34:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636464879; cv=none; d=google.com; s=arc-20160816; b=Rrqy2KwuPYYyzoJIRhllPRPY+W29FgHMD27xkoccrkoUUzYJyAJ8JoJxQY6WHPufhW f6vF/DN90PKyAj/s+DBPdxES1KBbn1TOPeJyI7j5ZWvIQBppxzhfvxe/Laj/MciiHaeW d6Hl6T1LJSFnRxC6qqxzkHcaq5TFw3OwBF508AbTV5hWYPJ/YuA2fP8DKKlRm00G2tE4 i/6NbjKwyV4EQwp4O7ADQQ+C0+SD42d7oYg1CjnWx3HmmWvO/AoRrm+isGVqg/vY1x84 qQSQuPNlARDxnPNOIUsnbQLnuUu+cUAQpbjCtA4elszKLcziWlVZ/oXhVmVf1XIhqME+ BEBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RPvJcJDPMdp7Swo0W51sy6DYmybCviFK4B196uJ5MtU=; b=CRgTm6Xho7Mzi1jQLu+QXSu+CCHX7NkxW/+Pw7i/6oP0jyBxOdfia2R25ojP4gT3Ev oSFZqWklbSUri4XPpeDvQz4jfBDf7ACFturZSF3c5xDiTQ8OdRmySKhkR2OMkWlN3z/R epOhueFuA5t2oul3QkTCKRLu/Oixgx99yXu3PNHw1XVxE719UbxkK6ln104GTnePgccM rBkliOQh6arX7O07KEMbEtsXdVC8O6M74k4CfhETHlvxx2ZpEPZnIBSaCZWRzVHTTGkA 0lGXXIFRq3odWzcLcZnqf/aVH4nCNG26BxQUL9qsAMx6iBrGv+FaO0qkjYgbKn+2RvD/ AHGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=B4RJTFsV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v33si22246561jal.20.2021.11.09.05.34.24; Tue, 09 Nov 2021 05:34:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=B4RJTFsV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242812AbhKIEql (ORCPT + 99 others); Mon, 8 Nov 2021 23:46:41 -0500 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:62176 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242766AbhKIEqk (ORCPT ); Mon, 8 Nov 2021 23:46:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1636433035; x=1667969035; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=RPvJcJDPMdp7Swo0W51sy6DYmybCviFK4B196uJ5MtU=; b=B4RJTFsVYUWnpLsLCLV9YTjlCqdSfTmFSJm7ZcxYJXKZ68rP+RA4lHZh CIf2R60odjISVa7YAyXXTQFRCvMOOPxaTsGNlJASAODykVdjUwhr9oXWc BFF3wctjiZpp5h1BqDX6c+dzwq6Q2bDNAjtejuCycOXIv/UpTONMH4CU9 8=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-02.qualcomm.com with ESMTP; 08 Nov 2021 20:43:55 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 20:43:54 -0800 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.7; Mon, 8 Nov 2021 20:43:54 -0800 Received: from qian-HP-Z2-SFF-G5-Workstation (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.7; Mon, 8 Nov 2021 20:43:52 -0800 Date: Mon, 8 Nov 2021 23:43:50 -0500 From: Qian Cai To: Andy Shevchenko CC: "Rafael J. Wysocki" , Heikki Krogerus , Greg Kroah-Hartman , Laurentiu Tudor , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Felipe Balbi , , Lorenzo Pieralisi , Subject: Re: [RFC PATCH] software node: Skip duplicated software_node sysfs Message-ID: References: <20211101200346.16466-1-quic_qiancai@quicinc.com> <52df4a97-1132-d594-0180-132d0ca714d5@quicinc.com> <1269258d-db4c-3922-776b-f11e6a1e338e@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 08, 2021 at 08:06:26PM +0200, Andy Shevchenko wrote: > Btw, what you can do in this case is to switch to use fwnode_create_software > node and switch them in drd.c. It will be much much easier to achieve then > full kernel refactoring. (Adding arm64 and dwc3 people since that iort_iommu_configure_id() path below to create a duplicated sysfs is arm64-specific. The original thread is here): https://lore.kernel.org/lkml/20211101200346.16466-1-quic_qiancai@quicinc.com/ Andy, did you mean host.c? I saw that the first time "/devices/platform/808622B7:01/xhci-hcd.3.auto/software_node" was created by dwc3_host_init(). Call trace: sysfs_do_create_link_sd.isra.0 sysfs_create_link software_node_notify device_add platform_device_add dwc3_host_init dwc3_probe platform_probe really_probe.part.0 really_probe __driver_probe_device driver_probe_device __driver_attach bus_for_each_dev driver_attach bus_add_driver driver_register __platform_driver_register dwc3_driver_init dwc3_driver_init at drivers/usb/dwc3/core.c:2072 do_one_initcall kernel_init_freeable kernel_init ret_from_fork Then, which functions do you suggest to replace with fwnode_create_software_node()? In dwc3_host_init(), int dwc3_host_init(struct dwc3 *dwc) { ... xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO); ... ret = platform_device_add(xhci); I am wondering if that we could solve the problem by avoiding "xhci-hcd" string here which would unfortunately clash with xhci_plat_init() as mentioned before: sysfs_create_link software_node_notify device_create_managed_software_node iort_named_component_init iort_iommu_configure_id acpi_dma_configure_id platform_dma_configure really_probe.part.0 really_probe __driver_probe_device driver_probe_device __driver_attach bus_for_each_dev driver_attach bus_add_driver driver_register __platform_driver_register xhci_plat_init do_one_initcall kernel_init_freeable kernel_init ret_from_fork since the driver would also use "xhci-hcd". static struct platform_driver usb_xhci_driver = { ... .driver = { .name = "xhci-hcd", static int __init xhci_plat_init(void) { ... return platform_driver_register(&usb_xhci_driver); BTW, "/sys/devices/platform/808622B7:01/software_node" was also created from the path: sysfs_create_link software_node_notify device_create_managed_software_node iort_named_component_init iort_iommu_configure_id acpi_dma_configure_id platform_dma_configure really_probe.part.0 really_probe __driver_probe_device driver_probe_device __driver_attach bus_for_each_dev driver_attach bus_add_driver driver_register __platform_driver_register dwc3_driver_init do_one_initcall kernel_init_freeable kernel_init ret_from_fork # ls -l /sys//devices/platform/808622B7:01/xhci-hcd.3.auto/software_node lrwxrwxrwx 1 root root 0 Nov 9 03:18 /sys//devices/platform/808622B7:01/xhci-hcd.3.auto/software_node -> ../../../../kernel/software_nodes/node4 # ls -l /sys//devices/platform/808622B7:01/software_node lrwxrwxrwx 1 root root 0 Nov 9 03:18 /sys//devices/platform/808622B7:01/software_node -> ../../../kernel/software_nodes/node4