mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-22 18:06:40 +00:00
Utilize ARRAY_SIZE macro
This commit is contained in:
parent
55568b037f
commit
669e42960c
6 changed files with 11 additions and 10 deletions
|
@ -703,7 +703,7 @@ break_nosleep:
|
|||
#ifndef CONFIG_SDRAM_COMPRESS_CFG
|
||||
static void _sdram_patch_model_params(u32 dramid, u32 *params)
|
||||
{
|
||||
for (u32 i = 0; i < sizeof(sdram_cfg_vendor_patches) / sizeof(sdram_vendor_patch_t); i++)
|
||||
for (u32 i = 0; i < ARRAY_SIZE(sdram_cfg_vendor_patches); i++)
|
||||
if (sdram_cfg_vendor_patches[i].dramid & DRAM_ID(dramid))
|
||||
params[sdram_cfg_vendor_patches[i].addr] = sdram_cfg_vendor_patches[i].val;
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ void bpmp_mmu_enable()
|
|||
|
||||
// Init BPMP MMU entries.
|
||||
BPMP_CACHE_CTRL(BPMP_CACHE_MMU_SHADOW_COPY_MASK) = 0;
|
||||
for (u32 idx = 0; idx < (sizeof(mmu_entries) / sizeof(bpmp_mmu_entry_t)); idx++)
|
||||
for (u32 idx = 0; idx < ARRAY_SIZE(mmu_entries); idx++)
|
||||
bpmp_mmu_set_entry(idx, &mmu_entries[idx], false);
|
||||
|
||||
BPMP_CACHE_CTRL(BPMP_CACHE_MMU_CMD) = MMU_CMD_COPY_SHADOW;
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
|
||||
#include <soc/fuse.h>
|
||||
#include <soc/t210.h>
|
||||
|
||||
#define ARRAYSIZE(x) (sizeof(x) / sizeof(*x))
|
||||
#include <utils/types.h>
|
||||
|
||||
static const u32 evp_thunk_template[] = {
|
||||
0xe92d0007, // STMFD SP!, {R0-R2}
|
||||
|
@ -145,7 +144,7 @@ static int _patch_hash_one(u32 *word)
|
|||
{
|
||||
return 3;
|
||||
}
|
||||
for (u32 i = 0; i < ARRAYSIZE(hash_vals); i++)
|
||||
for (u32 i = 0; i < ARRAY_SIZE(hash_vals); i++)
|
||||
{
|
||||
if (hash_vals[i] == hash)
|
||||
{
|
||||
|
@ -234,7 +233,7 @@ int fuse_read_ipatch(void (*ipatch)(u32 offset, u32 value))
|
|||
while (word_count)
|
||||
{
|
||||
total_read += word_count;
|
||||
if (total_read >= ARRAYSIZE(words))
|
||||
if (total_read >= ARRAY_SIZE(words))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -291,7 +290,7 @@ int fuse_read_evp_thunk(u32 *iram_evp_thunks, u32 *iram_evp_thunks_len)
|
|||
while (word_count)
|
||||
{
|
||||
total_read += word_count;
|
||||
if (total_read >= ARRAYSIZE(words))
|
||||
if (total_read >= ARRAY_SIZE(words))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
|
||||
|
||||
#define OFFSET_OF(t, m) ((u32)&((t *)NULL)->m)
|
||||
#define CONTAINER_OF(mp, t, mn) ((t *)((u32)mp - OFFSET_OF(t, mn)))
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ static const pkg1_id_t _pkg1_ids[] = {
|
|||
|
||||
const pkg1_id_t *pkg1_get_latest()
|
||||
{
|
||||
return &_pkg1_ids[sizeof(_pkg1_ids) / sizeof(pkg1_id_t) - 2];
|
||||
return &_pkg1_ids[ARRAY_SIZE(_pkg1_ids) - 2];
|
||||
}
|
||||
|
||||
const pkg1_id_t *pkg1_identify(u8 *pkg1)
|
||||
|
|
|
@ -660,7 +660,7 @@ static kip1_id_t _kip_ids[] =
|
|||
};
|
||||
|
||||
static kip1_id_t *_kip_id_sets = _kip_ids;
|
||||
static u32 _kip_id_sets_cnt = sizeof(_kip_ids) / sizeof(_kip_ids[0]);
|
||||
static u32 _kip_id_sets_cnt = ARRAY_SIZE(_kip_ids);
|
||||
|
||||
void pkg2_get_ids(kip1_id_t **ids, u32 *entries)
|
||||
{
|
||||
|
@ -783,7 +783,7 @@ static void parse_external_kip_patches()
|
|||
|
||||
const pkg2_kernel_id_t *pkg2_identify(u8 *hash)
|
||||
{
|
||||
for (u32 i = 0; i < (sizeof(_pkg2_kernel_ids) / sizeof(pkg2_kernel_id_t)); i++)
|
||||
for (u32 i = 0; i < ARRAY_SIZE(_pkg2_kernel_ids); i++)
|
||||
{
|
||||
if (!memcmp(hash, _pkg2_kernel_ids[i].hash, sizeof(_pkg2_kernel_ids[0].hash)))
|
||||
return &_pkg2_kernel_ids[i];
|
||||
|
|
Loading…
Reference in a new issue