Re: [PATCH 08/56] microblaze_v2: Interrupt handling, timer support, supported function

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Thomas Gleixner
Date: Wednesday, May 7, 2008 - 12:04 am

Michal,

On Sun, 4 May 2008, monstr@seznam.cz wrote:


no need to initialize flags 


Just a coding style nit:

       unsigned int i, j, flags, *addr = NULL;

saves 2 lines of code :)


Please replace all those hex constants with proper named defines so
the code becomes readable


Please split this modification code out into a separate function. The
same code is used below.



Please use lower case for variables


Please use a sensible name for that config switch and the constants
(e.g. HACK_BASE_ADDR)


Please create a macro for that instead of uglyfying each function with
ifdeffery

#ifdef CONFIG_XXXX
# define INTC_BASE	XXX_BASE_ADDR
#else
# define INTC_BASE	intc_baseaddr
#endif

So now your functions reads simple:

       unsigned int mask = (0x00000001 << (irq & 31));

       iowrite32(mask, INTC_BASE_ADDR + SIE);


Please do not do that. Create two irq_chips one for level and one for
edge with different implementations of the functions so you don't have
to check for level/edge in the functions itself.


With two irq chips this would be:

	for (i = 0; i < NR_IRQ; ++i) {
		if (handle & (0x00000001 << i)) {
		        set_irq_chip_and_handler(irq, &intc_edge, handle_edge_irq);
			irq_desc[i].status &= ~IRQ_LEVEL;
		} else {
		        set_irq_chip_and_handler(irq, &intc_level, handle_level_irq);
			irq_desc[i].status |= IRQ_LEVEL;
		}
	}


Please remove those useless (and in this case even wrong) file names.


Please do not use __do_IRQ() use the handlers which provide per
interrupt type optimized handlers.

	  struct irq_desc *desc = irq_desc + irq;

	  desc->handle(irq);
	  



Please remove unused code


Same thing as the interrupt one


Can you please move a new architecture to clockevents / clocksource
right from the beginning ? No need to invent another incompatible set
of time(r) related functions.



Grr. Please use defines for everything and do not hardcode stuff here
and there and make a define depend on some hardcoded value in a c
function.




Eeew.


asm/irq.h is included from linux/irq.h not the other way round


Is ledoff an interrupt function ?


Why is this needed ? Any users ?



Already defined in include/linux/interrupt.h

