From: "Goswami, Sanket" <Sanket.Goswami@amd.com>
To: Hans de Goede <hdegoede@redhat.com>,
Shyam-sundar.S-k@amd.com, mgross@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] platform/x86: amd-pmc: Store the pci_dev instance inside struct amd_pmc_dev
Date: Fri, 22 Oct 2021 15:46:43 +0530 [thread overview]
Message-ID: <b3c0b917-0dc7-d3aa-fee0-b8181f0fcef3@amd.com> (raw)
In-Reply-To: <ff8b1f12-5123-324d-a8dd-2161c04cafad@redhat.com>
Hi Hans,
On 22-Oct-21 14:21, Hans de Goede wrote:
> [CAUTION: External Email]
>
> Hi Sanket,
>
> On 10/22/21 08:55, Goswami, Sanket wrote:
>> Hi Hans,
>>
>> On 21-Oct-21 23:48, Hans de Goede wrote:
>>> [CAUTION: External Email]
>>>
>>> Hi,
>>>
>>> On 10/21/21 11:29, Sanket Goswami wrote:
>>>> Store the root port information in amd_pmc_probe() so that the
>>>> information can be used across multiple routines.
>>>>
>>>> Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
>>>> ---
>>>> Changes in v2:
>>>> - Store the rdev info in amd_pmc_probe() as suggested by Hans.
>>>
>>> Thank you, but there are still some issues, see below.
>>>
>>>
>>>> drivers/platform/x86/amd-pmc.c | 4 +++-
>>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
>>>> index 55f14bdfdbfd..502f37eaba1f 100644
>>>> --- a/drivers/platform/x86/amd-pmc.c
>>>> +++ b/drivers/platform/x86/amd-pmc.c
>>>> @@ -119,6 +119,7 @@ struct amd_pmc_dev {
>>>> u16 minor;
>>>> u16 rev;
>>>> struct device *dev;
>>>> + struct pci_dev *rdev;
>>>> struct mutex lock; /* generic mutex lock */
>>>> #if IS_ENABLED(CONFIG_DEBUG_FS)
>>>> struct dentry *dbgfs_dir;
>>>> @@ -482,6 +483,7 @@ static int amd_pmc_probe(struct platform_device *pdev)
>>>> return -ENODEV;
>>>> }
>>>>
>>>> + dev->rdev = rdev;
>>>> dev->cpu_id = rdev->device;
>>>> err = pci_write_config_dword(rdev, AMD_PMC_SMU_INDEX_ADDRESS, AMD_PMC_BASE_ADDR_LO);
>>>> if (err) {
>>>> @@ -512,7 +514,6 @@ static int amd_pmc_probe(struct platform_device *pdev)
>>>> }
>>>>
>>>> base_addr_hi = val & AMD_PMC_BASE_ADDR_LO_MASK;
>>>> - pci_dev_put(dev->rdev);
>>>
>>> The current code here actually reads:
>>>
>>> pci_dev_put(rdev);
>>>
>>> Note (rdev) not (dev->rdev). I don't know what you based this on, this is weird.
>>
>> rdev is already retrieved before doing this:
>> pci_dev_put(dev->rdev);
>>
>> i.e.
>> in amd_pmc_probe()
>>
>> rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
>> if (!rdev || !pci_match_id(pmc_pci_ids, rdev)) {
>> pci_dev_put(rdev);
>> return -ENODEV;
>> }
>>
>> after this I am storing rdev in "dev->rdev"
>> i.e.
>> dev->rdev = rdev;
>>
>> after this I am using "dev->rdev" at places where "rdev" was getting used earlier.
>> Do you see any problem?
>
> What I was trying to say is that the patch does not apply, because it is
> trying to remove the pci_put_dev() line from a block of code like this:
>
> base_addr_hi = val & AMD_PMC_BASE_ADDR_LO_MASK;
> pci_dev_put(dev->rdev);
> base_addr = ((u64)base_addr_hi << 32 | base_addr_lo);
>
> But the actual code in platform-drivers-x86/review-hans (and for-next too) has:
>
> base_addr_hi = val & AMD_PMC_BASE_ADDR_LO_MASK;
> pci_dev_put(rdev);
> base_addr = ((u64)base_addr_hi << 32 | base_addr_lo);
>
>
>
> After your patch using dev->rdev instead of just rdev is fine
> (but please be consistent, which would mean use just rdev everywhere).
>
> But your patch is removing a line which does not exist in that form,
> IOW it is based on some intermediate version of amd-pmc.c and not
> on the HEAD of platform-drivers-x86/review-hans.
I will rebase it to review-hans branch and will respin a new version.
Thanks,
Sanket
prev parent reply other threads:[~2021-10-22 10:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 9:29 Sanket Goswami
2021-10-21 18:18 ` Hans de Goede
2021-10-22 6:55 ` Goswami, Sanket
2021-10-22 8:51 ` Hans de Goede
2021-10-22 10:16 ` Goswami, Sanket [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b3c0b917-0dc7-d3aa-fee0-b8181f0fcef3@amd.com \
--to=sanket.goswami@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgross@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®