[PATCH v6 05/24] soc: qcom: cmd-db: drop unused functions

Caleb Connolly caleb.connolly at linaro.org
Mon Jul 15 12:08:04 CEST 2024


Due to our simpler rpmh-rsc driver and lack of debugfs, we don't need
quite a few cmd-db functions, just drop them.

Acked-by: Sumit Garg <sumit.garg at linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly at linaro.org>
---
 drivers/soc/qcom/cmd-db.c | 144 ----------------------------------------------
 include/soc/qcom/cmd-db.h |  15 -----
 2 files changed, 159 deletions(-)

diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c
index b25f3549c18f..4317310d0bcd 100644
--- a/drivers/soc/qcom/cmd-db.c
+++ b/drivers/soc/qcom/cmd-db.c
@@ -194,150 +194,8 @@ u32 cmd_db_read_addr(const char *id)
 	return ret < 0 ? 0 : le32_to_cpu(ent->addr);
 }
 EXPORT_SYMBOL_GPL(cmd_db_read_addr);
 
-/**
- * cmd_db_read_aux_data() - Query command db for aux data.
- *
- *  @id: Resource to retrieve AUX Data on
- *  @len: size of data buffer returned
- *
- *  Return: pointer to data on success, error pointer otherwise
- */
-const void *cmd_db_read_aux_data(const char *id, size_t *len)
-{
-	int ret;
-	const struct entry_header *ent;
-	const struct rsc_hdr *rsc_hdr;
-
-	ret = cmd_db_get_header(id, &ent, &rsc_hdr);
-	if (ret)
-		return ERR_PTR(ret);
-
-	if (len)
-		*len = le16_to_cpu(ent->len);
-
-	return rsc_offset(rsc_hdr, ent);
-}
-EXPORT_SYMBOL_GPL(cmd_db_read_aux_data);
-
-/**
- * cmd_db_match_resource_addr() - Compare if both Resource addresses are same
- *
- * @addr1: Resource address to compare
- * @addr2: Resource address to compare
- *
- * Return: true if two addresses refer to the same resource, false otherwise
- */
-bool cmd_db_match_resource_addr(u32 addr1, u32 addr2)
-{
-	/*
-	 * Each RPMh VRM accelerator resource has 3 or 4 contiguous 4-byte
-	 * aligned addresses associated with it. Ignore the offset to check
-	 * for VRM requests.
-	 */
-	if (addr1 == addr2)
-		return true;
-	else if (SLAVE_ID(addr1) == CMD_DB_HW_VRM && VRM_ADDR(addr1) == VRM_ADDR(addr2))
-		return true;
-
-	return false;
-}
-EXPORT_SYMBOL_GPL(cmd_db_match_resource_addr);
-
-/**
- * cmd_db_read_slave_id - Get the slave ID for a given resource address
- *
- * @id: Resource id to query the DB for version
- *
- * Return: cmd_db_hw_type enum on success, CMD_DB_HW_INVALID on error
- */
-enum cmd_db_hw_type cmd_db_read_slave_id(const char *id)
-{
-	int ret;
-	const struct entry_header *ent;
-	u32 addr;
-
-	ret = cmd_db_get_header(id, &ent, NULL);
-	if (ret < 0)
-		return CMD_DB_HW_INVALID;
-
-	addr = le32_to_cpu(ent->addr);
-	return (addr >> SLAVE_ID_SHIFT) & SLAVE_ID_MASK;
-}
-EXPORT_SYMBOL_GPL(cmd_db_read_slave_id);
-
-#ifdef CONFIG_DEBUG_FS
-static int cmd_db_debugfs_dump(struct seq_file *seq, void *p)
-{
-	int i, j;
-	const struct rsc_hdr *rsc;
-	const struct entry_header *ent;
-	const char *name;
-	u16 len, version;
-	u8 major, minor;
-
-	seq_puts(seq, "Command DB DUMP\n");
-
-	for (i = 0; i < MAX_SLV_ID; i++) {
-		rsc = &cmd_db_header->header[i];
-		if (!rsc->slv_id)
-			break;
-
-		switch (le16_to_cpu(rsc->slv_id)) {
-		case CMD_DB_HW_ARC:
-			name = "ARC";
-			break;
-		case CMD_DB_HW_VRM:
-			name = "VRM";
-			break;
-		case CMD_DB_HW_BCM:
-			name = "BCM";
-			break;
-		default:
-			name = "Unknown";
-			break;
-		}
-
-		version = le16_to_cpu(rsc->version);
-		major = version >> 8;
-		minor = version;
-
-		seq_printf(seq, "Slave %s (v%u.%u)\n", name, major, minor);
-		seq_puts(seq, "-------------------------\n");
-
-		ent = rsc_to_entry_header(rsc);
-		for (j = 0; j < le16_to_cpu(rsc->cnt); j++, ent++) {
-			seq_printf(seq, "0x%05x: %*pEp", le32_to_cpu(ent->addr),
-				   (int)strnlen(ent->id, sizeof(ent->id)), ent->id);
-
-			len = le16_to_cpu(ent->len);
-			if (len) {
-				seq_printf(seq, " [%*ph]",
-					   len, rsc_offset(rsc, ent));
-			}
-			seq_putc(seq, '\n');
-		}
-	}
-
-	return 0;
-}
-
-static int open_cmd_db_debugfs(struct inode *inode, struct file *file)
-{
-	return single_open(file, cmd_db_debugfs_dump, inode->i_private);
-}
-#endif
-
-static const struct file_operations cmd_db_debugfs_ops = {
-#ifdef CONFIG_DEBUG_FS
-	.open = open_cmd_db_debugfs,
-#endif
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
-
 static int cmd_db_dev_probe(struct platform_device *pdev)
 {
 	struct reserved_mem *rmem;
 	int ret = 0;
@@ -359,10 +217,8 @@ static int cmd_db_dev_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "Invalid Command DB Magic\n");
 		return -EINVAL;
 	}
 
-	debugfs_create_file("cmd-db", 0400, NULL, NULL, &cmd_db_debugfs_ops);
-
 	device_set_pm_not_required(&pdev->dev);
 
 	return 0;
 }
diff --git a/include/soc/qcom/cmd-db.h b/include/soc/qcom/cmd-db.h
index 47a6cab75e63..753c7923f8e5 100644
--- a/include/soc/qcom/cmd-db.h
+++ b/include/soc/qcom/cmd-db.h
@@ -21,28 +21,13 @@ enum cmd_db_hw_type {
 
 #if IS_ENABLED(CONFIG_QCOM_COMMAND_DB)
 u32 cmd_db_read_addr(const char *resource_id);
 
-const void *cmd_db_read_aux_data(const char *resource_id, size_t *len);
-
-bool cmd_db_match_resource_addr(u32 addr1, u32 addr2);
-
-enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id);
-
 int cmd_db_ready(void);
 #else
 static inline u32 cmd_db_read_addr(const char *resource_id)
 { return 0; }
 
-static inline const void *cmd_db_read_aux_data(const char *resource_id, size_t *len)
-{ return ERR_PTR(-ENODEV); }
-
-static inline bool cmd_db_match_resource_addr(u32 addr1, u32 addr2)
-{ return false; }
-
-static inline enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id)
-{ return -ENODEV; }
-
 static inline int cmd_db_ready(void)
 { return -ENODEV; }
 #endif /* CONFIG_QCOM_COMMAND_DB */
 #endif /* __QCOM_COMMAND_DB_H__ */

-- 
2.45.2



More information about the U-Boot mailing list