Unverified Commit 8cfda405 authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

Merge tag 'qcom-drivers-for-6.11-2' of...

Merge tag 'qcom-drivers-for-6.11-2' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into soc/drivers

A few more Qualcomm driver updates for v6.11

This adds a quirk to skip using the newly introduced SHM Bridge
implementation while regressions are being investigated.

One occurance of return no_free_ptr() is replaced with return_ptr() to
make code easier to read. llcc, mdt_loader, ocmem, pdr, socinfo and
wcnss drivers gets simplified using cleanup.h.

* tag 'qcom-drivers-for-6.11-2' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux:
  firmware: qcom: tzmem: blacklist more platforms for SHM Bridge
  soc: qcom: wcnss: simplify with cleanup.h
  soc: qcom: pdr: simplify with cleanup.h
  soc: qcom: ocmem: simplify with cleanup.h
  soc: qcom: mdt_loader: simplify with cleanup.h
  soc: qcom: llcc: simplify with cleanup.h
  firmware: qcom: tzmem: simplify returning pointer without cleanup
  soc: qcom: socinfo: Add PM6350 PMIC

Link: https://lore.kernel.org/r/20240709191246.3053-1-andersson@kernel.org


Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents 782b7262 55751d3e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ static bool qcom_tzmem_using_shm_bridge;
/* List of machines that are known to not support SHM bridge correctly. */
static const char *const qcom_tzmem_blacklist[] = {
	"qcom,sc8180x",
	"qcom,sdm845", /* reset in rmtfs memory assignment */
	"qcom,sm8150", /* reset in rmtfs memory assignment */
	NULL
};

@@ -242,7 +244,7 @@ qcom_tzmem_pool_new(const struct qcom_tzmem_pool_config *config)
		}
	}

	return no_free_ptr(pool);
	return_ptr(pool);
}
EXPORT_SYMBOL_GPL(qcom_tzmem_pool_new);

+2 −4
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#include <linux/bitfield.h>
#include <linux/bitmap.h>
#include <linux/bitops.h>
#include <linux/cleanup.h>
#include <linux/device.h>
#include <linux/io.h>
#include <linux/kernel.h>
@@ -1294,16 +1295,13 @@ static int qcom_llcc_probe(struct platform_device *pdev)

	/* Initialize rest of LLCC bank regmaps */
	for (i = 1; i < num_banks; i++) {
		char *base = kasprintf(GFP_KERNEL, "llcc%d_base", i);
		char *base __free(kfree) = kasprintf(GFP_KERNEL, "llcc%d_base", i);

		drv_data->regmaps[i] = qcom_llcc_init_mmio(pdev, i, base);
		if (IS_ERR(drv_data->regmaps[i])) {
			ret = PTR_ERR(drv_data->regmaps[i]);
			kfree(base);
			goto err;
		}

		kfree(base);
	}

	drv_data->bcast_regmap = qcom_llcc_init_mmio(pdev, i, "llcc_broadcast_base");
+2 −4
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
 */

