2018-08-14 09:18:17

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH] [v2] media: camss: add missing includes

Multiple files in this driver fail to build because of missing
header inclusions:

drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c: In function 'csiphy_hw_version_read':
drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c:31:18: error: implicit declaration of function 'readl_relaxed'; did you mean 'xchg_relaxed'? [-Werror=implicit-function-declaration]
drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c: In function 'csiphy_hw_version_read':
drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c:52:2: error: implicit declaration of function 'writel' [-Werror=implicit-function-declaration]
drivers/media/platform/qcom/camss/camss-ispif.c: In function 'msm_ispif_subdev_init':
drivers/media/platform/qcom/camss/camss-ispif.c:1079:16: error: implicit declaration of function 'kcalloc'; did you mean 'kvcalloc'? [-Werror=implicit-function-declaration]

Add the ones that I observed, plus linux/io.h in all other files that
call readl/writel and related interfaces.

Signed-off-by: Arnd Bergmann <[email protected]>
---
v2: actually add the linux/io.h instances for files that did not show
the error but might still be affected because of the readl/writel usage
---
drivers/media/platform/qcom/camss/camss-csid.c | 1 +
drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c | 1 +
drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 1 +
drivers/media/platform/qcom/camss/camss-csiphy.c | 1 +
drivers/media/platform/qcom/camss/camss-ispif.c | 2 ++
drivers/media/platform/qcom/camss/camss-vfe-4-1.c | 1 +
drivers/media/platform/qcom/camss/camss-vfe-4-7.c | 1 +
7 files changed, 8 insertions(+)

diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
index 729b31891466..a5ae85674ffb 100644
--- a/drivers/media/platform/qcom/camss/camss-csid.c
+++ b/drivers/media/platform/qcom/camss/camss-csid.c
@@ -10,6 +10,7 @@
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/interrupt.h>
+#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/platform_device.h>
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
index c832539397d7..12bce391d71f 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
@@ -12,6 +12,7 @@

#include <linux/delay.h>
#include <linux/interrupt.h>
+#include <linux/io.h>

#define CAMSS_CSI_PHY_LNn_CFG2(n) (0x004 + 0x40 * (n))
#define CAMSS_CSI_PHY_LNn_CFG3(n) (0x008 + 0x40 * (n))
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
index bcd0dfd33618..2e65caf1ecae 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
@@ -12,6 +12,7 @@

#include <linux/delay.h>
#include <linux/interrupt.h>
+#include <linux/io.h>

#define CSIPHY_3PH_LNn_CFG1(n) (0x000 + 0x100 * (n))
#define CSIPHY_3PH_LNn_CFG1_SWI_REC_DLY_PRG (BIT(7) | BIT(6))
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
index 4559f3b1b38c..008afb85023b 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
@@ -10,6 +10,7 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
+#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/platform_device.h>
diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/media/platform/qcom/camss/camss-ispif.c
index 7f269021d08c..d824c4958c07 100644
--- a/drivers/media/platform/qcom/camss/camss-ispif.c
+++ b/drivers/media/platform/qcom/camss/camss-ispif.c
@@ -10,11 +10,13 @@
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/interrupt.h>
+#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/slab.h>
#include <media/media-entity.h>
#include <media/v4l2-device.h>
#include <media/v4l2-subdev.h>
diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c b/drivers/media/platform/qcom/camss/camss-vfe-4-1.c
index da3a9fed9f2d..174a36be6f5d 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-4-1.c
@@ -9,6 +9,7 @@
*/

#include <linux/interrupt.h>
+#include <linux/io.h>
#include <linux/iopoll.h>

#include "camss-vfe.h"
diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c
index 4c584bffd179..0dca8bf9281e 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c
@@ -9,6 +9,7 @@
*/

#include <linux/interrupt.h>
+#include <linux/io.h>
#include <linux/iopoll.h>

#include "camss-vfe.h"
--
2.18.0



2018-08-14 12:46:48

by Todor Tomov

