Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp86178lqp; Tue, 11 Jun 2024 15:56:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVS6p6O6uBVMHz5OlUBhUh/6hZIS4vrQvrUeek0/M42kJNUPH7lft3hddjEdVCUYYNvg1QmEwsNC33HcKedJzWxf1XWA8mGz2g/ygWkTQ== X-Google-Smtp-Source: AGHT+IFo4xrWonRT89v9QqLq2dVvgMFjdYzXR4pAsvyA9I8haLX47d6uUS15bd55E2jAuuNpfEbU X-Received: by 2002:ac2:4890:0:b0:52b:bf8e:ffea with SMTP id 2adb3069b0e04-52c9a3e2c4bmr47432e87.40.1718146602268; Tue, 11 Jun 2024 15:56:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718146602; cv=pass; d=google.com; s=arc-20160816; b=f0ZywQ07GuYMWMuCVbvrgO22srishz0EqZZeQ3XJ8aICRfMpll/ZVe/woq7Jlw7UqK aON97a/kPvDU7Db8pEBFqXVY2vUtRajI1cvpPHYWuhV40sQ8o24SIXZ6zHtyCUYZ0CuY UdBJs36Cwd8DGVv8c0cCHTzUL+ugKgjbggg8jM4829KuMAFNQFymaHE8e8tjAUj8H4Wz W29Cb9Dt+BNOa3eDAEvozRb1mTzjQgHqM6ZvqeUb3Ycmsfv7Az6dR8CdHUatlix2+K5P thkXqBwRlERbuRlq3We3+HaqZi4CRkGSttLDiCjQSakOb6BWPs44IZrsPDqptMLhLkr7 11dg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=WeWY5EYSyRTtVxqmHVyRh0DLGsJX6o+nhbwxLU4W1Ys=; fh=yr6H0T3KHgahQEioEQNcWtbiz+auLXCWSFFYubaICQE=; b=uLrFodhtt/4FlPZspW7jgTDN+Z4gUYtlsSpLIaDKeAa3PD3Lkw0puiAmccnAgkcVm4 0iszt0Uip8dhLzdaLx8NVyaMn+MaiMTDnSIImJa+K9zfLUJ8tz1EfFYAFRs7jLJxhIRh X/SihWNzxeM/di6rauQNGkk/Y13SiIoZHnMYG5/XI/Kj+AMQW554Ukk9jH9JJ/zED5Z+ U/B1RXGhpFYOZggV4mOhm3tlnSyCU3K7iGNP6v8VYzmtPTdcOEazyv/DKwm+jtrRtCRn 9612bntDXjeKZ2UXes7YSpcLivyLTKMTi142KRSHZyCIlZfvIhLH+sDYBrSthRHmJq9C zryQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OvG5hfJP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-5263-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-5263-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57c770e970csi3095060a12.207.2024.06.11.15.56.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 15:56:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-5263-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OvG5hfJP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-5263-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-5263-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F25D31F23680 for ; Tue, 11 Jun 2024 22:56:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E341155CB7; Tue, 11 Jun 2024 22:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OvG5hfJP" X-Original-To: linux-bluetooth@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64AA5171C4; Tue, 11 Jun 2024 22:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718146565; cv=none; b=SUrNRT9p1s/P+IyKTaPV0ZWlH9pkqqPkK67PphgRMH78UHrZCK/a2RRmyGtjTIN5AIceNiQZdrOi0cE1+j7DPpEUBIrtjy+LEdqRLKrxDEIvJFevm97Ryj+MCCULr2jwqQVSE6ojsDJoRGNJdCgLVbea7ztPSDjcSByXxbTgSEU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718146565; c=relaxed/simple; bh=e+yEenAa0DBKBAH1JDI7Art8IiR8vko+Q5ejQxwgRgI=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=a2si+pWjz+Wv4Ml53+UneVSc7JtWrzoJFLx3xC6hriJ20KqlUYbT92Et+vT29i7001tYs7DLMMR+APC5xIL7ZeDq+/q/5/NCLMQdC8gxi74Wyb5lCPaehS8FXXwmB0zMsaR6+FJIkwHS9Ldyz2Un/nZ2J2d22JLs78M8OSYXnw8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OvG5hfJP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7F39C2BD10; Tue, 11 Jun 2024 22:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718146565; bh=e+yEenAa0DBKBAH1JDI7Art8IiR8vko+Q5ejQxwgRgI=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=OvG5hfJPF+ZFKDXc8gWwryQhBayku2+B8u+fC9uzzr7nfGli565gerUMIqyvQ8xhh D4McVRpS+rqeHTb+xEsXa+HUgAq8qWuH5JZ5NSjWP7kvetD0rpu0Eg7lwgZjjjabw6 YMZ2z4sY4N3Cit6Po1fzGzJevdjLZcddYtqShxtwAvYzkFXaSqWQvdzP+omZjjDbV6 Azwun9MqTlLj0iNAPVD8FT3Hyy/bzNe0znsk1fSHnNkJAPz/YqmS9BV+Rau6GhdoP8 yqy9SCNAiPsSajUpCwQJgO23bSjU7ufbAu1nLTbf2Yx6jE7ZVJMqvjdJq9dKEFqxc/ PCWkwc/rUH6BQ== Date: Tue, 11 Jun 2024 17:56:03 -0500 From: Bjorn Helgaas To: Bartosz Golaszewski Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Balakrishna Godavarthi , Rocky Liao , Kalle Valo , Jeff Johnson , Bjorn Andersson , Konrad Dybcio , Bjorn Helgaas , Srini Kandagatla , Elliot Berman , Caleb Connolly , Neil Armstrong , Dmitry Baryshkov , Alex Elder , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, Jeff Johnson , ath12k@lists.infradead.org, linux-pm@vger.kernel.org, linux-pci@vger.kernel.org, Bartosz Golaszewski , kernel@quicinc.com, Amit Pundir Subject: Re: [PATCH v8 13/17] PCI/pwrctl: reuse the OF node for power controlled devices Message-ID: <20240611225603.GA1005810@bhelgaas> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240528-pwrseq-v8-13-d354d52b763c@linaro.org> On Tue, May 28, 2024 at 09:03:21PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > With PCI power control we deal with two struct device objects bound to > two different drivers but consuming the same OF node. We must not bind > the pinctrl twice. To that end: before setting the OF node of the newly > instantiated PCI device, check if a platform device consuming the same > OF node doesn't already exist on the platform bus and - if so - mark the > PCI device as reusing the OF node. > > Tested-by: Amit Pundir > Signed-off-by: Bartosz Golaszewski With s/reuse/Reuse/ in subject to match history, Acked-by: Bjorn Helgaas Would be good to get Rob's ack as well. > --- > drivers/pci/of.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/of.c b/drivers/pci/of.c > index 51e3dd0ea5ab..b908fe1ae951 100644 > --- a/drivers/pci/of.c > +++ b/drivers/pci/of.c > @@ -6,6 +6,7 @@ > */ > #define pr_fmt(fmt) "PCI: OF: " fmt > > +#include > #include > #include > #include > @@ -13,6 +14,7 @@ > #include > #include > #include > +#include > #include "pci.h" > > #ifdef CONFIG_PCI > @@ -25,16 +27,20 @@ > */ > int pci_set_of_node(struct pci_dev *dev) > { > - struct device_node *node; > - > if (!dev->bus->dev.of_node) > return 0; > > - node = of_pci_find_child_device(dev->bus->dev.of_node, dev->devfn); > + struct device_node *node __free(device_node) = > + of_pci_find_child_device(dev->bus->dev.of_node, dev->devfn); > if (!node) > return 0; > > - device_set_node(&dev->dev, of_fwnode_handle(node)); > + struct device *pdev __free(put_device) = > + bus_find_device_by_of_node(&platform_bus_type, node); > + if (pdev) > + dev->bus->dev.of_node_reused = true; > + > + device_set_node(&dev->dev, of_fwnode_handle(no_free_ptr(node))); > return 0; > } > > > -- > 2.43.0 >