soc: qcom: socinfo: simplify searching for smem regions
Instead calling smem_find() repeatedly with different sizes for SMEM_HW_SW_BUILD_ID, call smem_get_entry() which returns a pointer to the region regardless of its size. Change-Id: If68ab31f808e2ecb740e1560ec5d9a7edd9a8c9f Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
This commit is contained in:
parent
52dabc73a5
commit
137431c1fb
1 changed files with 3 additions and 59 deletions
|
@ -1268,69 +1268,13 @@ static void socinfo_print(void)
|
|||
int __init socinfo_init(void)
|
||||
{
|
||||
static bool socinfo_init_done;
|
||||
unsigned size;
|
||||
|
||||
if (socinfo_init_done)
|
||||
return 0;
|
||||
|
||||
socinfo = smem_find(SMEM_HW_SW_BUILD_ID,
|
||||
sizeof(struct socinfo_v10),
|
||||
0,
|
||||
socinfo = smem_get_entry(SMEM_HW_SW_BUILD_ID, &size, 0,
|
||||
SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (IS_ERR_OR_NULL(socinfo))
|
||||
socinfo = smem_find(SMEM_HW_SW_BUILD_ID,
|
||||
sizeof(struct socinfo_v9),
|
||||
0,
|
||||
SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (IS_ERR_OR_NULL(socinfo))
|
||||
socinfo = smem_find(SMEM_HW_SW_BUILD_ID,
|
||||
sizeof(struct socinfo_v8),
|
||||
0,
|
||||
SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (IS_ERR_OR_NULL(socinfo))
|
||||
socinfo = smem_find(SMEM_HW_SW_BUILD_ID,
|
||||
sizeof(struct socinfo_v7),
|
||||
0,
|
||||
SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (IS_ERR_OR_NULL(socinfo))
|
||||
socinfo = smem_find(SMEM_HW_SW_BUILD_ID,
|
||||
sizeof(struct socinfo_v6),
|
||||
0,
|
||||
SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (IS_ERR_OR_NULL(socinfo))
|
||||
socinfo = smem_find(SMEM_HW_SW_BUILD_ID,
|
||||
sizeof(struct socinfo_v5),
|
||||
0,
|
||||
SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (IS_ERR_OR_NULL(socinfo))
|
||||
socinfo = smem_find(SMEM_HW_SW_BUILD_ID,
|
||||
sizeof(struct socinfo_v4),
|
||||
0,
|
||||
SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (IS_ERR_OR_NULL(socinfo))
|
||||
socinfo = smem_find(SMEM_HW_SW_BUILD_ID,
|
||||
sizeof(struct socinfo_v3),
|
||||
0,
|
||||
SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (IS_ERR_OR_NULL(socinfo))
|
||||
socinfo = smem_find(SMEM_HW_SW_BUILD_ID,
|
||||
sizeof(struct socinfo_v2),
|
||||
0,
|
||||
SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (IS_ERR_OR_NULL(socinfo))
|
||||
socinfo = smem_find(SMEM_HW_SW_BUILD_ID,
|
||||
sizeof(struct socinfo_v1),
|
||||
0,
|
||||
SMEM_ANY_HOST_FLAG);
|
||||
|
||||
if (IS_ERR_OR_NULL(socinfo)) {
|
||||
pr_warn("%s: Can't find SMEM_HW_SW_BUILD_ID; falling back on dummy values.\n",
|
||||
__func__);
|
||||
|
|
Loading…
Add table
Reference in a new issue