Thanks,
	tglx
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Microblaze patches V2, monstr, (Sun May 4, 4:40 am)
[PATCH 01/56] microblaze_v2: Kconfig patches, monstr, (Sun May 4, 4:40 am)
[PATCH 03/56] microblaze_v2: Cpuinfo handling, monstr, (Sun May 4, 4:40 am)
[PATCH 07/56] microblaze_v2: Signal support, monstr, (Sun May 4, 4:40 am)
[PATCH 09/56] microblaze_v2: cache support, monstr, (Sun May 4, 4:40 am)
[PATCH 12/56] microblaze_v2: lmb support, monstr, (Sun May 4, 4:41 am)
[PATCH 14/56] microblaze_v2: defconfig file, monstr, (Sun May 4, 4:41 am)
[PATCH 17/56] microblaze_v2: checksum support, monstr, (Sun May 4, 4:41 am)
[PATCH 19/56] microblaze_v2: uaccess files, monstr, (Sun May 4, 4:41 am)
[PATCH 20/56] microblaze_v2: heartbeat file, monstr, (Sun May 4, 4:41 am)
[PATCH 22/56] microblaze_v2: asm-offsets, monstr, (Sun May 4, 4:41 am)
[PATCH 24/56] microblaze_v2: time support, monstr, (Sun May 4, 4:41 am)
[PATCH 25/56] microblaze_v2: ptrace support, monstr, (Sun May 4, 4:41 am)
[PATCH 26/56] microblaze_v2: traps support, monstr, (Sun May 4, 4:41 am)
[PATCH 33/56] microblaze_v2: ioctl support, monstr, (Sun May 4, 4:41 am)
[PATCH 36/56] microblaze_v2: dma support, monstr, (Sun May 4, 4:41 am)
[PATCH 37/56] microblaze_v2: headers for irq, monstr, (Sun May 4, 4:41 am)
[PATCH 42/56] microblaze_v2: stats headers, monstr, (Sun May 4, 4:41 am)
[PATCH 48/56] microblaze_v2: pool.h socket.h, monstr, (Sun May 4, 4:41 am)
[PATCH 51/56] microblaze_v2: Kbuild file, monstr, (Sun May 4, 4:41 am)
[PATCH 52/56] microblaze_v2: pci headers, monstr, (Sun May 4, 4:41 am)
[PATCH 53/56] microblaze_v2: IPC headers, monstr, (Sun May 4, 4:41 am)
[PATCH 54/56] microblaze_v2: entry.S, monstr, (Sun May 4, 4:41 am)
[PATCH 55/56] microblaze_v2: sys_microblaze.c, monstr, (Sun May 4, 4:41 am)
Re: [PATCH 07/56] microblaze_v2: Signal support, Arnd Bergmann, (Sun May 4, 12:52 pm)
Re: [PATCH 17/56] microblaze_v2: checksum support, Arnd Bergmann, (Sun May 4, 12:59 pm)
Re: [PATCH 30/56] microblaze_v2: includes SHM*, msgbuf, Arnd Bergmann, (Sun May 4, 2:10 pm)
Re: [PATCH 01/56] microblaze_v2: Kconfig patches, Grant Likely, (Sun May 4, 2:24 pm)
Re: [PATCH 32/56] microblaze_v2: definitions of types, Arnd Bergmann, (Sun May 4, 2:28 pm)
Re: [PATCH 33/56] microblaze_v2: ioctl support, Arnd Bergmann, (Sun May 4, 2:34 pm)
Re: [PATCH 42/56] microblaze_v2: stats headers, Arnd Bergmann, (Sun May 4, 3:31 pm)
Re: [PATCH 48/56] microblaze_v2: pool.h socket.h, Arnd Bergmann, (Sun May 4, 3:39 pm)
Re: [PATCH 52/56] microblaze_v2: pci headers, Arnd Bergmann, (Sun May 4, 3:45 pm)
Re: [PATCH 01/56] microblaze_v2: Kconfig patches, John Williams, (Sun May 4, 6:42 pm)
Re: [PATCH 03/56] microblaze_v2: Cpuinfo handling, John Williams, (Sun May 4, 6:52 pm)
Re: [PATCH 09/56] microblaze_v2: cache support, John Williams, (Sun May 4, 7:09 pm)
Re: [PATCH 12/56] microblaze_v2: lmb support, John Williams, (Sun May 4, 7:11 pm)
Re: [PATCH 24/56] microblaze_v2: time support, John Williams, (Sun May 4, 7:19 pm)
Re: [PATCH 36/56] microblaze_v2: dma support, John Williams, (Sun May 4, 7:25 pm)
Re: Microblaze patches V2, John Williams, (Sun May 4, 7:30 pm)
Re: [PATCH 01/56] microblaze_v2: Kconfig patches, Michal Simek, (Sun May 4, 11:36 pm)
Re: [PATCH 36/56] microblaze_v2: dma support, Geert Uytterhoeven, (Sun May 4, 11:45 pm)
Re: [PATCH 01/56] microblaze_v2: Kconfig patches, Michal Simek, (Sun May 4, 11:46 pm)
Re: Microblaze patches V2, Michal Simek, (Mon May 5, 12:02 am)
Re: [PATCH 43/56] microblaze_v2: termbits.h termios.h, Arnd Bergmann, (Mon May 5, 2:50 am)
Re: [PATCH 17/56] microblaze_v2: checksum support, Michal Simek, (Mon May 5, 7:05 am)
Re: [PATCH 33/56] microblaze_v2: ioctl support, Michal Simek, (Mon May 5, 7:06 am)
Re: [PATCH 52/56] microblaze_v2: pci headers, Michal Simek, (Mon May 5, 7:08 am)
Re: [PATCH 01/56] microblaze_v2: Kconfig patches, Michal Simek, (Mon May 5, 7:16 am)
Re: [PATCH 03/56] microblaze_v2: Cpuinfo handling, Michal Simek, (Mon May 5, 7:19 am)
Re: [PATCH 24/56] microblaze_v2: time support, Michal Simek, (Mon May 5, 7:22 am)
Re: [PATCH 04/56] microblaze_v2: Open firmware files, Grant Likely, (Mon May 5, 7:24 am)
Re: [PATCH 18/56] microblaze_v2: early_printk support, Grant Likely, (Mon May 5, 7:36 am)
RE: [PATCH 10/56] microblaze_v2: Generic dts file for plat ..., Stephen Neuendorffer, (Mon May 5, 10:25 am)
RE: [microblaze-uclinux] [PATCH 09/56] microblaze_v2: cach ..., Stephen Neuendorffer, (Mon May 5, 10:37 am)
Re: [PATCH 18/56] microblaze_v2: early_printk support, Michal Simek, (Mon May 5, 1:10 pm)
Re: [PATCH 12/56] microblaze_v2: lmb support, Segher Boessenkool, (Mon May 5, 2:32 pm)
RE: [PATCH 07/56] microblaze_v2: Signal support, Stephen Neuendorffer, (Mon May 5, 2:32 pm)
RE: [PATCH 04/56] microblaze_v2: Open firmware files, Stephen Neuendorffer, (Mon May 5, 2:56 pm)
RE: [PATCH 09/56] microblaze_v2: cache support, Stephen Neuendorffer, (Mon May 5, 3:37 pm)
Re: [PATCH 18/56] microblaze_v2: early_printk support, John Williams, (Mon May 5, 4:22 pm)
RE: [PATCH 10/56] microblaze_v2: Generic dts file for plat ..., Stephen Neuendorffer, (Mon May 5, 4:32 pm)
RE: [PATCH 07/56] microblaze_v2: Signal support, John Williams, (Mon May 5, 4:33 pm)
RE: [PATCH 07/56] microblaze_v2: Signal support, Stephen Neuendorffer, (Mon May 5, 5:13 pm)
RE: [PATCH 10/56] microblaze_v2: Generic dts file for plat ..., Stephen Neuendorffer, (Mon May 5, 5:17 pm)
RE: [PATCH 07/56] microblaze_v2: Signal support, John Williams, (Mon May 5, 5:25 pm)
Re: [PATCH 24/56] microblaze_v2: time support, John Williams, (Mon May 5, 5:30 pm)
RE: [PATCH 07/56] microblaze_v2: Signal support, Stephen Neuendorffer, (Mon May 5, 5:33 pm)
Re: [PATCH 04/56] microblaze_v2: Open firmware files, Michal Simek, (Tue May 6, 12:27 am)
Re: [PATCH 18/56] microblaze_v2: early_printk support, Michal Simek, (Tue May 6, 1:14 am)
Re: [PATCH 36/56] microblaze_v2: dma support, Michal Simek, (Tue May 6, 2:16 am)
Re: [PATCH 07/56] microblaze_v2: Signal support, Michal Simek, (Tue May 6, 2:41 am)
Re: [PATCH 36/56] microblaze_v2: dma support, Geert Uytterhoeven, (Tue May 6, 2:48 am)
Re: [PATCH 36/56] microblaze_v2: dma support, Michal Simek, (Tue May 6, 2:53 am)
Re: [PATCH 24/56] microblaze_v2: time support, Michal Simek, (Tue May 6, 2:56 am)
Re: [PATCH 24/56] microblaze_v2: time support, Michal Simek, (Tue May 6, 3:02 am)
Re: [PATCH 36/56] microblaze_v2: dma support, Geert Uytterhoeven, (Tue May 6, 4:17 am)
Re: [PATCH 36/56] microblaze_v2: dma support, Arnd Bergmann, (Tue May 6, 4:24 am)
Re: [PATCH 24/56] microblaze_v2: time support, Arnd Bergmann, (Tue May 6, 4:38 am)
Re: [PATCH 36/56] microblaze_v2: dma support, Michal Simek, (Tue May 6, 6:20 am)
Re: [PATCH 24/56] microblaze_v2: time support, Michal Simek, (Tue May 6, 6:26 am)
Re: [PATCH 24/56] microblaze_v2: time support, Grant Likely, (Tue May 6, 7:28 am)
Re: [PATCH 36/56] microblaze_v2: dma support, Arnd Bergmann, (Tue May 6, 8:36 am)
RE: [PATCH 24/56] microblaze_v2: time support, Stephen Neuendorffer, (Tue May 6, 9:36 am)
Re: [PATCH 46/56] microblaze_v2: headers files entry.h cur ..., Geert Uytterhoeven, (Tue May 6, 1:57 pm)
Re: [PATCH 24/56] microblaze_v2: time support, John Williams, (Tue May 6, 3:50 pm)
Re: [PATCH 36/56] microblaze_v2: dma support, Michal Simek, (Tue May 6, 11:24 pm)
Re: [PATCH 08/56] microblaze_v2: Interrupt handling, timer ..., Thomas Gleixner, (Wed May 7, 12:04 am)
Re: [PATCH 36/56] microblaze_v2: dma support, Geert Uytterhoeven, (Wed May 7, 12:17 am)
Re: [PATCH 24/56] microblaze_v2: time support, Thomas Gleixner, (Wed May 7, 12:22 am)
Re: [PATCH 37/56] microblaze_v2: headers for irq, Thomas Gleixner, (Wed May 7, 12:26 am)
Re: [PATCH 36/56] microblaze_v2: dma support, Arnd Bergmann, (Wed May 7, 2:21 am)
RE: [microblaze-uclinux] [PATCH 04/56] microblaze_v2: Open ..., Stephen Neuendorffer, (Wed May 7, 9:04 am)
Re: [PATCH 36/56] microblaze_v2: dma support, Michal Simek, (Wed May 7, 11:43 am)
RE: [microblaze-uclinux] [PATCH 04/56] microblaze_v2: Open ..., Stephen Neuendorffer, (Wed May 7, 1:14 pm)
Re: [PATCH 37/56] microblaze_v2: headers for irq, Michal Simek, (Sun May 11, 6:56 am)