Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750911AbdLGGuR (ORCPT ); Thu, 7 Dec 2017 01:50:17 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:53490 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750744AbdLGGuP (ORCPT ); Thu, 7 Dec 2017 01:50:15 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C12D96081A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sboyd@codeaurora.org Date: Wed, 6 Dec 2017 22:50:12 -0800 From: Stephen Boyd To: Chunyan Zhang Cc: Michael Turquette , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Mark Brown , Xiaolong Zhang , Ben Li , Orson Zhai , Chunyan Zhang Subject: Re: [PATCH V6 02/12] clk: sprd: Add common infrastructure Message-ID: <20171207065012.GW4283@codeaurora.org> References: <20171127100115.20655-1-chunyan.zhang@spreadtrum.com> <20171127100115.20655-3-chunyan.zhang@spreadtrum.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171127100115.20655-3-chunyan.zhang@spreadtrum.com> 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: 2187 Lines: 99 On 11/27, Chunyan Zhang wrote: > + > + sprd_clk_set_regmap(desc, regmap); > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(sprd_clk_regmap_init); > + > +int sprd_clk_probe(struct device *dev, struct clk_hw_onecell_data *clkhw) > +{ > + int i, ret = 0; ret shouldn't need to be initialized here. > + struct clk_hw *hw; > + > + for (i = 0; i < clkhw->num; i++) { > + > + hw = clkhw->hws[i]; > + > + if (!hw) > + continue; > + > + ret = devm_clk_hw_register(dev, hw); > + if (ret) { > + dev_err(dev, "Couldn't register clock %d - %s\n", > + i, hw->init->name); > + return ret; > + } > + } > + > + ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, > + clkhw); You can use devm_ now for this. > + if (ret) > + dev_err(dev, "Failed to add clock provider.\n"); Please remove the full stop on error messages. > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(sprd_clk_probe); > + > +MODULE_LICENSE("GPL v2"); > diff --git a/drivers/clk/sprd/common.h b/drivers/clk/sprd/common.h > new file mode 100644 > index 0000000..8cd774e > --- /dev/null > +++ b/drivers/clk/sprd/common.h > @@ -0,0 +1,52 @@ > +/* > + * Spreadtrum clock infrastructure > + * > + * Copyright (C) 2017 Spreadtrum, Inc. > + * Author: Chunyan Zhang > + * > + * SPDX-License-Identifier: GPL-2.0 > + */ > + > +#ifndef _SPRD_CLK_COMMON_H_ > +#define _SPRD_CLK_COMMON_H_ > + > +#include > +#include > +#include > + > +#include "../clk_common.h" > + > +struct device_node; > + > +struct sprd_clk_common { > + struct regmap *regmap; > + u32 reg; > + struct clk_hw hw; > +}; > + > +struct sprd_clk_desc { > + struct sprd_clk_common **clk_clks; > + unsigned long num_clk_clks; > + struct clk_hw_onecell_data *hw_clks; > +}; > + > +#define sprd_regmap_read(map, reg, val) \ > +({ \ > + (map) ? regmap_read((map), (reg), (val)) : (-EINVAL); \ Do we sometimes not have a map? This seems overly cautious. > +}) > + > +#define sprd_regmap_write(map, reg, val) \ > +({ \ -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project