Skip to content

Commit

Permalink
clk: sunxi: factors: Make struct clk_factors_config table const
Browse files Browse the repository at this point in the history
struct clk_factors_config contains shifts/widths for the factors of
the factors clk. This is used to read out the factors from the register
value. In no case is it written to, so make it const.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
  • Loading branch information
Chen-Yu Tsai authored and Maxime Ripard committed Jan 27, 2016
1 parent 63d8c7b commit b3e919e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions drivers/clk/sunxi/clk-factors.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static unsigned long clk_factors_recalc_rate(struct clk_hw *hw,
u32 reg;
unsigned long rate;
struct clk_factors *factors = to_clk_factors(hw);
struct clk_factors_config *config = factors->config;
const struct clk_factors_config *config = factors->config;

/* Fetch the register value */
reg = readl(factors->reg);
Expand Down Expand Up @@ -123,7 +123,7 @@ static int clk_factors_set_rate(struct clk_hw *hw, unsigned long rate,
u8 n = 0, k = 0, m = 0, p = 0;
u32 reg;
struct clk_factors *factors = to_clk_factors(hw);
struct clk_factors_config *config = factors->config;
const struct clk_factors_config *config = factors->config;
unsigned long flags = 0;

factors->get_factors((u32 *)&rate, (u32)parent_rate, &n, &k, &m, &p);
Expand Down
4 changes: 2 additions & 2 deletions drivers/clk/sunxi/clk-factors.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ struct factors_data {
int enable;
int mux;
int muxmask;
struct clk_factors_config *table;
const struct clk_factors_config *table;
void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p);
const char *name;
};

struct clk_factors {
struct clk_hw hw;
void __iomem *reg;
struct clk_factors_config *config;
const struct clk_factors_config *config;
void (*get_factors) (u32 *rate, u32 parent, u8 *n, u8 *k, u8 *m, u8 *p);
spinlock_t *lock;
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/sunxi/clk-mod0.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void sun4i_a10_get_mod0_factors(u32 *freq, u32 parent_rate,
}

/* user manual says "n" but it's really "p" */
static struct clk_factors_config sun4i_a10_mod0_config = {
static const struct clk_factors_config sun4i_a10_mod0_config = {
.mshift = 0,
.mwidth = 4,
.pshift = 16,
Expand Down
8 changes: 4 additions & 4 deletions drivers/clk/sunxi/clk-sun9i-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void sun9i_a80_get_pll4_factors(u32 *freq, u32 parent_rate,
*p_ret = p;
}

static struct clk_factors_config sun9i_a80_pll4_config = {
static const struct clk_factors_config sun9i_a80_pll4_config = {
.mshift = 18,
.mwidth = 1,
.nshift = 8,
Expand Down Expand Up @@ -134,7 +134,7 @@ static void sun9i_a80_get_gt_factors(u32 *freq, u32 parent_rate,
*m = div;
}

static struct clk_factors_config sun9i_a80_gt_config = {
static const struct clk_factors_config sun9i_a80_gt_config = {
.mshift = 0,
.mwidth = 2,
};
Expand Down Expand Up @@ -199,7 +199,7 @@ static void sun9i_a80_get_ahb_factors(u32 *freq, u32 parent_rate,
*p = _p;
}

static struct clk_factors_config sun9i_a80_ahb_config = {
static const struct clk_factors_config sun9i_a80_ahb_config = {
.pshift = 0,
.pwidth = 2,
};
Expand Down Expand Up @@ -289,7 +289,7 @@ static void sun9i_a80_get_apb1_factors(u32 *freq, u32 parent_rate,
*p = calcp;
}

static struct clk_factors_config sun9i_a80_apb1_config = {
static const struct clk_factors_config sun9i_a80_apb1_config = {
.mshift = 0,
.mwidth = 5,
.pshift = 16,
Expand Down
16 changes: 8 additions & 8 deletions drivers/clk/sunxi/clk-sunxi.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ static void sun7i_a20_get_out_factors(u32 *freq, u32 parent_rate,
* sunxi_factors_clk_setup() - Setup function for factor clocks
*/

static struct clk_factors_config sun4i_pll1_config = {
static const struct clk_factors_config sun4i_pll1_config = {
.nshift = 8,
.nwidth = 5,
.kshift = 4,
Expand All @@ -619,7 +619,7 @@ static struct clk_factors_config sun4i_pll1_config = {
.pwidth = 2,
};

static struct clk_factors_config sun6i_a31_pll1_config = {
static const struct clk_factors_config sun6i_a31_pll1_config = {
.nshift = 8,
.nwidth = 5,
.kshift = 4,
Expand All @@ -629,7 +629,7 @@ static struct clk_factors_config sun6i_a31_pll1_config = {
.n_start = 1,
};

static struct clk_factors_config sun8i_a23_pll1_config = {
static const struct clk_factors_config sun8i_a23_pll1_config = {
.nshift = 8,
.nwidth = 5,
.kshift = 4,
Expand All @@ -641,35 +641,35 @@ static struct clk_factors_config sun8i_a23_pll1_config = {
.n_start = 1,
};

static struct clk_factors_config sun4i_pll5_config = {
static const struct clk_factors_config sun4i_pll5_config = {
.nshift = 8,
.nwidth = 5,
.kshift = 4,
.kwidth = 2,
};

static struct clk_factors_config sun6i_a31_pll6_config = {
static const struct clk_factors_config sun6i_a31_pll6_config = {
.nshift = 8,
.nwidth = 5,
.kshift = 4,
.kwidth = 2,
.n_start = 1,
};

static struct clk_factors_config sun5i_a13_ahb_config = {
static const struct clk_factors_config sun5i_a13_ahb_config = {
.pshift = 4,
.pwidth = 2,
};

static struct clk_factors_config sun4i_apb1_config = {
static const struct clk_factors_config sun4i_apb1_config = {
.mshift = 0,
.mwidth = 5,
.pshift = 16,
.pwidth = 2,
};

/* user manual says "n" but it's really "p" */
static struct clk_factors_config sun7i_a20_out_config = {
static const struct clk_factors_config sun7i_a20_out_config = {
.mshift = 8,
.mwidth = 5,
.pshift = 20,
Expand Down

0 comments on commit b3e919e

Please sign in to comment.