Skip to content

Commit 64e70a7

Browse files
committed
Merge tag 'qcom-drivers-for-6.15' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into soc/drivers
Qualcomm driver updates for v6.15 Improve the client interface for the Qualcomm ICE driver to avoid leaking references, including fixing the client drivers to call the new function. Adopt str_on_off() helper in AOSS driver and mark non-global servreg QMI element info array in the PDR driver static. * tag 'qcom-drivers-for-6.15' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux: soc: qcom: Do not expose internal servreg_location_entry_ei array soc: qcom: ice: make of_qcom_ice_get() static scsi: ufs: qcom: fix dev reference leaked through of_qcom_ice_get mmc: sdhci-msm: fix dev reference leaked through of_qcom_ice_get soc: qcom: ice: introduce devm_of_qcom_ice_get dt-bindings: soc: qcom: qcom,pmic-glink: Document SM8750 compatible soc: qcom: Use str_enable_disable-like helpers Link: https://lore.kernel.org/r/20250317210158.2025380-1-andersson@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents c6325a2 + 2e14c17 commit 64e70a7

8 files changed

Lines changed: 57 additions & 9 deletions

File tree

Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ properties:
3838
- items:
3939
- enum:
4040
- qcom,sm8650-pmic-glink
41+
- qcom,sm8750-pmic-glink
4142
- qcom,x1e80100-pmic-glink
4243
- const: qcom,sm8550-pmic-glink
4344
- const: qcom,pmic-glink