[permalink] [raw]
Subject: Re: [PATCH] [v2] media: camss: add missing includes

Hi Arnd,

On 14.08.2018 12:13, Arnd Bergmann wrote:
> Multiple files in this driver fail to build because of missing
> header inclusions:
>
> drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c: In function 'csiphy_hw_version_read':
> drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c:31:18: error: implicit declaration of function 'readl_relaxed'; did you mean 'xchg_relaxed'? [-Werror=implicit-function-declaration]
> drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c: In function 'csiphy_hw_version_read':
> drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c:52:2: error: implicit declaration of function 'writel' [-Werror=implicit-function-declaration]

Thank you for noticing this and preparing a patch.
I build for arm64 and x86_64 with compile test enabled and I don't see these errors. Do you have a guess what is different that I don't have them?

> drivers/media/platform/qcom/camss/camss-ispif.c: In function 'msm_ispif_subdev_init':
> drivers/media/platform/qcom/camss/camss-ispif.c:1079:16: error: implicit declaration of function 'kcalloc'; did you mean 'kvcalloc'? [-Werror=implicit-function-declaration]

Maybe we have to use devm_kcalloc instead of kcalloc here, I will check this.

Best regards,
Todor

>
> Add the ones that I observed, plus linux/io.h in all other files that
> call readl/writel and related interfaces.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> ---
> v2: actually add the linux/io.h instances for files that did not show
> the error but might still be affected because of the readl/writel usage
> ---
> drivers/media/platform/qcom/camss/camss-csid.c | 1 +
> drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c | 1 +
> drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 1 +
> drivers/media/platform/qcom/camss/camss-csiphy.c | 1 +
> drivers/media/platform/qcom/camss/camss-ispif.c | 2 ++
> drivers/media/platform/qcom/camss/camss-vfe-4-1.c | 1 +
> drivers/media/platform/qcom/camss/camss-vfe-4-7.c | 1 +
> 7 files changed, 8 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
> index 729b31891466..a5ae85674ffb 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid.c
> @@ -10,6 +10,7 @@
> #include <linux/clk.h>
> #include <linux/completion.h>
> #include <linux/interrupt.h>
> +#include <linux/io.h>
> #include <linux/kernel.h>
> #include <linux/of.h>
> #include <linux/platform_device.h>
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
> index c832539397d7..12bce391d71f 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
> @@ -12,6 +12,7 @@
>
> #include <linux/delay.h>
> #include <linux/interrupt.h>
> +#include <linux/io.h>
>
> #define CAMSS_CSI_PHY_LNn_CFG2(n) (0x004 + 0x40 * (n))
> #define CAMSS_CSI_PHY_LNn_CFG3(n) (0x008 + 0x40 * (n))
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> index bcd0dfd33618..2e65caf1ecae 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> @@ -12,6 +12,7 @@
>
> #include <linux/delay.h>
> #include <linux/interrupt.h>
> +#include <linux/io.h>
>
> #define CSIPHY_3PH_LNn_CFG1(n) (0x000 + 0x100 * (n))
> #define CSIPHY_3PH_LNn_CFG1_SWI_REC_DLY_PRG (BIT(7) | BIT(6))
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
> index 4559f3b1b38c..008afb85023b 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
> @@ -10,6 +10,7 @@
> #include <linux/clk.h>
> #include <linux/delay.h>
> #include <linux/interrupt.h>
> +#include <linux/io.h>
> #include <linux/kernel.h>
> #include <linux/of.h>
> #include <linux/platform_device.h>
> diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/media/platform/qcom/camss/camss-ispif.c
> index 7f269021d08c..d824c4958c07 100644
> --- a/drivers/media/platform/qcom/camss/camss-ispif.c
> +++ b/drivers/media/platform/qcom/camss/camss-ispif.c
> @@ -10,11 +10,13 @@
> #include <linux/clk.h>
> #include <linux/completion.h>
> #include <linux/interrupt.h>
> +#include <linux/io.h>
> #include <linux/iopoll.h>
> #include <linux/kernel.h>
> #include <linux/mutex.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> +#include <linux/slab.h>
> #include <media/media-entity.h>
> #include <media/v4l2-device.h>
> #include <media/v4l2-subdev.h>
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c b/drivers/media/platform/qcom/camss/camss-vfe-4-1.c
> index da3a9fed9f2d..174a36be6f5d 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-1.c
> @@ -9,6 +9,7 @@
> */
>
> #include <linux/interrupt.h>
> +#include <linux/io.h>
> #include <linux/iopoll.h>
>
> #include "camss-vfe.h"
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c
> index 4c584bffd179..0dca8bf9281e 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c
> @@ -9,6 +9,7 @@
> */
>
> #include <linux/interrupt.h>
> +#include <linux/io.h>
> #include <linux/iopoll.h>
>
> #include "camss-vfe.h"
>

