Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1504326

Re: [PATCH v2 5/6] clk: stm32f469: Add QSPI clock

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 5/6] clk: stm32f469: Add QSPI clock
Date 2016-10-19 22:40 +0200
Message-ID <su5Ox-6he-27@gated-at.bofh.it> (permalink)
References <ss6OK-7Nf-3@gated-at.bofh.it> <ss6Yp-7QI-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 10/14, gabriel.fernandez@st.com wrote:
> @@ -532,10 +618,42 @@ static struct clk_hw *stm32_register_cclk(struct device *dev, const char *name,
>  	{ 0 },
>  };
>  
> +struct stm32f4_clk_data {
> +	const struct stm32f4_gate_data *gates_data;
> +	const u64 *gates_map;
> +	int gates_num;
> +};
> @@ -549,6 +667,19 @@ static void __init stm32f4_rcc_init(struct device_node *np)
>  		goto fail;
>  	}
>  
> +	match = of_match_node(stm32f4_of_match, np);
> +	if (WARN_ON(!match))
> +		return;
> +
> +	data = match->data;
> +
> +	clks = kmalloc_array(data->gates_num + END_PRIMARY_CLK,
> +			sizeof(struct clk_hw *), GFP_KERNEL);

sizeof(*clks)?

> +	if (!clks)
> +		goto fail;
> +
> +	stm32f4_gate_map = data->gates_map;
> +
>  	hse_clk = of_clk_get_parent_name(np, 0);
>  
>  	clk_register_fixed_rate_with_accuracy(NULL, "hsi", NULL, 0,
> @@ -581,11 +712,15 @@ static void __init stm32f4_rcc_init(struct device_node *np)
>  	clks[FCLK] = clk_hw_register_fixed_factor(NULL, "fclk", "ahb_div",
>  					       0, 1, 1);
>  
> -	for (n = 0; n < ARRAY_SIZE(stm32f4_gates); n++) {
> -		const struct stm32f4_gate_data *gd = &stm32f4_gates[n];
> -		unsigned int secondary =
> -		    8 * (gd->offset - STM32F4_RCC_AHB1ENR) + gd->bit_idx;
> -		int idx = stm32f4_rcc_lookup_clk_idx(0, secondary);
> +	for (n = 0; n < data->gates_num; n++) {
> +		const struct stm32f4_gate_data *gd;
> +		unsigned int secondary;
> +		int idx;
> +
> +		gd = (struct stm32f4_gate_data *) &data->gates_data[n];

Why do we cast here? Get rid of const? Perhaps the struct
shouldn't have const on the member instead?

> +		secondary = 8 * (gd->offset - STM32F4_RCC_AHB1ENR) +
> +			gd->bit_idx;
> +		idx = stm32f4_rcc_lookup_clk_idx(0, secondary);
>  
>  		if (idx < 0)

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/6] STM32F4 Add RTC & QSPI clocks <gabriel.fernandez@st.com> - 2016-10-14 11:20 +0200
  [PATCH v2 6/6] ARM: dts: stm32f429: Add QSPI clock <gabriel.fernandez@st.com> - 2016-10-14 11:20 +0200
  [PATCH v2 5/6] clk: stm32f469: Add QSPI clock <gabriel.fernandez@st.com> - 2016-10-14 11:30 +0200
    Re: [PATCH v2 5/6] clk: stm32f469: Add QSPI clock Rob Herring <robh@kernel.org> - 2016-10-18 16:20 +0200
    Re: [PATCH v2 5/6] clk: stm32f469: Add QSPI clock Stephen Boyd <sboyd@codeaurora.org> - 2016-10-19 22:40 +0200
      Re: [PATCH v2 5/6] clk: stm32f469: Add QSPI clock Gabriel Fernandez <gabriel.fernandez@st.com> - 2016-10-20 17:50 +0200
  [PATCH v2 4/6] clk: stm32f4: Add RTC clock <gabriel.fernandez@st.com> - 2016-10-14 11:30 +0200
    Re: [PATCH v2 4/6] clk: stm32f4: Add RTC clock Stephen Boyd <sboyd@codeaurora.org> - 2016-10-19 22:50 +0200
      Re: [PATCH v2 4/6] clk: stm32f4: Add RTC clock Gabriel Fernandez <gabriel.fernandez@st.com> - 2016-10-20 10:00 +0200
      Re: [PATCH v2 4/6] clk: stm32f4: Add RTC clock Gabriel Fernandez <gabriel.fernandez@st.com> - 2016-10-20 10:00 +0200
  [PATCH v2 1/6] clk: stm32f4: Add LSI & LSE clocks <gabriel.fernandez@st.com> - 2016-10-14 11:30 +0200
    Re: [PATCH v2 1/6] clk: stm32f4: Add LSI & LSE clocks Stephen Boyd <sboyd@codeaurora.org> - 2016-10-19 22:30 +0200
      Re: [PATCH v2 1/6] clk: stm32f4: Add LSI & LSE clocks Gabriel Fernandez <gabriel.fernandez@st.com> - 2016-10-20 09:50 +0200
      Re: [PATCH v2 1/6] clk: stm32f4: Add LSI & LSE clocks Gabriel Fernandez <gabriel.fernandez@st.com> - 2016-10-20 18:10 +0200
  Re: [PATCH v2 0/6] STM32F4 Add RTC & QSPI clocks Stephen Boyd <sboyd@codeaurora.org> - 2016-10-19 02:00 +0200
    Re: [PATCH v2 0/6] STM32F4 Add RTC & QSPI clocks Gabriel Fernandez <gabriel.fernandez@st.com> - 2016-10-19 16:20 +0200
      Re: [PATCH v2 0/6] STM32F4 Add RTC & QSPI clocks Stephen Boyd <sboyd@codeaurora.org> - 2016-10-19 22:30 +0200
        Re: [PATCH v2 0/6] STM32F4 Add RTC & QSPI clocks Gabriel Fernandez <gabriel.fernandez@st.com> - 2016-10-20 10:00 +0200

csiph-web