devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Eric Anholt <eric@anholt.net>
Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Stephen Warren <swarren@wwwdotorg.org>,
	Lee Jones <lee@kernel.org>,
	Mike Turquette <mturquette@baylibre.com>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 2/3] clk: bcm2835: Add a driver for the auxiliary peripheral clock gates.
Date: Thu, 1 Oct 2015 17:19:05 -0700	[thread overview]
Message-ID: <20151002001905.GB12338@codeaurora.org> (raw)
In-Reply-To: <1441923750-19404-3-git-send-email-eric@anholt.net>

On 09/10, Eric Anholt wrote:
> diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c
> new file mode 100644
> index 0000000..1efa6fb
> --- /dev/null
> +++ b/drivers/clk/bcm/clk-bcm2835-aux.c
> @@ -0,0 +1,80 @@
> +/*
> + * Copyright (C) 2015 Broadcom
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/clk-provider.h>
> +#include <linux/clkdev.h>

Is this include used?

> +#include <linux/clk/bcm2835.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/platform_device.h>
> +#include <dt-bindings/clock/bcm2835-aux.h>
> +
> +static int bcm2835_aux_clk_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct clk_onecell_data *onecell;
> +	const char *parent;
> +	struct clk *parent_clk;
> +	void __iomem *reg;
> +
> +	parent_clk = of_clk_get(dev->of_node, 0);
> +	if (IS_ERR(parent_clk))
> +		return PTR_ERR(parent_clk);

We have a device, any reason we can't use clk_get() directly?

> +	parent = __clk_get_name(parent_clk);
> +
> +	reg = of_iomap(dev->of_node, 0);

We have a platform device here, why aren't we using platform
device APIs like platform_get_resource() and
devm_ioremap_resource()?

> +	if (!reg)
> +		return -ENODEV;
> +
> +	onecell = kmalloc(sizeof(*onecell), GFP_KERNEL);
> +	if (!onecell)
> +		return -ENOMEM;
> +	onecell->clk_num = BCM2835_AUX_CLOCK_COUNT;
> +	onecell->clks = kzalloc(sizeof(*onecell->clks) *

kcalloc?

> +				BCM2835_AUX_CLOCK_COUNT, GFP_KERNEL);
> +	if (!onecell->clks)
> +		return -ENOMEM;
> +

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

  parent reply	other threads:[~2015-10-02  0:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 22:22 BCM2835 auxiliary peripheral clocks Eric Anholt
     [not found] ` <1441923750-19404-1-git-send-email-eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>
2015-09-10 22:22   ` [PATCH 1/3] clk: bcm2835: Add bindings for the auxiliary peripheral clock gates Eric Anholt
2015-09-10 22:22 ` [PATCH 2/3] clk: bcm2835: Add a driver " Eric Anholt
     [not found]   ` <1441923750-19404-3-git-send-email-eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>
2015-09-11 10:24     ` Martin Sperl
2015-09-22  2:11   ` Stephen Warren
2015-10-02  0:19   ` Stephen Boyd [this message]
2015-09-10 22:22 ` [PATCH 3/3] ARM: bcm2835: Add the auxiliary clocks to the device tree Eric Anholt
     [not found]   ` <1441923750-19404-4-git-send-email-eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>
2015-09-22  2:12     ` Stephen Warren
2015-09-22  2:19     ` Stephen Warren
2015-09-28 19:26       ` Eric Anholt
2015-09-28 19:49         ` Stephen Warren

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=20151002001905.GB12338@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eric@anholt.net \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=swarren@wwwdotorg.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).