Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2959705rdb; Tue, 12 Sep 2023 18:57:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzyVDR+kmYpkTyVpRjXO+Zw1smDwHvQgCWq6f9LSh5JzZ9IK1hf4P9Y4+sNPGzjaTztTuj X-Received: by 2002:a05:6358:341d:b0:142:d04e:59f0 with SMTP id h29-20020a056358341d00b00142d04e59f0mr1337341rwd.14.1694570232966; Tue, 12 Sep 2023 18:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694570232; cv=none; d=google.com; s=arc-20160816; b=S0ilexA7kpOua1j/2NfUVq3pWn6OxMMdA5Apwi3oMZR1Vp8vfsMoVwlu7plAKaN5Zd o2sqVNQFrPm1I0ddGGxpl8K8URSDhIPMJZffYkN6w2RVGk3E6hubID+vTfNISIYclQCB 9KfKsx1wS3WRVY4BicpOJwDL52oVkW4pZxBC1YR+rNPmyQ0iIjiJWJb33SElpGXxrVUJ oAS3z24wTwg4/Y8S7pZs50a2A9tdVoOJZIHXS59iHZIPNbdMtaWRIFY/BQv2Yc9dfuSx Gi1+WV2/I/qD81dj5WctsGH7NZcxBxLGo4ZNMcxisiGtyQO7JF+occIjOwjsHijLzv3g PX5A== 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=DH56zUT5lrunOMpd3fqGi9WjnCJZEohtguuTUJSrzes=; fh=0g/CNaSeWwJfzb8CG+09cqWVzxBHClpcDgfiJbaJySA=; b=gbnWizcPhjYf2OhuekyPFzL6ibpfWjFW34kIJGFuP3oksJUY4X5WCkKdBQzoaeaQLF 8OksGXKo4lITi33WChHvergju9QZLbZYfLvs/bptJGus08M9CjQLi0j+h4Y24nj3tvPP 2TgrEKixriP0akOyW/aaOlRvSHu82bIq5/VVDirC40UHCUFf6AGuxZXNG6VRJYJYdIyE J0kv2S4z13dBhJ7jUgIB3pyOlkGfLbZ6139cK6D9JbnAkY5esZWZUcprjdHU2ClkGAR2 0dZN0jEJi8OKeY7uv9336WhankEoJ+1DKfm9VE20GfyI1vUUnhXigN74Cqs+7uxKChh9 +5jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oJUnZGpA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id p4-20020a056a000b4400b0068a3da84110si9364251pfo.333.2023.09.12.18.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 18:57:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oJUnZGpA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E41A584AC679; Tue, 12 Sep 2023 01:12:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232032AbjILIL6 (ORCPT + 99 others); Tue, 12 Sep 2023 04:11:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232228AbjILIL5 (ORCPT ); Tue, 12 Sep 2023 04:11:57 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E49ED10CA; Tue, 12 Sep 2023 01:11:52 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5EF5C433C8; Tue, 12 Sep 2023 08:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1694506312; bh=86DRriTPA8s3y0wTZiZ9RpDhVjbzsr/+auYV4gwpeRQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oJUnZGpAxXe3T43MFIEaLN3gAgGj6Yec9hhpNSmAAhvgXEdShkfB8vpxW35TOXrxw c+hD7iWXhl8eA550i6gFxITfSy96lby8AD4ImDTZwc5vsoysXC9v5nMVSqOryiIQH7 zFHHbJ0p/etx1Mxftp3SP/iLY9LIKuGar9zY12Xc= Date: Tue, 12 Sep 2023 10:11:49 +0200 From: Greg KH To: "guojinhui.liam" Cc: rafael@kernel.org, lenb@kernel.org, lizefan.x@bytedance.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] driver core: platform: set numa_node before platform_add_device() Message-ID: <2023091258-matrix-imitation-cc70@gregkh> References: <20230912070900.1862-1-guojinhui.liam@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230912070900.1862-1-guojinhui.liam@bytedance.com> 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 (howler.vger.email [0.0.0.0]); Tue, 12 Sep 2023 01:12:04 -0700 (PDT) On Tue, Sep 12, 2023 at 03:09:00PM +0800, guojinhui.liam wrote: > 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. Why? What will this allow to happen differently? What is broken with the current code? > Fixes: 4a60406d3592 ("driver core: platform: expose numa_node to users in sysfs") > Signed-off-by: guojinhui.liam Please use your name here, and not your email alias, as the first part of the signed-off-by line. And also, please fix up your email client to have the correct name as well. > --- > drivers/acpi/acpi_platform.c | 4 +--- > drivers/base/platform.c | 4 ++++ > 2 files changed, 5 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..355abf91930a 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -808,6 +808,7 @@ struct platform_device *platform_device_register_full( > { > int ret; > struct platform_device *pdev; > + struct acpi_device *adev = to_acpi_device_node(pdevinfo->fwnode); > > pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id); > if (!pdev) > @@ -841,6 +842,9 @@ struct platform_device *platform_device_register_full( > goto err; > } > > + if (adev) > + set_dev_node(&pdev->dev, acpi_get_node(adev->handle)); Are you sure that this platform code can always call acpi functions? thanks, greg k-h