Skip to contentSkip to conversation

m68k: Mark functions only called from setup_arch() __init

PATCH In review Geert Uytterhoeven 1 participant 4 messages Jun 25, 2013 – Jun 26, 2013

Subsystems (2)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

PATCH 1/2 m68k: Mark functions only called from setup_arch() __init

Some functions that are only called (indirectly) from setup_arch() lack __init annotations.

---
 arch/m68k/emu/natfeat.c   |    3 ++-
 arch/m68k/sun3/dvma.c     |    6 ++----
 arch/m68k/sun3/mmu_emu.c  |    3 ++-
 arch/m68k/sun3/sun3dvma.c |    3 ++-
 4 files changed, 8 insertions(+), 7 deletions(-)
arch/m68k/emu/natfeat.c +2 -1
index 2291a7d..cb574ae 100644
@@ -9,6 +9,7 @@
  * the GNU General Public License (GPL), incorporated herein by reference.
  */
 
+#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/console.h>
 #include <linux/string.h>
@@ -55,7 +56,7 @@ static void nf_poweroff(void)
 		nf_call(id);
 }
 
-void nf_init(void)
+void __init nf_init(void)
 {
 	unsigned long id, version;
 	char buf[256];
arch/m68k/sun3/dvma.c +2 -4
index d522eaa..d95506e 100644
@@ -7,6 +7,7 @@
  *
  */
 
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/bootmem.h>
@@ -62,10 +63,7 @@ int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
 
 }
 
-void sun3_dvma_init(void)
+void __init sun3_dvma_init(void)
 {
-
 	memset(ptelist, 0, sizeof(ptelist));
-
-
 }
arch/m68k/sun3/mmu_emu.c +2 -1
index 8edc510..3f258e2 100644
@@ -6,6 +6,7 @@
 ** Started 1/16/98 @ 2:22 am
 */
 
+#include <linux/init.h>
 #include <linux/mman.h>
 #include <linux/mm.h>
 #include <linux/kernel.h>
@@ -122,7 +123,7 @@ void print_pte_vaddr (unsigned long vaddr)
 /*
  * Initialise the MMU emulator.
  */
-void mmu_emu_init(unsigned long bootmem_end)
+void __init mmu_emu_init(unsigned long bootmem_end)
 {
 	unsigned long seg, num;
 	int i,j;
arch/m68k/sun3/sun3dvma.c +2 -1
index cab5448..ca57966 100644
@@ -6,6 +6,7 @@
  * Contains common routines for sun3/sun3x DVMA management.
  */
 
+#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/gfp.h>
@@ -245,7 +246,7 @@ static inline int free_baddr(unsigned long baddr)
 
 }
 
-void dvma_init(void)
+void __init dvma_init(void)
 {
 
 	struct hole *hole;
Signature · 1 line
1.7.9.5
author maintainer
#1 lore raw

PATCH 2/2 m68k/sun3: Dynamically allocate the table to track IOMMU use

As Sun 3 kernels cannot be multi-platform due to the different Sun 3 MMU type, it made sense to statically allocate the table to track IOMMU use.

However, Sun 3x kernels can be multi-platform. Furthermore, Sun 3x uses a larger table than Sun 3 (8192 bytes instead of 512 bytes).

Hence switch to dynamic allocation of this table to avoid wasting 8192 bytes when not running on a Sun 3x.

---
Untested due to lack of hardware

 arch/m68k/sun3/sun3dvma.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/m68k/sun3/sun3dvma.c +3 -1
index ca57966..e0a3d36 100644
@@ -6,6 +6,7 @@
  * Contains common routines for sun3/sun3x DVMA management.
  */
 
+#include <linux/bootmem.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -31,7 +32,7 @@ static inline void dvma_unmap_iommu(unsigned long a, int b)
 extern void sun3_dvma_init(void);
 #endif
 
-static unsigned long iommu_use[IOMMU_TOTAL_ENTRIES];
+static unsigned long *iommu_use;
 
 #define dvma_index(baddr) ((baddr - DVMA_START) >> DVMA_PAGE_SHIFT)
 
@@ -266,6 +267,7 @@ void __init dvma_init(void)
 
 	list_add(&(hole->list), &hole_list);
 
+	iommu_use = alloc_bootmem(IOMMU_TOTAL_ENTRIES * sizeof(unsigned long));
 	memset(iommu_use, 0, sizeof(iommu_use));
 
 	dvma_unmap_iommu(DVMA_START, DVMA_SIZE);
Signature · 1 line
1.7.9.5
author maintainer
#2 lore raw

Re: [PATCH 2/2] m68k/sun3: Dynamically allocate the table to track IOMMU use

arch/m68k/sun3/sun3dvma.c void __init dvma_init(void) · line 271

Quoted 11 lines · Geert Uytterhoeven
arch/m68k/sun3/sun3dvma.c +2 -1
-static unsigned long iommu_use[IOMMU_TOTAL_ENTRIES];
+static unsigned long *iommu_use;
 
 #define dvma_index(baddr) ((baddr - DVMA_START) >> DVMA_PAGE_SHIFT)
@@ -266,6 +267,7 @@ void __init dvma_init(void)
 
        list_add(&(hole->list), &hole_list);
 
+       iommu_use = alloc_bootmem(IOMMU_TOTAL_ENTRIES * sizeof(unsigned long));
        memset(iommu_use, 0, sizeof(iommu_use));

Bummer, the sizeof in the above line is no longer valid. As the bootmem allocator zeroes memory, the line can just be removed.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#3 lore raw

Re: [PATCH 2/2] m68k/sun3: Dynamically allocate the table to track IOMMU use

In reply to Geert Uytterhoeven

arch/m68k/sun3/sun3dvma.c void __init dvma_init(void) · line 271

Quoted 11 lines · Geert Uytterhoeven
arch/m68k/sun3/sun3dvma.c +2 -1
-static unsigned long iommu_use[IOMMU_TOTAL_ENTRIES];
+static unsigned long *iommu_use;
 
 #define dvma_index(baddr) ((baddr - DVMA_START) >> DVMA_PAGE_SHIFT)
@@ -266,6 +267,7 @@ void __init dvma_init(void)
 
        list_add(&(hole->list), &hole_list);
 
+       iommu_use = alloc_bootmem(IOMMU_TOTAL_ENTRIES * sizeof(unsigned long));
        memset(iommu_use, 0, sizeof(iommu_use));

Bummer, the sizeof in the above line is no longer valid. As the bootmem allocator zeroes memory, the line can just be removed.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds