From: Bintian <bintian.wang@huawei.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: <mturquette@linaro.org>, <zhangfei.gao@linaro.org>,
<xuwei5@hisilicon.com>, <xuejiancheng@huawei.com>,
<tomeu.vizoso@collabora.com>, <sledge.yanwei@huawei.com>,
<linux-clk@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<arnd@arndb.de>, <will.deacon@arm.com>, <robh+dt@kernel.org>,
<khilman@linaro.org>, <mark.rutland@arm.com>,
<catalin.marinas@arm.com>, <haojian.zhuang@linaro.org>,
<linux-arm-kernel@lists.infradead.org>, <olof@lixom.net>,
<yanhaifeng@gmail.com>, <linux@arm.linux.org.uk>,
<guodong.xu@linaro.org>, <jorge.ramirez-ortiz@linaro.org>,
<tyler.baker@linaro.org>, <khilman@kernel.org>,
<xuyiping@hisilicon.com>, <wangbinghui@hisilicon.com>,
<zhenwei.wang@hisilicon.com>, <victor.lixin@hisilicon.com>,
<puck.chen@hisilicon.com>, <dan.zhao@hisilicon.com>,
<huxinwei@huawei.com>, <z.liuxinliang@huawei.com>,
<heyunlei@huawei.com>, <kong.kongxinwei@hisilicon.com>,
<w.f@huawei.com>, <liguozhu@hisilicon.com>,
<wangbintian@gmail.com>
Subject: Re: [PATCH v6 5/6] clk: hi6220: Clock driver support for Hisilicon hi6220 SoC
Date: Wed, 20 May 2015 14:42:45 +0800 [thread overview]
Message-ID: <555C2CE5.4010706@huawei.com> (raw)
In-Reply-To: <20150520013941.GD31054@codeaurora.org>
Hello Stephen,
I will fix in version 7 based on all comments.
Thanks,
Bintian
On 2015/5/20 9:39, Stephen Boyd wrote:
> On 05/16, Bintian Wang wrote:
>> @@ -94,18 +106,23 @@ struct clk *hisi_register_clkgate_sep(struct device *, const char *,
>> const char *, unsigned long,
>> void __iomem *, u8,
>> u8, spinlock_t *);
>> +struct clk *hi6220_register_clkdiv(struct device *dev, const char *name,
>> + const char *parent_name, unsigned long flags, void __iomem *reg,
>> + u8 shift, u8 width, u32 mask_bit, spinlock_t *lock);
>>
>> -struct hisi_clock_data __init *hisi_clk_init(struct device_node *, int);
>> -void __init hisi_clk_register_fixed_rate(struct hisi_fixed_rate_clock *,
>> +struct hisi_clock_data *hisi_clk_init(struct device_node *, int);
>> +void hisi_clk_register_fixed_rate(struct hisi_fixed_rate_clock *,
>> int, struct hisi_clock_data *);
>> -void __init hisi_clk_register_fixed_factor(struct hisi_fixed_factor_clock *,
>> +void hisi_clk_register_fixed_factor(struct hisi_fixed_factor_clock *,
>> int, struct hisi_clock_data *);
>> -void __init hisi_clk_register_mux(struct hisi_mux_clock *, int,
>> +void hisi_clk_register_mux(struct hisi_mux_clock *, int,
>> struct hisi_clock_data *);
>> -void __init hisi_clk_register_divider(struct hisi_divider_clock *,
>> +void hisi_clk_register_divider(struct hisi_divider_clock *,
>> int, struct hisi_clock_data *);
>> -void __init hisi_clk_register_gate(struct hisi_gate_clock *,
>> +void hisi_clk_register_gate(struct hisi_gate_clock *,
>> + int, struct hisi_clock_data *);
>> +void hisi_clk_register_gate_sep(struct hisi_gate_clock *,
>> int, struct hisi_clock_data *);
>> -void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *,
>> +void hi6220_clk_register_divider(struct hi6220_divider_clock *,
>> int, struct hisi_clock_data *);
>
> Please don't do the mass __init removal in this patch. Do it in a
> separate patch.
>
>> #endif /* __HISI_CLK_H */
>> diff --git a/drivers/clk/hisilicon/clkdivider-hi6220.c b/drivers/clk/hisilicon/clkdivider-hi6220.c
>> new file mode 100644
>> index 0000000..bc85ef6
>> --- /dev/null
>> +++ b/drivers/clk/hisilicon/clkdivider-hi6220.c
>> @@ -0,0 +1,157 @@
>> +/*
>> + * Hisilicon hi6220 SoC divider clock driver
>> + *
>> + * Copyright (c) 2015 Hisilicon Limited.
>> + *
>> + * Author: Bintian Wang <bintian.wang@huawei.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + *
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/clk-provider.h>
>> +#include <linux/slab.h>
>> +#include <linux/io.h>
>> +#include <linux/err.h>
>
> #include <linux/spinlock.h> ?
>
>> +
>> +#define div_mask(width) ((1 << (width)) - 1)
>> +
> [..]
>> +
>> +struct clk *hi6220_register_clkdiv(struct device *dev, const char *name,
>> + const char *parent_name, unsigned long flags, void __iomem *reg,
>> + u8 shift, u8 width, u32 mask_bit, spinlock_t *lock)
>> +{
>> + struct hi6220_clk_divider *div;
>> + struct clk *clk;
>> + struct clk_init_data init;
>> + struct clk_div_table *table;
>> + u32 max_div, min_div;
>> + int i;
>> +
>> + /* allocate the divider */
>> + div = kzalloc(sizeof(struct hi6220_clk_divider), GFP_KERNEL);
>
> nitpick: Use sizeof(*div) please.
>
>> + if (!div)
>> + return ERR_PTR(-ENOMEM);
>> +
>> + /* Init the divider table */
>> + max_div = div_mask(width) + 1;
>> + min_div = 1;
>> +
>> + table = kzalloc(sizeof(struct clk_div_table) * (max_div + 1),
>
> And kcalloc() here please
>
>> + GFP_KERNEL);
>> + if (!table) {
>> + kfree(div);
>> + return ERR_PTR(-ENOMEM);
>> + }
>> +
>> + for (i = 0; i < max_div; i++) {
>> + table[i].div = min_div + i;
>> + table[i].val = table[i].div - 1;
>> + }
>> +
>> + init.name = name;
>> + init.ops = &hi6220_clkdiv_ops;
>> + init.flags = flags;
>> + init.parent_names = parent_name ? &parent_name : NULL;
>> + init.num_parents = parent_name ? 1 : 0;
>> +
>> + /* struct hi6220_clk_divider assignments */
>> + div->reg = reg;
>> + div->shift = shift;
>> + div->width = width;
>> + div->mask = mask_bit ? BIT(mask_bit) : 0;
>> + div->lock = lock;
>> + div->hw.init = &init;
>> + div->table = table;
>> +
>> + /* register the clock */
>> + clk = clk_register(dev, &div->hw);
>> +
>
> Drop the newline here.
>
>> + if (IS_ERR(clk)) {
>> + kfree(table);
>> + kfree(div);
>> + }
>> +
>> + return clk;
>> +}
>
WARNING: multiple messages have this Message-ID (diff)
From: bintian.wang@huawei.com (Bintian)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 5/6] clk: hi6220: Clock driver support for Hisilicon hi6220 SoC
Date: Wed, 20 May 2015 14:42:45 +0800 [thread overview]
Message-ID: <555C2CE5.4010706@huawei.com> (raw)
In-Reply-To: <20150520013941.GD31054@codeaurora.org>
Hello Stephen,
I will fix in version 7 based on all comments.
Thanks,
Bintian
On 2015/5/20 9:39, Stephen Boyd wrote:
> On 05/16, Bintian Wang wrote:
>> @@ -94,18 +106,23 @@ struct clk *hisi_register_clkgate_sep(struct device *, const char *,
>> const char *, unsigned long,
>> void __iomem *, u8,
>> u8, spinlock_t *);
>> +struct clk *hi6220_register_clkdiv(struct device *dev, const char *name,
>> + const char *parent_name, unsigned long flags, void __iomem *reg,
>> + u8 shift, u8 width, u32 mask_bit, spinlock_t *lock);
>>
>> -struct hisi_clock_data __init *hisi_clk_init(struct device_node *, int);
>> -void __init hisi_clk_register_fixed_rate(struct hisi_fixed_rate_clock *,
>> +struct hisi_clock_data *hisi_clk_init(struct device_node *, int);
>> +void hisi_clk_register_fixed_rate(struct hisi_fixed_rate_clock *,
>> int, struct hisi_clock_data *);
>> -void __init hisi_clk_register_fixed_factor(struct hisi_fixed_factor_clock *,
>> +void hisi_clk_register_fixed_factor(struct hisi_fixed_factor_clock *,
>> int, struct hisi_clock_data *);
>> -void __init hisi_clk_register_mux(struct hisi_mux_clock *, int,
>> +void hisi_clk_register_mux(struct hisi_mux_clock *, int,
>> struct hisi_clock_data *);
>> -void __init hisi_clk_register_divider(struct hisi_divider_clock *,
>> +void hisi_clk_register_divider(struct hisi_divider_clock *,
>> int, struct hisi_clock_data *);
>> -void __init hisi_clk_register_gate(struct hisi_gate_clock *,
>> +void hisi_clk_register_gate(struct hisi_gate_clock *,
>> + int, struct hisi_clock_data *);
>> +void hisi_clk_register_gate_sep(struct hisi_gate_clock *,
>> int, struct hisi_clock_data *);
>> -void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *,
>> +void hi6220_clk_register_divider(struct hi6220_divider_clock *,
>> int, struct hisi_clock_data *);
>
> Please don't do the mass __init removal in this patch. Do it in a
> separate patch.
>
>> #endif /* __HISI_CLK_H */
>> diff --git a/drivers/clk/hisilicon/clkdivider-hi6220.c b/drivers/clk/hisilicon/clkdivider-hi6220.c
>> new file mode 100644
>> index 0000000..bc85ef6
>> --- /dev/null
>> +++ b/drivers/clk/hisilicon/clkdivider-hi6220.c
>> @@ -0,0 +1,157 @@
>> +/*
>> + * Hisilicon hi6220 SoC divider clock driver
>> + *
>> + * Copyright (c) 2015 Hisilicon Limited.
>> + *
>> + * Author: Bintian Wang <bintian.wang@huawei.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + *
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/clk-provider.h>
>> +#include <linux/slab.h>
>> +#include <linux/io.h>
>> +#include <linux/err.h>
>
> #include <linux/spinlock.h> ?
>
>> +
>> +#define div_mask(width) ((1 << (width)) - 1)
>> +
> [..]
>> +
>> +struct clk *hi6220_register_clkdiv(struct device *dev, const char *name,
>> + const char *parent_name, unsigned long flags, void __iomem *reg,
>> + u8 shift, u8 width, u32 mask_bit, spinlock_t *lock)
>> +{
>> + struct hi6220_clk_divider *div;
>> + struct clk *clk;
>> + struct clk_init_data init;
>> + struct clk_div_table *table;
>> + u32 max_div, min_div;
>> + int i;
>> +
>> + /* allocate the divider */
>> + div = kzalloc(sizeof(struct hi6220_clk_divider), GFP_KERNEL);
>
> nitpick: Use sizeof(*div) please.
>
>> + if (!div)
>> + return ERR_PTR(-ENOMEM);
>> +
>> + /* Init the divider table */
>> + max_div = div_mask(width) + 1;
>> + min_div = 1;
>> +
>> + table = kzalloc(sizeof(struct clk_div_table) * (max_div + 1),
>
> And kcalloc() here please
>
>> + GFP_KERNEL);
>> + if (!table) {
>> + kfree(div);
>> + return ERR_PTR(-ENOMEM);
>> + }
>> +
>> + for (i = 0; i < max_div; i++) {
>> + table[i].div = min_div + i;
>> + table[i].val = table[i].div - 1;
>> + }
>> +
>> + init.name = name;
>> + init.ops = &hi6220_clkdiv_ops;
>> + init.flags = flags;
>> + init.parent_names = parent_name ? &parent_name : NULL;
>> + init.num_parents = parent_name ? 1 : 0;
>> +
>> + /* struct hi6220_clk_divider assignments */
>> + div->reg = reg;
>> + div->shift = shift;
>> + div->width = width;
>> + div->mask = mask_bit ? BIT(mask_bit) : 0;
>> + div->lock = lock;
>> + div->hw.init = &init;
>> + div->table = table;
>> +
>> + /* register the clock */
>> + clk = clk_register(dev, &div->hw);
>> +
>
> Drop the newline here.
>
>> + if (IS_ERR(clk)) {
>> + kfree(table);
>> + kfree(div);
>> + }
>> +
>> + return clk;
>> +}
>
next prev parent reply other threads:[~2015-05-20 6:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-16 7:40 [PATCH v6 5/6] clk: hi6220: Clock driver support for Hisilicon hi6220 SoC Bintian Wang
2015-05-16 7:40 ` Bintian Wang
2015-05-19 12:21 ` Bintian
2015-05-19 12:21 ` Bintian
2015-05-20 1:39 ` Stephen Boyd
2015-05-20 1:39 ` Stephen Boyd
2015-05-20 6:42 ` Bintian [this message]
2015-05-20 6:42 ` Bintian
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=555C2CE5.4010706@huawei.com \
--to=bintian.wang@huawei.com \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=dan.zhao@hisilicon.com \
--cc=guodong.xu@linaro.org \
--cc=haojian.zhuang@linaro.org \
--cc=heyunlei@huawei.com \
--cc=huxinwei@huawei.com \
--cc=jorge.ramirez-ortiz@linaro.org \
--cc=khilman@kernel.org \
--cc=khilman@linaro.org \
--cc=kong.kongxinwei@hisilicon.com \
--cc=liguozhu@hisilicon.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=mturquette@linaro.org \
--cc=olof@lixom.net \
--cc=puck.chen@hisilicon.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@codeaurora.org \
--cc=sledge.yanwei@huawei.com \
--cc=tomeu.vizoso@collabora.com \
--cc=tyler.baker@linaro.org \
--cc=victor.lixin@hisilicon.com \
--cc=w.f@huawei.com \
--cc=wangbinghui@hisilicon.com \
--cc=wangbintian@gmail.com \
--cc=will.deacon@arm.com \
--cc=xuejiancheng@huawei.com \
--cc=xuwei5@hisilicon.com \
--cc=xuyiping@hisilicon.com \
--cc=yanhaifeng@gmail.com \
--cc=z.liuxinliang@huawei.com \
--cc=zhangfei.gao@linaro.org \
--cc=zhenwei.wang@hisilicon.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.