Skip to content

Commit 1e27c46

Browse files
committed
drivers: clock_control: npcm: add missing const qualifiers
Ensure that the various configuration and conversion tables are marked as const to save on RAM usage. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
1 parent 1c1ec64 commit 1e27c46

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/clock_control/clock_control_npcm.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct freq_multiplier_t {
124124
uint8_t hfcgml;
125125
};
126126

127-
static struct freq_multiplier_t freq_multiplier[] = {
127+
static const struct freq_multiplier_t freq_multiplier[] = {
128128
{.ofmclk = 100000000, .hfcgn = 0x82, .hfcgmh = 0x0B, .hfcgml = 0xEC},
129129
{.ofmclk = 96000000, .hfcgn = 0x82, .hfcgmh = 0x0B, .hfcgml = 0x72},
130130
{.ofmclk = 80000000, .hfcgn = 0x82, .hfcgmh = 0x09, .hfcgml = 0x89},
@@ -139,7 +139,7 @@ struct clk_cfg_t {
139139
uint16_t bus;
140140
};
141141

142-
static struct clk_cfg_t clk_cfg[] = {
142+
static const struct clk_cfg_t clk_cfg[] = {
143143
{.clock_id = NPCM_CLOCK_PWM_I, .bus = NPCM_CLOCK_BUS_LFCLK},
144144
{.clock_id = NPCM_CLOCK_PWM_J, .bus = NPCM_CLOCK_BUS_LFCLK},
145145
{.clock_id = NPCM_CLOCK_I3CI, .bus = NPCM_CLOCK_BUS_APB3},
@@ -193,7 +193,7 @@ static struct clk_cfg_t clk_cfg[] = {
193193
#define DRV_CONFIG(dev) ((const struct npcm_pcc_config *)(dev)->config)
194194

195195
/* Clock controller local functions */
196-
static struct clk_cfg_t *npcm_get_cfg(clock_control_subsys_t sub_system)
196+
static const struct clk_cfg_t *npcm_get_cfg(clock_control_subsys_t sub_system)
197197
{
198198
uint32_t clk_id = (uint32_t)sub_system;
199199
uint32_t i;
@@ -210,7 +210,7 @@ static struct clk_cfg_t *npcm_get_cfg(clock_control_subsys_t sub_system)
210210
static inline int npcm_clock_control_on(const struct device *dev, clock_control_subsys_t sub_system)
211211
{
212212
uint32_t clk_id = (uint32_t)sub_system;
213-
struct clk_cfg_t *priv;
213+
const struct clk_cfg_t *priv;
214214
const uint32_t pmc_base = DRV_CONFIG(dev)->base_pmc;
215215

216216
priv = npcm_get_cfg(sub_system);
@@ -229,7 +229,7 @@ static inline int npcm_clock_control_off(const struct device *dev,
229229
clock_control_subsys_t sub_system)
230230
{
231231
uint32_t clk_id = (uint32_t)sub_system;
232-
struct clk_cfg_t *priv;
232+
const struct clk_cfg_t *priv;
233233
const uint32_t pmc_base = DRV_CONFIG(dev)->base_pmc;
234234

235235
priv = npcm_get_cfg(sub_system);
@@ -249,7 +249,7 @@ static int npcm_clock_control_get_subsys_rate(const struct device *dev,
249249
{
250250
ARG_UNUSED(dev);
251251
uint32_t clk_id = (uint32_t)sub_system;
252-
struct clk_cfg_t *priv;
252+
const struct clk_cfg_t *priv;
253253

254254
priv = npcm_get_cfg(sub_system);
255255
if (!priv) {
@@ -310,7 +310,7 @@ static DEVICE_API(clock_control, npcm_clock_control_api) = {
310310
static int npcm_clock_control_init(const struct device *dev)
311311
{
312312
struct cdcg_reg *const priv = (struct cdcg_reg *)(DRV_CONFIG(dev)->base_cdcg);
313-
struct freq_multiplier_t *freq_p;
313+
const struct freq_multiplier_t *freq_p;
314314
int i;
315315

316316
for (i = 0; i < ARRAY_SIZE(freq_multiplier); i++) {

0 commit comments

Comments
 (0)