Skip to contentSkip to conversation

arm: vt8500: Convert irq.c for multiplatform integration

RFC PATCH New Tony Prisk 2 participants 5 messages Oct 10, 2012

Subsystems (3)
lore
Share & tools
lore

Tony Prisk

author
#0 lore raw

RFC PATCH 1/1 arm: vt8500: Convert irq.c for multiplatform integration

This patch converts arch-vt8500/irq.c to MULTI_IRQ_HANDLER and SPARSE_IRQ. IRQ domain is changed from legacy to linear.

Also, remove legacy code in include/mach/entry-macro.S and include/mach/irq.h to prepare for multiplatform.

---
 arch/arm/Kconfig                                |    2 +
 arch/arm/mach-vt8500/common.h                   |    3 +
 arch/arm/mach-vt8500/include/mach/entry-macro.S |   26 ------
 arch/arm/mach-vt8500/include/mach/irqs.h        |   22 -----
 arch/arm/mach-vt8500/irq.c                      |  111 +++++++++++++++--------
 arch/arm/mach-vt8500/vt8500.c                   |    1 +
 6 files changed, 79 insertions(+), 86 deletions(-)
 delete mode 100644 arch/arm/mach-vt8500/include/mach/entry-macro.S
 delete mode 100644 arch/arm/mach-vt8500/include/mach/irqs.h
arch/arm/Kconfig +2 -0
index 6d2f7f5..32b62ac 100644
@@ -949,6 +949,8 @@ config ARCH_VT8500
 	select COMMON_CLK
 	select HAVE_CLK
 	select CLKDEV_LOOKUP
+	select MULTI_IRQ_HANDLER
+	select SPARSE_IRQ
 	help
 	  Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
 
arch/arm/mach-vt8500/common.h +3 -0
index 2b24196..6f2b843 100644
@@ -25,4 +25,7 @@ int __init vt8500_irq_init(struct device_node *node,
 /* defined in drivers/clk/clk-vt8500.c */
 void __init vtwm_clk_init(void __iomem *pmc_base);
 
+/* defined in irq.c */
+asmlinkage void vt8500_handle_irq(struct pt_regs *regs);
+
 #endif
arch/arm/mach-vt8500/include/mach/entry-macro.S deleted +0 -26
deleted file mode 100644
index 367d1b5..0000000
@@ -1,26 +0,0 @@
-/*
- * arch/arm/mach-vt8500/include/mach/entry-macro.S
- *
- * Low-level IRQ helper macros for VIA VT8500
- *
- * This file is licensed under  the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-	.macro  get_irqnr_preamble, base, tmp
-	@ physical 0xd8140000 is virtual 0xf8140000
-	mov	\base, #0xf8000000
-	orr	\base, \base, #0x00140000
-	.endm
-
-	.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
-	ldr	\irqnr, [\base]
-	cmp	\irqnr, #63 @ may be false positive, check interrupt status
-	bne	1001f
-	ldr	\irqstat, [\base, #0x84]
-	ands	\irqstat, #0x80000000
-	moveq	\irqnr, #0
-1001:
-	.endm
-
arch/arm/mach-vt8500/include/mach/irqs.h deleted +0 -22
deleted file mode 100644
index a129fd1..0000000
@@ -1,22 +0,0 @@
-/*
- *  arch/arm/mach-vt8500/include/mach/irqs.h
- *
- *  Copyright (C) 2010 Alexey Charkov <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/* This value is just to make the core happy, never used otherwise */
-#define NR_IRQS 128
arch/arm/mach-vt8500/irq.c +73 -38

185 lines not on this page · raw message

arch/arm/mach-vt8500/vt8500.c +1 -0
index 8d3871f..14def0f 100644
@@ -194,5 +194,6 @@ DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)")
 	.timer		= &vt8500_timer,
 	.init_machine	= vt8500_init,
 	.restart	= vt8500_restart,
+	.handle_irq	= vt8500_handle_irq,
 MACHINE_END
 
Signature · 1 line
1.7.9.5
#1 lore raw

RFC PATCH 1/1 arm: vt8500: Convert irq.c for multiplatform integration

Quoted 7 lines · Tony Prisk

This patch converts arch-vt8500/irq.c to MULTI_IRQ_HANDLER and SPARSE_IRQ. IRQ domain is changed from legacy to linear.

Also, remove legacy code in include/mach/entry-macro.S and include/mach/irq.h to prepare for multiplatform.

Excellent!

One small style comment for a preexisting issue I had not noticed before:

arch/arm/mach-vt8500/irq.c line 84

Quoted 6 lines

