Re: PATCH: was Re: 2.3.13 pci_namedevice compile error

Carsten Paeth (calle@calle.in-berlin.de)
Thu, 12 Aug 1999 12:15:56 +0200


Hello.

To be compartible with old struct pci_dev
"base_address[i]" had to be substitute by
"resource[i].start & resource[i].flags".
This patch will not work ...
You have to use

static int __init
pci_get_base_address(struct pci_dev *pdev, int index, u_long *base)
)
{
*base = (pdev->resource[index].start|pdev->resource[index].flags);
index++;
return index;
}

best regards

calle

Wed, Aug 11, 1999 at 11:53:50PM +0100, Alan Cox schrieb:
> > drivers/pci/pci.a(pci.o): In function `pci_scan_bus':
> > pci.o(.text.init+0x261): undefined reference to `pci_namedevice'
> > make: *** [vmlinux] Error 1
> >
> > I also got the infamous error under one configuration:
> >
> > ncr53c8xx.c: In function `pci_get_base_address':
> > ncr53c8xx.c:9636: structure has no member named `base_address'
>
>
> diff -u --new-file --recursive --exclude-from ../exclude linux.13p8/drivers/scsi/ncr53c8xx.c linux.ac/drivers/scsi/ncr53c8xx.c
> --- linux.13p8/drivers/scsi/ncr53c8xx.c Sat Aug 7 17:55:28 1999
> +++ linux.ac/drivers/scsi/ncr53c8xx.c Fri Aug 6 01:23:13 1999
> @@ -588,9 +588,7 @@
> #endif
>
> #if defined(__i386__) || !defined(NCR_IOMAPPED)
> -__initfunc(
> -static vm_offset_t remap_pci_mem(u_long base, u_long size)
> -)
> +static vm_offset_t __init remap_pci_mem(u_long base, u_long size)
> {
> u_long page_base = ((u_long) base) & PAGE_MASK;
> u_long page_offs = ((u_long) base) - page_base;
> @@ -599,9 +597,7 @@
> return (vm_offset_t) (page_remapped? (page_remapped + page_offs) : 0UL);
> }
>
> -__initfunc(
> -static void unmap_pci_mem(vm_offset_t vaddr, u_long size)
> -)
> +static void __init unmap_pci_mem(vm_offset_t vaddr, u_long size)
> {
> if (vaddr)
> iounmap((void *) (vaddr & PAGE_MASK));
> @@ -3701,9 +3697,7 @@
> **==========================================================
> */
>
> -__initfunc(
> -void ncr_script_fill (struct script * scr, struct scripth * scrh)
> -)
> +void __init ncr_script_fill (struct script * scr, struct scripth * scrh)
> {
> int i;
> ncrcmd *p;
> @@ -3778,9 +3772,7 @@
> **==========================================================
> */
>
> -__initfunc(
> -static void ncr_script_copy_and_bind (ncb_p np, ncrcmd *src, ncrcmd *dst, int len)
> -)
> +static void __init ncr_script_copy_and_bind (ncb_p np, ncrcmd *src, ncrcmd *dst, int len)
> {
> ncrcmd opcode, new, old, tmp1, tmp2;
> ncrcmd *start, *end;
> @@ -4036,10 +4028,8 @@
> ** Get target set-up from Symbios format NVRAM.
> */
>
> -__initfunc(
> -static void
> - ncr_Symbios_setup_target(ncb_p np, int target, Symbios_nvram *nvram)
> -)
> +static void __init
> +ncr_Symbios_setup_target(ncb_p np, int target, Symbios_nvram *nvram)
> {
> tcb_p tp = &np->target[target];
> Symbios_target *tn = &nvram->target[target];
> @@ -4059,10 +4049,8 @@
> ** Get target set-up from Tekram format NVRAM.
> */
>
> -__initfunc(
> -static void
> - ncr_Tekram_setup_target(ncb_p np, int target, Tekram_nvram *nvram)
> -)
> +static void __init
> +ncr_Tekram_setup_target(ncb_p np, int target, Tekram_nvram *nvram)
> {
> tcb_p tp = &np->target[target];
> struct Tekram_target *tn = &nvram->target[target];
> @@ -4088,9 +4076,7 @@
> }
> #endif /* SCSI_NCR_NVRAM_SUPPORT */
>
> -__initfunc(
> -static int ncr_prepare_setting(ncb_p np, ncr_nvram *nvram)
> -)
> +static int __init ncr_prepare_setting(ncb_p np, ncr_nvram *nvram)
> {
> u_char burst_max;
> u_long period;
> @@ -4372,9 +4358,7 @@
>
> #ifdef SCSI_NCR_DEBUG_NVRAM
>
> -__initfunc(
> -void ncr_display_Symbios_nvram(ncb_p np, Symbios_nvram *nvram)
> -)
> +void __init ncr_display_Symbios_nvram(ncb_p np, Symbios_nvram *nvram)
> {
> int i;
>
> @@ -4404,9 +4388,7 @@
>
> static u_char Tekram_boot_delay[7] __initdata = {3, 5, 10, 20, 30, 60, 120};
>
> -__initfunc(
> -void ncr_display_Tekram_nvram(ncb_p np, Tekram_nvram *nvram)
> -)
> +void __init ncr_display_Tekram_nvram(ncb_p np, Tekram_nvram *nvram)
> {
> int i, tags, boot_delay;
> char *rem;
> @@ -4465,9 +4447,8 @@
> ** start the timer daemon.
> */
>
> -__initfunc(
> -static int ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
> -)
> +static int __init
> +ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
> {
> struct host_data *host_data;
> ncb_p np;
> @@ -8807,9 +8788,7 @@
> */
>
> #ifndef NCR_IOMAPPED
> -__initfunc(
> -static int ncr_regtest (struct ncb* np)
> -)
> +static int __init ncr_regtest (struct ncb* np)
> {
> register volatile u_int32 data;
> /*
> @@ -8833,9 +8812,7 @@
> }
> #endif
>
> -__initfunc(
> -static int ncr_snooptest (struct ncb* np)
> -)
> +static int __init ncr_snooptest (struct ncb* np)
> {
> u_int32 ncr_rd, ncr_wr, ncr_bk, host_rd, host_wr, pc;
> int i, err=0;
> @@ -9098,9 +9075,7 @@
> /*
> * calculate NCR SCSI clock frequency (in KHz)
> */
> -__initfunc(
> -static unsigned ncrgetfreq (ncb_p np, int gen)
> -)
> +static unsigned __init ncrgetfreq (ncb_p np, int gen)
> {
> unsigned ms = 0;
>
> @@ -9148,9 +9123,7 @@
> /*
> * Get/probe NCR SCSI clock frequency
> */
> -__initfunc(
> -static void ncr_getclock (ncb_p np, int mult)
> -)
> +static void __init ncr_getclock (ncb_p np, int mult)
> {
> unsigned char scntl3 = INB(nc_scntl3);
> unsigned char stest1 = INB(nc_stest1);
> @@ -9238,9 +9211,8 @@
> #define ARG_SEP ','
> #endif
>
> -__initfunc(
> -void ncr53c8xx_setup(char *str, int *ints)
> -)
> +
> +void __init ncr53c8xx_setup(char *str, int *ints)
> {
> #ifdef SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT
> char *cur = str;
> @@ -9351,9 +9323,7 @@
> ** Returns the number of boards successfully attached.
> */
>
> -__initfunc(
> -static void ncr_print_driver_setup(void)
> -)
> +static void __init ncr_print_driver_setup(void)
> {
> #define YesNo(y) y ? 'y' : 'n'
> printk ("ncr53c8xx: setup=disc:%c,specf:%d,ultra:%d,tags:%d,sync:%d,"
> @@ -9392,10 +9362,8 @@
> static ushort ncr_chip_ids[] __initdata = SCSI_NCR_CHIP_IDS;
>
> #ifdef SCSI_NCR_NVRAM_SUPPORT
> -__initfunc(
> -static int
> +static int __init
> ncr_attach_using_nvram(Scsi_Host_Template *tpnt, int nvram_index, int count, ncr_device device[])
> -)
> {
> int i, j;
> int attach_count = 0;
> @@ -9476,9 +9444,7 @@
> }
> #endif /* SCSI_NCR_NVRAM_SUPPORT */
>
> -__initfunc(
> -int ncr53c8xx_detect(Scsi_Host_Template *tpnt)
> -)
> +int __init ncr53c8xx_detect(Scsi_Host_Template *tpnt)
> {
> int i, j;
> int chips;
> @@ -9605,44 +9571,16 @@
> ** Return the offset immediately after the base address that has
> ** been read. Btw, we blindly assume that the high 32 bits of 64 bit
> ** base addresses are set to zero on 32 bit architectures.
> +** (the pci generic code now does this for us)
> **
> */
> -#if LINUX_VERSION_CODE <= LinuxVersionCode(2,1,92)
> -__initfunc(
> -static int
> -pci_read_base_address(u_char bus, u_char device_fn, int offset, u_long *base)
> -)
> -{
> - u_int32 tmp;
> -
> - pcibios_read_config_dword(bus, device_fn, offset, &tmp);
> - *base = tmp;
> - offset += sizeof(u_int32);
> - if ((tmp & 0x7) == 0x4) {
> -#if BITS_PER_LONG > 32
> - pcibios_read_config_dword(bus, device_fn, offset, &tmp);
> - *base |= (((u_long)tmp) << 32);
> -#endif
> - offset += sizeof(u_int32);
> - }
> - return offset;
> -}
> -#else /* LINUX_VERSION_CODE > LinuxVersionCode(2,1,92) */
> -__initfunc(
> -static int
> +
> +static int __init
> pci_get_base_address(struct pci_dev *pdev, int index, u_long *base)
> -)
> {
> - *base = pdev->base_address[index++];
> - if ((*base & 0x7) == 0x4) {
> -#if BITS_PER_LONG > 32
> - *base |= (((u_long)pdev->base_address[index]) << 32);
> -#endif
> - ++index;
> - }
> + *base = pdev->resource[++index].start;
> return index;
> }
> -#endif
>
> /*
> ** Read and check the PCI configuration for any detected NCR
> @@ -9650,10 +9588,9 @@
> ** been detected.
> */
>
> -__initfunc(
> -static int ncr53c8xx_pci_init(Scsi_Host_Template *tpnt,
> +
> +static int __init ncr53c8xx_pci_init(Scsi_Host_Template *tpnt,
> uchar bus, uchar device_fn, ncr_device *device)
> -)
> {
> ushort vendor_id, device_id, command;
> uchar cache_line_size, latency_timer;
> @@ -10907,9 +10844,7 @@
> static void nvram_stop(ncr_slot *np, u_char *gpreg);
> static void nvram_setBit(ncr_slot *np, u_char write_bit, u_char *gpreg, int bit_mode);
>
> -__initfunc(
> -static int ncr_get_Symbios_nvram (ncr_slot *np, Symbios_nvram *nvram)
> -)
> +static int __init ncr_get_Symbios_nvram (ncr_slot *np, Symbios_nvram *nvram)
> {
> static u_char Symbios_trailer[6] = {0xfe, 0xfe, 0, 0, 0, 0};
> u_char gpcntl, gpreg;
> @@ -10998,9 +10933,8 @@
> /*
> * Read Symbios NvRAM data and compute checksum.
> */
> -__initfunc(
> -static u_short nvram_read_data(ncr_slot *np, u_char *data, int len, u_char *gpreg, u_char *gpcntl)
> -)
> +static u_short __init nvram_read_data(ncr_slot *np, u_char *data, int len,
> + u_char *gpreg, u_char *gpcntl)
> {
> int x;
> u_short csum;
> @@ -11017,9 +10951,7 @@
> /*
> * Send START condition to NVRAM to wake it up.
> */
> -__initfunc(
> -static void nvram_start(ncr_slot *np, u_char *gpreg)
> -)
> +static void __init nvram_start(ncr_slot *np, u_char *gpreg)
> {
> nvram_setBit(np, 1, gpreg, SET_BIT);
> nvram_setBit(np, 0, gpreg, SET_CLK);
> @@ -11031,9 +10963,9 @@
> * WRITE a byte to the NVRAM and then get an ACK to see it was accepted OK,
> * GPIO0 must already be set as an output
> */
> -__initfunc(
> -static void nvram_write_byte(ncr_slot *np, u_char *ack_data, u_char write_data, u_char *gpreg, u_char *gpcntl)
> -)
> +static void __init nvram_write_byte(ncr_slot *np, u_char *ack_data,
> + u_char write_data, u_char *gpreg,
> + u_char *gpcntl)
> {
> int x;
>
> @@ -11047,9 +10979,9 @@
> * READ a byte from the NVRAM and then send an ACK to say we have got it,
> * GPIO0 must already be set as an input
> */
> -__initfunc(
> -static void nvram_read_byte(ncr_slot *np, u_char *read_data, u_char ack_data, u_char *gpreg, u_char *gpcntl)
> -)
> +static void __init nvram_read_byte(ncr_slot *np, u_char *read_data,
> + u_char ack_data, u_char *gpreg,
> + u_char *gpcntl)
> {
> int x;
> u_char read_bit;
> @@ -11067,9 +10999,8 @@
> * Output an ACK to the NVRAM after reading,
> * change GPIO0 to output and when done back to an input
> */
> -__initfunc(
> -static void nvram_writeAck(ncr_slot *np, u_char write_bit, u_char *gpreg, u_char *gpcntl)
> -)
> +static void __init nvram_writeAck(ncr_slot *np, u_char write_bit,
> + u_char *gpreg, u_char *gpcntl)
> {
> OUTB (nc_gpcntl, *gpcntl & 0xfe);
> nvram_doBit(np, 0, write_bit, gpreg);
> @@ -11080,9 +11011,8 @@
> * Input an ACK from NVRAM after writing,
> * change GPIO0 to input and when done back to an output
> */
> -__initfunc(
> -static void nvram_readAck(ncr_slot *np, u_char *read_bit, u_char *gpreg, u_char *gpcntl)
> -)
> +static void __init nvram_readAck(ncr_slot *np, u_char *read_bit,
> + u_char *gpreg, u_char *gpcntl)
> {
> OUTB (nc_gpcntl, *gpcntl | 0x01);
> nvram_doBit(np, read_bit, 1, gpreg);
> @@ -11093,9 +11023,8 @@
> * Read or write a bit to the NVRAM,
> * read if GPIO0 input else write if GPIO0 output
> */
> -__initfunc(
> -static void nvram_doBit(ncr_slot *np, u_char *read_bit, u_char write_bit, u_char *gpreg)
> -)
> +static void __init nvram_doBit(ncr_slot *np, u_char *read_bit,
> + u_char write_bit, u_char *gpreg)
> {
> nvram_setBit(np, write_bit, gpreg, SET_BIT);
> nvram_setBit(np, 0, gpreg, SET_CLK);
> @@ -11108,9 +11037,7 @@
> /*
> * Send STOP condition to NVRAM - puts NVRAM to sleep... ZZzzzz!!
> */
> -__initfunc(
> -static void nvram_stop(ncr_slot *np, u_char *gpreg)
> -)
> +static void __init nvram_stop(ncr_slot *np, u_char *gpreg)
> {
> nvram_setBit(np, 0, gpreg, SET_CLK);
> nvram_setBit(np, 1, gpreg, SET_BIT);
> @@ -11119,9 +11046,8 @@
> /*
> * Set/clear data/clock bit in GPIO0
> */
> -__initfunc(
> -static void nvram_setBit(ncr_slot *np, u_char write_bit, u_char *gpreg, int bit_mode)
> -)
> +static void __init nvram_setBit(ncr_slot *np, u_char write_bit,
> + u_char *gpreg, int bit_mode)
> {
> UDELAY (5);
> switch (bit_mode){
> @@ -11172,9 +11098,7 @@
> static void Tnvram_Stop(ncr_slot *np, u_char *gpreg);
> static void Tnvram_Clk(ncr_slot *np, u_char *gpreg);
>
> -__initfunc(
> -static int ncr_get_Tekram_nvram (ncr_slot *np, Tekram_nvram *nvram)
> -)
> +static int __init ncr_get_Tekram_nvram (ncr_slot *np, Tekram_nvram *nvram)
> {
> u_char gpcntl, gpreg;
> u_char old_gpcntl, old_gpreg;
> @@ -11209,9 +11133,8 @@
> /*
> * Read Tekram NvRAM data and compute checksum.
> */
> -__initfunc(
> -static u_short Tnvram_read_data(ncr_slot *np, u_short *data, int len, u_char *gpreg)
> -)
> +static u_short __init Tnvram_read_data(ncr_slot *np, u_short *data, int len,
> + u_char *gpreg)
> {
> u_char read_bit;
> u_short csum;
> @@ -11236,9 +11159,8 @@
> /*
> * Send read command and address to NVRAM
> */
> -__initfunc(
> -static void Tnvram_Send_Command(ncr_slot *np, u_short write_data, u_char *read_bit, u_char *gpreg)
> -)
> +static void __init Tnvram_Send_Command(ncr_slot *np, u_short write_data,
> + u_char *read_bit, u_char *gpreg)
> {
> int x;
>
> @@ -11252,9 +11174,8 @@
> /*
> * READ a byte from the NVRAM
> */
> -__initfunc(
> -static void Tnvram_Read_Word(ncr_slot *np, u_short *nvram_data, u_char *gpreg)
> -)
> +static void __init Tnvram_Read_Word(ncr_slot *np, u_short *nvram_data,
> + u_char *gpreg)
> {
> int x;
> u_char read_bit;
> @@ -11273,9 +11194,8 @@
> /*
> * Read bit from NVRAM
> */
> -__initfunc(
> -static void Tnvram_Read_Bit(ncr_slot *np, u_char *read_bit, u_char *gpreg)
> -)
> +static void __init Tnvram_Read_Bit(ncr_slot *np, u_char *read_bit,
> + u_char *gpreg)
> {
> UDELAY (2);
> Tnvram_Clk(np, gpreg);
> @@ -11285,9 +11205,8 @@
> /*
> * Write bit to GPIO0
> */
> -__initfunc(
> -static void Tnvram_Write_Bit(ncr_slot *np, u_char write_bit, u_char *gpreg)
> -)
> +static void __init Tnvram_Write_Bit(ncr_slot *np, u_char write_bit,
> + u_char *gpreg)
> {
> if (write_bit & 0x01)
> *gpreg |= 0x02;
> @@ -11305,9 +11224,7 @@
> /*
> * Send STOP condition to NVRAM - puts NVRAM to sleep... ZZZzzz!!
> */
> -__initfunc(
> -static void Tnvram_Stop(ncr_slot *np, u_char *gpreg)
> -)
> +static void __init Tnvram_Stop(ncr_slot *np, u_char *gpreg)
> {
> *gpreg &= 0xef;
> OUTB (nc_gpreg, *gpreg);
> @@ -11319,9 +11236,7 @@
> /*
> * Pulse clock bit in GPIO0
> */
> -__initfunc(
> -static void Tnvram_Clk(ncr_slot *np, u_char *gpreg)
> -)
> +static void __init Tnvram_Clk(ncr_slot *np, u_char *gpreg)
> {
> OUTB (nc_gpreg, *gpreg | 0x04);
> UDELAY (2);
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/