Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3096760rdb; Wed, 13 Sep 2023 01:40:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHaMpjuY/J3Cy1BUpegKArhocshj9VWiSjw5dYSzpOfqSH6r9e2SB2oNoluBh/21GEAUPjL X-Received: by 2002:a05:6a20:6daf:b0:158:1387:6a95 with SMTP id gl47-20020a056a206daf00b0015813876a95mr717063pzb.19.1694594453640; Wed, 13 Sep 2023 01:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694594453; cv=none; d=google.com; s=arc-20160816; b=JY++BdJeBc/WetopBs+IzSRJ+bnCnlOdpqMr9Hs2od4Mx2m/pwfBwmgIEa16hhSbpw HrvJv+pkAhHR2A8CICAbx1bXBf149rf+3Mf2dMTYDMjRLm0b2OpbFIpMBlqRuQgyj9sT heujWH4w30iFXixReEeqYzY6wS1Ub/XYaiM1cNcQ2mPWiRSLilJgMJvvJLjLoYUllrLK KMOw2af57tPvbSgKYvB6U1v7Vjhh1VN0NNsfTniVUTN2T7p5CbPPX7HEeWC9uvhCdgOF 5m2nSBzZAXGtpFFwlX2JaT72ljP8kkBISRuu3dSLticf/iZgURBMwZUADoWpbV3HWKj0 dUdg== 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=0GxVMeNb/eVsL5k6yegenMY0uKehAcu5sJKI/IuX61Q=; fh=hID0bbkjjxAQo3fZl29aVr26rPTZDpAFealu3BGAL1k=; b=0iPUi8nFPYAaGl2L/p6QwTYSJk2j8mQusInkgpxrHWNfJrvwuJXqvSo81y7hvdUb/2 I9qgBbRPhKHd3kWxKveD7ZveRzRPuw3MrdiPH71Xi4rV/w6dWxg9oEzTcS2HMkN/+yXA vij9gWrnDnTu0/yQbhC/sCMkQvuAxdwoFROgGHctvsS9L5qDIutGf/8ceDYNbflI9Nrx zHkVK/N1KUBqF/rlRZDqONvSv4NhC/Ygjsormx8+8jvBsLTHfH8974bf9CUOTE2VrS6M OeCWua6IeAbbGjPgM2LNWDKA2m0x8VdW9JEME5/7rHaLTMW2v39J9FAQA0OdqvPJCWbb rpxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="TQ606CQ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id l13-20020a17090aec0d00b0026841a42bfdsi1078437pjy.159.2023.09.13.01.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 01:40:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="TQ606CQ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 1D1FD82430A2; Wed, 13 Sep 2023 01:38:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238995AbjIMIii (ORCPT + 99 others); Wed, 13 Sep 2023 04:38:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238983AbjIMIii (ORCPT ); Wed, 13 Sep 2023 04:38:38 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97D0D196 for ; Wed, 13 Sep 2023 01:38:34 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1bf7a6509deso45784235ad.3 for ; Wed, 13 Sep 2023 01:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1694594314; x=1695199114; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0GxVMeNb/eVsL5k6yegenMY0uKehAcu5sJKI/IuX61Q=; b=TQ606CQ/XNc0d6LRzKEeveRJMj17fIFhZVKbBLROhRf4Gp46fa9GZhxK7q2oH/DXab PNSzSrCa91yRnMNEHQQ2PRAsnve9FQBfXePaKnJATHrM5ON7UGIxf0B3ngFITaTOLw/j yQmrJq3FAq8EzW8XxAfU9F+2ZBPyVljqSh8mFArG+LKHy7UeCn5TkWorKb/bhaX2EyY3 w2fPwMErd7ZEkkBnWT4su14/SzVv1MR/xcin+yCF8vFVcIVbl1p7iH79ZkBI1R8Fe21j /F1Ph4lD4wFBJq3lmyQ7I9R4Hcd4PC7psf7TPrMr6hK6C9lSd52M6WW8BkWxCMuGRHFT 7QUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694594314; x=1695199114; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0GxVMeNb/eVsL5k6yegenMY0uKehAcu5sJKI/IuX61Q=; b=LMvoOepOe4wzG1jKtqwvJTo6lLHmFPI2d9A4agEBx4Hb2oHItTMk6cUJPQ+Pf2z2Iw KN6DENMwmp9jT9l+oT+miqCJ7PjyJP/ujevEcgOhpTxqWSbFAJjT+/sE+1K/UZ8kEVYE hhOSspgQskGBrMqI5JZx6JK1uklkM1oB7jChDjvZOlrqEu3kgDEZwPsDPW23qFfwaUeq BS08YAnK6pKfVBCH7tr2sSnn9b1AlpnlXKDBSaidGCvue83ikXqIbRQzqR8DQVov7kOC umXfAahRVnpqbqNgxF6PfdJBwsUnXvLoFdO6JDUTp/stncImTJOfNhuZA/Y4TiU7aD+0 Emkw== X-Gm-Message-State: AOJu0YzLb1xa4kfs5o/yECl3bGkddKqXfi9VP7Hz2E+iGUP1VEId6bik 2Ch2pWybF5vdlKoWuhVPB8RlnA== X-Received: by 2002:a17:902:ab95:b0:1c1:fe97:bf34 with SMTP id f21-20020a170902ab9500b001c1fe97bf34mr2055525plr.24.1694594314083; Wed, 13 Sep 2023 01:38:34 -0700 (PDT) Received: from PF2LML5M-SMJ.bytedance.net ([220.243.131.6]) by smtp.gmail.com with ESMTPSA id p6-20020a170902a40600b001c3adb4f9e3sm6105837plq.120.2023.09.13.01.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 01:38:33 -0700 (PDT) From: guojinhui To: rafael@kernel.org, lenb@kernel.org, gregkh@linuxfoundation.org Cc: lizefan.x@bytedance.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "guojinhui" , kernel test robot Subject: [PATCH v2] driver core: platform: set numa_node before platform_add_device() Date: Wed, 13 Sep 2023 16:38:25 +0800 Message-Id: <20230913083825.2670-1-guojinhui.liam@bytedance.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (pete.vger.email [0.0.0.0]); Wed, 13 Sep 2023 01:38:41 -0700 (PDT) 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email From: "guojinhui" platform_add_device creates numa_node attribute of sysfs according to whether dev_to_node(dev) is equal to NUMA_NO_NODE. So set the numa node of the device before creating numa_node attribute of sysfs. Fixes: 4a60406d3592 ("driver core: platform: expose numa_node to users in sysfs") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202309122309.mbxAnAIe-lkp@intel.com/ Signed-off-by: guojinhui --- drivers/acpi/acpi_platform.c | 4 +--- drivers/base/platform.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index 48d15dd785f6..adcbfbdc343f 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c @@ -178,11 +178,9 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, if (IS_ERR(pdev)) dev_err(&adev->dev, "platform device creation failed: %ld\n", PTR_ERR(pdev)); - else { - set_dev_node(&pdev->dev, acpi_get_node(adev->handle)); + else dev_dbg(&adev->dev, "created platform device %s\n", dev_name(&pdev->dev)); - } kfree(resources); diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 76bfcba25003..206dc7b020cd 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -795,6 +795,18 @@ void platform_device_unregister(struct platform_device *pdev) } EXPORT_SYMBOL_GPL(platform_device_unregister); +#ifdef CONFIG_ACPI +static inline void platform_set_dev_node(struct platform_device *pdev) +{ + struct acpi_device *adev = to_acpi_device_node(pdev->dev.fwnode); + + if (adev && adev->handle) + set_dev_node(&pdev->dev, acpi_get_node(adev->handle)); +} +#else +static inline void platform_set_dev_node(struct platform_device *pdev) {} +#endif + /** * platform_device_register_full - add a platform-level device with * resources and platform-specific data @@ -841,6 +853,7 @@ struct platform_device *platform_device_register_full( goto err; } + platform_set_dev_node(pdev); ret = platform_device_add(pdev); if (ret) { err: -- 2.20.1