ide_hwif_t *hwif	= HWIF(drive); 
ide_hwif_t *hwif	= drive->hwif; 
static int hpt370_busproc(ide_drive_t * drive, int state){	ide_hwif_t *hwif	= HWIF(drive);	struct pci_dev *dev	= hwif->pci_dev;	u8 tristate = 0, resetmask = 0, bus_reg = 0;	u16 tri_reg;	hwif->bus_state = state;	if (hwif->channel) { 		/* secondary channel */		tristate = 0x56;		resetmask = 0x80; 	} else { 		/* primary channel */		tristate = 0x52;		resetmask = 0x40;	}	/* grab status */	pci_read_config_word(dev, tristate, &tri_reg);	pci_read_config_byte(dev, 0x59, &bus_reg);	/* set the state. we don't set it if we don't need to do so.	 * make sure that the drive knows that it has failed if it's off */	switch (state) {	case BUSSTATE_ON:		hwif->drives[0].failures = 0;		hwif->drives[1].failures = 0;		if ((bus_reg & resetmask) == 0)			return 0;		tri_reg &= ~TRISTATE_BIT;		bus_reg &= ~resetmask;		break;	case BUSSTATE_OFF:		hwif->drives[0].failures = hwif->drives[0].max_failures + 1;		hwif->drives[1].failures = hwif->drives[1].max_failures + 1;		if ((tri_reg & TRISTATE_BIT) == 0 && (bus_reg & resetmask))			return 0;		tri_reg &= ~TRISTATE_BIT;		bus_reg |= resetmask;		break;	case BUSSTATE_TRISTATE:		hwif->drives[0].failures = hwif->drives[0].max_failures + 1;		hwif->drives[1].failures = hwif->drives[1].max_failures + 1;		if ((tri_reg & TRISTATE_BIT) && (bus_reg & resetmask))			return 0;		tri_reg |= TRISTATE_BIT;		bus_reg |= resetmask;		break;	}	pci_write_config_byte(dev, 0x59, bus_reg);	pci_write_config_word(dev, tristate, tri_reg);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b39b01ffb75e14ed76510e4229ffb575007df0fb/hpt366.c/buggy/drivers/ide/pci/hpt366.c