From: Sanjay R Mehta <sanmehta@amd.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: Greg KH <gregkh@linuxfoundation.org>,
Sanjay R Mehta <Sanju.Mehta@amd.com>,
dan.j.williams@intel.com, Thomas.Lendacky@amd.com,
Shyam-sundar.S-k@amd.com, Nehal-bakulchandra.Shah@amd.com,
robh@kernel.org, mchehab+samsung@kernel.org, davem@davemloft.net,
linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v9 1/3] dmaengine: ptdma: Initial driver for the AMD PTDMA
Date: Wed, 16 Jun 2021 17:30:49 +0530 [thread overview]
Message-ID: <627518e2-8b20-d6a9-1e0c-9822c4fa95ed@amd.com> (raw)
In-Reply-To: <YMmt1qhC1dIiYx7O@vkoul-mobl>
On 6/16/2021 1:22 PM, Vinod Koul wrote:
> [CAUTION: External Email]
>
> On 16-06-21, 12:27, Sanjay R Mehta wrote:
>>
>>
>> On 6/16/2021 11:46 AM, Greg KH wrote:
>>> [CAUTION: External Email]
>>>
>>> On Wed, Jun 16, 2021 at 10:24:52AM +0530, Sanjay R Mehta wrote:
>>>>
>>>>
>>>> On 6/16/2021 9:45 AM, Vinod Koul wrote:
>>>>> [CAUTION: External Email]
>>>>>
>>>>> On 15-06-21, 16:50, Sanjay R Mehta wrote:
>>>>>
>>>>>>>> +static struct pt_device *pt_alloc_struct(struct device *dev)
>>>>>>>> +{
>>>>>>>> + struct pt_device *pt;
>>>>>>>> +
>>>>>>>> + pt = devm_kzalloc(dev, sizeof(*pt), GFP_KERNEL);
>>>>>>>> +
>>>>>>>> + if (!pt)
>>>>>>>> + return NULL;
>>>>>>>> + pt->dev = dev;
>>>>>>>> + pt->ord = atomic_inc_return(&pt_ordinal);
>>>>>>>
>>>>>>> What is the use of this number?
>>>>>>>
>>>>>>
>>>>>> There are eight similar instances of this DMA engine on AMD SOC.
>>>>>> It is to differentiate each of these instances.
>>>>>
>>>>> Are they individual device objects?
>>>>>
>>>>
>>>> Yes, they are individual device objects.
>>>
>>> Then what is "ord" for? Why are you using an atomic variable for this?
>>> What does this field do? Why doesn't the normal way of naming a device
>>> come into play here instead?
>>>
>>
>> Hi Greg,
>>
>> The value of "ord" is incremented for each device instance and then it
>> is used to store different name for each device as shown in below snippet.
>>
>> pt->ord = atomic_inc_return(&pt_ordinal);
>> snprintf(pt->name, MAX_PT_NAME_LEN, "pt-%u", pt->ord);
>
> Okay why not use device->name ?
>
> Trying to unroll further, who creates pt_device? who creates the dev
> object under this..?
>
Hi Vinod,
The pt_device is allocated and initialized in the PCI probe function and
then we just get the "dev" from the "pci_dev" object and save it in
"pt->dev" as shown in below snippet.
static int pt_pci_probe(struct pci_dev *pdev, const struct
pci_device_id *id)
{
struct pt_device *pt;
struct pt_msix *pt_msix;
struct device *dev = &pdev->dev;
Thanks,
- Sanjay
next prev parent reply other threads:[~2021-06-16 12:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 17:22 [PATCH v9 0/3] Add support for AMD PTDMA controller driver Sanjay R Mehta
2021-06-02 17:22 ` [PATCH v9 1/3] dmaengine: ptdma: Initial driver for the AMD PTDMA Sanjay R Mehta
2021-06-08 17:39 ` Vinod Koul
2021-06-15 11:20 ` Sanjay R Mehta
2021-06-16 4:15 ` Vinod Koul
2021-06-16 4:54 ` Sanjay R Mehta
2021-06-16 6:16 ` Greg KH
2021-06-16 6:57 ` Sanjay R Mehta
2021-06-16 7:17 ` Greg KH
2021-06-16 7:52 ` Vinod Koul
2021-06-16 7:59 ` Greg KH
2021-06-16 9:46 ` Sanjay R Mehta
2021-06-16 9:56 ` Vinod Koul
2021-06-16 12:00 ` Sanjay R Mehta [this message]
2021-06-16 12:23 ` Greg KH
2021-06-16 12:53 ` Sanjay R Mehta
2021-06-16 12:57 ` Greg KH
2021-06-02 17:22 ` [PATCH v9 2/3] dmaengine: ptdma: register PTDMA controller as a DMA resource Sanjay R Mehta
2021-06-08 18:56 ` Vinod Koul
2021-06-15 11:34 ` Sanjay R Mehta
2021-06-16 4:18 ` Vinod Koul
2021-06-16 5:23 ` Sanjay R Mehta
2021-06-20 3:52 ` Sanjay R Mehta
2021-06-02 17:22 ` [PATCH v9 3/3] dmaengine: ptdma: Add debugfs entries for PTDMA Sanjay R Mehta
2021-06-09 14:10 ` Vinod Koul
2021-06-15 11:18 ` Sanjay R Mehta
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=627518e2-8b20-d6a9-1e0c-9822c4fa95ed@amd.com \
--to=sanmehta@amd.com \
--cc=Nehal-bakulchandra.Shah@amd.com \
--cc=Sanju.Mehta@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=Thomas.Lendacky@amd.com \
--cc=dan.j.williams@intel.com \
--cc=davem@davemloft.net \
--cc=dmaengine@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab+samsung@kernel.org \
--cc=robh@kernel.org \
--cc=vkoul@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;
as well as URLs for NNTP newsgroup(s).