[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <465a1275-f7a4-4d04-b69d-9d062883c2c4@wanadoo.fr>
Date: Fri, 5 Jan 2024 12:56:47 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
linux-pci@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>, Rob Herring
<robh@...nel.org>, Krzysztof Wilczyński <kw@...ux.com>,
Lukas Wunner <lukas@...ner.de>, Alexandru Gagniuc <mr.nuke.me@...il.com>,
Krishna chaitanya chundru <quic_krichai@...cinc.com>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
"Rafael J. Wysocki" <rafael@...nel.org>, linux-pm@...r.kernel.org,
Daniel Lezcano <daniel.lezcano@...aro.org>, Zhang Rui <rui.zhang@...el.com>,
Lukasz Luba <lukasz.luba@....com>, linux-kernel@...r.kernel.org
Cc: Alex Deucher <alexdeucher@...il.com>, Amit Kucheria <amitk@...nel.org>
Subject: Re: [PATCH v4 7/8] thermal: Add PCIe cooling driver
Le 05/01/2024 à 12:25, Ilpo Järvinen a écrit :
> 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@...ux.intel.com>
> Acked-by: Rafael J. Wysocki <rafael@...nel.org> # From the cooling device interface perspective
> ---
...
> +struct thermal_cooling_device *pcie_cooling_device_register(struct pci_dev *port,
> + struct pcie_device *pdev)
> +{
> + struct pcie_cooling_device *pcie_cdev;
> + struct thermal_cooling_device *cdev;
> + size_t name_len;
> + char *name;
> +
> + pcie_cdev = kzalloc(sizeof(*pcie_cdev), GFP_KERNEL);
> + if (!pcie_cdev)
> + return ERR_PTR(-ENOMEM);
> +
> + pcie_cdev->port = port;
> + pcie_cdev->pdev = pdev;
> +
> + name_len = strlen(COOLING_DEV_TYPE_PREFIX) + strlen(pci_name(port)) + 1;
> + name = kzalloc(name_len, GFP_KERNEL);
> + if (!name) {
> + kfree(pcie_cdev);
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + snprintf(name, name_len, COOLING_DEV_TYPE_PREFIX "%s", pci_name(port));
Nit: kasprintf() ?
> + cdev = thermal_cooling_device_register(name, pcie_cdev, &pcie_cooling_ops);
> + kfree(name);
> +
> + return cdev;
> +}
Powered by blists - more mailing lists