soc: qcom: socinfo: Code clean-up

Performing code clean up.

Change-Id: I13aef8793bcbad485b0b56cb437b65cfb97a6086
Signed-off-by: Naini Singh <quic_nainsing@quicinc.com>
This commit is contained in:
Naini Singh committed 2022-12-15 10:13:46 +05:30
1 parent e0b641d7b3
commit efd4404fd9
2 files changed
+54 -54

No files matched your search

+50 -50
View File
@@ -200,8 +200,8 @@ struct socinfo_v0_14 {
struct socinfo_v0_13 v0_13;
uint32_t num_clusters;
uint32_t ncluster_array_offset;
uint32_t num_defective_parts;
uint32_t ndefective_parts_array_offset;
uint32_t num_subset_parts;
uint32_t nsubset_parts_array_offset;
};
struct socinfo_v0_15 {
@@ -633,19 +633,19 @@ static uint32_t socinfo_get_ncluster_array_offset(void)
: 0;
}
static uint32_t socinfo_get_num_defective_parts(void)
static uint32_t socinfo_get_num_subset_parts(void)
{
return socinfo ?
(socinfo_format >= SOCINFO_VERSION(0, 14) ?
socinfo->v0_14.num_defective_parts : 0)
socinfo->v0_14.num_subset_parts : 0)
: 0;
}
static uint32_t socinfo_get_ndefective_parts_array_offset(void)
static uint32_t socinfo_get_nsubset_parts_array_offset(void)
{
return socinfo ?
(socinfo_format >= SOCINFO_VERSION(0, 14) ?
socinfo->v0_14.ndefective_parts_array_offset : 0)
socinfo->v0_14.nsubset_parts_array_offset : 0)
: 0;
}
@@ -872,9 +872,9 @@ msm_get_ncluster_array_offset(struct device *dev,
}
uint32_t
socinfo_get_cluster_info(enum defective_cluster_type cluster)
socinfo_get_cluster_info(enum subset_cluster_type cluster)
{
uint32_t def_cluster, num_cluster, offset;
uint32_t sub_cluster, num_cluster, offset;
void *cluster_val;
void *info = socinfo;
@@ -891,46 +891,46 @@ socinfo_get_cluster_info(enum defective_cluster_type cluster)
info += offset;
cluster_val = info + (sizeof(uint32_t) * cluster);
def_cluster = get_unaligned_le32(cluster_val);
sub_cluster = get_unaligned_le32(cluster_val);
return def_cluster;
return sub_cluster;
}
EXPORT_SYMBOL(socinfo_get_cluster_info);
static ssize_t
msm_get_defective_cores(struct device *dev,
msm_get_subset_cores(struct device *dev,
struct device_attribute *attr,
char *buf)
{
uint32_t def_cluster = socinfo_get_cluster_info(CLUSTER_CPUSS);
uint32_t sub_cluster = socinfo_get_cluster_info(CLUSTER_CPUSS);
return scnprintf(buf, PAGE_SIZE, "%x\n", def_cluster);
return scnprintf(buf, PAGE_SIZE, "%x\n", sub_cluster);
}
static ssize_t
msm_get_num_defective_parts(struct device *dev,
msm_get_num_subset_parts(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return snprintf(buf, PAGE_SIZE, "0x%x\n",
socinfo_get_num_defective_parts());
socinfo_get_num_subset_parts());
}
static ssize_t
msm_get_ndefective_parts_array_offset(struct device *dev,
msm_get_nsubset_parts_array_offset(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return snprintf(buf, PAGE_SIZE, "0x%x\n",
socinfo_get_ndefective_parts_array_offset());
socinfo_get_nsubset_parts_array_offset());
}
static uint32_t
socinfo_get_defective_parts(void)
socinfo_get_subset_parts(void)
{
uint32_t num_parts = socinfo_get_num_defective_parts();
uint32_t offset = socinfo_get_ndefective_parts_array_offset();
uint32_t def_parts = 0;
uint32_t num_parts = socinfo_get_num_subset_parts();
uint32_t offset = socinfo_get_nsubset_parts_array_offset();
uint32_t sub_parts = 0;
void *info = socinfo;
uint32_t part_entry;
int i;
@@ -942,15 +942,15 @@ socinfo_get_defective_parts(void)
for (i = 0; i < num_parts; i++) {
part_entry = get_unaligned_le32(info);
if (part_entry)
def_parts |= BIT(i);
sub_parts |= BIT(i);
info += sizeof(uint32_t);
}
return def_parts;
return sub_parts;
}
bool
socinfo_get_part_info(enum defective_part_type part)
socinfo_get_part_info(enum subset_part_type part)
{
uint32_t partinfo;
@@ -959,7 +959,7 @@ socinfo_get_part_info(enum defective_part_type part)
return false;
}
partinfo = socinfo_get_defective_parts();
partinfo = socinfo_get_subset_parts();
if (partinfo < 0) {
pr_err("Failed to get part information\n");
return false;
@@ -970,13 +970,13 @@ socinfo_get_part_info(enum defective_part_type part)
EXPORT_SYMBOL(socinfo_get_part_info);
static ssize_t
msm_get_defective_parts(struct device *dev,
msm_get_subset_parts(struct device *dev,
struct device_attribute *attr,
char *buf)
{
uint32_t def_parts = socinfo_get_defective_parts();
uint32_t sub_parts = socinfo_get_subset_parts();
return scnprintf(buf, PAGE_SIZE, "%x\n", def_parts);
return scnprintf(buf, PAGE_SIZE, "%x\n", sub_parts);
}
static ssize_t
@@ -1283,21 +1283,21 @@ static struct device_attribute msm_soc_attr_ncluster_array_offset =
__ATTR(ncluster_array_offset, 0444,
msm_get_ncluster_array_offset, NULL);
static struct device_attribute msm_soc_attr_defective_cores =
__ATTR(defective_cores, 0444,
msm_get_defective_cores, NULL);
static struct device_attribute msm_soc_attr_subset_cores =
__ATTR(subset_cores, 0444,
msm_get_subset_cores, NULL);
static struct device_attribute msm_soc_attr_num_defective_parts =
__ATTR(num_defective_parts, 0444,
msm_get_num_defective_parts, NULL);
static struct device_attribute msm_soc_attr_num_subset_parts =
__ATTR(num_subset_parts, 0444,
msm_get_num_subset_parts, NULL);
static struct device_attribute msm_soc_attr_ndefective_parts_array_offset =
__ATTR(ndefective_parts_array_offset, 0444,
msm_get_ndefective_parts_array_offset, NULL);
static struct device_attribute msm_soc_attr_nsubset_parts_array_offset =
__ATTR(nsubset_parts_array_offset, 0444,
msm_get_nsubset_parts_array_offset, NULL);
static struct device_attribute msm_soc_attr_defective_parts =
__ATTR(defective_parts, 0444,
msm_get_defective_parts, NULL);
static struct device_attribute msm_soc_attr_subset_parts =
__ATTR(subset_parts, 0444,
msm_get_subset_parts, NULL);
static struct device_attribute msm_soc_attr_nmodem_supported =
__ATTR(nmodem_supported, 0444,
@@ -1498,13 +1498,13 @@ static void __init populate_soc_sysfs_files(struct device *msm_soc_device)
device_create_file(msm_soc_device,
&msm_soc_attr_ncluster_array_offset);
device_create_file(msm_soc_device,
&msm_soc_attr_defective_cores);
&msm_soc_attr_subset_cores);
device_create_file(msm_soc_device,
&msm_soc_attr_num_defective_parts);
&msm_soc_attr_num_subset_parts);
device_create_file(msm_soc_device,
&msm_soc_attr_ndefective_parts_array_offset);
&msm_soc_attr_nsubset_parts_array_offset);
device_create_file(msm_soc_device,
&msm_soc_attr_defective_parts);
&msm_soc_attr_subset_parts);
case SOCINFO_VERSION(0, 13):
device_create_file(msm_soc_device,
&msm_soc_attr_nproduct_id);
@@ -1741,7 +1741,7 @@ static void socinfo_print(void)
break;
case SOCINFO_VERSION(0, 14):
pr_info("v%u.%u, id=%u, ver=%u.%u, raw_id=%u, raw_ver=%u, hw_plat=%u, hw_plat_ver=%u\n accessory_chip=%u, hw_plat_subtype=%u, pmic_model=%u, pmic_die_revision=%u foundry_id=%u serial_number=%u num_pmics=%u chip_family=0x%x raw_device_family=0x%x raw_device_number=0x%x nproduct_id=0x%x num_clusters=0x%x ncluster_array_offset=0x%x num_defective_parts=0x%x ndefective_parts_array_offset=0x%x\n",
pr_info("v%u.%u, id=%u, ver=%u.%u, raw_id=%u, raw_ver=%u, hw_plat=%u, hw_plat_ver=%u\n accessory_chip=%u, hw_plat_subtype=%u, pmic_model=%u, pmic_die_revision=%u foundry_id=%u serial_number=%u num_pmics=%u chip_family=0x%x raw_device_family=0x%x raw_device_number=0x%x nproduct_id=0x%x num_clusters=0x%x ncluster_array_offset=0x%x num_subset_parts=0x%x nsubset_parts_array_offset=0x%x\n",
f_maj, f_min, socinfo->v0_1.id, v_maj, v_min,
socinfo->v0_2.raw_id, socinfo->v0_2.raw_version,
socinfo->v0_3.hw_platform,
@@ -1759,12 +1759,12 @@ static void socinfo_print(void)
socinfo->v0_13.nproduct_id,
socinfo->v0_14.num_clusters,
socinfo->v0_14.ncluster_array_offset,
socinfo->v0_14.num_defective_parts,
socinfo->v0_14.ndefective_parts_array_offset);
socinfo->v0_14.num_subset_parts,
socinfo->v0_14.nsubset_parts_array_offset);
break;
case SOCINFO_VERSION(0, 15):
pr_info("v%u.%u, id=%u, ver=%u.%u, raw_id=%u, raw_ver=%u, hw_plat=%u, hw_plat_ver=%u\n accessory_chip=%u, hw_plat_subtype=%u, pmic_model=%u, pmic_die_revision=%u foundry_id=%u serial_number=%u num_pmics=%u chip_family=0x%x raw_device_family=0x%x raw_device_number=0x%x nproduct_id=0x%x num_clusters=0x%x ncluster_array_offset=0x%x num_defective_parts=0x%x ndefective_parts_array_offset=0x%x nmodem_supported=0x%x\n",
pr_info("v%u.%u, id=%u, ver=%u.%u, raw_id=%u, raw_ver=%u, hw_plat=%u, hw_plat_ver=%u\n accessory_chip=%u, hw_plat_subtype=%u, pmic_model=%u, pmic_die_revision=%u foundry_id=%u serial_number=%u num_pmics=%u chip_family=0x%x raw_device_family=0x%x raw_device_number=0x%x nproduct_id=0x%x num_clusters=0x%x ncluster_array_offset=0x%x num_subset_parts=0x%x nsubset_parts_array_offset=0x%x nmodem_supported=0x%x\n",
f_maj, f_min, socinfo->v0_1.id, v_maj, v_min,
socinfo->v0_2.raw_id, socinfo->v0_2.raw_version,
socinfo->v0_3.hw_platform,
@@ -1782,8 +1782,8 @@ static void socinfo_print(void)
socinfo->v0_13.nproduct_id,
socinfo->v0_14.num_clusters,
socinfo->v0_14.ncluster_array_offset,
socinfo->v0_14.num_defective_parts,
socinfo->v0_14.ndefective_parts_array_offset,
socinfo->v0_14.num_subset_parts,
socinfo->v0_14.nsubset_parts_array_offset,
socinfo->v0_15.nmodem_supported);
break;
+4 -4
View File
@@ -233,7 +233,7 @@ enum pmic_model {
PMIC_MODEL_UNKNOWN = 0xFFFFFFFF
};
enum defective_part_type {
enum subset_part_type {
PART_UNKNOWN = 0,
PART_GPU = 1,
PART_VIDEO = 2,
@@ -252,7 +252,7 @@ enum defective_part_type {
NUM_PARTS_MAX,
};
enum defective_cluster_type {
enum subset_cluster_type {
CLUSTER_CPUSS = 0,
NUM_CLUSTERS_MAX,
};
@@ -267,8 +267,8 @@ uint32_t socinfo_get_platform_type(void);
uint32_t socinfo_get_platform_subtype(void);
uint32_t socinfo_get_platform_version(void);
uint32_t socinfo_get_serial_number(void);
uint32_t socinfo_get_cluster_info(enum defective_cluster_type cluster);
bool socinfo_get_part_info(enum defective_part_type part);
uint32_t socinfo_get_cluster_info(enum subset_cluster_type cluster);
bool socinfo_get_part_info(enum subset_part_type part);
enum pmic_model socinfo_get_pmic_model(void);
uint32_t socinfo_get_pmic_die_revision(void);
int __init socinfo_init(void) __must_check;