Skip to contentSkip to conversation

net: wwan: iosm: fw flashing and cd improvements

PATCH Applied M Chetan Kumar 2 participants 2 messages Sep 21, 2021 – Sep 22, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: wwan: iosm: fw flashing and cd improvements

1> Function comments moved to .c file.
2> Use literals in return to improve readability. 3> Do error handling check instead of success check. 4> Redundant ret assignment removed.

---
 drivers/net/wwan/iosm/iosm_ipc_coredump.c | 23 ++++++++--
 drivers/net/wwan/iosm/iosm_ipc_coredump.h | 16 -------
 drivers/net/wwan/iosm/iosm_ipc_devlink.c  | 40 +++++++++++++-----
 drivers/net/wwan/iosm/iosm_ipc_devlink.h  | 18 --------
 drivers/net/wwan/iosm/iosm_ipc_flash.c    | 51 +++++++++++++++++------
 drivers/net/wwan/iosm/iosm_ipc_flash.h    | 42 -------------------
 6 files changed, 87 insertions(+), 103 deletions(-)
drivers/net/wwan/iosm/iosm_ipc_coredump.c +19 -4
index fba3c3454e80..9acd87724c9d 100644
@@ -5,7 +5,15 @@
 
 #include "iosm_ipc_coredump.h"
 
