diff mbox series

[1/7] clk: samsung: s3c64xx: Declare s3c64xx_clk_init() in shared header

Message ID 20200729160942.28867-2-krzk@kernel.org (mailing list archive)
State Changes Requested
Headers show
Series ARM: samsung: Cleanup of various S3C bits | expand

Commit Message

Krzysztof Kozlowski July 29, 2020, 4:09 p.m. UTC
The s3c64xx_clk_init() is defined and used by clk-s3c64xx driver and
also used in mach-s3c64xx machine code.  Move the declaration to a
header to fix W=1 build warning:

    drivers/clk/samsung/clk-s3c64xx.c:391:13: warning: no previous prototype for 's3c64xx_clk_init' [-Wmissing-prototypes]
      391 | void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 MAINTAINERS                       |  1 +
 arch/arm/mach-s3c64xx/common.c    |  1 +
 arch/arm/mach-s3c64xx/common.h    |  2 --
 drivers/clk/samsung/clk-s3c64xx.c |  1 +
 include/linux/clk/samsung.h       | 21 +++++++++++++++++++++
 5 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/clk/samsung.h

Comments

Tomasz Figa July 29, 2020, 5:39 p.m. UTC | #1
2020年7月29日(水) 18:11 Krzysztof Kozlowski <krzk@kernel.org>:
>
> The s3c64xx_clk_init() is defined and used by clk-s3c64xx driver and
> also used in mach-s3c64xx machine code.  Move the declaration to a
> header to fix W=1 build warning:
>
>     drivers/clk/samsung/clk-s3c64xx.c:391:13: warning: no previous prototype for 's3c64xx_clk_init' [-Wmissing-prototypes]
>       391 | void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  MAINTAINERS                       |  1 +
>  arch/arm/mach-s3c64xx/common.c    |  1 +
>  arch/arm/mach-s3c64xx/common.h    |  2 --
>  drivers/clk/samsung/clk-s3c64xx.c |  1 +
>  include/linux/clk/samsung.h       | 21 +++++++++++++++++++++
>  5 files changed, 24 insertions(+), 2 deletions(-)
>  create mode 100644 include/linux/clk/samsung.h
>

Reviewed-by: Tomasz Figa <tomasz.figa@gmail.com>

Best regards,
Tomasz
Stephen Boyd July 29, 2020, 7:42 p.m. UTC | #2
Quoting Krzysztof Kozlowski (2020-07-29 09:09:36)
> diff --git a/include/linux/clk/samsung.h b/include/linux/clk/samsung.h
> new file mode 100644
> index 000000000000..b6b253c46c22
> --- /dev/null
> +++ b/include/linux/clk/samsung.h
> @@ -0,0 +1,21 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (c) 2020 Krzysztof Kozlowski <krzk@kernel.org>
> + */
> +
> +#ifndef __LINUX_CLK_SAMSUNG_H_
> +#define __LINUX_CLK_SAMSUNG_H_
> +
> +#ifdef CONFIG_ARCH_S3C64XX
> +void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,

Don't use __init in header files. It doesn't do anything.

> +                            unsigned long xusbxti_f, bool s3c6400,
> +                            void __iomem *base);
> +#else
> +static inline void __init s3c64xx_clk_init(struct device_node *np,

Forward declare struct device_node;

> +                                          unsigned long xtal_f,
> +                                          unsigned long xusbxti_f,
> +                                          bool s3c6400,
> +                                          void __iomem *base) { }

Include <linux/compiler.h> (or compiler_types.h) for __iomem define
please.

