Re: [PATCH v5 7/8] thermal: Add PCIe cooling driver

From: Jonathan Cameron
Date: Thu May 09 2024 - 07:59:51 EST


On Wed, 8 May 2024 16:47:43 +0300
Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx> wrote:

> 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.
>
> The thermal side state 0 means no throttling, i.e., maximum supported
> PCIe Link Speed.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
> Acked-by: Rafael J. Wysocki <rafael@xxxxxxxxxx> # From the cooling device interface perspective

> +struct thermal_cooling_device *pcie_cooling_device_register(struct pci_dev *port)
> +{
> + struct thermal_cooling_device *cdev;
> + char *name;
> +
> + name = kasprintf(GFP_KERNEL, COOLING_DEV_TYPE_PREFIX "%s", pci_name(port));
> + if (!name)
> + return ERR_PTR(-ENOMEM);
> +
> + cdev = thermal_cooling_device_register(name, port, &pcie_cooling_ops);
> + kfree(name);

__free? Only small saving, but I think it's just about worth it to
give you
return thermal_cooling_device_register()
and drop the local cdev variable.


> +
> + return cdev;
> +}

Otherwise LGTM
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>