static void vt8500_irq_mask(struct irq_data *d)
{

arch/arm/mach-vt8500/irq.c +2 -2
-	struct vt8500_irq_priv *priv =
-			(struct vt8500_irq_priv *)(d->domain->host_data);
+	struct vt8500_irq_data *priv = 
+			(struct vt8500_irq_data *)(d->domain->host_data);

host_data is a void pointer, so you don't need the type cast. Writing this as

	struct vt8500_irq_priv *priv = d->domain->host_data;

is both the common convention and easier to read.

Arnd

author
#2 lore raw

RFC PATCH 1/1 arm: vt8500: Convert irq.c for multiplatform integration

Quoted 27 lines · Arnd Bergmann
Quoted 7 lines · Tony Prisk

This patch converts arch-vt8500/irq.c to MULTI_IRQ_HANDLER and SPARSE_IRQ. IRQ domain is changed from legacy to linear.

Also, remove legacy code in include/mach/entry-macro.S and include/mach/irq.h to prepare for multiplatform.

Excellent!

One small style comment for a preexisting issue I had not noticed before:

arch/arm/mach-vt8500/irq.c line 84

Quoted 6 lines

static void vt8500_irq_mask(struct irq_data *d)
{

arch/arm/mach-vt8500/irq.c +2 -2
-	struct vt8500_irq_priv *priv =
-			(struct vt8500_irq_priv *)(d->domain->host_data);
+	struct vt8500_irq_data *priv = 
+			(struct vt8500_irq_data *)(d->domain->host_data);

host_data is a void pointer, so you don't need the type cast. Writing this as

	struct vt8500_irq_priv *priv = d->domain->host_data;
Quoted 8 lines

is both the common convention and easier to read.

Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

I seem to have a thing about casting pointers - this must be the 3rd-4th time you've mentioned different occasions where I've unnecessarily cast a void pointer.

Must do better! :)

Changes made locally as requested - Should have the rest of the multiplatform change done shortly.. then roll on -rc1....

Regards
Tony P

author
#3 lore raw

RFC PATCH 1/1 arm: vt8500: Convert irq.c for multiplatform integration

In reply to Tony Prisk

I did have one bit I wasn't sure about:

Quoted 15 lines · Tony Prisk

This patch converts arch-vt8500/irq.c to MULTI_IRQ_HANDLER and SPARSE_IRQ. IRQ domain is changed from legacy to linear.

Also, remove legacy code in include/mach/entry-macro.S and include/mach/irq.h to prepare for multiplatform.

---
...

arch/arm/mach-vt8500/common.h +0 -0
index 2b24196..6f2b843 100644

arch/arm/mach-vt8500/common.h int __init vt8500_irq_init(struct device_node *node, · line 29

Quoted 5 lines
arch/arm/mach-vt8500/common.h +2 -0
@@ -25,4 +25,7 @@ int __init vt8500_irq_init(struct device_node *node,
 /* defined in drivers/clk/clk-vt8500.c */
 void __init vtwm_clk_init(void __iomem *pmc_base);
 
+/* defined in irq.c */
+asmlinkage void vt8500_handle_irq(struct pt_regs *regs);

Should asmlinkage be used here in the header or is it unnecessary?

arch/arm/mach-vt8500/common.h int __init vt8500_irq_init(struct device_node *node, · line 31

Quoted 2 lines
arch/arm/mach-vt8500/common.h +1 -0
+
 #endif

Regards
Tony P

#4 lore raw

RFC PATCH 1/1 arm: vt8500: Convert irq.c for multiplatform integration

Quoted 21 lines · Tony Prisk

I did have one bit I wasn't sure about:

Quoted 18 lines · Tony Prisk

This patch converts arch-vt8500/irq.c to MULTI_IRQ_HANDLER and SPARSE_IRQ. IRQ domain is changed from legacy to linear.

Also, remove legacy code in include/mach/entry-macro.S and include/mach/irq.h to prepare for multiplatform.

---
...

arch/arm/mach-vt8500/common.h +0 -0
index 2b24196..6f2b843 100644
@@ -25,4 +25,7 @@ int __init vt8500_irq_init(struct device_node *node,
 /* defined in drivers/clk/clk-vt8500.c */
 void __init vtwm_clk_init(void __iomem *pmc_base);
 
Quoted 4 lines

arch/arm/mach-vt8500/common.h int __init vt8500_irq_init(struct device_node *node, · line 29

Quoted 2 lines
arch/arm/mach-vt8500/common.h +2 -0
+/* defined in irq.c */
+asmlinkage void vt8500_handle_irq(struct pt_regs *regs);

Should asmlinkage be used here in the header or is it unnecessary?

I think it's not technically needed because the function is not called from C code anywhere, but IMHO it's better to have it here out of principle.

Arnd