linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Keguang Zhang <keguang.zhang@gmail.com>
Cc: linux-clk@vger.kernel.org, linux-mips@linux-mips.org,
	linux-kernel@vger.kernel.org,
	Michael Turquette <mturquette@baylibre.com>
Subject: Re: [PATCH 1/3] clk: Loongson1: Refactor Loongson1 clock
Date: Thu, 18 Aug 2016 17:02:44 -0700	[thread overview]
Message-ID: <20160819000244.GK361@codeaurora.org> (raw)
In-Reply-To: <1470999108-9851-2-git-send-email-keguang.zhang@gmail.com>

On 08/12, Keguang Zhang wrote:
> @@ -91,3 +90,4 @@ obj-$(CONFIG_COMMON_CLK_VERSATILE)	+= versatile/
>  obj-$(CONFIG_X86)			+= x86/
>  obj-$(CONFIG_ARCH_ZX)			+= zte/
>  obj-$(CONFIG_ARCH_ZYNQ)			+= zynq/
> +obj-$(CONFIG_MACH_LOONGSON32)		+= loongson1/

Please keep this sorted alphabetically.

> diff --git a/drivers/clk/loongson1/clk.c b/drivers/clk/loongson1/clk.c
> new file mode 100644
> index 0000000..367b84a
> --- /dev/null
> +++ b/drivers/clk/loongson1/clk.c
> @@ -0,0 +1,52 @@
> +/*
> + * Copyright (c) 2012-2016 Zhang, Keguang <keguang.zhang@gmail.com>
> + *
> + * 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.
> + */
> +
> +#include <linux/clk-provider.h>
> +#include <linux/slab.h>
> +
> +int ls1x_pll_clk_enable(struct clk_hw *hw)
> +{
> +	return 0;
> +}
> +
> +void ls1x_pll_clk_disable(struct clk_hw *hw)
> +{
> +}

Why do we need empty functions?

> +
> +struct clk *__init clk_register_pll(struct device *dev,
> +				    const char *name,
> +				    const char *parent_name,
> +				    const struct clk_ops *ops,
> +				    unsigned long flags)
> +{
> +	struct clk_hw *hw;
> +	struct clk *clk;
> +	struct clk_init_data init;
> +
> +	/* allocate the divider */
> +	hw = kzalloc(sizeof(*hw), GFP_KERNEL);
> +	if (!hw)
> +		return ERR_PTR(-ENOMEM);
> +
> +	init.name = name;
> +	init.ops = ops;
> +	init.flags = flags | CLK_IS_BASIC;
> +	init.parent_names = (parent_name ? &parent_name : NULL);
> +	init.num_parents = (parent_name ? 1 : 0);
> +	hw->init = &init;
> +
> +	/* register the clock */
> +	clk = clk_register(dev, hw);

Please rebase this on clk: ls1x: Migrate to clk_hw based OF and
registration APIs. I've put that into clk-next.

> +
> +	if (IS_ERR(clk))
> +		kfree(hw);
> +
> +	return clk;
> +}
> +
> diff --git a/drivers/clk/loongson1/clk.h b/drivers/clk/loongson1/clk.h
> new file mode 100644
> index 0000000..aa880e6
> --- /dev/null
> +++ b/drivers/clk/loongson1/clk.h
> @@ -0,0 +1,21 @@
> +/*
> + * Copyright (c) 2012-2016 Zhang, Keguang <keguang.zhang@gmail.com>
> + *
> + * 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.
> + */
> +
> +#ifndef __LOONGSON1_CLK_H
> +#define __LOONGSON1_CLK_H

Forward declare struct clk_hw, struct device, struct clk_ops
here.

> +
> +int ls1x_pll_clk_enable(struct clk_hw *hw);
> +void ls1x_pll_clk_disable(struct clk_hw *hw);
> +struct clk *__init clk_register_pll(struct device *dev,

__init is unnecessary in header files.

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

  reply	other threads:[~2016-08-19  0:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12 10:51 [PATCH 0/3] Refactor Loongson1 clock Keguang Zhang
2016-08-12 10:51 ` [PATCH 1/3] clk: Loongson1: " Keguang Zhang
2016-08-19  0:02   ` Stephen Boyd [this message]
2016-09-18 10:56     ` Kelvin Cheung
2016-08-12 10:51 ` [PATCH 2/3] clk: Loongson1: Update clocks of Loongson1B Keguang Zhang
2016-08-19  0:03   ` Stephen Boyd
2016-08-12 10:51 ` [PATCH 3/3] clk: Loongson1: Make use of GENMASK Keguang Zhang
2016-08-19  0:04   ` Stephen Boyd
2016-09-18 11:00     ` Kelvin Cheung

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=20160819000244.GK361@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=keguang.zhang@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --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 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).