hwgroup = kmalloc(sizeof(ide_hwgroup_t),GFP_KERNEL); 
hwgroup = kmalloc_node(sizeof(ide_hwgroup_t), GFP_KERNEL, pcibus_to_node(hwif->drives[0].hwif->pci_dev->bus)); 
static int init_irq (ide_hwif_t *hwif){	unsigned int index;	ide_hwgroup_t *hwgroup;	ide_hwif_t *match = NULL;	BUG_ON(in_interrupt());	BUG_ON(irqs_disabled());		down(&ide_cfg_sem);	hwif->hwgroup = NULL;#if MAX_HWIFS > 1	/*	 * Group up with any other hwifs that share our irq(s).	 */	for (index = 0; index < MAX_HWIFS; index++) {		ide_hwif_t *h = &ide_hwifs[index];		if (h->hwgroup) {  /* scan only initialized hwif's */			if (hwif->irq == h->irq) {				hwif->sharing_irq = h->sharing_irq = 1;				if (hwif->chipset != ide_pci ||				    h->chipset != ide_pci) {					save_match(hwif, h, &match);				}			}			if (hwif->serialized) {				if (hwif->mate && hwif->mate->irq == h->irq)					save_match(hwif, h, &match);			}			if (h->serialized) {				if (h->mate && hwif->irq == h->mate->irq)					save_match(hwif, h, &match);			}		}	}#endif /* MAX_HWIFS > 1 */	/*	 * If we are still without a hwgroup, then form a new one	 */	if (match) {		hwgroup = match->hwgroup;		hwif->hwgroup = hwgroup;		/*		 * Link us into the hwgroup.		 * This must be done early, do ensure that unexpected_intr		 * can find the hwif and prevent irq storms.		 * No drives are attached to the new hwif, choose_drive		 * can't do anything stupid (yet).		 * Add ourself as the 2nd entry to the hwgroup->hwif		 * linked list, the first entry is the hwif that owns		 * hwgroup->handler - do not change that.		 */		spin_lock_irq(&ide_lock);		hwif->next = hwgroup->hwif->next;		hwgroup->hwif->next = hwif;		spin_unlock_irq(&ide_lock);	} else {		hwgroup = kmalloc(sizeof(ide_hwgroup_t),GFP_KERNEL);		if (!hwgroup)	       		goto out_up;		hwif->hwgroup = hwgroup;		memset(hwgroup, 0, sizeof(ide_hwgroup_t));		hwgroup->hwif     = hwif->next = hwif;		hwgroup->rq       = NULL;		hwgroup->handler  = NULL;		hwgroup->drive    = NULL;		hwgroup->busy     = 0;		init_timer(&hwgroup->timer);		hwgroup->timer.function = &ide_timer_expiry;		hwgroup->timer.data = (unsigned long) hwgroup;	}	/*	 * Allocate the irq, if not already obtained for another hwif	 */	if (!match || match->irq != hwif->irq) {		int sa = SA_INTERRUPT;#if defined(__mc68000__) || defined(CONFIG_APUS)		sa = SA_SHIRQ;#endif /* __mc68000__ || CONFIG_APUS */		if (IDE_CHIPSET_IS_PCI(hwif->chipset)) {			sa = SA_SHIRQ;#ifndef CONFIG_IDEPCI_SHARE_IRQ			sa |= SA_INTERRUPT;#endif /* CONFIG_IDEPCI_SHARE_IRQ */		}		if (hwif->io_ports[IDE_CONTROL_OFFSET])			/* clear nIEN */			hwif->OUTB(0x08, hwif->io_ports[IDE_CONTROL_OFFSET]);		if (request_irq(hwif->irq,&ide_intr,sa,hwif->name,hwgroup))	       		goto out_unlink;	}	/*	 * For any present drive:	 * - allocate the block device queue	 * - link drive into the hwgroup	 */	for (index = 0; index < MAX_DRIVES; ++index) {		ide_drive_t *drive = &hwif->drives[index];		if (!drive->present)			continue;		if (ide_init_queue(drive)) {			printk(KERN_ERR "ide: failed to init %s\n",drive->name);			continue;		}		spin_lock_irq(&ide_lock);		if (!hwgroup->drive) {			/* first drive for hwgroup. */			drive->next = drive;			hwgroup->drive = drive;			hwgroup->hwif = HWIF(hwgroup->drive);		} else {			drive->next = hwgroup->drive->next;			hwgroup->drive->next = drive;		}		spin_unlock_irq(&ide_lock);	}#if !defined(__mc68000__) && !defined(CONFIG_APUS) && !defined(__sparc__)	printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name,		hwif->io_ports[IDE_DATA_OFFSET],		hwif->io_ports[IDE_DATA_OFFSET]+7,		hwif->io_ports[IDE_CONTROL_OFFSET], hwif->irq);#elif defined(__sparc__)	printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %s", hwif->name,		hwif->io_ports[IDE_DATA_OFFSET],		hwif->io_ports[IDE_DATA_OFFSET]+7,		hwif->io_ports[IDE_CONTROL_OFFSET], __irq_itoa(hwif->irq));#else	printk("%s at 0x%08lx on irq %d", hwif->name,		hwif->io_ports[IDE_DATA_OFFSET], hwif->irq);#endif /* __mc68000__ && CONFIG_APUS */	if (match)		printk(" (%sed with %s)",			hwif->sharing_irq ? "shar" : "serializ", match->name);	printk("\n");	up(&ide_cfg_sem);	return 0;out_unlink:	spin_lock_irq(&ide_lock);	if (hwif->next == hwif) {		BUG_ON(match);		BUG_ON(hwgroup->hwif != hwif);		kfree(hwgroup);	} else {		ide_hwif_t *g;		g = hwgroup->hwif;		while (g->next != hwif)			g = g->next;		g->next = hwif->next;		if (hwgroup->hwif == hwif) {			/* Impossible. */			printk(KERN_ERR "Duh. Uninitialized hwif listed as active hwif.\n");			hwgroup->hwif = g;		}		BUG_ON(hwgroup->hwif == hwif);	}	spin_unlock_irq(&ide_lock);out_up:	up(&ide_cfg_sem);	return 1;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/1946089a109251655c5438d92c539bd2930e71ea/ide-probe.c/buggy/drivers/ide/ide-probe.c