mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 14:41:39 +00:00
5a0e3ad6af
percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
131 lines
3.5 KiB
C
131 lines
3.5 KiB
C
/*
|
|
* ASP Device Driver
|
|
*
|
|
* (c) Copyright 2000 The Puffin Group Inc.
|
|
*
|
|
* 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.
|
|
*
|
|
* by Helge Deller <deller@gmx.de>
|
|
*/
|
|
|
|
#include <linux/errno.h>
|
|
#include <linux/init.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/module.h>
|
|
#include <linux/types.h>
|
|
#include <asm/io.h>
|
|
#include <asm/led.h>
|
|
|
|
#include "gsc.h"
|
|
|
|
#define ASP_GSC_IRQ 3 /* hardcoded interrupt for GSC */
|
|
|
|
#define ASP_VER_OFFSET 0x20 /* offset of ASP version */
|
|
|
|
#define ASP_LED_ADDR 0xf0800020
|
|
|
|
#define VIPER_INT_WORD 0xFFFBF088 /* addr of viper interrupt word */
|
|
|
|
static struct gsc_asic asp;
|
|
|
|
static void asp_choose_irq(struct parisc_device *dev, void *ctrl)
|
|
{
|
|
int irq;
|
|
|
|
switch (dev->id.sversion) {
|
|
case 0x71: irq = 9; break; /* SCSI */
|
|
case 0x72: irq = 8; break; /* LAN */
|
|
case 0x73: irq = 1; break; /* HIL */
|
|
case 0x74: irq = 7; break; /* Centronics */
|
|
case 0x75: irq = (dev->hw_path == 4) ? 5 : 6; break; /* RS232 */
|
|
case 0x76: irq = 10; break; /* EISA BA */
|
|
case 0x77: irq = 11; break; /* Graphics1 */
|
|
case 0x7a: irq = 13; break; /* Audio (Bushmaster) */
|
|
case 0x7b: irq = 13; break; /* Audio (Scorpio) */
|
|
case 0x7c: irq = 3; break; /* FW SCSI */
|
|
case 0x7d: irq = 4; break; /* FDDI */
|
|
case 0x7f: irq = 13; break; /* Audio (Outfield) */
|
|
default: return; /* Unknown */
|
|
}
|
|
|
|
gsc_asic_assign_irq(ctrl, irq, &dev->irq);
|
|
|
|
switch (dev->id.sversion) {
|
|
case 0x73: irq = 2; break; /* i8042 High-priority */
|
|
case 0x76: irq = 0; break; /* EISA BA */
|
|
default: return; /* Other */
|
|
}
|
|
|
|
gsc_asic_assign_irq(ctrl, irq, &dev->aux_irq);
|
|
}
|
|
|
|
/* There are two register ranges we're interested in. Interrupt /
|
|
* Status / LED are at 0xf080xxxx and Asp special registers are at
|
|
* 0xf082fxxx. PDC only tells us that Asp is at 0xf082f000, so for
|
|
* the purposes of interrupt handling, we have to tell other bits of
|
|
* the kernel to look at the other registers.
|
|
*/
|
|
#define ASP_INTERRUPT_ADDR 0xf0800000
|
|
|
|
static int __init asp_init_chip(struct parisc_device *dev)
|
|
{
|
|
struct gsc_irq gsc_irq;
|
|
int ret;
|
|
|
|
asp.version = gsc_readb(dev->hpa.start + ASP_VER_OFFSET) & 0xf;
|
|
asp.name = (asp.version == 1) ? "Asp" : "Cutoff";
|
|
asp.hpa = ASP_INTERRUPT_ADDR;
|
|
|
|
printk(KERN_INFO "%s version %d at 0x%lx found.\n",
|
|
asp.name, asp.version, (unsigned long)dev->hpa.start);
|
|
|
|
/* the IRQ ASP should use */
|
|
ret = -EBUSY;
|
|
dev->irq = gsc_claim_irq(&gsc_irq, ASP_GSC_IRQ);
|
|
if (dev->irq < 0) {
|
|
printk(KERN_ERR "%s(): cannot get GSC irq\n", __func__);
|
|
goto out;
|
|
}
|
|
|
|
asp.eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
|
|
|
|
ret = request_irq(gsc_irq.irq, gsc_asic_intr, 0, "asp", &asp);
|
|
if (ret < 0)
|
|
goto out;
|
|
|
|
/* Program VIPER to interrupt on the ASP irq */
|
|
gsc_writel((1 << (31 - ASP_GSC_IRQ)),VIPER_INT_WORD);
|
|
|
|
/* Done init'ing, register this driver */
|
|
ret = gsc_common_setup(dev, &asp);
|
|
if (ret)
|
|
goto out;
|
|
|
|
gsc_fixup_irqs(dev, &asp, asp_choose_irq);
|
|
/* Mongoose is a sibling of Asp, not a child... */
|
|
gsc_fixup_irqs(parisc_parent(dev), &asp, asp_choose_irq);
|
|
|
|
/* initialize the chassis LEDs */
|
|
#ifdef CONFIG_CHASSIS_LCD_LED
|
|
register_led_driver(DISPLAY_MODEL_OLD_ASP, LED_CMD_REG_NONE,
|
|
ASP_LED_ADDR);
|
|
#endif
|
|
|
|
out:
|
|
return ret;
|
|
}
|
|
|
|
static struct parisc_device_id asp_tbl[] = {
|
|
{ HPHW_BA, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00070 },
|
|
{ 0, }
|
|
};
|
|
|
|
struct parisc_driver asp_driver = {
|
|
.name = "asp",
|
|
.id_table = asp_tbl,
|
|
.probe = asp_init_chip,
|
|
};
|