Skip to contentSkip to conversation

Use arm_memblock_steal

PATCH New Russell King - ARM Linux 3 participants 3 messages Apr 3, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use arm_memblock_steal

Use the provided function rather than re-coding this bit of code. This also gets us protection against using these functions from invalid contexts.

---
Please test this; I've not even compile tested this. Thanks.

 arch/arm/mach-imx/mach-imx27_visstrim_m10.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-imx/mach-imx27_visstrim_m10.c +2 -4
index f7b074f..c27058e 100644
@@ -32,12 +32,12 @@
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
 #include <linux/leds.h>
-#include <linux/memblock.h>
 #include <media/soc_camera.h>
 #include <sound/tlv320aic32x4.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
+#include <asm/memblock.h>
 #include <mach/common.h>
 #include <mach/iomux-mx27.h>
 
@@ -193,10 +193,8 @@ static void __init visstrim_camera_init(void)
 static void __init visstrim_reserve(void)
 {
 	/* reserve 4 MiB for mx2-camera */
-	mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE,
+	mx2_camera_base = arm_memblock_steal(MX2_CAMERA_BUF_SIZE,
 			MX2_CAMERA_BUF_SIZE);
-	memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
-	memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
 }
 
 /* GPIOs used as events for applications */
maintainer
#1 lore raw

PATCH 1/1 Use arm_memblock_steal

Quoted 7 lines · Russell King - ARM Linux

Use the provided function rather than re-coding this bit of code. This also gets us protection against using these functions from invalid contexts.

---
Please test this; I've not even compile tested this. Thanks.

It compiles, so from my pov:

However, I don't have the hardware to test it, so I hope Javier follows up on this.

Sascha

Quoted 36 lines
 arch/arm/mach-imx/mach-imx27_visstrim_m10.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-imx/mach-imx27_visstrim_m10.c +2 -4
index f7b074f..c27058e 100644
@@ -32,12 +32,12 @@
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
 #include <linux/leds.h>
-#include <linux/memblock.h>
 #include <media/soc_camera.h>
 #include <sound/tlv320aic32x4.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
+#include <asm/memblock.h>
 #include <mach/common.h>
 #include <mach/iomux-mx27.h>
 
@@ -193,10 +193,8 @@ static void __init visstrim_camera_init(void)
 static void __init visstrim_reserve(void)
 {
 	/* reserve 4 MiB for mx2-camera */
-	mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE,
+	mx2_camera_base = arm_memblock_steal(MX2_CAMERA_BUF_SIZE,
 			MX2_CAMERA_BUF_SIZE);
-	memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
-	memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
 }
 
 /* GPIOs used as events for applications */
Signature · 4 lines
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 |
#2 lore raw

PATCH 1/1 Use arm_memblock_steal

Quoted 56 lines · Sascha Hauer
Quoted 7 lines · Russell King - ARM Linux

Use the provided function rather than re-coding this bit of code. This also gets us protection against using these functions from invalid contexts.

---
Please test this; I've not even compile tested this. ?Thanks.

It compiles, so from my pov:

However, I don't have the hardware to test it, so I hope Javier follows up on this.

Sascha

Quoted 33 lines

?arch/arm/mach-imx/mach-imx27_visstrim_m10.c | ? ?6 ++---- ?1 files changed, 2 insertions(+), 4 deletions(-)

arch/arm/mach-imx/mach-imx27_visstrim_m10.c +0 -0
index f7b074f..c27058e 100644
@@ -32,12 +32,12 @@

?#include <linux/delay.h>
?#include <linux/dma-mapping.h>
?#include <linux/leds.h>
-#include <linux/memblock.h>
?#include <media/soc_camera.h>
?#include <sound/tlv320aic32x4.h>
?#include <asm/mach-types.h>
?#include <asm/mach/arch.h>
?#include <asm/mach/time.h>
+#include <asm/memblock.h>
?#include <mach/common.h>
?#include <mach/iomux-mx27.h>

arch/arm/mach-imx/mach-imx27_visstrim_m10.c +0 -0
@@ -193,10 +193,8 @@ static void __init visstrim_camera_init(void)
 ?static void __init visstrim_reserve(void)
 ?{

? ? ? /* reserve 4 MiB for mx2-camera */
- ? ? mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE,
+ ? ? mx2_camera_base = arm_memblock_steal(MX2_CAMERA_BUF_SIZE, ? ? ? ? ? ? ? ? ? ? ? MX2_CAMERA_BUF_SIZE);
- ? ? memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE);
- ? ? memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE); ?}

Quoted 3 lines

?/* GPIOs used as events for applications */

--

Quoted 4 lines
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 |

Hi,
this patch works as expected in our Visstrim_SM10 board.

Regards.

Signature · 7 lines
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com