Skip to contentSkip to conversation

: make highmem only things enclosed in the right #ifdef

PATCH In review Juan Quintela 2 participants 6 messages Dec 18, 2002 – Dec 20, 2002 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : make highmem only things enclosed in the right #ifdef

Hi
a couple of variable declarations and a function declaration wasn't properly protected by #ifdefs.

Later, Juan.

Index: arch/mips/mm/init.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/init.c,v
retrieving revision 1.38.2.7

mips/mm/init.c +7 -3
diff -u -r1.38.2.7 init.c
@@ -161,6 +161,7 @@
 extern char _ftext, _etext, _fdata, _edata;
 extern char __init_begin, __init_end;
 
+#ifdef CONFIG_HIGHMEM
 static void __init fixrange_init (unsigned long start, unsigned long end,
 	pgd_t *pgd_base)
 {
@@ -189,22 +190,25 @@
 		j = 0;
 	}
 }
+#endif /* CONFIG_HIGHMEM */
 
 void __init pagetable_init(void)
 {
+#ifdef CONFIG_HIGHMEM
 	unsigned long vaddr;
-	pgd_t *pgd, *pgd_base;
 	pmd_t *pmd;
 	pte_t *pte;
-
+	pgd_t *pgd, pgd_base;
+#endif
 	/* Initialize the entire pgd.  */
 	pgd_init((unsigned long)swapper_pg_dir);
 	pgd_init((unsigned long)swapper_pg_dir +
 	         sizeof(pgd_t ) * USER_PTRS_PER_PGD);
 
-	pgd_base = swapper_pg_dir;
 
 #ifdef CONFIG_HIGHMEM
+	pgd_base = swapper_pg_dir;
+
 	/*
 	 * Fixed mappings:
 	 */
Signature · 2 lines
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy
#1 lore raw

mips/mm/init.c line 204

Quoted 10 lines · Juan Quintela
mips/mm/init.c +3 -2
+#ifdef CONFIG_HIGHMEM
 	unsigned long vaddr;
-	pgd_t *pgd, *pgd_base;
 	pmd_t *pmd;
 	pte_t *pte;
-
+	pgd_t *pgd, pgd_base;
+#endif
 	/* Initialize the entire pgd.  */
 	pgd_init((unsigned long)swapper_pg_dir);

Please don't change the spacing this way -- it worsens readability.
Check other pathes for cases like this, too.

Signature · 3 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +
#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"maciej" == Maciej W Rozycki <[email protected]> writes:

Quoted 10 lines · Juan Quintela
Quoted 10 lines

+#ifdef CONFIG_HIGHMEM
unsigned long vaddr;

(quoted diff) +0 -1
-	pgd_t *pgd, *pgd_base;

pmd_t *pmd;
pte_t *pte;

(quoted diff) +2 -1
-
+	pgd_t *pgd, pgd_base;
+#endif

/* Initialize the entire pgd. */
pgd_init((unsigned long)swapper_pg_dir);

maciej> Please don't change the spacing this way -- it worsens readability. maciej> Check other pathes for cases like this, too.

Hi

Argh, the patch indeed missed an *.

What do you think of this new one?

Later ,Juan.

Index: arch/mips/mm/init.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/init.c,v
retrieving revision 1.38.2.7

mips/mm/init.c +6 -1
diff -u -r1.38.2.7 init.c
@@ -161,6 +161,7 @@
 extern char _ftext, _etext, _fdata, _edata;
 extern char __init_begin, __init_end;
 
+#ifdef CONFIG_HIGHMEM
 static void __init fixrange_init (unsigned long start, unsigned long end,
 	pgd_t *pgd_base)
 {
@@ -189,22 +190,26 @@
 		j = 0;
 	}
 }
