From 86f79621b0c4b03a983d70850bf04b6cb1b9f2a4 Mon Sep 17 00:00:00 2001 From: Ondrej Čerman Date: Sat, 6 Jun 2020 15:20:38 +0200 Subject: Changed detection code to be compatible with kernel 5.7 Version 0.1.11 --- Makefile | 2 +- zenpower.c | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 2beabad..88b37ce 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION := 0.1.10 +VERSION := 0.1.11 TARGET := $(shell uname -r) DKMS_ROOT_PATH := /usr/src/zenpower-$(VERSION) diff --git a/zenpower.c b/zenpower.c index 7dfa3c2..7bbd930 100644 --- a/zenpower.c +++ b/zenpower.c @@ -38,7 +38,7 @@ MODULE_DESCRIPTION("AMD ZEN family CPU Sensors Driver"); MODULE_AUTHOR("Ondrej Čerman"); MODULE_LICENSE("GPL"); -MODULE_VERSION("0.1.10"); +MODULE_VERSION("0.1.11"); #ifndef PCI_DEVICE_ID_AMD_17H_DF_F3 @@ -518,6 +518,7 @@ static int zenpower_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct device *dev = &pdev->dev; struct zenpower_data *data; struct device *hwmon_dev; + struct pci_dev *misc; int i, ccd_check = 0; bool multinode; u8 node_of_cpu; @@ -540,18 +541,16 @@ static int zenpower_probe(struct pci_dev *pdev, const struct pci_device_id *id) data->ccd_visible[i] = false; } - for (id = amd_nb_misc_ids; id->vendor; id++) { - if (pdev->vendor == id->vendor && pdev->device == id->device) { + for (i = 0; i < amd_nb_num(); i++) { + misc = node_to_amd_nb(i)->misc; + if (pdev->vendor == misc->vendor && pdev->device == misc->device) { data->kernel_smn_support = true; data->read_amdsmn_addr = kernel_smn_read; + data->node_id = amd_pci_dev_to_node_id(pdev); break; } } - if (data->kernel_smn_support) { - data->node_id = amd_pci_dev_to_node_id(pdev); - } - // CPUID_Fn8000001E_ECX [Node Identifiers] (Core::X86::Cpuid::NodeId) // 10:8 NodesPerProcessor data->nodes_per_cpu = 1 + ((cpuid_ecx(0x8000001E) >> 8) & 0b111); -- cgit v1.2.3-70-g09d2