Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: "Cavitt, Jonathan" <jonathan.cavitt@intel.com>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Cc: "De Marchi, Lucas" <lucas.demarchi@intel.com>
Subject: Re: [PATCH 3/5] drm/xe/configfs: Use pci_name() for lookup
Date: Fri, 18 Jul 2025 11:23:50 +0200	[thread overview]
Message-ID: <97755849-44a3-441a-abfe-29d1815aefa7@intel.com> (raw)
In-Reply-To: <CH0PR11MB544443198055F40D7E90C1E0E551A@CH0PR11MB5444.namprd11.prod.outlook.com>



On 17.07.2025 23:18, Cavitt, Jonathan wrote:
> -----Original Message-----
> From: Intel-xe <intel-xe-bounces@lists.freedesktop.org> On Behalf Of Michal Wajdeczko
> Sent: Thursday, July 17, 2025 11:48 AM
> To: intel-xe@lists.freedesktop.org
> Cc: Wajdeczko, Michal <Michal.Wajdeczko@intel.com>; De Marchi, Lucas <lucas.demarchi@intel.com>
> Subject: [PATCH 3/5] drm/xe/configfs: Use pci_name() for lookup
>>
>> There is no need to manually build PCI device name from BDF data,
>> since it was already prepared and assigned and can be accessed by
>> calling pci_name() function.
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>>  drivers/gpu/drm/xe/xe_configfs.c | 6 +-----
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
>> index 90b4fe92a611..00bb4e412c12 100644
>> --- a/drivers/gpu/drm/xe/xe_configfs.c
>> +++ b/drivers/gpu/drm/xe/xe_configfs.c
>> @@ -312,13 +312,9 @@ static struct configfs_subsystem xe_configfs = {
>>  static struct xe_config_device *configfs_find_group(struct pci_dev *pdev)
>>  {
>>  	struct config_item *item;
>> -	char name[64];
>> -
>> -	snprintf(name, sizeof(name), "%04x:%02x:%02x.%x", pci_domain_nr(pdev->bus),
>> -		 pdev->bus->number, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
>>  
>>  	mutex_lock(&xe_configfs.su_mutex);
>> -	item = config_group_find_item(&xe_configfs.su_group, name);
>> +	item = config_group_find_item(&xe_configfs.su_group, pci_name(pdev));
> 
> Oddly, it doesn't seem like pci_name is a helper function that generates the name we were
> previously constructing manually.  Instead, it looks like it returns either pdev->dev->init_name
> or pdev->dev->kobj->name.
> 
> On the other hand, I can't imagine a function called "pci_name" returning anything other
> than what we were looking for prior, so I'm going to trust you did your due diligence
> and that pci_name returns the same thing during runtime that the snprintf was previously
> constructing.

you missed dev_set_name() called from pci_setup_device() here [1]

[1]
https://elixir.bootlin.com/linux/v6.16-rc6/source/drivers/pci/probe.c#L2006

> 
> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> -Jonathan Cavitt
>  
>>  	mutex_unlock(&xe_configfs.su_mutex);
>>  
>>  	if (!item)
>> -- 
>> 2.47.1
>>
>>


  reply	other threads:[~2025-07-18  9:23 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 18:48 [PATCH 0/5] Updates for drm/xe/configfs Michal Wajdeczko
2025-07-17 18:48 ` [PATCH 1/5] drm/xe/configfs: Fix pci_dev reference leak Michal Wajdeczko
2025-07-17 19:35   ` Lucas De Marchi
2025-07-17 21:16   ` Cavitt, Jonathan
2025-07-18  8:58     ` Michal Wajdeczko
2025-07-17 18:48 ` [PATCH 2/5] drm/xe/configfs: Enforce canonical device names Michal Wajdeczko
2025-07-17 19:43   ` Lucas De Marchi
2025-07-17 20:27     ` Michal Wajdeczko
2025-07-17 21:17   ` Cavitt, Jonathan
2025-07-18  9:06     ` Michal Wajdeczko
2025-07-18 14:16       ` Cavitt, Jonathan
2025-07-18 14:05   ` [PATCH v2 " Michal Wajdeczko
2025-07-18 20:52     ` Lucas De Marchi
2025-07-17 18:48 ` [PATCH 3/5] drm/xe/configfs: Use pci_name() for lookup Michal Wajdeczko
2025-07-17 19:44   ` Lucas De Marchi
2025-07-17 21:18   ` Cavitt, Jonathan
2025-07-18  9:23     ` Michal Wajdeczko [this message]
2025-07-17 18:48 ` [PATCH 4/5] drm/xe/configfs: Allow configurations only for Intel VGA devices Michal Wajdeczko
2025-07-17 19:52   ` Lucas De Marchi
2025-07-17 20:51     ` Michal Wajdeczko
2025-07-18 21:02       ` Lucas De Marchi
2025-07-17 21:19   ` Cavitt, Jonathan
2025-07-18  9:29     ` Michal Wajdeczko
2025-07-18 14:27       ` Cavitt, Jonathan
2025-07-18 14:33         ` Michal Wajdeczko
2025-07-18 17:28           ` Cavitt, Jonathan
2025-07-18 14:17   ` [PATCH v2 " Michal Wajdeczko
2025-07-17 18:48 ` [PATCH 5/5] drm/xe/configfs: Allow adding configurations for future VFs Michal Wajdeczko
2025-07-17 21:19   ` Cavitt, Jonathan
2025-07-17 19:06 ` ✓ CI.KUnit: success for Updates for drm/xe/configfs Patchwork
2025-07-17 20:13 ` ✓ Xe.CI.BAT: " Patchwork
2025-07-18 14:23 ` ✓ CI.KUnit: success for Updates for drm/xe/configfs (rev3) Patchwork
2025-07-18 15:15 ` ✓ Xe.CI.BAT: " Patchwork
2025-07-19  7:47 ` ✗ Xe.CI.Full: failure for Updates for drm/xe/configfs Patchwork
2025-07-21 10:53 ` ✗ Xe.CI.Full: failure for Updates for drm/xe/configfs (rev3) Patchwork

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=97755849-44a3-441a-abfe-29d1815aefa7@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jonathan.cavitt@intel.com \
    --cc=lucas.demarchi@intel.com \
    /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