#include <linux/cleanup.h>
#include <linux/device.h>
#include <linux/elf.h>
#include <linux/firmware.h>
@@ -37,13 +38,12 @@ static ssize_t mdt_load_split_segment(void *ptr, const struct elf32_phdr *phdrs,
{
	const struct elf32_phdr *phdr = &phdrs[segment];
	const struct firmware *seg_fw;
	char *seg_name;
	ssize_t ret;

	if (strlen(fw_name) < 4)
		return -EINVAL;

	seg_name = kstrdup(fw_name, GFP_KERNEL);
	char *seg_name __free(kfree) = kstrdup(fw_name, GFP_KERNEL);
	if (!seg_name)
		return -ENOMEM;

@@ -52,7 +52,6 @@ static ssize_t mdt_load_split_segment(void *ptr, const struct elf32_phdr *phdrs,
					ptr, phdr->p_filesz);
	if (ret) {
		dev_err(dev, "error %zd loading %s\n", ret, seg_name);
		kfree(seg_name);
		return ret;
	}

@@ -64,7 +63,6 @@ static ssize_t mdt_load_split_segment(void *ptr, const struct elf32_phdr *phdrs,
	}

	release_firmware(seg_fw);
	kfree(seg_name);

	return ret;
}
+4 −6
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
 */

#include <linux/bitfield.h>
#include <linux/cleanup.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/kernel.h>
@@ -216,7 +217,6 @@ EXPORT_SYMBOL_GPL(of_get_ocmem);
struct ocmem_buf *ocmem_allocate(struct ocmem *ocmem, enum ocmem_client client,
				 unsigned long size)
{
	struct ocmem_buf *buf;
	int ret;

	/* TODO: add support for other clients... */
@@ -229,7 +229,7 @@ struct ocmem_buf *ocmem_allocate(struct ocmem *ocmem, enum ocmem_client client,
	if (test_and_set_bit_lock(BIT(client), &ocmem->active_allocations))
		return ERR_PTR(-EBUSY);

	buf = kzalloc(sizeof(*buf), GFP_KERNEL);
	struct ocmem_buf *buf __free(kfree) = kzalloc(sizeof(*buf), GFP_KERNEL);
	if (!buf) {
		ret = -ENOMEM;
		goto err_unlock;
@@ -247,7 +247,7 @@ struct ocmem_buf *ocmem_allocate(struct ocmem *ocmem, enum ocmem_client client,
		if (ret) {
			dev_err(ocmem->dev, "could not lock: %d\n", ret);
			ret = -EINVAL;
			goto err_kfree;
			goto err_unlock;
		}
	} else {
		ocmem_write(ocmem, OCMEM_REG_GFX_MPU_START, buf->offset);
@@ -258,10 +258,8 @@ struct ocmem_buf *ocmem_allocate(struct ocmem *ocmem, enum ocmem_client client,
	dev_dbg(ocmem->dev, "using %ldK of OCMEM at 0x%08lx for client %d\n",
		size / 1024, buf->addr, client);

	return buf;
	return_ptr(buf);

err_kfree:
	kfree(buf);
err_unlock:
	clear_bit_unlock(BIT(client), &ocmem->active_allocations);

+14 −24
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
 * Copyright (C) 2020 The Linux Foundation. All rights reserved.
 */

#include <linux/cleanup.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
@@ -396,13 +397,13 @@ static int pdr_get_domain_list(struct servreg_get_domain_list_req *req,

static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds)
{
	struct servreg_get_domain_list_resp *resp;
	struct servreg_get_domain_list_req req;
	struct servreg_location_entry *entry;
	int domains_read = 0;
	int ret, i;

	resp = kzalloc(sizeof(*resp), GFP_KERNEL);
	struct servreg_get_domain_list_resp *resp __free(kfree) = kzalloc(sizeof(*resp),
									  GFP_KERNEL);
	if (!resp)
		return -ENOMEM;

@@ -415,7 +416,7 @@ static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds)
		req.domain_offset = domains_read;
		ret = pdr_get_domain_list(&req, resp, pdr);
		if (ret < 0)
			goto out;
			return ret;

		for (i = 0; i < resp->domain_list_len; i++) {
			entry = &resp->domain_list[i];
@@ -427,7 +428,7 @@ static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds)
				pds->service_data_valid = entry->service_data_valid;
				pds->service_data = entry->service_data;
				pds->instance = entry->instance;
				goto out;
				return 0;
			}
		}

@@ -440,8 +441,7 @@ static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds)

		domains_read += resp->domain_list_len;
	} while (domains_read < resp->total_domains);
out:
	kfree(resp);

	return ret;
}

@@ -517,8 +517,7 @@ struct pdr_service *pdr_add_lookup(struct pdr_handle *pdr,
				   const char *service_name,
				   const char *service_path)
{
	struct pdr_service *pds, *tmp;
	int ret;
	struct pdr_service *tmp;

	if (IS_ERR_OR_NULL(pdr))
		return ERR_PTR(-EINVAL);
@@ -527,7 +526,7 @@ struct pdr_service *pdr_add_lookup(struct pdr_handle *pdr,
	    !service_path || strlen(service_path) > SERVREG_NAME_LENGTH)
		return ERR_PTR(-EINVAL);

	pds = kzalloc(sizeof(*pds), GFP_KERNEL);
	struct pdr_service *pds __free(kfree) = kzalloc(sizeof(*pds), GFP_KERNEL);
	if (!pds)
		return ERR_PTR(-ENOMEM);

@@ -542,8 +541,7 @@ struct pdr_service *pdr_add_lookup(struct pdr_handle *pdr,
			continue;

		mutex_unlock(&pdr->list_lock);
		ret = -EALREADY;
		goto err;
		return ERR_PTR(-EALREADY);
	}

	list_add(&pds->node, &pdr->lookups);
@@ -551,10 +549,7 @@ struct pdr_service *pdr_add_lookup(struct pdr_handle *pdr,

	schedule_work(&pdr->locator_work);

	return pds;
err:
	kfree(pds);
	return ERR_PTR(ret);
	return_ptr(pds);
}
EXPORT_SYMBOL_GPL(pdr_add_lookup);

@@ -651,13 +646,12 @@ struct pdr_handle *pdr_handle_alloc(void (*status)(int state,
						   char *service_path,
						   void *priv), void *priv)
{
	struct pdr_handle *pdr;
	int ret;

	if (!status)
		return ERR_PTR(-EINVAL);

	pdr = kzalloc(sizeof(*pdr), GFP_KERNEL);
	struct pdr_handle *pdr __free(kfree) = kzalloc(sizeof(*pdr), GFP_KERNEL);
	if (!pdr)
		return ERR_PTR(-ENOMEM);

@@ -676,10 +670,8 @@ struct pdr_handle *pdr_handle_alloc(void (*status)(int state,
	INIT_WORK(&pdr->indack_work, pdr_indack_work);

	pdr->notifier_wq = create_singlethread_workqueue("pdr_notifier_wq");
	if (!pdr->notifier_wq) {
		ret = -ENOMEM;
		goto free_pdr_handle;
	}
	if (!pdr->notifier_wq)
		return ERR_PTR(-ENOMEM);

	pdr->indack_wq = alloc_ordered_workqueue("pdr_indack_wq", WQ_HIGHPRI);
	if (!pdr->indack_wq) {
@@ -704,7 +696,7 @@ struct pdr_handle *pdr_handle_alloc(void (*status)(int state,
	if (ret < 0)
		goto release_qmi_handle;

	return pdr;
	return_ptr(pdr);

release_qmi_handle:
	qmi_handle_release(&pdr->locator_hdl);
@@ -712,8 +704,6 @@ struct pdr_handle *pdr_handle_alloc(void (*status)(int state,
	destroy_workqueue(pdr->indack_wq);
destroy_notifier:
	destroy_workqueue(pdr->notifier_wq);
free_pdr_handle:
	kfree(pdr);

	return ERR_PTR(ret);
}
Loading