/* We can't address 8 and 16 bit words directly. Instead we have to read/write a 32bit word and mask/modify the data we actually want.  */
static int read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 *val)
/* We can't address 8 and 16 bit words directly. Instead we have to read/write a 32bit word and mask/modify the data we actually want.  */
static int read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 *val)
{
	unsigned int data = 0;
	int err;
	if (bus == NULL)
		return -1;
	err = config_access(PCI_CMD_CONFIG_READ, bus, devfn, where, ~(1 << (where & 3)), &data);
	switch (where & 0x03) {
	case 0:
		*val = (unsigned char)(data & 0x000000ff);
		break;
	case 1:
		*val = (unsigned char)((data & 0x0000ff00) >> 8);
		break;
	case 2:
		*val = (unsigned char)((data & 0x00ff0000) >> 16);
		break;
	case 3:
		*val = (unsigned char)((data & 0xff000000) >> 24);
		break;
	}
	return err;
}