+#endif /* CONFIG_HIGHMEM */
 
 void __init pagetable_init(void)
 {
+#ifdef CONFIG_HIGHMEM
 	unsigned long vaddr;
 	pgd_t *pgd, *pgd_base;
 	pmd_t *pmd;
 	pte_t *pte;
+#endif
 
 	/* Initialize the entire pgd.  */
 	pgd_init((unsigned long)swapper_pg_dir);
 	pgd_init((unsigned long)swapper_pg_dir +
 	         sizeof(pgd_t ) * USER_PTRS_PER_PGD);
 
-	pgd_base = swapper_pg_dir;
 
 #ifdef CONFIG_HIGHMEM
+	pgd_base = swapper_pg_dir;
+
 	/*
 	 * Fixed mappings:
 	 */
Signature · 2 lines
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy
#3 lore raw
Quoted 1 line · Juan Quintela

What do you think of this new one?

Well, you could remove the line below:

mips/mm/init.c line 210

Quoted 5 lines
mips/mm/init.c +0 -1
 	         sizeof(pgd_t ) * USER_PTRS_PER_PGD);
 
-	pgd_base = swapper_pg_dir;
 
 #ifdef CONFIG_HIGHMEM

but that's nitpicking (and I may fix it up if Ralf applies the patch as is) -- I've pointed you out the problem of spacing more to bring your attention to such details than to object this particular change. The patch looks semantically OK.

Signature · 3 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +
#4 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"maciej" == Maciej W Rozycki <[email protected]> writes:

Quoted 1 line · Juan Quintela
Quoted 1 line

What do you think of this new one?

maciej> Well, you could remove the line below:

Quoted 5 lines
Quoted 5 lines

sizeof(pgd_t ) * USER_PTRS_PER_PGD);

(quoted diff) +0 -1
-	pgd_base = swapper_pg_dir;

#ifdef CONFIG_HIGHMEM

maciej> but that's nitpicking (and I may fix it up if Ralf applies the patch as maciej> is) -- I've pointed you out the problem of spacing more to bring your maciej> attention to such details than to object this particular change. The maciej> patch looks semantically OK.

Hi

Do you preffer this way?

Later, Juan.

Index: arch/mips/mm/init.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/mm/init.c,v
retrieving revision 1.38.2.7

mips/mm/init.c +7 -4
diff -u -r1.38.2.7 init.c
@@ -161,6 +161,7 @@
 extern char _ftext, _etext, _fdata, _edata;
 extern char __init_begin, __init_end;
 
+#ifdef CONFIG_HIGHMEM
 static void __init fixrange_init (unsigned long start, unsigned long end,
 	pgd_t *pgd_base)
 {
@@ -189,33 +190,35 @@
 		j = 0;
 	}
 }
+#endif /* CONFIG_HIGHMEM */
 
 void __init pagetable_init(void)
 {
+#ifdef CONFIG_HIGHMEM
 	unsigned long vaddr;
-	pgd_t *pgd, *pgd_base;
+	pgd_t *pgd;
 	pmd_t *pmd;
 	pte_t *pte;
+#endif
 
 	/* Initialize the entire pgd.  */
 	pgd_init((unsigned long)swapper_pg_dir);
 	pgd_init((unsigned long)swapper_pg_dir +
 	         sizeof(pgd_t ) * USER_PTRS_PER_PGD);
 
-	pgd_base = swapper_pg_dir;
 
 #ifdef CONFIG_HIGHMEM
 	/*
 	 * Fixed mappings:
 	 */
 	vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
-	fixrange_init(vaddr, 0, pgd_base);
+	fixrange_init(vaddr, 0, swapper_pg_dir);
 
 	/*
 	 * Permanent kmaps:
 	 */
 	vaddr = PKMAP_BASE;
-	fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base);
+	fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, swapper_pg_dir);
 
 	pgd = swapper_pg_dir + __pgd_offset(vaddr);
 	pmd = pmd_offset(pgd, vaddr);
Signature · 2 lines
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy
#5 lore raw
Quoted 1 line · Juan Quintela

Do you preffer this way?

It's actually alike to me. I was ambiguous -- sorry for that. But in
the context of spacing changes, I assumed it will be obvious I refer to the double empty line.

Anyway, the pgd_base variable seems superfluous here. This patch is
fine. Thanks for working on it.

Maciej

Signature · 3 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +