thermal: intel: int340x: Allow limited thermal MSI support

On some Lunar Lake pre-production systems, not all the MSI thermal
vectors are valid. In that case instead of failing module load, continue
with partial thermal interrupt support.

pci_alloc_irq_vectors() can return less than expected maximum vectors.
In that case call devm_request_threaded_irq() only for current maximum
vectors.

Fixes: 7a9a8c5faf ("thermal: intel: int340x: Support MSI interrupt for Lunar Lake")
Reported-by: Yijun Shen <Yijun.Shen@dell.com>
Tested-by: Yijun Shen <Yijun.Shen@dell.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Link: https://patch.msgid.link/20240723140228.865919-3-srinivas.pandruvada@linux.intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Srinivas Pandruvada 2024-07-23 07:02:27 -07:00 committed by Rafael J. Wysocki
parent b630a04121
commit b85a2d300a

View File

@ -292,18 +292,18 @@ static void proc_thermal_free_msi(struct pci_dev *pdev, struct proc_thermal_pci
static int proc_thermal_setup_msi(struct pci_dev *pdev, struct proc_thermal_pci *pci_info) static int proc_thermal_setup_msi(struct pci_dev *pdev, struct proc_thermal_pci *pci_info)
{ {
int ret, i, irq; int ret, i, irq, count;
ret = pci_alloc_irq_vectors(pdev, 1, MSI_THERMAL_MAX, PCI_IRQ_MSI | PCI_IRQ_MSIX); count = pci_alloc_irq_vectors(pdev, 1, MSI_THERMAL_MAX, PCI_IRQ_MSI | PCI_IRQ_MSIX);
if (ret < 0) { if (count < 0) {
dev_err(&pdev->dev, "Failed to allocate vectors!\n"); dev_err(&pdev->dev, "Failed to allocate vectors!\n");
return ret; return count;
} }
dev_info(&pdev->dev, "msi enabled:%d msix enabled:%d\n", pdev->msi_enabled, dev_info(&pdev->dev, "msi enabled:%d msix enabled:%d\n", pdev->msi_enabled,
pdev->msix_enabled); pdev->msix_enabled);
for (i = 0; i < MSI_THERMAL_MAX; i++) { for (i = 0; i < count; i++) {
irq = pci_irq_vector(pdev, i); irq = pci_irq_vector(pdev, i);
ret = devm_request_threaded_irq(&pdev->dev, irq, proc_thermal_irq_handler, ret = devm_request_threaded_irq(&pdev->dev, irq, proc_thermal_irq_handler,