All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: Klara Modin <klarasmodin@gmail.com>,
	"andriy.shevchenko@linux.intel.com"
	<andriy.shevchenko@linux.intel.com>,
	"hdegoede@redhat.com" <hdegoede@redhat.com>,
	"ilpo.jarvinen@linux.intel.com" <ilpo.jarvinen@linux.intel.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>
Subject: Re: [PATCH v5 1/2] platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe
Date: Fri, 5 Jan 2024 09:44:54 +0100	[thread overview]
Message-ID: <20240105084454.GA28978@wunner.de> (raw)
In-Reply-To: <b565j7nbqu67pjhjw6ei7i3nkazazirl4dyxhaem3z7ghii3gs@dngmvjcylrjp>

On Fri, Jan 05, 2024 at 08:18:05AM +0000, Shinichiro Kawasaki wrote:
> --- a/drivers/platform/x86/p2sb.c
> +++ b/drivers/platform/x86/p2sb.c
> @@ -150,6 +153,14 @@ static int p2sb_cache_resources(void)
>  	if (!bus)
>  		return -ENODEV;
>  
> +	/*
> +	 * When a device with same devfn exists and it is not P2SB, do not
> +	 * touch it.
> +	 */
> +	pci_bus_read_config_dword(bus, devfn_p2sb, PCI_CLASS_REVISION, &class);
> +	if (!PCI_POSSIBLE_ERROR(class) && class >> 8 != P2SB_CLASS_CODE)
> +		return -ENODEV;
> +

The function should probably return if PCI_POSSIBLE_ERROR() is true.
Also I think you can use PCI_CLASS_MEMORY_OTHER, so how about:

	if (PCI_POSSIBLE_ERROR(class) || class >> 16 != PCI_CLASS_MEMORY_OTHER)
		return -ENODEV;

Can alternatively use "class >> 8 != PCI_CLASS_MEMORY_OTHER << 8" if you
want to ensure the lowest byte is 0x00.

Thanks,

Lukas

  reply	other threads:[~2024-01-05  8:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03 21:31 [PATCH v5 1/2] platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe Klara Modin
2024-01-04  8:41 ` Shinichiro Kawasaki
2024-01-04 12:22   ` Klara Modin
2024-01-04 12:36   ` Lukas Wunner
2024-01-05  8:18     ` Shinichiro Kawasaki
2024-01-05  8:44       ` Lukas Wunner [this message]
2024-01-05 10:26         ` Shinichiro Kawasaki
2024-01-05 11:45           ` Klara Modin
2024-01-06  1:03             ` Shinichiro Kawasaki
  -- strict thread matches above, loose matches on Subject: below --
2023-12-29  6:39 [PATCH v5 0/2] platform/x86: p2sb: Fix deadlock at sysfs PCI bus rescan Shin'ichiro Kawasaki
2023-12-29  6:39 ` [PATCH v5 1/2] platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe Shin'ichiro Kawasaki
2023-12-29 13:34   ` Ilpo Järvinen

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=20240105084454.GA28978@wunner.de \
    --to=lukas@wunner.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=klarasmodin@gmail.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.