* Porting Linux MIPS issue: maltaint.h files
@ 2010-09-15 20:04 ` Ardelean, Andrei
0 siblings, 0 replies; 6+ messages in thread
From: Ardelean, Andrei @ 2010-09-15 20:04 UTC (permalink / raw)
To: linux-mips
Hi,
I am porting LINUX MIPS from MALTA on a new board. The problem is that
.../mips-boards/maltaint.h files is included in a non-MALTA specific
file, irq-gic.c, without #ifdef CONFIG_MALTA protection. The only need
there is for the following constant:
#define X 0xdead
What is the recommended way to follow since I will replace maltaint.h
with my new file gdint.h?
Thanks,
Andrei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Porting Linux MIPS issue: maltaint.h files
@ 2010-09-15 20:04 ` Ardelean, Andrei
0 siblings, 0 replies; 6+ messages in thread
From: Ardelean, Andrei @ 2010-09-15 20:04 UTC (permalink / raw)
To: linux-mips
Hi,
I am porting LINUX MIPS from MALTA on a new board. The problem is that
.../mips-boards/maltaint.h files is included in a non-MALTA specific
file, irq-gic.c, without #ifdef CONFIG_MALTA protection. The only need
there is for the following constant:
#define X 0xdead
What is the recommended way to follow since I will replace maltaint.h
with my new file gdint.h?
Thanks,
Andrei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Porting Linux MIPS issue: maltaint.h files
2010-09-15 20:04 ` Ardelean, Andrei
(?)
@ 2010-09-16 23:57 ` Ralf Baechle
2010-09-17 15:57 ` Ralf Baechle
-1 siblings, 1 reply; 6+ messages in thread
From: Ralf Baechle @ 2010-09-16 23:57 UTC (permalink / raw)
To: Ardelean, Andrei; +Cc: linux-mips
On Wed, Sep 15, 2010 at 01:04:02PM -0700, Ardelean, Andrei wrote:
> I am porting LINUX MIPS from MALTA on a new board. The problem is that
> .../mips-boards/maltaint.h files is included in a non-MALTA specific
> file, irq-gic.c, without #ifdef CONFIG_MALTA protection. The only need
> there is for the following constant:
> #define X 0xdead
That's just poor programming style. 1 character long names in headers are
begging for conflicts and with few exceptions as the universal loop index
variables i, j, k are not descriptive.
Including system specific headers hinders code reusability and reusability
is the reason why most of the irq-*.c files are in arch/mips/kernel and not
hidden away in some platform specific directory.
> What is the recommended way to follow since I will replace maltaint.h
> with my new file gdint.h?
Post a patch to cleanup the mess.
In this case (and I haven't looked at it for more than 30s ...) it seems
that the constant X should be moved into <asm/gic.h> after which the
inclusion of the Malta header can go away.
Ralf
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Porting Linux MIPS issue: maltaint.h files
2010-09-16 23:57 ` Ralf Baechle
@ 2010-09-17 15:57 ` Ralf Baechle
2010-09-17 21:41 ` Ardelean, Andrei
0 siblings, 1 reply; 6+ messages in thread
From: Ralf Baechle @ 2010-09-17 15:57 UTC (permalink / raw)
To: Ardelean, Andrei; +Cc: linux-mips
On Fri, Sep 17, 2010 at 12:57:39AM +0100, Ralf Baechle wrote:
> Post a patch to cleanup the mess.
>
> In this case (and I haven't looked at it for more than 30s ...) it seems
> that the constant X should be moved into <asm/gic.h> after which the
> inclusion of the Malta header can go away.
So here it is.
Ralf
arch/mips/include/asm/gic.h | 1 +
arch/mips/include/asm/mips-boards/maltaint.h | 3 ---
arch/mips/kernel/irq-gic.c | 3 +--
arch/mips/mti-malta/malta-int.c | 3 +++
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h
index 9b9436a..86548da 100644
--- a/arch/mips/include/asm/gic.h
+++ b/arch/mips/include/asm/gic.h
@@ -321,6 +321,7 @@ struct gic_intrmask_regs {
*/
struct gic_intr_map {
unsigned int cpunum; /* Directed to this CPU */
+#define GIC_UNUSED 0xdead /* Dummy data */
unsigned int pin; /* Directed to this Pin */
unsigned int polarity; /* Polarity : +/- */
unsigned int trigtype; /* Trigger : Edge/Levl */
diff --git a/arch/mips/include/asm/mips-boards/maltaint.h b/arch/mips/include/asm/mips-boards/maltaint.h
index cea872f..d11aa02 100644
--- a/arch/mips/include/asm/mips-boards/maltaint.h
+++ b/arch/mips/include/asm/mips-boards/maltaint.h
@@ -88,9 +88,6 @@
#define GIC_EXT_INTR(x) x
-/* Dummy data */
-#define X 0xdead
-
/* External Interrupts used for IPI */
#define GIC_IPI_EXT_INTR_RESCHED_VPE0 16
#define GIC_IPI_EXT_INTR_CALLFNC_VPE0 17
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c
index b181f2f..3e57e29 100644
--- a/arch/mips/kernel/irq-gic.c
+++ b/arch/mips/kernel/irq-gic.c
@@ -7,7 +7,6 @@
#include <asm/io.h>
#include <asm/gic.h>
#include <asm/gcmpregs.h>
-#include <asm/mips-boards/maltaint.h>
#include <asm/irq.h>
#include <linux/hardirq.h>
#include <asm-generic/bitops/find.h>
@@ -222,7 +221,7 @@ static void __init gic_basic_init(int numintrs, int numvpes,
/* Setup specifics */
for (i = 0; i < mapsize; i++) {
cpu = intrmap[i].cpunum;
- if (cpu == X)
+ if (cpu == GIC_UNUSED)
continue;
if (cpu == 0 && i != 0 && intrmap[i].flags == 0)
continue;
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index 15949b0..b79b24a 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -385,6 +385,8 @@ static int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap);
*/
#define GIC_CPU_NMI GIC_MAP_TO_NMI_MSK
+#define X GIC_UNUSED
+
static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = {
{ X, X, X, X, 0 },
{ X, X, X, X, 0 },
@@ -404,6 +406,7 @@ static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = {
{ X, X, X, X, 0 },
/* The remainder of this table is initialised by fill_ipi_map */
};
+#undef X
/*
* GCMP needs to be detected before any SMP initialisation
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: Porting Linux MIPS issue: maltaint.h files
@ 2010-09-17 21:41 ` Ardelean, Andrei
0 siblings, 0 replies; 6+ messages in thread
From: Ardelean, Andrei @ 2010-09-17 21:41 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
Thanks a lot,
Andrei
-----Original Message-----
From: Ralf Baechle [mailto:ralf@linux-mips.org]
Sent: Friday, September 17, 2010 11:57 AM
To: Ardelean, Andrei
Cc: linux-mips@linux-mips.org
Subject: Re: Porting Linux MIPS issue: maltaint.h files
On Fri, Sep 17, 2010 at 12:57:39AM +0100, Ralf Baechle wrote:
> Post a patch to cleanup the mess.
>
> In this case (and I haven't looked at it for more than 30s ...) it
seems
> that the constant X should be moved into <asm/gic.h> after which the
> inclusion of the Malta header can go away.
So here it is.
Ralf
arch/mips/include/asm/gic.h | 1 +
arch/mips/include/asm/mips-boards/maltaint.h | 3 ---
arch/mips/kernel/irq-gic.c | 3 +--
arch/mips/mti-malta/malta-int.c | 3 +++
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h
index 9b9436a..86548da 100644
--- a/arch/mips/include/asm/gic.h
+++ b/arch/mips/include/asm/gic.h
@@ -321,6 +321,7 @@ struct gic_intrmask_regs {
*/
struct gic_intr_map {
unsigned int cpunum; /* Directed to this CPU */
+#define GIC_UNUSED 0xdead /* Dummy data */
unsigned int pin; /* Directed to this Pin */
unsigned int polarity; /* Polarity : +/- */
unsigned int trigtype; /* Trigger : Edge/Levl */
diff --git a/arch/mips/include/asm/mips-boards/maltaint.h
b/arch/mips/include/asm/mips-boards/maltaint.h
index cea872f..d11aa02 100644
--- a/arch/mips/include/asm/mips-boards/maltaint.h
+++ b/arch/mips/include/asm/mips-boards/maltaint.h
@@ -88,9 +88,6 @@
#define GIC_EXT_INTR(x) x
-/* Dummy data */
-#define X 0xdead
-
/* External Interrupts used for IPI */
#define GIC_IPI_EXT_INTR_RESCHED_VPE0 16
#define GIC_IPI_EXT_INTR_CALLFNC_VPE0 17
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c
index b181f2f..3e57e29 100644
--- a/arch/mips/kernel/irq-gic.c
+++ b/arch/mips/kernel/irq-gic.c
@@ -7,7 +7,6 @@
#include <asm/io.h>
#include <asm/gic.h>
#include <asm/gcmpregs.h>
-#include <asm/mips-boards/maltaint.h>
#include <asm/irq.h>
#include <linux/hardirq.h>
#include <asm-generic/bitops/find.h>
@@ -222,7 +221,7 @@ static void __init gic_basic_init(int numintrs, int
numvpes,
/* Setup specifics */
for (i = 0; i < mapsize; i++) {
cpu = intrmap[i].cpunum;
- if (cpu == X)
+ if (cpu == GIC_UNUSED)
continue;
if (cpu == 0 && i != 0 && intrmap[i].flags == 0)
continue;
diff --git a/arch/mips/mti-malta/malta-int.c
b/arch/mips/mti-malta/malta-int.c
index 15949b0..b79b24a 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -385,6 +385,8 @@ static int __initdata msc_nr_eicirqs =
ARRAY_SIZE(msc_eicirqmap);
*/
#define GIC_CPU_NMI GIC_MAP_TO_NMI_MSK
+#define X GIC_UNUSED
+
static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = {
{ X, X, X, X, 0 },
{ X, X, X, X, 0 },
@@ -404,6 +406,7 @@ static struct gic_intr_map
gic_intr_map[GIC_NUM_INTRS] = {
{ X, X, X, X, 0 },
/* The remainder of this table is initialised by fill_ipi_map */
};
+#undef X
/*
* GCMP needs to be detected before any SMP initialisation
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: Porting Linux MIPS issue: maltaint.h files
@ 2010-09-17 21:41 ` Ardelean, Andrei
0 siblings, 0 replies; 6+ messages in thread
From: Ardelean, Andrei @ 2010-09-17 21:41 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
Thanks a lot,
Andrei
-----Original Message-----
From: Ralf Baechle [mailto:ralf@linux-mips.org]
Sent: Friday, September 17, 2010 11:57 AM
To: Ardelean, Andrei
Cc: linux-mips@linux-mips.org
Subject: Re: Porting Linux MIPS issue: maltaint.h files
On Fri, Sep 17, 2010 at 12:57:39AM +0100, Ralf Baechle wrote:
> Post a patch to cleanup the mess.
>
> In this case (and I haven't looked at it for more than 30s ...) it
seems
> that the constant X should be moved into <asm/gic.h> after which the
> inclusion of the Malta header can go away.
So here it is.
Ralf
arch/mips/include/asm/gic.h | 1 +
arch/mips/include/asm/mips-boards/maltaint.h | 3 ---
arch/mips/kernel/irq-gic.c | 3 +--
arch/mips/mti-malta/malta-int.c | 3 +++
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h
index 9b9436a..86548da 100644
--- a/arch/mips/include/asm/gic.h
+++ b/arch/mips/include/asm/gic.h
@@ -321,6 +321,7 @@ struct gic_intrmask_regs {
*/
struct gic_intr_map {
unsigned int cpunum; /* Directed to this CPU */
+#define GIC_UNUSED 0xdead /* Dummy data */
unsigned int pin; /* Directed to this Pin */
unsigned int polarity; /* Polarity : +/- */
unsigned int trigtype; /* Trigger : Edge/Levl */
diff --git a/arch/mips/include/asm/mips-boards/maltaint.h
b/arch/mips/include/asm/mips-boards/maltaint.h
index cea872f..d11aa02 100644
--- a/arch/mips/include/asm/mips-boards/maltaint.h
+++ b/arch/mips/include/asm/mips-boards/maltaint.h
@@ -88,9 +88,6 @@
#define GIC_EXT_INTR(x) x
-/* Dummy data */
-#define X 0xdead
-
/* External Interrupts used for IPI */
#define GIC_IPI_EXT_INTR_RESCHED_VPE0 16
#define GIC_IPI_EXT_INTR_CALLFNC_VPE0 17
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c
index b181f2f..3e57e29 100644
--- a/arch/mips/kernel/irq-gic.c
+++ b/arch/mips/kernel/irq-gic.c
@@ -7,7 +7,6 @@
#include <asm/io.h>
#include <asm/gic.h>
#include <asm/gcmpregs.h>
-#include <asm/mips-boards/maltaint.h>
#include <asm/irq.h>
#include <linux/hardirq.h>
#include <asm-generic/bitops/find.h>
@@ -222,7 +221,7 @@ static void __init gic_basic_init(int numintrs, int
numvpes,
/* Setup specifics */
for (i = 0; i < mapsize; i++) {
cpu = intrmap[i].cpunum;
- if (cpu == X)
+ if (cpu == GIC_UNUSED)
continue;
if (cpu == 0 && i != 0 && intrmap[i].flags == 0)
continue;
diff --git a/arch/mips/mti-malta/malta-int.c
b/arch/mips/mti-malta/malta-int.c
index 15949b0..b79b24a 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -385,6 +385,8 @@ static int __initdata msc_nr_eicirqs =
ARRAY_SIZE(msc_eicirqmap);
*/
#define GIC_CPU_NMI GIC_MAP_TO_NMI_MSK
+#define X GIC_UNUSED
+
static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = {
{ X, X, X, X, 0 },
{ X, X, X, X, 0 },
@@ -404,6 +406,7 @@ static struct gic_intr_map
gic_intr_map[GIC_NUM_INTRS] = {
{ X, X, X, X, 0 },
/* The remainder of this table is initialised by fill_ipi_map */
};
+#undef X
/*
* GCMP needs to be detected before any SMP initialisation
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-09-17 21:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 20:04 Porting Linux MIPS issue: maltaint.h files Ardelean, Andrei
2010-09-15 20:04 ` Ardelean, Andrei
2010-09-16 23:57 ` Ralf Baechle
2010-09-17 15:57 ` Ralf Baechle
2010-09-17 21:41 ` Ardelean, Andrei
2010-09-17 21:41 ` Ardelean, Andrei
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.