> +#endif /* CONFIG_ARCH_S3C64XX */
> +
> +#endif /* __LINUX_CLK_SAMSUNG_H_ */
Krzysztof Kozlowski July 29, 2020, 8:16 p.m. UTC | #3
On Wed, Jul 29, 2020 at 12:42:43PM -0700, Stephen Boyd wrote:
> Quoting Krzysztof Kozlowski (2020-07-29 09:09:36)
> > diff --git a/include/linux/clk/samsung.h b/include/linux/clk/samsung.h
> > new file mode 100644
> > index 000000000000..b6b253c46c22
> > --- /dev/null
> > +++ b/include/linux/clk/samsung.h
> > @@ -0,0 +1,21 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +/*
> > + * Copyright (c) 2020 Krzysztof Kozlowski <krzk@kernel.org>
> > + */
> > +
> > +#ifndef __LINUX_CLK_SAMSUNG_H_
> > +#define __LINUX_CLK_SAMSUNG_H_
> > +
> > +#ifdef CONFIG_ARCH_S3C64XX
> > +void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
> 
> Don't use __init in header files. It doesn't do anything.
> 
> > +                            unsigned long xusbxti_f, bool s3c6400,
> > +                            void __iomem *base);
> > +#else
> > +static inline void __init s3c64xx_clk_init(struct device_node *np,
> 
> Forward declare struct device_node;
> 
> > +                                          unsigned long xtal_f,
> > +                                          unsigned long xusbxti_f,
> > +                                          bool s3c6400,
> > +                                          void __iomem *base) { }
> 
> Include <linux/compiler.h> (or compiler_types.h) for __iomem define
> please.

Thanks for the feedback. I'll send v2.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 7f8c6e41a364..f5d7cf3c3aaa 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15294,6 +15294,7 @@  F:	Documentation/devicetree/bindings/clock/samsung,s3c*
 F:	Documentation/devicetree/bindings/clock/samsung,s5p*
 F:	drivers/clk/samsung/
 F:	include/dt-bindings/clock/exynos*.h
+F:	include/linux/clk/samsung.h
 
 SAMSUNG SPI DRIVERS
 M:	Kukjin Kim <kgene@kernel.org>
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 13e91074308a..a655bf0c7802 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -24,6 +24,7 @@ 
 #include <linux/platform_device.h>
 #include <linux/reboot.h>
 #include <linux/io.h>
+#include <linux/clk/samsung.h>
 #include <linux/dma-mapping.h>
 #include <linux/irq.h>
 #include <linux/gpio.h>
diff --git a/arch/arm/mach-s3c64xx/common.h b/arch/arm/mach-s3c64xx/common.h
index 03670887a764..f4eca42cdc86 100644
--- a/arch/arm/mach-s3c64xx/common.h
+++ b/arch/arm/mach-s3c64xx/common.h
@@ -22,8 +22,6 @@  void s3c64xx_init_io(struct map_desc *mach_desc, int size);
 void s3c64xx_restart(enum reboot_mode mode, const char *cmd);
 
 struct device_node;
-void s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
-	unsigned long xusbxti_f, bool is_s3c6400, void __iomem *reg_base);
 void s3c64xx_set_xtal_freq(unsigned long freq);
 void s3c64xx_set_xusbxti_freq(unsigned long freq);
 
diff --git a/drivers/clk/samsung/clk-s3c64xx.c b/drivers/clk/samsung/clk-s3c64xx.c
index b96d33e5eb45..56f95b63f71f 100644
--- a/drivers/clk/samsung/clk-s3c64xx.c
+++ b/drivers/clk/samsung/clk-s3c64xx.c
@@ -7,6 +7,7 @@ 
 
 #include <linux/slab.h>
 #include <linux/clk-provider.h>
+#include <linux/clk/samsung.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 
diff --git a/include/linux/clk/samsung.h b/include/linux/clk/samsung.h
new file mode 100644
index 000000000000..b6b253c46c22
--- /dev/null
+++ b/include/linux/clk/samsung.h
@@ -0,0 +1,21 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020 Krzysztof Kozlowski <krzk@kernel.org>
+ */
+
+#ifndef __LINUX_CLK_SAMSUNG_H_
+#define __LINUX_CLK_SAMSUNG_H_
+
+#ifdef CONFIG_ARCH_S3C64XX
+void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
+			     unsigned long xusbxti_f, bool s3c6400,
+			     void __iomem *base);
+#else
+static inline void __init s3c64xx_clk_init(struct device_node *np,
+					   unsigned long xtal_f,
+					   unsigned long xusbxti_f,
+					   bool s3c6400,
+					   void __iomem *base) { }
+#endif /* CONFIG_ARCH_S3C64XX */
+
+#endif /* __LINUX_CLK_SAMSUNG_H_ */