--
Best regards,
Todor Tomov

2018-08-14 13:04:39

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] [v2] media: camss: add missing includes

On Tue, Aug 14, 2018 at 2:45 PM Todor Tomov <[email protected]> wrote:
>
> Hi Arnd,
>
> On 14.08.2018 12:13, Arnd Bergmann wrote:
> > Multiple files in this driver fail to build because of missing
> > header inclusions:
> >
> > drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c: In function 'csiphy_hw_version_read':
> > drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c:31:18: error: implicit declaration of function 'readl_relaxed'; did you mean 'xchg_relaxed'? [-Werror=implicit-function-declaration]
> > drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c: In function 'csiphy_hw_version_read':
> > drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c:52:2: error: implicit declaration of function 'writel' [-Werror=implicit-function-declaration]
>
> Thank you for noticing this and preparing a patch.
> I build for arm64 and x86_64 with compile test enabled and I don't see these errors. Do you have a guess what is different that I don't have them?

I try lots of randconfig builds, and only one of them hit this, so
it's surely some
header that may or may not include io.h and slab.h depending on the
configuration,
or based on some other changes in linux-next.

Since the solution seemed obvious, I did not investigate further.

If you want to try reproducing the problem, see the arm64 config file
at https://pastebin.com/raw/bNTPvYfZ

Arnd

2018-08-14 16:34:01

by Todor Tomov

[permalink] [raw]
Subject: Re: [PATCH] [v2] media: camss: add missing includes

Hi Arnd,

On 14.08.2018 15:58, Arnd Bergmann wrote:
> On Tue, Aug 14, 2018 at 2:45 PM Todor Tomov <[email protected]> wrote:
>>
>> Hi Arnd,
>>
>> On 14.08.2018 12:13, Arnd Bergmann wrote:
>>> Multiple files in this driver fail to build because of missing
>>> header inclusions:
>>>
>>> drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c: In function 'csiphy_hw_version_read':
>>> drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c:31:18: error: implicit declaration of function 'readl_relaxed'; did you mean 'xchg_relaxed'? [-Werror=implicit-function-declaration]
>>> drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c: In function 'csiphy_hw_version_read':
>>> drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c:52:2: error: implicit declaration of function 'writel' [-Werror=implicit-function-declaration]
>>
>> Thank you for noticing this and preparing a patch.
>> I build for arm64 and x86_64 with compile test enabled and I don't see these errors. Do you have a guess what is different that I don't have them?
>
> I try lots of randconfig builds, and only one of them hit this, so
> it's surely some
> header that may or may not include io.h and slab.h depending on the
> configuration,
> or based on some other changes in linux-next.
>
> Since the solution seemed obvious, I did not investigate further.
>
> If you want to try reproducing the problem, see the arm64 config file
> at https://pastebin.com/raw/bNTPvYfZ

Thank you, I was able to reproduce it.

I have sent another patch which changes kcalloc to devm_kcalloc so the
hunk including slab.h is not needed anymore. For the rest of the patch
you can have my:
Acked-by: Todor Tomov <[email protected]>


--
Best regards,
Todor Tomov