All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Joachim Eastwood <manabian@gmail.com>
Cc: mturquette@baylibre.com, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2 1/2] clk: add lpc18xx creg clk driver
Date: Mon, 22 Feb 2016 13:55:36 -0800	[thread overview]
Message-ID: <20160222215536.GX4847@codeaurora.org> (raw)
In-Reply-To: <1455994417-4471-2-git-send-email-manabian@gmail.com>

On 02/20, Joachim Eastwood wrote:
> +static int lpc18xx_creg_clk_probe(struct platform_device *pdev)
> +{
> +	struct device_node *np = pdev->dev.of_node;
> +	struct regmap *syscon;
> +
> +	syscon = syscon_node_to_regmap(np->parent);
> +	if (IS_ERR(syscon)) {
> +		dev_err(&pdev->dev, "syscon lookup failed\n");
> +		return PTR_ERR(syscon);
> +	}
> +
> +	clk_creg[CREG_CLK_1KHZ] =
> +		clk_register_creg_clk(&clk_creg_clocks[CREG_CLK_1KHZ],
> +				      &clk_creg_clocks[CREG_CLK_32KHZ].name,
> +				      syscon);
> +
> +	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_base_data);

If we use the same clk_base_data both times then why can't we
just insert the 1KHz clk into the clk_creg array when the
platform device probes? That would be racy if something was
trying to read the array when it's being modified, so the
alternative non-racy solution would be to make two clk_base_data
structures, one in CLK_OF_DECLARE() and one in platform device
probe.

Otherwise this looks like what I was envisioning.

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

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Joachim Eastwood <manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org,
	linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 1/2] clk: add lpc18xx creg clk driver
Date: Mon, 22 Feb 2016 13:55:36 -0800	[thread overview]
Message-ID: <20160222215536.GX4847@codeaurora.org> (raw)
In-Reply-To: <1455994417-4471-2-git-send-email-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On 02/20, Joachim Eastwood wrote:
> +static int lpc18xx_creg_clk_probe(struct platform_device *pdev)
> +{
> +	struct device_node *np = pdev->dev.of_node;
> +	struct regmap *syscon;
> +
> +	syscon = syscon_node_to_regmap(np->parent);
> +	if (IS_ERR(syscon)) {
> +		dev_err(&pdev->dev, "syscon lookup failed\n");
> +		return PTR_ERR(syscon);
> +	}
> +
> +	clk_creg[CREG_CLK_1KHZ] =
> +		clk_register_creg_clk(&clk_creg_clocks[CREG_CLK_1KHZ],
> +				      &clk_creg_clocks[CREG_CLK_32KHZ].name,
> +				      syscon);
> +
> +	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_base_data);

If we use the same clk_base_data both times then why can't we
just insert the 1KHz clk into the clk_creg array when the
platform device probes? That would be racy if something was
trying to read the array when it's being modified, so the
alternative non-racy solution would be to make two clk_base_data
structures, one in CLK_OF_DECLARE() and one in platform device
probe.

Otherwise this looks like what I was envisioning.

-- 
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 devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-02-22 21:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-20 18:53 [PATCH v2 0/2] CREG clk driver for NXP LPC18xx family Joachim Eastwood
2016-02-20 18:53 ` [PATCH v2 1/2] clk: add lpc18xx creg clk driver Joachim Eastwood
2016-02-22 21:55   ` Stephen Boyd [this message]
2016-02-22 21:55     ` Stephen Boyd
2016-02-24 21:05   ` Michael Turquette
2016-02-24 21:05     ` Michael Turquette
2016-02-20 18:53 ` [PATCH v2 2/2] doc: dt: add documentation for lpc1850-creg-clk driver Joachim Eastwood
2016-02-23 18:08   ` Rob Herring
2016-02-23 18:53     ` Joachim Eastwood
2016-02-23 21:58       ` Rob Herring
2016-02-23 22:12         ` Joachim Eastwood

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=20160222215536.GX4847@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=manabian@gmail.com \
    --cc=mturquette@baylibre.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.