Re: [PATCH v2] ARM: omap2: Fix build when using split object directories

2018-04-13 Thread Dave Gerlach
On 04/12/2018 10:24 PM, Masahiro Yamada wrote:
> 2018-04-13 11:58 GMT+09:00 Dave Gerlach :
>> The sleep33xx and sleep43xx files should not depend on a header file
>> generated in drivers/memory. Remove this dependency and instead allow
>> both drivers/memory and arch/arm/mach-omap2 to generate all macros
>> needed in headers local to their own paths.
>>
>> This fixes an issue where the build fail will when using O= to set a
>> split object directory and arch/arm/mach-omap2 is built before
>> drivers/memory with the following error:
>>
>> .../drivers/memory/emif-asm-offsets.c:1:0: fatal error: can't open 
>> drivers/memory/emif-asm-offsets.s for writing: No such file or directory
>> compilation terminated.
>>
>> Fixes: 41d9d44d7258 ("ARM: OMAP2+: pm33xx-core: Add platform code needed for 
>> PM")
>> Acked-by: Tony Lindgren 
>> Reviewed-by: Masahiro Yamada 
>> Tested-by: Anders Roxell 
>> Signed-off-by: Dave Gerlach 
>> ---
>> v1 -> v2:
>>  * Removed drivers/memory/Makefile.asm-offsets and consolidated into
>>drivers/memory/Makefile.
> 
> 
> 
> I did not mean like this.
> 
> I thought this clean-up would be done in a separate patch.
> 
> I think your previous patch is OK as-is.
> 

Ok sorry for the confusion let's forget this version then.

Regards,
Dave

> 
> 
> 
> 
>>  arch/arm/mach-omap2/Makefile |  6 +--
>>  arch/arm/mach-omap2/pm-asm-offsets.c |  3 ++
>>  arch/arm/mach-omap2/sleep33xx.S  |  1 -
>>  arch/arm/mach-omap2/sleep43xx.S  |  1 -
>>  drivers/memory/Makefile  |  8 +++-
>>  drivers/memory/Makefile.asm-offsets  |  5 ---
>>  drivers/memory/emif-asm-offsets.c| 72 +-
>>  include/linux/ti-emif-sram.h | 75 
>> 
>>  8 files changed, 86 insertions(+), 85 deletions(-)
>>  delete mode 100644 drivers/memory/Makefile.asm-offsets
>>
>> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
>> index 4603c30fef73..0d9ce58bc464 100644
>> --- a/arch/arm/mach-omap2/Makefile
>> +++ b/arch/arm/mach-omap2/Makefile
>> @@ -243,8 +243,4 @@ arch/arm/mach-omap2/pm-asm-offsets.s: 
>> arch/arm/mach-omap2/pm-asm-offsets.c
>>  include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s 
>> FORCE
>> $(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__)
>>
>> -# For rule to generate ti-emif-asm-offsets.h dependency
>> -include drivers/memory/Makefile.asm-offsets
>> -
>> -arch/arm/mach-omap2/sleep33xx.o: include/generated/ti-pm-asm-offsets.h 
>> include/generated/ti-emif-asm-offsets.h
>> -arch/arm/mach-omap2/sleep43xx.o: include/generated/ti-pm-asm-offsets.h 
>> include/generated/ti-emif-asm-offsets.h
>> +$(obj)/sleep33xx.o $(obj)/sleep43xx.o: include/generated/ti-pm-asm-offsets.h
>> diff --git a/arch/arm/mach-omap2/pm-asm-offsets.c 
>> b/arch/arm/mach-omap2/pm-asm-offsets.c
>> index 6d4392da7c11..b9846b19e5e2 100644
>> --- a/arch/arm/mach-omap2/pm-asm-offsets.c
>> +++ b/arch/arm/mach-omap2/pm-asm-offsets.c
>> @@ -7,9 +7,12 @@
>>
>>  #include 
>>  #include 
>> +#include 
>>
>>  int main(void)
>>  {
>> +   ti_emif_asm_offsets();
>> +
>> DEFINE(AMX3_PM_WFI_FLAGS_OFFSET,
>>offsetof(struct am33xx_pm_sram_data, wfi_flags));
>> DEFINE(AMX3_PM_L2_AUX_CTRL_VAL_OFFSET,
>> diff --git a/arch/arm/mach-omap2/sleep33xx.S 
>> b/arch/arm/mach-omap2/sleep33xx.S
>> index 218d79930b04..322b3bb868b4 100644
>> --- a/arch/arm/mach-omap2/sleep33xx.S
>> +++ b/arch/arm/mach-omap2/sleep33xx.S
>> @@ -6,7 +6,6 @@
>>   * Dave Gerlach, Vaibhav Bedia
>>   */
>>
>> -#include 
>>  #include 
>>  #include 
>>  #include 
>> diff --git a/arch/arm/mach-omap2/sleep43xx.S 
>> b/arch/arm/mach-omap2/sleep43xx.S
>> index b24be624e8b9..8903814a6677 100644
>> --- a/arch/arm/mach-omap2/sleep43xx.S
>> +++ b/arch/arm/mach-omap2/sleep43xx.S
>> @@ -6,7 +6,6 @@
>>   * Dave Gerlach, Vaibhav Bedia
>>   */
>>
>> -#include 
>>  #include 
>>  #include 
>>  #include 
>> diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
>> index 66f55240830e..b3b95380346f 100644
>> --- a/drivers/memory/Makefile
>> +++ b/drivers/memory/Makefile
>> @@ -28,6 +28,10 @@ ti-emif-sram-objs:= ti-emif-pm.o 
>> ti-emif-sram-pm.o
>>
>>  AFLAGS_ti-emif-sram-pm.o   :=-Wa,-march=armv7-a
>>
>> -include drivers/memory/Makefile.asm-offsets
>> +drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c
>> +   $(call if_changed_dep,cc_s_c)
>>
>> -drivers/memory/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
>> +include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s 
>> FORCE
>> +   $(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
>> +
>> +$(obj)/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
>> diff --git a/drivers/memory/Makefile.asm-offsets 
>> b/drivers/memory/Makefile.asm-offsets
>> deleted file mode 100644
>> index 

Re: [PATCH v2] ARM: omap2: Fix build when using split object directories

2018-04-13 Thread Dave Gerlach
On 04/12/2018 10:24 PM, Masahiro Yamada wrote:
> 2018-04-13 11:58 GMT+09:00 Dave Gerlach :
>> The sleep33xx and sleep43xx files should not depend on a header file
>> generated in drivers/memory. Remove this dependency and instead allow
>> both drivers/memory and arch/arm/mach-omap2 to generate all macros
>> needed in headers local to their own paths.
>>
>> This fixes an issue where the build fail will when using O= to set a
>> split object directory and arch/arm/mach-omap2 is built before
>> drivers/memory with the following error:
>>
>> .../drivers/memory/emif-asm-offsets.c:1:0: fatal error: can't open 
>> drivers/memory/emif-asm-offsets.s for writing: No such file or directory
>> compilation terminated.
>>
>> Fixes: 41d9d44d7258 ("ARM: OMAP2+: pm33xx-core: Add platform code needed for 
>> PM")
>> Acked-by: Tony Lindgren 
>> Reviewed-by: Masahiro Yamada 
>> Tested-by: Anders Roxell 
>> Signed-off-by: Dave Gerlach 
>> ---
>> v1 -> v2:
>>  * Removed drivers/memory/Makefile.asm-offsets and consolidated into
>>drivers/memory/Makefile.
> 
> 
> 
> I did not mean like this.
> 
> I thought this clean-up would be done in a separate patch.
> 
> I think your previous patch is OK as-is.
> 

Ok sorry for the confusion let's forget this version then.

Regards,
Dave

> 
> 
> 
> 
>>  arch/arm/mach-omap2/Makefile |  6 +--
>>  arch/arm/mach-omap2/pm-asm-offsets.c |  3 ++
>>  arch/arm/mach-omap2/sleep33xx.S  |  1 -
>>  arch/arm/mach-omap2/sleep43xx.S  |  1 -
>>  drivers/memory/Makefile  |  8 +++-
>>  drivers/memory/Makefile.asm-offsets  |  5 ---
>>  drivers/memory/emif-asm-offsets.c| 72 +-
>>  include/linux/ti-emif-sram.h | 75 
>> 
>>  8 files changed, 86 insertions(+), 85 deletions(-)
>>  delete mode 100644 drivers/memory/Makefile.asm-offsets
>>
>> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
>> index 4603c30fef73..0d9ce58bc464 100644
>> --- a/arch/arm/mach-omap2/Makefile
>> +++ b/arch/arm/mach-omap2/Makefile
>> @@ -243,8 +243,4 @@ arch/arm/mach-omap2/pm-asm-offsets.s: 
>> arch/arm/mach-omap2/pm-asm-offsets.c
>>  include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s 
>> FORCE
>> $(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__)
>>
>> -# For rule to generate ti-emif-asm-offsets.h dependency
>> -include drivers/memory/Makefile.asm-offsets
>> -
>> -arch/arm/mach-omap2/sleep33xx.o: include/generated/ti-pm-asm-offsets.h 
>> include/generated/ti-emif-asm-offsets.h
>> -arch/arm/mach-omap2/sleep43xx.o: include/generated/ti-pm-asm-offsets.h 
>> include/generated/ti-emif-asm-offsets.h
>> +$(obj)/sleep33xx.o $(obj)/sleep43xx.o: include/generated/ti-pm-asm-offsets.h
>> diff --git a/arch/arm/mach-omap2/pm-asm-offsets.c 
>> b/arch/arm/mach-omap2/pm-asm-offsets.c
>> index 6d4392da7c11..b9846b19e5e2 100644
>> --- a/arch/arm/mach-omap2/pm-asm-offsets.c
>> +++ b/arch/arm/mach-omap2/pm-asm-offsets.c
>> @@ -7,9 +7,12 @@
>>
>>  #include 
>>  #include 
>> +#include 
>>
>>  int main(void)
>>  {
>> +   ti_emif_asm_offsets();
>> +
>> DEFINE(AMX3_PM_WFI_FLAGS_OFFSET,
>>offsetof(struct am33xx_pm_sram_data, wfi_flags));
>> DEFINE(AMX3_PM_L2_AUX_CTRL_VAL_OFFSET,
>> diff --git a/arch/arm/mach-omap2/sleep33xx.S 
>> b/arch/arm/mach-omap2/sleep33xx.S
>> index 218d79930b04..322b3bb868b4 100644
>> --- a/arch/arm/mach-omap2/sleep33xx.S
>> +++ b/arch/arm/mach-omap2/sleep33xx.S
>> @@ -6,7 +6,6 @@
>>   * Dave Gerlach, Vaibhav Bedia
>>   */
>>
>> -#include 
>>  #include 
>>  #include 
>>  #include 
>> diff --git a/arch/arm/mach-omap2/sleep43xx.S 
>> b/arch/arm/mach-omap2/sleep43xx.S
>> index b24be624e8b9..8903814a6677 100644
>> --- a/arch/arm/mach-omap2/sleep43xx.S
>> +++ b/arch/arm/mach-omap2/sleep43xx.S
>> @@ -6,7 +6,6 @@
>>   * Dave Gerlach, Vaibhav Bedia
>>   */
>>
>> -#include 
>>  #include 
>>  #include 
>>  #include 
>> diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
>> index 66f55240830e..b3b95380346f 100644
>> --- a/drivers/memory/Makefile
>> +++ b/drivers/memory/Makefile
>> @@ -28,6 +28,10 @@ ti-emif-sram-objs:= ti-emif-pm.o 
>> ti-emif-sram-pm.o
>>
>>  AFLAGS_ti-emif-sram-pm.o   :=-Wa,-march=armv7-a
>>
>> -include drivers/memory/Makefile.asm-offsets
>> +drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c
>> +   $(call if_changed_dep,cc_s_c)
>>
>> -drivers/memory/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
>> +include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s 
>> FORCE
>> +   $(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
>> +
>> +$(obj)/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
>> diff --git a/drivers/memory/Makefile.asm-offsets 
>> b/drivers/memory/Makefile.asm-offsets
>> deleted file mode 100644
>> index 843ff60ccb5a..
>> --- a/drivers/memory/Makefile.asm-offsets
>> +++ /dev/null
>> @@ -1,5 +0,0 @@
>> 

Re: [PATCH v2] ARM: omap2: Fix build when using split object directories

2018-04-12 Thread Masahiro Yamada
2018-04-13 11:58 GMT+09:00 Dave Gerlach :
> The sleep33xx and sleep43xx files should not depend on a header file
> generated in drivers/memory. Remove this dependency and instead allow
> both drivers/memory and arch/arm/mach-omap2 to generate all macros
> needed in headers local to their own paths.
>
> This fixes an issue where the build fail will when using O= to set a
> split object directory and arch/arm/mach-omap2 is built before
> drivers/memory with the following error:
>
> .../drivers/memory/emif-asm-offsets.c:1:0: fatal error: can't open 
> drivers/memory/emif-asm-offsets.s for writing: No such file or directory
> compilation terminated.
>
> Fixes: 41d9d44d7258 ("ARM: OMAP2+: pm33xx-core: Add platform code needed for 
> PM")
> Acked-by: Tony Lindgren 
> Reviewed-by: Masahiro Yamada 
> Tested-by: Anders Roxell 
> Signed-off-by: Dave Gerlach 
> ---
> v1 -> v2:
>  * Removed drivers/memory/Makefile.asm-offsets and consolidated into
>drivers/memory/Makefile.



I did not mean like this.

I thought this clean-up would be done in a separate patch.

I think your previous patch is OK as-is.





>  arch/arm/mach-omap2/Makefile |  6 +--
>  arch/arm/mach-omap2/pm-asm-offsets.c |  3 ++
>  arch/arm/mach-omap2/sleep33xx.S  |  1 -
>  arch/arm/mach-omap2/sleep43xx.S  |  1 -
>  drivers/memory/Makefile  |  8 +++-
>  drivers/memory/Makefile.asm-offsets  |  5 ---
>  drivers/memory/emif-asm-offsets.c| 72 +-
>  include/linux/ti-emif-sram.h | 75 
> 
>  8 files changed, 86 insertions(+), 85 deletions(-)
>  delete mode 100644 drivers/memory/Makefile.asm-offsets
>
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index 4603c30fef73..0d9ce58bc464 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -243,8 +243,4 @@ arch/arm/mach-omap2/pm-asm-offsets.s: 
> arch/arm/mach-omap2/pm-asm-offsets.c
>  include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s 
> FORCE
> $(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__)
>
> -# For rule to generate ti-emif-asm-offsets.h dependency
> -include drivers/memory/Makefile.asm-offsets
> -
> -arch/arm/mach-omap2/sleep33xx.o: include/generated/ti-pm-asm-offsets.h 
> include/generated/ti-emif-asm-offsets.h
> -arch/arm/mach-omap2/sleep43xx.o: include/generated/ti-pm-asm-offsets.h 
> include/generated/ti-emif-asm-offsets.h
> +$(obj)/sleep33xx.o $(obj)/sleep43xx.o: include/generated/ti-pm-asm-offsets.h
> diff --git a/arch/arm/mach-omap2/pm-asm-offsets.c 
> b/arch/arm/mach-omap2/pm-asm-offsets.c
> index 6d4392da7c11..b9846b19e5e2 100644
> --- a/arch/arm/mach-omap2/pm-asm-offsets.c
> +++ b/arch/arm/mach-omap2/pm-asm-offsets.c
> @@ -7,9 +7,12 @@
>
>  #include 
>  #include 
> +#include 
>
>  int main(void)
>  {
> +   ti_emif_asm_offsets();
> +
> DEFINE(AMX3_PM_WFI_FLAGS_OFFSET,
>offsetof(struct am33xx_pm_sram_data, wfi_flags));
> DEFINE(AMX3_PM_L2_AUX_CTRL_VAL_OFFSET,
> diff --git a/arch/arm/mach-omap2/sleep33xx.S b/arch/arm/mach-omap2/sleep33xx.S
> index 218d79930b04..322b3bb868b4 100644
> --- a/arch/arm/mach-omap2/sleep33xx.S
> +++ b/arch/arm/mach-omap2/sleep33xx.S
> @@ -6,7 +6,6 @@
>   * Dave Gerlach, Vaibhav Bedia
>   */
>
> -#include 
>  #include 
>  #include 
>  #include 
> diff --git a/arch/arm/mach-omap2/sleep43xx.S b/arch/arm/mach-omap2/sleep43xx.S
> index b24be624e8b9..8903814a6677 100644
> --- a/arch/arm/mach-omap2/sleep43xx.S
> +++ b/arch/arm/mach-omap2/sleep43xx.S
> @@ -6,7 +6,6 @@
>   * Dave Gerlach, Vaibhav Bedia
>   */
>
> -#include 
>  #include 
>  #include 
>  #include 
> diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
> index 66f55240830e..b3b95380346f 100644
> --- a/drivers/memory/Makefile
> +++ b/drivers/memory/Makefile
> @@ -28,6 +28,10 @@ ti-emif-sram-objs:= ti-emif-pm.o 
> ti-emif-sram-pm.o
>
>  AFLAGS_ti-emif-sram-pm.o   :=-Wa,-march=armv7-a
>
> -include drivers/memory/Makefile.asm-offsets
> +drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c
> +   $(call if_changed_dep,cc_s_c)
>
> -drivers/memory/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
> +include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s 
> FORCE
> +   $(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
> +
> +$(obj)/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
> diff --git a/drivers/memory/Makefile.asm-offsets 
> b/drivers/memory/Makefile.asm-offsets
> deleted file mode 100644
> index 843ff60ccb5a..
> --- a/drivers/memory/Makefile.asm-offsets
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c
> -   $(call if_changed_dep,cc_s_c)
> -
> -include/generated/ti-emif-asm-offsets.h: 

Re: [PATCH v2] ARM: omap2: Fix build when using split object directories

2018-04-12 Thread Masahiro Yamada
2018-04-13 11:58 GMT+09:00 Dave Gerlach :
> The sleep33xx and sleep43xx files should not depend on a header file
> generated in drivers/memory. Remove this dependency and instead allow
> both drivers/memory and arch/arm/mach-omap2 to generate all macros
> needed in headers local to their own paths.
>
> This fixes an issue where the build fail will when using O= to set a
> split object directory and arch/arm/mach-omap2 is built before
> drivers/memory with the following error:
>
> .../drivers/memory/emif-asm-offsets.c:1:0: fatal error: can't open 
> drivers/memory/emif-asm-offsets.s for writing: No such file or directory
> compilation terminated.
>
> Fixes: 41d9d44d7258 ("ARM: OMAP2+: pm33xx-core: Add platform code needed for 
> PM")
> Acked-by: Tony Lindgren 
> Reviewed-by: Masahiro Yamada 
> Tested-by: Anders Roxell 
> Signed-off-by: Dave Gerlach 
> ---
> v1 -> v2:
>  * Removed drivers/memory/Makefile.asm-offsets and consolidated into
>drivers/memory/Makefile.



I did not mean like this.

I thought this clean-up would be done in a separate patch.

I think your previous patch is OK as-is.





>  arch/arm/mach-omap2/Makefile |  6 +--
>  arch/arm/mach-omap2/pm-asm-offsets.c |  3 ++
>  arch/arm/mach-omap2/sleep33xx.S  |  1 -
>  arch/arm/mach-omap2/sleep43xx.S  |  1 -
>  drivers/memory/Makefile  |  8 +++-
>  drivers/memory/Makefile.asm-offsets  |  5 ---
>  drivers/memory/emif-asm-offsets.c| 72 +-
>  include/linux/ti-emif-sram.h | 75 
> 
>  8 files changed, 86 insertions(+), 85 deletions(-)
>  delete mode 100644 drivers/memory/Makefile.asm-offsets
>
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index 4603c30fef73..0d9ce58bc464 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -243,8 +243,4 @@ arch/arm/mach-omap2/pm-asm-offsets.s: 
> arch/arm/mach-omap2/pm-asm-offsets.c
>  include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s 
> FORCE
> $(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__)
>
> -# For rule to generate ti-emif-asm-offsets.h dependency
> -include drivers/memory/Makefile.asm-offsets
> -
> -arch/arm/mach-omap2/sleep33xx.o: include/generated/ti-pm-asm-offsets.h 
> include/generated/ti-emif-asm-offsets.h
> -arch/arm/mach-omap2/sleep43xx.o: include/generated/ti-pm-asm-offsets.h 
> include/generated/ti-emif-asm-offsets.h
> +$(obj)/sleep33xx.o $(obj)/sleep43xx.o: include/generated/ti-pm-asm-offsets.h
> diff --git a/arch/arm/mach-omap2/pm-asm-offsets.c 
> b/arch/arm/mach-omap2/pm-asm-offsets.c
> index 6d4392da7c11..b9846b19e5e2 100644
> --- a/arch/arm/mach-omap2/pm-asm-offsets.c
> +++ b/arch/arm/mach-omap2/pm-asm-offsets.c
> @@ -7,9 +7,12 @@
>
>  #include 
>  #include 
> +#include 
>
>  int main(void)
>  {
> +   ti_emif_asm_offsets();
> +
> DEFINE(AMX3_PM_WFI_FLAGS_OFFSET,
>offsetof(struct am33xx_pm_sram_data, wfi_flags));
> DEFINE(AMX3_PM_L2_AUX_CTRL_VAL_OFFSET,
> diff --git a/arch/arm/mach-omap2/sleep33xx.S b/arch/arm/mach-omap2/sleep33xx.S
> index 218d79930b04..322b3bb868b4 100644
> --- a/arch/arm/mach-omap2/sleep33xx.S
> +++ b/arch/arm/mach-omap2/sleep33xx.S
> @@ -6,7 +6,6 @@
>   * Dave Gerlach, Vaibhav Bedia
>   */
>
> -#include 
>  #include 
>  #include 
>  #include 
> diff --git a/arch/arm/mach-omap2/sleep43xx.S b/arch/arm/mach-omap2/sleep43xx.S
> index b24be624e8b9..8903814a6677 100644
> --- a/arch/arm/mach-omap2/sleep43xx.S
> +++ b/arch/arm/mach-omap2/sleep43xx.S
> @@ -6,7 +6,6 @@
>   * Dave Gerlach, Vaibhav Bedia
>   */
>
> -#include 
>  #include 
>  #include 
>  #include 
> diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
> index 66f55240830e..b3b95380346f 100644
> --- a/drivers/memory/Makefile
> +++ b/drivers/memory/Makefile
> @@ -28,6 +28,10 @@ ti-emif-sram-objs:= ti-emif-pm.o 
> ti-emif-sram-pm.o
>
>  AFLAGS_ti-emif-sram-pm.o   :=-Wa,-march=armv7-a
>
> -include drivers/memory/Makefile.asm-offsets
> +drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c
> +   $(call if_changed_dep,cc_s_c)
>
> -drivers/memory/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
> +include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s 
> FORCE
> +   $(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
> +
> +$(obj)/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
> diff --git a/drivers/memory/Makefile.asm-offsets 
> b/drivers/memory/Makefile.asm-offsets
> deleted file mode 100644
> index 843ff60ccb5a..
> --- a/drivers/memory/Makefile.asm-offsets
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c
> -   $(call if_changed_dep,cc_s_c)
> -
> -include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s 
> FORCE
> -   $(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
> diff --git 

[PATCH v2] ARM: omap2: Fix build when using split object directories

2018-04-12 Thread Dave Gerlach
The sleep33xx and sleep43xx files should not depend on a header file
generated in drivers/memory. Remove this dependency and instead allow
both drivers/memory and arch/arm/mach-omap2 to generate all macros
needed in headers local to their own paths.

This fixes an issue where the build fail will when using O= to set a
split object directory and arch/arm/mach-omap2 is built before
drivers/memory with the following error:

.../drivers/memory/emif-asm-offsets.c:1:0: fatal error: can't open 
drivers/memory/emif-asm-offsets.s for writing: No such file or directory
compilation terminated.

Fixes: 41d9d44d7258 ("ARM: OMAP2+: pm33xx-core: Add platform code needed for 
PM")
Acked-by: Tony Lindgren 
Reviewed-by: Masahiro Yamada 
Tested-by: Anders Roxell 
Signed-off-by: Dave Gerlach 
---
v1 -> v2:
 * Removed drivers/memory/Makefile.asm-offsets and consolidated into
   drivers/memory/Makefile.

 arch/arm/mach-omap2/Makefile |  6 +--
 arch/arm/mach-omap2/pm-asm-offsets.c |  3 ++
 arch/arm/mach-omap2/sleep33xx.S  |  1 -
 arch/arm/mach-omap2/sleep43xx.S  |  1 -
 drivers/memory/Makefile  |  8 +++-
 drivers/memory/Makefile.asm-offsets  |  5 ---
 drivers/memory/emif-asm-offsets.c| 72 +-
 include/linux/ti-emif-sram.h | 75 
 8 files changed, 86 insertions(+), 85 deletions(-)
 delete mode 100644 drivers/memory/Makefile.asm-offsets

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 4603c30fef73..0d9ce58bc464 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -243,8 +243,4 @@ arch/arm/mach-omap2/pm-asm-offsets.s: 
arch/arm/mach-omap2/pm-asm-offsets.c
 include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s 
FORCE
$(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__)
 
-# For rule to generate ti-emif-asm-offsets.h dependency
-include drivers/memory/Makefile.asm-offsets
-
-arch/arm/mach-omap2/sleep33xx.o: include/generated/ti-pm-asm-offsets.h 
include/generated/ti-emif-asm-offsets.h
-arch/arm/mach-omap2/sleep43xx.o: include/generated/ti-pm-asm-offsets.h 
include/generated/ti-emif-asm-offsets.h
+$(obj)/sleep33xx.o $(obj)/sleep43xx.o: include/generated/ti-pm-asm-offsets.h
diff --git a/arch/arm/mach-omap2/pm-asm-offsets.c 
b/arch/arm/mach-omap2/pm-asm-offsets.c
index 6d4392da7c11..b9846b19e5e2 100644
--- a/arch/arm/mach-omap2/pm-asm-offsets.c
+++ b/arch/arm/mach-omap2/pm-asm-offsets.c
@@ -7,9 +7,12 @@
 
 #include 
 #include 
+#include 
 
 int main(void)
 {
+   ti_emif_asm_offsets();
+
DEFINE(AMX3_PM_WFI_FLAGS_OFFSET,
   offsetof(struct am33xx_pm_sram_data, wfi_flags));
DEFINE(AMX3_PM_L2_AUX_CTRL_VAL_OFFSET,
diff --git a/arch/arm/mach-omap2/sleep33xx.S b/arch/arm/mach-omap2/sleep33xx.S
index 218d79930b04..322b3bb868b4 100644
--- a/arch/arm/mach-omap2/sleep33xx.S
+++ b/arch/arm/mach-omap2/sleep33xx.S
@@ -6,7 +6,6 @@
  * Dave Gerlach, Vaibhav Bedia
  */
 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-omap2/sleep43xx.S b/arch/arm/mach-omap2/sleep43xx.S
index b24be624e8b9..8903814a6677 100644
--- a/arch/arm/mach-omap2/sleep43xx.S
+++ b/arch/arm/mach-omap2/sleep43xx.S
@@ -6,7 +6,6 @@
  * Dave Gerlach, Vaibhav Bedia
  */
 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
index 66f55240830e..b3b95380346f 100644
--- a/drivers/memory/Makefile
+++ b/drivers/memory/Makefile
@@ -28,6 +28,10 @@ ti-emif-sram-objs:= ti-emif-pm.o 
ti-emif-sram-pm.o
 
 AFLAGS_ti-emif-sram-pm.o   :=-Wa,-march=armv7-a
 
-include drivers/memory/Makefile.asm-offsets
+drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c
+   $(call if_changed_dep,cc_s_c)
 
-drivers/memory/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
+include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s 
FORCE
+   $(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
+
+$(obj)/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
diff --git a/drivers/memory/Makefile.asm-offsets 
b/drivers/memory/Makefile.asm-offsets
deleted file mode 100644
index 843ff60ccb5a..
--- a/drivers/memory/Makefile.asm-offsets
+++ /dev/null
@@ -1,5 +0,0 @@
-drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c
-   $(call if_changed_dep,cc_s_c)
-
-include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s 
FORCE
-   $(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
diff --git a/drivers/memory/emif-asm-offsets.c 
b/drivers/memory/emif-asm-offsets.c
index 71a89d5d3efd..db8043019ec6 100644
--- a/drivers/memory/emif-asm-offsets.c
+++ b/drivers/memory/emif-asm-offsets.c
@@ -16,77 +16,7 @@
 
 int main(void)
 {
-   DEFINE(EMIF_SDCFG_VAL_OFFSET,
-  offsetof(struct emif_regs_amx3, emif_sdcfg_val));
- 

[PATCH v2] ARM: omap2: Fix build when using split object directories

2018-04-12 Thread Dave Gerlach
The sleep33xx and sleep43xx files should not depend on a header file
generated in drivers/memory. Remove this dependency and instead allow
both drivers/memory and arch/arm/mach-omap2 to generate all macros
needed in headers local to their own paths.

This fixes an issue where the build fail will when using O= to set a
split object directory and arch/arm/mach-omap2 is built before
drivers/memory with the following error:

.../drivers/memory/emif-asm-offsets.c:1:0: fatal error: can't open 
drivers/memory/emif-asm-offsets.s for writing: No such file or directory
compilation terminated.

Fixes: 41d9d44d7258 ("ARM: OMAP2+: pm33xx-core: Add platform code needed for 
PM")
Acked-by: Tony Lindgren 
Reviewed-by: Masahiro Yamada 
Tested-by: Anders Roxell 
Signed-off-by: Dave Gerlach 
---
v1 -> v2:
 * Removed drivers/memory/Makefile.asm-offsets and consolidated into
   drivers/memory/Makefile.

 arch/arm/mach-omap2/Makefile |  6 +--
 arch/arm/mach-omap2/pm-asm-offsets.c |  3 ++
 arch/arm/mach-omap2/sleep33xx.S  |  1 -
 arch/arm/mach-omap2/sleep43xx.S  |  1 -
 drivers/memory/Makefile  |  8 +++-
 drivers/memory/Makefile.asm-offsets  |  5 ---
 drivers/memory/emif-asm-offsets.c| 72 +-
 include/linux/ti-emif-sram.h | 75 
 8 files changed, 86 insertions(+), 85 deletions(-)
 delete mode 100644 drivers/memory/Makefile.asm-offsets

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 4603c30fef73..0d9ce58bc464 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -243,8 +243,4 @@ arch/arm/mach-omap2/pm-asm-offsets.s: 
arch/arm/mach-omap2/pm-asm-offsets.c
 include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s 
FORCE
$(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__)
 
-# For rule to generate ti-emif-asm-offsets.h dependency
-include drivers/memory/Makefile.asm-offsets
-
-arch/arm/mach-omap2/sleep33xx.o: include/generated/ti-pm-asm-offsets.h 
include/generated/ti-emif-asm-offsets.h
-arch/arm/mach-omap2/sleep43xx.o: include/generated/ti-pm-asm-offsets.h 
include/generated/ti-emif-asm-offsets.h
+$(obj)/sleep33xx.o $(obj)/sleep43xx.o: include/generated/ti-pm-asm-offsets.h
diff --git a/arch/arm/mach-omap2/pm-asm-offsets.c 
b/arch/arm/mach-omap2/pm-asm-offsets.c
index 6d4392da7c11..b9846b19e5e2 100644
--- a/arch/arm/mach-omap2/pm-asm-offsets.c
+++ b/arch/arm/mach-omap2/pm-asm-offsets.c
@@ -7,9 +7,12 @@
 
 #include 
 #include 
+#include 
 
 int main(void)
 {
+   ti_emif_asm_offsets();
+
DEFINE(AMX3_PM_WFI_FLAGS_OFFSET,
   offsetof(struct am33xx_pm_sram_data, wfi_flags));
DEFINE(AMX3_PM_L2_AUX_CTRL_VAL_OFFSET,
diff --git a/arch/arm/mach-omap2/sleep33xx.S b/arch/arm/mach-omap2/sleep33xx.S
index 218d79930b04..322b3bb868b4 100644
--- a/arch/arm/mach-omap2/sleep33xx.S
+++ b/arch/arm/mach-omap2/sleep33xx.S
@@ -6,7 +6,6 @@
  * Dave Gerlach, Vaibhav Bedia
  */
 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-omap2/sleep43xx.S b/arch/arm/mach-omap2/sleep43xx.S
index b24be624e8b9..8903814a6677 100644
--- a/arch/arm/mach-omap2/sleep43xx.S
+++ b/arch/arm/mach-omap2/sleep43xx.S
@@ -6,7 +6,6 @@
  * Dave Gerlach, Vaibhav Bedia
  */
 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
index 66f55240830e..b3b95380346f 100644
--- a/drivers/memory/Makefile
+++ b/drivers/memory/Makefile
@@ -28,6 +28,10 @@ ti-emif-sram-objs:= ti-emif-pm.o 
ti-emif-sram-pm.o
 
 AFLAGS_ti-emif-sram-pm.o   :=-Wa,-march=armv7-a
 
-include drivers/memory/Makefile.asm-offsets
+drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c
+   $(call if_changed_dep,cc_s_c)
 
-drivers/memory/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
+include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s 
FORCE
+   $(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
+
+$(obj)/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
diff --git a/drivers/memory/Makefile.asm-offsets 
b/drivers/memory/Makefile.asm-offsets
deleted file mode 100644
index 843ff60ccb5a..
--- a/drivers/memory/Makefile.asm-offsets
+++ /dev/null
@@ -1,5 +0,0 @@
-drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c
-   $(call if_changed_dep,cc_s_c)
-
-include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s 
FORCE
-   $(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)
diff --git a/drivers/memory/emif-asm-offsets.c 
b/drivers/memory/emif-asm-offsets.c
index 71a89d5d3efd..db8043019ec6 100644
--- a/drivers/memory/emif-asm-offsets.c
+++ b/drivers/memory/emif-asm-offsets.c
@@ -16,77 +16,7 @@
 
 int main(void)
 {
-   DEFINE(EMIF_SDCFG_VAL_OFFSET,
-  offsetof(struct emif_regs_amx3, emif_sdcfg_val));
-   DEFINE(EMIF_TIMING1_VAL_OFFSET,
-  offsetof(struct emif_regs_amx3,