drivers/mmc/host/sdhci-msm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,7 @@ static int sdhci_msm_ice_init(struct sdhci_msm_host *msm_host,
18731873
if (!(cqhci_readl(cq_host, CQHCI_CAP) & CQHCI_CAP_CS))
18741874
return 0;
18751875

1876-
ice = of_qcom_ice_get(dev);
1876+
ice = devm_of_qcom_ice_get(dev);
18771877
if (ice == ERR_PTR(-EOPNOTSUPP)) {
18781878
dev_warn(dev, "Disabling inline encryption support\n");
18791879
ice = NULL;

drivers/soc/qcom/ice.c

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/cleanup.h>
1212
#include <linux/clk.h>
1313
#include <linux/delay.h>
14+
#include <linux/device.h>
1415
#include <linux/iopoll.h>
1516
#include <linux/of.h>
1617
#include <linux/of_platform.h>
@@ -261,7 +262,7 @@ static struct qcom_ice *qcom_ice_create(struct device *dev,
261262
* Return: ICE pointer on success, NULL if there is no ICE data provided by the
262263
* consumer or ERR_PTR() on error.
263264
*/
264-
struct qcom_ice *of_qcom_ice_get(struct device *dev)
265+
static struct qcom_ice *of_qcom_ice_get(struct device *dev)
265266
{
266267
struct platform_device *pdev = to_platform_device(dev);
267268
struct qcom_ice *ice;
@@ -322,7 +323,53 @@ struct qcom_ice *of_qcom_ice_get(struct device *dev)
322323

323324
return ice;
324325
}
325-
EXPORT_SYMBOL_GPL(of_qcom_ice_get);
326+
327+
static void qcom_ice_put(const struct qcom_ice *ice)
328+
{
329+
struct platform_device *pdev = to_platform_device(ice->dev);
330+
331+
if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "ice"))
332+
platform_device_put(pdev);
333+
}
334+
335+
static void devm_of_qcom_ice_put(struct device *dev, void *res)
336+
{
337+
qcom_ice_put(*(struct qcom_ice **)res);
338+
}
339+
340+
/**
341+
* devm_of_qcom_ice_get() - Devres managed helper to get an ICE instance from
342+
* a DT node.
343+
* @dev: device pointer for the consumer device.
344+
*
345+
* This function will provide an ICE instance either by creating one for the
346+
* consumer device if its DT node provides the 'ice' reg range and the 'ice'
347+
* clock (for legacy DT style). On the other hand, if consumer provides a
348+
* phandle via 'qcom,ice' property to an ICE DT, the ICE instance will already
349+
* be created and so this function will return that instead.
350+
*
351+
* Return: ICE pointer on success, NULL if there is no ICE data provided by the
352+
* consumer or ERR_PTR() on error.
353+
*/
354+
struct qcom_ice *devm_of_qcom_ice_get(struct device *dev)
355+
{
356+
struct qcom_ice *ice, **dr;
357+
358+
dr = devres_alloc(devm_of_qcom_ice_put, sizeof(*dr), GFP_KERNEL);
359+
if (!dr)
360+
return ERR_PTR(-ENOMEM);
361+
362+
ice = of_qcom_ice_get(dev);
363+
if (!IS_ERR_OR_NULL(ice)) {
364+
*dr = ice;
365+
devres_add(dev, dr);
366+
} else {
367+
devres_free(dr);
368+
}
369+
370+
return ice;
371+
}
372+
EXPORT_SYMBOL_GPL(devm_of_qcom_ice_get);
326373

327374
static int qcom_ice_probe(struct platform_device *pdev)
328375
{

drivers/soc/qcom/pdr_internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ struct servreg_loc_pfr_resp {
9191
struct qmi_response_type_v01 rsp;
9292
};
9393

94-
extern const struct qmi_elem_info servreg_location_entry_ei[];
9594
extern const struct qmi_elem_info servreg_get_domain_list_req_ei[];
9695
extern const struct qmi_elem_info servreg_get_domain_list_resp_ei[];
9796
extern const struct qmi_elem_info servreg_register_listener_req_ei[];

drivers/soc/qcom/qcom_aoss.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/platform_device.h>
1313
#include <linux/thermal.h>
1414
#include <linux/slab.h>
15+
#include <linux/string_choices.h>
1516
#include <linux/soc/qcom/qcom_aoss.h>
1617

1718
#define CREATE_TRACE_POINTS
@@ -358,7 +359,7 @@ static int qmp_cdev_set_cur_state(struct thermal_cooling_device *cdev,
358359
return 0;
359360

360361
ret = qmp_send(qmp_cdev->qmp, "{class: volt_flr, event:zero_temp, res:%s, value:%s}",
361-
qmp_cdev->name, cdev_state ? "on" : "off");
362+
qmp_cdev->name, str_on_off(cdev_state));
362363
if (!ret)
363364
qmp_cdev->state = cdev_state;
364365

drivers/soc/qcom/qcom_pdr_msg.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include "pdr_internal.h"
1010

11-
const struct qmi_elem_info servreg_location_entry_ei[] = {
11+
static const struct qmi_elem_info servreg_location_entry_ei[] = {
1212
{
1313
.data_type = QMI_STRING,
1414
.elem_len = SERVREG_NAME_LENGTH + 1,
@@ -47,7 +47,6 @@ const struct qmi_elem_info servreg_location_entry_ei[] = {
4747
},
4848
{}
4949
};
50-
EXPORT_SYMBOL_GPL(servreg_location_entry_ei);
5150

5251
const struct qmi_elem_info servreg_get_domain_list_req_ei[] = {
5352
{

drivers/ufs/host/ufs-qcom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static int ufs_qcom_ice_init(struct ufs_qcom_host *host)
125125
int err;
126126
int i;
127127

128-
ice = of_qcom_ice_get(dev);
128+
ice = devm_of_qcom_ice_get(dev);
129129
if (ice == ERR_PTR(-EOPNOTSUPP)) {
130130
dev_warn(dev, "Disabling inline encryption support\n");
131131
ice = NULL;

include/soc/qcom/ice.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ int qcom_ice_program_key(struct qcom_ice *ice,
3333
const u8 crypto_key[], u8 data_unit_size,
3434
int slot);
3535
int qcom_ice_evict_key(struct qcom_ice *ice, int slot);
36-
struct qcom_ice *of_qcom_ice_get(struct device *dev);
36+
struct qcom_ice *devm_of_qcom_ice_get(struct device *dev);
37+
3738
#endif /* __QCOM_ICE_H__ */

0 commit comments

Comments
 (0)