From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1ACFF156654 for ; Wed, 20 Nov 2024 17:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732122166; cv=none; b=pu2hzSWQZ7KqXmIYyO+5kvwUoS8vcbdC+/8axjlRy+GQU1+DkQUMJPLXtKnFlOTFoETW3sNonlenLN3LEgvoeCvTFfOljTVC0tY8lH01Bw1dWvF3+0IXrKklEnCFuV8FvnQfax0PylM0T93e60iJya2yMHgwwT42VbO99zlJrnQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732122166; c=relaxed/simple; bh=/f8uYPuQX/ROszRbmQFmcbDG3zmYAvpDx4QiLFxHXMY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JEwtc/SXKyuclyngA2VfFpGzMtwmmRyj5GgW4UOVsfJvUHgx4ye7OnxJ0GC6qM1hys1WbxGnvH+4eS8Lta2YGEtxvIdkHwg5MfUiKjvnvxCx5jAB2J7/JMNTjaYperDUFiLKijqaHa+zaAQdV9ZaxCdolHuUY0S6NbojpwJwHZg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=j2in1Zcb; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="j2in1Zcb" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-7206304f93aso22401b3a.0 for ; Wed, 20 Nov 2024 09:02:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732122164; x=1732726964; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=ctM3iStXVQXWRldjhr5j1F7CLkwdxNQDSi2rfTsbrIo=; b=j2in1ZcbinVKOVt+IiwmC86MkvxdqvVtuGtNUIRRM3tSHPOcmOms9XxBVU8CnJIGGi zjWEUyHqwz9HOSz1h6ZWoQaWgGqhXC3DDMaZ22ol1ykG5eByR/ENzbQt7M5bW8IL8Nxo RKUe4pua4lV0qu0D4CvjHuH+Pcg7F2iGnRanQSg6E/ARGcGP5HpXTxpslRVcjrZXa3qD DoKXV94ierumvr+dLTEQ5soFmFNLm72QGwRnavVMUil2EgKeY2J7B9mDUcohekMq2wME +Z1R4MI5Pd2S58sof045t0ysRevRgu1T8AofdyqDtuukHJQkUqe8Xw1r4ljPrqHEM4Of reIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732122164; x=1732726964; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ctM3iStXVQXWRldjhr5j1F7CLkwdxNQDSi2rfTsbrIo=; b=J7Y2DmhLa9TPQRwClSzkhPayJ1PSXFHy2IIZ0O5y1rsj3yhy5z2K3u2QUktaaf2ry7 Kp2118PoyNlkWXt8cL3shvGHXC2y+LjMQ/yLtfMS6noQ3akR09Ek70hqzl6pkDH0pZCi FpHzCnUGF4EwmK69saBTpi4b3znI/TPsEH/YT+38PITetH5Vv31z1S30gucG2L4L+W1S 7kunKH6jJWXIc6vTptUkRgV0SPa6qFwcdnpDIvv3cVMBnO33PeUV8LakCCc6BAefGPCy CN7JcQp9HxqjYzdrvhw/RTOosRoSxXl/O2Vm12/UUl35PywuXv1qnYln+FqKkDTJedjX Huag== X-Forwarded-Encrypted: i=1; AJvYcCXNrSUM0zdPLJg7leV94bRo0Vajuk0W3HVSBHcnx/hSDF51OnyGDh/3mfpPVqPfXR5h8sEcQOWvg4KSZ4k=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2Db543rcwWpzgSRTkHqYTvV2hWiEQpuWmHIqw0IKKqzIZkL0K Fcnz72FMFnF7gbx+QHwK7oEEdXpTuLxoydTFBHRYdco9/AqBeYlpgURHxrGTRA== X-Google-Smtp-Source: AGHT+IHIik/zRYPgkopkspcV4s4tfBgXsrtFiGJpzprYeAmSSfSz+DgK3mZhO54pdUyDOXUVB0Ac3g== X-Received: by 2002:a17:903:2348:b0:20b:861a:25c7 with SMTP id d9443c01a7336-21270463234mr27106695ad.54.1732122164353; Wed, 20 Nov 2024 09:02:44 -0800 (PST) Received: from thinkpad ([120.60.72.89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2124aed0fbbsm36204065ad.18.2024.11.20.09.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 09:02:43 -0800 (PST) Date: Wed, 20 Nov 2024 22:32:32 +0530 From: Manivannan Sadhasivam To: Bjorn Helgaas Cc: Bjorn Helgaas , Bartosz Golaszewski , Bartosz Golaszewski , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov , Johan Hovold , Abel Vesa , Stephan Gerhold , Srinivas Kandagatla , Bjorn Andersson , stable+noautosel@kernel.org, Krishna chaitanya chundru Subject: Re: [PATCH v2 3/5] PCI/pwrctl: Ensure that the pwrctl drivers are probed before the PCI client drivers Message-ID: <20241120170232.flllyqcycsrsk6cj@thinkpad> References: <20241025-pci-pwrctl-rework-v2-3-568756156cbe@linaro.org> <20241120161047.GA2325953@bhelgaas> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20241120161047.GA2325953@bhelgaas> On Wed, Nov 20, 2024 at 10:10:47AM -0600, Bjorn Helgaas wrote: > On Fri, Oct 25, 2024 at 01:24:53PM +0530, Manivannan Sadhasivam via B4 Relay wrote: > > From: Manivannan Sadhasivam > > > > As per the kernel device driver model, pwrctl device is the supplier for > > the PCI device. But the device link that enforces the supplier-consumer > > relationship is created inside the pwrctl driver currently. Due to this, > > the driver model doesn't prevent probing of the PCI client drivers before > > probing the corresponding pwrctl drivers. This may lead to a race condition > > if the PCI device was already powered on by the bootloader (before the > > pwrctl driver). > > > + * Create a device link between the PCI device and pwrctl device (if > > + * exists). This ensures that the pwrctl drivers are probed before the > > + * PCI client drivers. > > + */ > > + pdev = of_find_device_by_node(dn); > > + if (pdev) { > > + if (!device_link_add(&dev->dev, &pdev->dev, DL_FLAG_AUTOREMOVE_CONSUMER)) > > + pci_err(dev, "failed to add device link between %s and %s\n", > > + dev_name(&dev->dev), pdev->name); > > This prints the name for "dev" twice (once by pci_err(dev) and again > from dev_name(&dev->dev)). Is it helpful to see it twice here? Hmm, not very much. It could be reworded as below: pci_err(dev, "failed to link: %s\n", pdev->name); - Mani -- மணிவண்ணன் சதாசிவம்