Skip to content

Commit 53eb64c

Browse files
andy-shevjwrdegoede
authored andcommitted
platform/x86: p2sb: Don't fail if unknown CPU is found
We have accessing P2SB from a very few places for quite known hardware. When a new SoC appears in intel-family.h it's not obvious that it needs to be added to p2sb.c as well. Instead, provide default BDF and refactor p2sb_get_devfn() to always succeed. If in the future we would need to exclude something, we may add a list of unsupported IDs. Without this change the iTCO on Intel Comet Lake SoCs became unavailable: i801_smbus 0000:00:1f.4: failed to create iTCO device Fixes: 5c7b916 ("i2c: i801: convert to use common P2SB accessor") Reported-and-tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221104154916.35231-1-andriy.shevchenko@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent a977ece commit 53eb64c

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

drivers/platform/x86/p2sb.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,23 @@
1919
#define P2SBC 0xe0
2020
#define P2SBC_HIDE BIT(8)
2121

22+
#define P2SB_DEVFN_DEFAULT PCI_DEVFN(31, 1)
23+
2224
static const struct x86_cpu_id p2sb_cpu_ids[] = {
2325
X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, PCI_DEVFN(13, 0)),
24-
X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_D, PCI_DEVFN(31, 1)),
25-
X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_D, PCI_DEVFN(31, 1)),
26-
X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE, PCI_DEVFN(31, 1)),
27-
X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE_L, PCI_DEVFN(31, 1)),
28-
X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE, PCI_DEVFN(31, 1)),
29-
X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_L, PCI_DEVFN(31, 1)),
3026
{}
3127
};
3228

3329
static int p2sb_get_devfn(unsigned int *devfn)
3430
{
31+
unsigned int fn = P2SB_DEVFN_DEFAULT;
3532
const struct x86_cpu_id *id;
3633

3734
id = x86_match_cpu(p2sb_cpu_ids);
38-
if (!id)
39-
return -ENODEV;
35+
if (id)
36+
fn = (unsigned int)id->driver_data;
4037

41-
*devfn = (unsigned int)id->driver_data;
38+
*devfn = fn;
4239
return 0;
4340
}
4441

0 commit comments

Comments
 (0)