Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 1/2] lib/igt_device_scan: Remember vendor/device for pci devices
Date: Tue, 17 Nov 2020 10:16:44 +0000	[thread overview]
Message-ID: <64bfdbf4-c626-a16c-6f92-07e4885c8357@linux.intel.com> (raw)
In-Reply-To: <20201117094830.103153-1-zbigniew.kempczynski@intel.com>


On 17/11/2020 09:48, Zbigniew Kempczyński wrote:
> If we want to use pci device id for not opened device we need to
> keep it in card structure.
> 
> To avoid compiler warnings after adding vendor/device fields
> increase pci_slot_name length.

What was the warning? (I did not get it after a minute or two of staring.)

Regards,

Tvrtko

> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> ---
>   lib/igt_device_scan.c | 8 ++++++++
>   lib/igt_device_scan.h | 3 ++-
>   2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
> index e97f7163..5793ef84 100644
> --- a/lib/igt_device_scan.c
> +++ b/lib/igt_device_scan.c
> @@ -463,6 +463,14 @@ __copy_dev_to_card(struct igt_device *dev, struct igt_device_card *card)
>   	if (dev->pci_slot_name != NULL)
>   		strncpy(card->pci_slot_name, dev->pci_slot_name,
>   			PCI_SLOT_NAME_SIZE + 1);
> +
> +	if (dev->vendor != NULL && strlen(dev->vendor) == 4)
> +		if (sscanf(dev->vendor, "%hx", &card->pci_vendor) != 1)
> +			card->pci_vendor = 0;
> +
> +	if (dev->device != NULL && strlen(dev->device) == 4)
> +		if (sscanf(dev->device, "%hx", &card->pci_device) != 1)
> +			card->pci_device = 0;
>   }
>   
>   /*
> diff --git a/lib/igt_device_scan.h b/lib/igt_device_scan.h
> index bb4be723..e96d8a25 100644
> --- a/lib/igt_device_scan.h
> +++ b/lib/igt_device_scan.h
> @@ -57,7 +57,8 @@ struct igt_device_card {
>   	char subsystem[NAME_MAX];
>   	char card[NAME_MAX];
>   	char render[NAME_MAX];
> -	char pci_slot_name[PCI_SLOT_NAME_SIZE+1];
> +	char pci_slot_name[PCI_SLOT_NAME_SIZE+2];
> +	uint16_t pci_vendor, pci_device;
>   };
>   
>   void igt_devices_scan(bool force);
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2020-11-17 10:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17  9:48 [igt-dev] [PATCH i-g-t 1/2] lib/igt_device_scan: Remember vendor/device for pci devices Zbigniew Kempczyński
2020-11-17  9:48 ` [igt-dev] [PATCH i-g-t 2/2] tools/intel_gpu_top: Add generation info in header Zbigniew Kempczyński
2020-11-17 10:15   ` Tvrtko Ursulin
2020-11-17 10:16 ` Tvrtko Ursulin [this message]
2020-11-17 10:38   ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_device_scan: Remember vendor/device for pci devices Zbigniew Kempczyński
2020-11-17 11:44 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] " Patchwork
2020-11-17 13:18 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=64bfdbf4-c626-a16c-6f92-07e4885c8357@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    --cc=tvrtko.ursulin@intel.com \
    --cc=zbigniew.kempczynski@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