-/* Collect coredump data from modem */
+/**
+ * ipc_coredump_collect - To collect coredump
+ * @devlink:            Pointer to devlink instance.
+ * @data:               Pointer to snapshot
+ * @entry:              ID of requested snapshot
+ * @region_size:        Region size
+ *
+ * Returns: 0 on success, error on failure
+ */
 int ipc_coredump_collect(struct iosm_devlink *devlink, u8 **data, int entry,
 			 u32 region_size)
 {
@@ -38,20 +46,27 @@ int ipc_coredump_collect(struct iosm_devlink *devlink, u8 **data, int entry,
 
 	*data = data_ptr;
 
-	return ret;
+	return 0;
+
 get_cd_fail:
 	vfree(data_ptr);
 	return ret;
 }
 
-/* Get coredump list to be collected from modem */
+/**
+ * ipc_coredump_get_list - Get coredump list from modem
+ * @devlink:         Pointer to devlink instance.
+ * @cmd:             RPSI command to be sent
+ *
+ * Returns: 0 on success, error on failure
+ */
 int ipc_coredump_get_list(struct iosm_devlink *devlink, u16 cmd)
 {
 	u32 byte_read, num_entries, file_size;
 	struct iosm_cd_table *cd_table;
 	u8 size[MAX_SIZE_LEN], i;
 	char *filename;
-	int ret = 0;
+	int ret;
 
 	cd_table = kzalloc(MAX_CD_LIST_SIZE, GFP_KERNEL);
 	if (!cd_table) {
drivers/net/wwan/iosm/iosm_ipc_coredump.h +0 -16
index d5028153c8d1..0809ba664276 100644
@@ -51,25 +51,9 @@ struct iosm_cd_table {
 	struct iosm_cd_list list;
 } __packed;
 
-/**
- * ipc_coredump_collect - To collect coredump
- * @devlink:		Pointer to devlink instance.
- * @data:		Pointer to snapshot
- * @entry:		ID of requested snapshot
- * @region_size:	Region size
- *
- * Returns: 0 on success, error on failure
- */
 int ipc_coredump_collect(struct iosm_devlink *devlink, u8 **data, int entry,
 			 u32 region_size);
 
-/**
- * ipc_coredump_get_list - Get coredump list
- * @devlink:         Pointer to devlink instance.
- * @cmd:	     RPSI command to be sent
- *
- * Returns: 0 on success, error on failure
- */
 int ipc_coredump_get_list(struct iosm_devlink *devlink, u16 cmd);
 
 #endif /* _IOSM_IPC_COREDUMP_H_ */
drivers/net/wwan/iosm/iosm_ipc_devlink.c +29 -11
index 7fd7956cc61e..eb96e7356868 100644
@@ -134,11 +134,11 @@ static int ipc_devlink_flash_update(struct devlink *devlink,
 {
 	struct iosm_devlink *ipc_devlink = devlink_priv(devlink);
 	enum iosm_flash_comp_type fls_type;
-	u32 rc = -EINVAL;
+	int rc = -EINVAL;
 	u8 *mdm_rsp;
 
 	if (!params->component)
-		return rc;
+		return -EINVAL;
 
 	mdm_rsp = kzalloc(IOSM_EBL_DW_PACK_SIZE, GFP_KERNEL);
 	if (!mdm_rsp)
@@ -153,11 +153,12 @@ static int ipc_devlink_flash_update(struct devlink *devlink,
 		break;
 	case FLASH_COMP_TYPE_EBL:
 		rc = ipc_flash_boot_ebl(ipc_devlink, params->fw);
-		if (!rc)
-			rc = ipc_flash_boot_set_capabilities(ipc_devlink,
-							     mdm_rsp);
-		if (!rc)
-			rc = ipc_flash_read_swid(ipc_devlink, mdm_rsp);
+		if (rc)
+			break;
+		rc = ipc_flash_boot_set_capabilities(ipc_devlink, mdm_rsp);
+		if (rc)
+			break;
+		rc = ipc_flash_read_swid(ipc_devlink, mdm_rsp);
 		break;
 	case FLASH_COMP_TYPE_FLS:
 		rc = ipc_flash_send_fls(ipc_devlink, params->fw, mdm_rsp);
@@ -185,7 +186,14 @@ static const struct devlink_ops devlink_flash_ops = {
 	.flash_update = ipc_devlink_flash_update,
 };
 
-/* Send command to modem to collect data */
+/**
+ * ipc_devlink_send_cmd - Send command to Modem
+ * @ipc_devlink: Pointer to struct iosm_devlink
+ * @cmd:         Command to be sent to modem
+ * @entry:       Command entry number
+ *
+ * Returns:      0 on success and failure value on error
+ */
 int ipc_devlink_send_cmd(struct iosm_devlink *ipc_devlink, u16 cmd, u32 entry)
 {
 	struct iosm_rpsi_cmd rpsi_cmd;
@@ -199,6 +207,7 @@ int ipc_devlink_send_cmd(struct iosm_devlink *ipc_devlink, u16 cmd, u32 entry)
 					  sizeof(rpsi_cmd));
 }
 
+/* Function to create snapshot */
 static int ipc_devlink_coredump_snapshot(struct devlink *dl,
 					 const struct devlink_region_ops *ops,
 					 struct netlink_ext_ack *extack,
@@ -223,7 +232,8 @@ static int ipc_devlink_coredump_snapshot(struct devlink *dl,
 	if (cd_list->entry == (IOSM_NOF_CD_REGION - 1))
 		ipc_coredump_get_list(ipc_devlink, rpsi_cmd_coredump_end);
 
-	return rc;
+	return 0;
+
 coredump_collect_err:
 	ipc_coredump_get_list(ipc_devlink, rpsi_cmd_coredump_end);
 	return rc;
@@ -270,7 +280,12 @@ static void ipc_devlink_destroy_region(struct iosm_devlink *ipc_devlink)
 		devlink_region_destroy(ipc_devlink->cd_regions[i]);
 }
 
-/* Handle registration to devlink framework */
+/**
+ * ipc_devlink_init - Initialize/register devlink to IOSM driver
+ * @ipc_imem:   Pointer to struct iosm_imem
+ *
+ * Returns:     Pointer to iosm_devlink on success and NULL on failure
+ */
 struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem)
 {
 	struct ipc_chnl_cfg chnl_cfg_flash = { 0 };
@@ -341,7 +356,10 @@ struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem)
 	return NULL;
 }
 
-/* Handle unregistration of devlink */
+/**
+ * ipc_devlink_deinit - To unintialize the devlink from IOSM driver.
+ * @ipc_devlink:        Devlink instance
+ */
 void ipc_devlink_deinit(struct iosm_devlink *ipc_devlink)
 {
 	struct devlink *devlink_ctx = ipc_devlink->devlink_ctx;
drivers/net/wwan/iosm/iosm_ipc_devlink.h +0 -18
index 392735080cb3..fa2b388a2f8a 100644
@@ -180,28 +180,10 @@ struct iosm_rpsi_cmd {
 	__le16	crc;
 };
 
-/**
- * ipc_devlink_init - To initialize the devlink to IOSM driver
- * @ipc_imem:	Pointer to struct iosm_imem
- *
- * Returns:	Pointer to iosm_devlink on success and NULL on failure
- */
 struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem);
 
-/**
- * ipc_devlink_deinit - To unintialize the devlink from IOSM driver.
- * @ipc_devlink:	Devlink instance
- */
 void ipc_devlink_deinit(struct iosm_devlink *ipc_devlink);
 
-/**
- * ipc_devlink_send_cmd - Send command to Modem
- * @ipc_devlink: Pointer to struct iosm_devlink
- * @cmd:	 Command to be sent to modem
- * @entry:	 Command entry number
- *
- * Returns:	 0 on success and failure value on error
- */
 int ipc_devlink_send_cmd(struct iosm_devlink *ipc_devlink, u16 cmd, u32 entry);
 
 #endif /* _IOSM_IPC_DEVLINK_H */
drivers/net/wwan/iosm/iosm_ipc_flash.c +39 -12

112 lines not on this page · raw message

drivers/net/wwan/iosm/iosm_ipc_flash.h +0 -42

61 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 8 lines · On Tue, 21 Sep 2021 22:17:36 +0530 you wrote:

1> Function comments moved to .c file.
2> Use literals in return to improve readability. 3> Do error handling check instead of success check. 4> Redundant ret assignment removed.

[...]

Here is the summary with links:
- [net-next] net: wwan: iosm: fw flashing and cd improvements

    https://git.kernel.org/netdev/net-next/c/8bea96efa7c0

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html