Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030214AbbFDWHd (ORCPT ); Thu, 4 Jun 2015 18:07:33 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:34478 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932483AbbFDWH2 (ORCPT ); Thu, 4 Jun 2015 18:07:28 -0400 Date: Thu, 4 Jun 2015 15:07:25 -0700 From: Stephen Boyd To: Daniel Thompson Cc: Mike Turquette , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Russell King , Maxime Coquelin , Kamil Lulko , Andreas Farber , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, patches@linaro.org, linaro-kernel@lists.linaro.org Subject: Re: [RFC PATCH 2/3] clk: stm32: Add clock driver for STM32F4[23]xxx devices Message-ID: <20150604220725.GT676@codeaurora.org> References: <1432327273-6810-1-git-send-email-daniel.thompson@linaro.org> <1432327273-6810-3-git-send-email-daniel.thompson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1432327273-6810-3-git-send-email-daniel.thompson@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2511 Lines: 107 On 05/22, Daniel Thompson wrote: > + > +#include Are you using this include? > +#include Are you using this include? > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include Are you using this include? > + > +static long clk_apb_mul_round_rate(struct clk_hw *hw, unsigned long rate, > + unsigned long *prate) > +{ > + struct clk_apb_mul *am = to_clk_apb_mul(hw); > + unsigned long mult = 1; > + > + if (readl(base + STM32F4_RCC_CFGR) & BIT(am->bit_idx)) > + mult *= 2; Isn't this the same as mult = 2? I guess we could rely on the compiler to figure out this one. > + > + if (__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT) { > + unsigned long best_parent = rate / mult; > + > + *prate = > + __clk_round_rate(__clk_get_parent(hw->clk), best_parent); > + } > + > + return *prate * mult; > +} > + > +static int clk_apb_mul_set_rate(struct clk_hw *hw, unsigned long rate, > + unsigned long parent_rate) > +{ Why don't we need to do anything here? > + return 0; > +} > + > +static struct clk_ops clk_apb_mul_factor_ops = { const? > + .round_rate = clk_apb_mul_round_rate, > + .set_rate = clk_apb_mul_set_rate, > + .recalc_rate = clk_apb_mul_recalc_rate, > +}; > + > +struct clk *clk_register_apb_mul(struct device *dev, const char *name, > + const char *parent_name, unsigned long flags, > + u8 bit_idx) > +{ > + struct clk_apb_mul *am; > + struct clk_init_data init; > + struct clk *clk; > + > + am = kzalloc(sizeof(*am), GFP_KERNEL); > + if (!am) > + return ERR_PTR(-ENOMEM); > + > + am->bit_idx = bit_idx; > + am->hw.init = &init; > + > + init.name = name; > + init.ops = &clk_apb_mul_factor_ops; > + init.flags = flags | CLK_IS_BASIC; Is it basic? > + init.parent_names = &parent_name; > + init.num_parents = 1; > + > + clk = clk_register(dev, &am->hw); > + > + if (IS_ERR(clk)) > + kfree(am); > + > + return clk; > +} > + > +static const char __initdata *sys_parents[] = { "hsi", NULL, "pll" }; __initdata goes after the [] -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/