From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933207AbbCQJ5P (ORCPT ); Tue, 17 Mar 2015 05:57:15 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:41395 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932470AbbCQJrn (ORCPT ); Tue, 17 Mar 2015 05:47:43 -0400 Date: Tue, 17 Mar 2015 10:47:38 +0100 From: Sascha Hauer To: Uwe =?iso-8859-15?Q?Kleine-K=F6nig?= Cc: Mike Turquette , James Liao , YH Chen , linux-kernel@vger.kernel.org, Henry Chen , linux-mediatek@lists.infradead.org, kernel@pengutronix.de, Matthias Brugger , Yingjoe Chen , Eddie Huang , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 3/5] clk: mediatek: Add basic clocks for Mediatek MT8135. Message-ID: <20150317094738.GF4927@pengutronix.de> References: <1426485311-31428-1-git-send-email-s.hauer@pengutronix.de> <1426485311-31428-4-git-send-email-s.hauer@pengutronix.de> <20150316070339.GA25487@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150316070339.GA25487@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 10:35:53 up 21:27, 45 users, load average: 0.47, 0.21, 0.16 User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 16, 2015 at 08:03:39AM +0100, Uwe Kleine-König wrote: > Hello Sascha, > > On Mon, Mar 16, 2015 at 06:55:09AM +0100, Sascha Hauer wrote: > > +static const char *axi_parents[] __initconst = { > > + "clk26m", > > + "syspll_d3", > > + "syspll_d4", > > + "syspll_d6", > > + "univpll_d5", > > + "univpll2_d2", > > + "syspll_d3p5" > > +}; > __initconst should only be used for const data, but this array isn't > const. Only the strings the pointer in this array point to are constant. That may be true, but the way it's currently done compiles through without warnings with CONFIG_DEBUG_SECTION_MISMATCH enabled. > > So you have to use either > > static const char *axi_parents[] __initdata = { This results in: drivers/clk/mediatek/clk-mt8173.c:515:20: error: i2s3_b_ck_parents causes a section type conflict with infra_clks static const char *i2s3_b_ck_parents[] __initdata = { which can be avoided with static const char * const axi_parents[] __initdata > > or > > static const char * const axi_parents[] __initconst = { Which results in: drivers/clk/mediatek/clk-mt8173.c:568:2: warning: initialization discards 'const' qualifier from pointer target type MUX_GATE(TOP_HDCP_24M_SEL, "hdcp_24m_sel", hdcp_24m_parents, 0x00d0, 16, 2, 23), With the following patch this can also be resolved. Until this is merged (or I have the OK from Mike to add this in front of this series) I prefer to keep it like it is at the moment. (BTW I compile tested this with ARM multi_v7_defconfig, no additional warnings are introduced with this patch) Sascha -------------------------------8<----------------------------------- >>From 49f76867545d2f402c9684bb26339054b2151977 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 17 Mar 2015 10:43:41 +0100 Subject: [PATCH] clk: make initialization arrays const char * const * Not only the initialization arrays should be const, but also the strings inside the arrays. This allows users to put the parent_name arrays into __initdata or __initconst. Signed-off-by: Sascha Hauer --- drivers/clk/clk-composite.c | 2 +- drivers/clk/clk-mux.c | 4 ++-- include/linux/clk-provider.h | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index 956b7e5..077f4c714 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@ -188,7 +188,7 @@ static void clk_composite_disable(struct clk_hw *hw) } struct clk *clk_register_composite(struct device *dev, const char *name, - const char **parent_names, int num_parents, + const char * const *parent_names, int num_parents, struct clk_hw *mux_hw, const struct clk_ops *mux_ops, struct clk_hw *rate_hw, const struct clk_ops *rate_ops, struct clk_hw *gate_hw, const struct clk_ops *gate_ops, diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 69a094c..1fa2a8d 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -114,7 +114,7 @@ const struct clk_ops clk_mux_ro_ops = { EXPORT_SYMBOL_GPL(clk_mux_ro_ops); struct clk *clk_register_mux_table(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, u8 clk_mux_flags, u32 *table, spinlock_t *lock) { @@ -166,7 +166,7 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name, EXPORT_SYMBOL_GPL(clk_register_mux_table); struct clk *clk_register_mux(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u8 width, u8 clk_mux_flags, spinlock_t *lock) { diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 5591ea7..3bdae71 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -209,7 +209,7 @@ struct clk_ops { struct clk_init_data { const char *name; const struct clk_ops *ops; - const char **parent_names; + const char * const *parent_names; u8 num_parents; unsigned long flags; }; @@ -426,12 +426,12 @@ extern const struct clk_ops clk_mux_ops; extern const struct clk_ops clk_mux_ro_ops; struct clk *clk_register_mux(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u8 width, u8 clk_mux_flags, spinlock_t *lock); struct clk *clk_register_mux_table(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, u8 clk_mux_flags, u32 *table, spinlock_t *lock); @@ -518,7 +518,7 @@ struct clk_composite { }; struct clk *clk_register_composite(struct device *dev, const char *name, - const char **parent_names, int num_parents, + const char * const *parent_names, int num_parents, struct clk_hw *mux_hw, const struct clk_ops *mux_ops, struct clk_hw *rate_hw, const struct clk_ops *rate_ops, struct clk_hw *gate_hw, const struct clk_ops *gate_ops, -- 2.1.4 -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sascha Hauer Subject: Re: [PATCH 3/5] clk: mediatek: Add basic clocks for Mediatek MT8135. Date: Tue, 17 Mar 2015 10:47:38 +0100 Message-ID: <20150317094738.GF4927@pengutronix.de> References: <1426485311-31428-1-git-send-email-s.hauer@pengutronix.de> <1426485311-31428-4-git-send-email-s.hauer@pengutronix.de> <20150316070339.GA25487@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <20150316070339.GA25487-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+glpam-linux-mediatek=m.gmane.org-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org To: Uwe =?iso-8859-15?Q?Kleine-K=F6nig?= Cc: James Liao , Mike Turquette , YH Chen , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Henry Chen , linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, Matthias Brugger , Yingjoe Chen , Eddie Huang , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: linux-mediatek@lists.infradead.org On Mon, Mar 16, 2015 at 08:03:39AM +0100, Uwe Kleine-K=F6nig wrote: > Hello Sascha, > = > On Mon, Mar 16, 2015 at 06:55:09AM +0100, Sascha Hauer wrote: > > +static const char *axi_parents[] __initconst =3D { > > + "clk26m", > > + "syspll_d3", > > + "syspll_d4", > > + "syspll_d6", > > + "univpll_d5", > > + "univpll2_d2", > > + "syspll_d3p5" > > +}; > __initconst should only be used for const data, but this array isn't > const. Only the strings the pointer in this array point to are constant. That may be true, but the way it's currently done compiles through without warnings with CONFIG_DEBUG_SECTION_MISMATCH enabled. > = > So you have to use either > = > static const char *axi_parents[] __initdata =3D { This results in: drivers/clk/mediatek/clk-mt8173.c:515:20: error: i2s3_b_ck_parents causes a= section type conflict with infra_clks static const char *i2s3_b_ck_parents[] __initdata =3D { which can be avoided with static const char * const axi_parents[] __initdata > = > or > = > static const char * const axi_parents[] __initconst =3D { Which results in: drivers/clk/mediatek/clk-mt8173.c:568:2: warning: initialization discards '= const' qualifier from pointer target type MUX_GATE(TOP_HDCP_24M_SEL, "hdcp_24m_sel", hdcp_24m_parents, 0x00d0, 16, = 2, 23), With the following patch this can also be resolved. Until this is merged (or I have the OK from Mike to add this in front of this series) I prefer to keep it like it is at the moment. (BTW I compile tested this with ARM multi_v7_defconfig, no additional warnings are introduced with this patch) Sascha -------------------------------8<----------------------------------- >>From 49f76867545d2f402c9684bb26339054b2151977 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 17 Mar 2015 10:43:41 +0100 Subject: [PATCH] clk: make initialization arrays const char * const * Not only the initialization arrays should be const, but also the strings inside the arrays. This allows users to put the parent_name arrays into __initdata or __initconst. Signed-off-by: Sascha Hauer --- drivers/clk/clk-composite.c | 2 +- drivers/clk/clk-mux.c | 4 ++-- include/linux/clk-provider.h | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index 956b7e5..077f4c714 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@ -188,7 +188,7 @@ static void clk_composite_disable(struct clk_hw *hw) } = struct clk *clk_register_composite(struct device *dev, const char *name, - const char **parent_names, int num_parents, + const char * const *parent_names, int num_parents, struct clk_hw *mux_hw, const struct clk_ops *mux_ops, struct clk_hw *rate_hw, const struct clk_ops *rate_ops, struct clk_hw *gate_hw, const struct clk_ops *gate_ops, diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 69a094c..1fa2a8d 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -114,7 +114,7 @@ const struct clk_ops clk_mux_ro_ops =3D { EXPORT_SYMBOL_GPL(clk_mux_ro_ops); = struct clk *clk_register_mux_table(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, u8 clk_mux_flags, u32 *table, spinlock_t *lock) { @@ -166,7 +166,7 @@ struct clk *clk_register_mux_table(struct device *dev, = const char *name, EXPORT_SYMBOL_GPL(clk_register_mux_table); = struct clk *clk_register_mux(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u8 width, u8 clk_mux_flags, spinlock_t *lock) { diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 5591ea7..3bdae71 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -209,7 +209,7 @@ struct clk_ops { struct clk_init_data { const char *name; const struct clk_ops *ops; - const char **parent_names; + const char * const *parent_names; u8 num_parents; unsigned long flags; }; @@ -426,12 +426,12 @@ extern const struct clk_ops clk_mux_ops; extern const struct clk_ops clk_mux_ro_ops; = struct clk *clk_register_mux(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u8 width, u8 clk_mux_flags, spinlock_t *lock); = struct clk *clk_register_mux_table(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, u8 clk_mux_flags, u32 *table, spinlock_t *lock); = @@ -518,7 +518,7 @@ struct clk_composite { }; = struct clk *clk_register_composite(struct device *dev, const char *name, - const char **parent_names, int num_parents, + const char * const *parent_names, int num_parents, struct clk_hw *mux_hw, const struct clk_ops *mux_ops, struct clk_hw *rate_hw, const struct clk_ops *rate_ops, struct clk_hw *gate_hw, const struct clk_ops *gate_ops, -- = 2.1.4 -- = Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | From mboxrd@z Thu Jan 1 00:00:00 1970 From: s.hauer@pengutronix.de (Sascha Hauer) Date: Tue, 17 Mar 2015 10:47:38 +0100 Subject: [PATCH 3/5] clk: mediatek: Add basic clocks for Mediatek MT8135. In-Reply-To: <20150316070339.GA25487@pengutronix.de> References: <1426485311-31428-1-git-send-email-s.hauer@pengutronix.de> <1426485311-31428-4-git-send-email-s.hauer@pengutronix.de> <20150316070339.GA25487@pengutronix.de> Message-ID: <20150317094738.GF4927@pengutronix.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, Mar 16, 2015 at 08:03:39AM +0100, Uwe Kleine-K?nig wrote: > Hello Sascha, > > On Mon, Mar 16, 2015 at 06:55:09AM +0100, Sascha Hauer wrote: > > +static const char *axi_parents[] __initconst = { > > + "clk26m", > > + "syspll_d3", > > + "syspll_d4", > > + "syspll_d6", > > + "univpll_d5", > > + "univpll2_d2", > > + "syspll_d3p5" > > +}; > __initconst should only be used for const data, but this array isn't > const. Only the strings the pointer in this array point to are constant. That may be true, but the way it's currently done compiles through without warnings with CONFIG_DEBUG_SECTION_MISMATCH enabled. > > So you have to use either > > static const char *axi_parents[] __initdata = { This results in: drivers/clk/mediatek/clk-mt8173.c:515:20: error: i2s3_b_ck_parents causes a section type conflict with infra_clks static const char *i2s3_b_ck_parents[] __initdata = { which can be avoided with static const char * const axi_parents[] __initdata > > or > > static const char * const axi_parents[] __initconst = { Which results in: drivers/clk/mediatek/clk-mt8173.c:568:2: warning: initialization discards 'const' qualifier from pointer target type MUX_GATE(TOP_HDCP_24M_SEL, "hdcp_24m_sel", hdcp_24m_parents, 0x00d0, 16, 2, 23), With the following patch this can also be resolved. Until this is merged (or I have the OK from Mike to add this in front of this series) I prefer to keep it like it is at the moment. (BTW I compile tested this with ARM multi_v7_defconfig, no additional warnings are introduced with this patch) Sascha -------------------------------8<----------------------------------- >>From 49f76867545d2f402c9684bb26339054b2151977 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 17 Mar 2015 10:43:41 +0100 Subject: [PATCH] clk: make initialization arrays const char * const * Not only the initialization arrays should be const, but also the strings inside the arrays. This allows users to put the parent_name arrays into __initdata or __initconst. Signed-off-by: Sascha Hauer --- drivers/clk/clk-composite.c | 2 +- drivers/clk/clk-mux.c | 4 ++-- include/linux/clk-provider.h | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index 956b7e5..077f4c714 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@ -188,7 +188,7 @@ static void clk_composite_disable(struct clk_hw *hw) } struct clk *clk_register_composite(struct device *dev, const char *name, - const char **parent_names, int num_parents, + const char * const *parent_names, int num_parents, struct clk_hw *mux_hw, const struct clk_ops *mux_ops, struct clk_hw *rate_hw, const struct clk_ops *rate_ops, struct clk_hw *gate_hw, const struct clk_ops *gate_ops, diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 69a094c..1fa2a8d 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -114,7 +114,7 @@ const struct clk_ops clk_mux_ro_ops = { EXPORT_SYMBOL_GPL(clk_mux_ro_ops); struct clk *clk_register_mux_table(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, u8 clk_mux_flags, u32 *table, spinlock_t *lock) { @@ -166,7 +166,7 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name, EXPORT_SYMBOL_GPL(clk_register_mux_table); struct clk *clk_register_mux(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u8 width, u8 clk_mux_flags, spinlock_t *lock) { diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 5591ea7..3bdae71 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -209,7 +209,7 @@ struct clk_ops { struct clk_init_data { const char *name; const struct clk_ops *ops; - const char **parent_names; + const char * const *parent_names; u8 num_parents; unsigned long flags; }; @@ -426,12 +426,12 @@ extern const struct clk_ops clk_mux_ops; extern const struct clk_ops clk_mux_ro_ops; struct clk *clk_register_mux(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u8 width, u8 clk_mux_flags, spinlock_t *lock); struct clk *clk_register_mux_table(struct device *dev, const char *name, - const char **parent_names, u8 num_parents, unsigned long flags, + const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, u8 clk_mux_flags, u32 *table, spinlock_t *lock); @@ -518,7 +518,7 @@ struct clk_composite { }; struct clk *clk_register_composite(struct device *dev, const char *name, - const char **parent_names, int num_parents, + const char * const *parent_names, int num_parents, struct clk_hw *mux_hw, const struct clk_ops *mux_ops, struct clk_hw *rate_hw, const struct clk_ops *rate_ops, struct clk_hw *gate_hw, const struct clk_ops *gate_ops, -- 2.1.4 -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |