Re: [PATCH v3 5/5] soc: qcom: socinfo: Expose image information

From: Greg KH
Date: Thu Feb 21 2019 - 11:34:16 EST


On Thu, Feb 21, 2019 at 09:54:19PM +0530, Vaishali Thakkar wrote:
> static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo)
> {
> + struct smem_image_version *smem_image_version;
> + size_t size;
> +
> qcom_socinfo->dbg_root = debugfs_create_dir("qcom_socinfo", NULL);
>
> DEBUGFS_UINT_ADD(raw_version);
> @@ -314,6 +432,98 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo)
> DEBUGFS_ADD(pmic_model);
> DEBUGFS_ADD(platform_subtype);
> DEBUGFS_ADD(pmic_die_revision);
> +
> + smem_image_version = qcom_smem_get(QCOM_SMEM_HOST_ANY,
> + SMEM_IMAGE_VERSION_TABLE,
> + &size);
> +
> + qcom_socinfo->boot = debugfs_create_dir("boot",
> + qcom_socinfo->dbg_root);
> + if (!qcom_socinfo->boot) {
> + pr_err("Cannot create boot image directory\n");
> + return;
> + }

You do not care, do not check please. Also, even if you wanted to
check, your error checking was wrong :)

> + DEBUGFS_IMAGE_NAME(name, boot, SMEM_IMAGE_TABLE_BOOT_INDEX);
> + DEBUGFS_IMAGE_VARIANT(variant, boot, SMEM_IMAGE_TABLE_BOOT_INDEX);
> + DEBUGFS_IMAGE_OEM(oem, boot, SMEM_IMAGE_TABLE_BOOT_INDEX);
> +
> + qcom_socinfo->tz = debugfs_create_dir("tz",
> + qcom_socinfo->dbg_root);
> + if (!qcom_socinfo->tz) {
> + pr_err("Cannot create tz image directory\n");
> + return;
> + }

Same here, no error checking please.

> + DEBUGFS_IMAGE_NAME(name, tz, SMEM_IMAGE_TABLE_TZ_INDEX);
> + DEBUGFS_IMAGE_VARIANT(variant, tz, SMEM_IMAGE_TABLE_TZ_INDEX);
> + DEBUGFS_IMAGE_OEM(oem, tz, SMEM_IMAGE_TABLE_TZ_INDEX);
> +
> + qcom_socinfo->rpm = debugfs_create_dir("rpm",
> + qcom_socinfo->dbg_root);
> + if (!qcom_socinfo->rpm) {
> + pr_err("Cannot create rpm image directory\n");
> + return;
> + }

And here.

> + DEBUGFS_IMAGE_NAME(name, rpm, SMEM_IMAGE_TABLE_RPM_INDEX);
> + DEBUGFS_IMAGE_VARIANT(variant, rpm, SMEM_IMAGE_TABLE_RPM_INDEX);
> + DEBUGFS_IMAGE_OEM(oem, rpm, SMEM_IMAGE_TABLE_RPM_INDEX);
> +
> + qcom_socinfo->apps = debugfs_create_dir("apps",
> + qcom_socinfo->dbg_root);
> + if (!qcom_socinfo->apps) {
> + pr_err("Cannot create apps image directory\n");
> + return;
> + }

And here.

> + DEBUGFS_IMAGE_NAME(name, apps, SMEM_IMAGE_TABLE_APPS_INDEX);
> + DEBUGFS_IMAGE_VARIANT(variant, apps, SMEM_IMAGE_TABLE_APPS_INDEX);
> + DEBUGFS_IMAGE_OEM(oem, apps, SMEM_IMAGE_TABLE_APPS_INDEX);
> +
> + qcom_socinfo->mpss = debugfs_create_dir("mpss",
> + qcom_socinfo->dbg_root);
> + if (!qcom_socinfo->mpss) {
> + pr_err("Cannot create mpss image directory\n");
> + return;
> + }

Yet again...

> +
> + DEBUGFS_IMAGE_NAME(name, mpss, SMEM_IMAGE_TABLE_MPSS_INDEX);
> + DEBUGFS_IMAGE_VARIANT(variant, mpss, SMEM_IMAGE_TABLE_MPSS_INDEX);
> + DEBUGFS_IMAGE_OEM(oem, mpss, SMEM_IMAGE_TABLE_MPSS_INDEX);
> +
> + qcom_socinfo->adsp = debugfs_create_dir("adsp",
> + qcom_socinfo->dbg_root);
> + if (!qcom_socinfo->adsp) {
> + pr_err("Cannot create adsp image directory\n");
> + return;
> + }

And again...

> +
> + DEBUGFS_IMAGE_NAME(name, adsp, SMEM_IMAGE_TABLE_ADSP_INDEX);
> + DEBUGFS_IMAGE_VARIANT(variant, adsp, SMEM_IMAGE_TABLE_ADSP_INDEX);
> + DEBUGFS_IMAGE_OEM(oem, adsp, SMEM_IMAGE_TABLE_ADSP_INDEX);
> +
> + qcom_socinfo->cnss = debugfs_create_dir("cnss",
> + qcom_socinfo->dbg_root);
> + if (!qcom_socinfo->cnss) {
> + pr_err("Cannot create cnss image directory\n");
> + return;
> + }

And again...

> +
> + DEBUGFS_IMAGE_NAME(name, cnss, SMEM_IMAGE_TABLE_CNSS_INDEX);
> + DEBUGFS_IMAGE_VARIANT(variant, cnss, SMEM_IMAGE_TABLE_CNSS_INDEX);
> + DEBUGFS_IMAGE_OEM(oem, cnss, SMEM_IMAGE_TABLE_CNSS_INDEX);
> +
> + qcom_socinfo->video = debugfs_create_dir("video",
> + qcom_socinfo->dbg_root);
> + if (!qcom_socinfo->video) {
> + pr_err("Cannot create video image directory\n");
> + return;
> + }

And one last time.

There, you get to delete a bunch of code, that's always fun :)

thanks,

greg k-h