mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
d278b09828
Add a thermal cooling driver to provide path to access PCIe bandwidth controller using the usual thermal interfaces. A cooling device is instantiated for controllable PCIe Ports from the bwctrl service driver. If registering the cooling device fails, allow bwctrl's probe to succeed regardless. As cdev in that case contains IS_ERR() pseudo "pointer", clean that up inside the probe function so the remove side doesn't need to suddenly make an odd looking IS_ERR() check. The thermal side state 0 means no throttling, i.e., maximum supported PCIe Link Speed. Link: https://lore.kernel.org/r/20241018144755.7875-9-ilpo.jarvinen@linux.intel.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> [bhelgaas: dropped data->cdev test per https://lore.kernel.org/r/ZzRm1SJTwEMRsAr8@wunner.de] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org> # From the cooling device interface perspective
29 lines
650 B
C
29 lines
650 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* PCIe bandwidth controller
|
|
*
|
|
* Copyright (C) 2023-2024 Intel Corporation
|
|
*/
|
|
|
|
#ifndef LINUX_PCI_BWCTRL_H
|
|
#define LINUX_PCI_BWCTRL_H
|
|
|
|
#include <linux/pci.h>
|
|
|
|
struct thermal_cooling_device;
|
|
|
|
#ifdef CONFIG_PCIE_THERMAL
|
|
struct thermal_cooling_device *pcie_cooling_device_register(struct pci_dev *port);
|
|
void pcie_cooling_device_unregister(struct thermal_cooling_device *cdev);
|
|
#else
|
|
static inline struct thermal_cooling_device *pcie_cooling_device_register(struct pci_dev *port)
|
|
{
|
|
return NULL;
|
|
}
|
|
static inline void pcie_cooling_device_unregister(struct thermal_cooling_device *cdev)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
#endif
|