linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V6 02/12] clk: sprd: Add common infrastructure
Date: Wed, 6 Dec 2017 22:50:12 -0800	[thread overview]
Message-ID: <20171207065012.GW4283@codeaurora.org> (raw)
In-Reply-To: <20171127100115.20655-3-chunyan.zhang@spreadtrum.com>

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 <chunyan.zhang@spreadtrum.com>
> + *
> + * SPDX-License-Identifier: GPL-2.0
> + */
> +
> +#ifndef _SPRD_CLK_COMMON_H_
> +#define _SPRD_CLK_COMMON_H_
> +
> +#include <linux/clk-provider.h>
> +#include <linux/of_platform.h>
> +#include <linux/regmap.h>
> +
> +#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

  reply	other threads:[~2017-12-07  6:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27 10:01 [PATCH V6 00/12] add clock driver for Spreadtrum platforms Chunyan Zhang
2017-11-27 10:01 ` [PATCH V6 01/12] drivers: move clock common macros out from vendor directories Chunyan Zhang
2017-12-07  6:47   ` Stephen Boyd
2017-12-07  8:08     ` Chunyan Zhang
2017-11-27 10:01 ` [PATCH V6 02/12] clk: sprd: Add common infrastructure Chunyan Zhang
2017-12-07  6:50   ` Stephen Boyd [this message]
2017-11-27 10:01 ` [PATCH V6 03/12] clk: sprd: add gate clock support Chunyan Zhang
2017-11-27 10:01 ` [PATCH V6 04/12] clk: sprd: add mux " Chunyan Zhang
2017-11-27 10:01 ` [PATCH V6 05/12] clk: sprd: add divider " Chunyan Zhang
2017-11-27 10:01 ` [PATCH V6 06/12] clk: sprd: add composite " Chunyan Zhang
2017-11-27 10:01 ` [PATCH V6 07/12] clk: sprd: add adjustable pll support Chunyan Zhang
2017-11-27 10:01 ` [PATCH V6 08/12] dt-bindings: Add Spreadtrum clock binding documentation Chunyan Zhang
2017-11-27 10:01 ` [PATCH V6 09/12] clk: sprd: Add dt-bindings include file for SC9860 Chunyan Zhang
2017-11-27 10:01 ` [PATCH V6 10/12] clk: sprd: add clocks support " Chunyan Zhang
2017-11-27 10:01 ` [PATCH V6 11/12] arm64: dts: add syscon for whale2 platform Chunyan Zhang
2017-11-27 10:01 ` [PATCH V6 12/12] arm64: dts: add clocks for SC9860 Chunyan Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171207065012.GW4283@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).