PATCH: PCI fixes for 2.3.38

From: Martin Mares (mj@ucw.cz)
Date: Sat Jan 08 2000 - 12:51:35 EST


Hi Linus!

Here are several PCI related fixes for 2.3.38:

o We forgot to initialize the device list in struct pci_bus when
   allocating a new ISAPNP card. This probably caused the oops ISAPNP
   users were seeing. Fixed.
o Since introduction of ISAPNP quirks, ISAPNP never compiled as a module.
   I've modified the makefile to link all the parts to single object file
   and also killed the #include "isapnp_proc.c" hack.
o Ported my previous isapnp_proc fixes.
o Fix to the cy82x693 fix (by Russell King).

                                        Have a nice day
                                                                Martin

--- include/linux/isapnp.h.mj Sat Jan 8 18:27:18 2000
+++ include/linux/isapnp.h Sat Jan 8 18:37:23 2000
@@ -146,6 +146,8 @@
 void isapnp_deactivate(unsigned char device);
 void isapnp_fixup_device(struct pci_dev *dev);
 void *isapnp_alloc(long size);
+int isapnp_proc_init(void);
+int isapnp_proc_done(void);
 /* manager */
 struct pci_bus *isapnp_find_card(unsigned short vendor,
                                  unsigned short device,
@@ -160,6 +162,14 @@
                             unsigned long size);
 /* init/main.c */
 int isapnp_init(void);
+
+extern struct list_head isapnp_cards;
+extern struct list_head isapnp_devices;
+
+#define isapnp_for_each_card(card) \
+ for(card = pci_bus_b(isapnp_cards.next); card != pci_bus_b(&isapnp_cards); card = pci_bus_b(card->node.next))
+#define isapnp_for_each_dev(dev) \
+ for(dev = pci_dev_g(isapnp_devices.next); dev != pci_dev_g(&isapnp_devices); dev = pci_dev_g(dev->global_list.next))
 
 #else /* !CONFIG_ISAPNP */
 
--- drivers/block/cy82c693.c.mj Sat Jan 8 18:04:20 2000
+++ drivers/block/cy82c693.c Sat Jan 8 18:04:20 2000
@@ -275,9 +275,9 @@
 
         /* select primary or secondary channel */
         if (hwif->index > 0) { /* drive is on the secondary channel */
- dev = pci_find_slot(dev, dev->devfn+1);
+ dev = pci_find_slot(dev->bus->number, dev->devfn+1);
                 if (!dev) {
- printk(KERN_ERR "%s: tune_drive: Cannot find secondary interface!\n");
+ printk(KERN_ERR "%s: tune_drive: Cannot find secondary interface!\n", drive->name);
                         return;
                 }
         }
--- drivers/pnp/isapnp_proc.c.mj Sat Jan 8 17:56:12 2000
+++ drivers/pnp/isapnp_proc.c Sat Jan 8 18:34:44 2000
@@ -19,6 +19,17 @@
  *
  */
 
+#define __NO_VERSION__
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/proc_fs.h>
+#include <linux/poll.h>
+#include <linux/vmalloc.h>
+#include <asm/uaccess.h>
+#include <linux/isapnp.h>
+
 struct isapnp_info_buffer {
         char *buffer; /* pointer to begin of buffer */
         char *curr; /* current position in buffer */
@@ -208,7 +219,7 @@
         &isapnp_info_entry_operations, /* default sound info directory file-ops */
 };
 
-static int __init isapnp_proc_init(void)
+int __init isapnp_proc_init(void)
 {
         struct proc_dir_entry *p;
 
@@ -222,7 +233,7 @@
 }
 
 #ifdef MODULE
-static int isapnp_proc_done(void)
+int isapnp_proc_done(void)
 {
         if (isapnp_proc_entry)
                 remove_proc_entry("isapnp",&proc_root);
@@ -533,10 +544,9 @@
  
 static void isapnp_info_read(isapnp_info_buffer_t *buffer)
 {
- struct list_head *card_list;
-
- for (card_list = isapnp_cards.next; card_list != &isapnp_cards; card_list = card_list->next) {
- struct pci_bus *card = list_entry(card_list, struct pci_bus, node);
+ struct pci_bus *card;
+
+ isapnp_for_each_card(card) {
                 struct list_head *dev_list;
 
                 isapnp_printf(buffer, "Card %i '", card->number);
@@ -547,10 +557,8 @@
                 if (card->productver)
                         isapnp_printf(buffer, " Product version %x.%x", card->productver >> 4, card->productver & 0x0f);
                 isapnp_printf(buffer,"\n");
- for (dev_list = card->devices.next; dev_list != &card->devices; dev_list = dev_list->next) {
- struct pci_dev *dev = list_entry(dev_list, struct pci_dev, bus_list);
- isapnp_print_device(buffer, dev);
- }
+ for (dev_list = card->devices.next; dev_list != &card->devices; dev_list = dev_list->next)
+ isapnp_print_device(buffer, pci_dev_b(dev_list));
         }
 }
 
@@ -644,12 +652,13 @@
         isapnp_info_device = NULL;
         isapnp_get_str(index, line, sizeof(index));
         csn = simple_strtoul(index, NULL, 0);
+
         for (list = isapnp_cards.next; list != &isapnp_cards; list = list->next) {
- isapnp_info_card = list_entry(list, struct pci_bus, node);
+ isapnp_info_card = pci_bus_b(list);
                 if (isapnp_info_card->number == csn)
                         break;
         }
- if (isapnp_info_card == NULL) {
+ if (list == &isapnp_cards) {
                 printk("isapnp: cannot find CSN %i\n", csn);
                 return 1;
         }
--- drivers/pnp/isapnp.c.mj Sat Jan 8 18:13:31 2000
+++ drivers/pnp/isapnp.c Sat Jan 8 18:32:56 2000
@@ -30,31 +30,17 @@
 #include <linux/ioport.h>
 #include <linux/string.h>
 #include <linux/malloc.h>
-#include <linux/proc_fs.h>
 #include <linux/delay.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <asm/irq.h>
 #include <linux/pci.h>
-#include <linux/vmalloc.h>
-#include <linux/poll.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
 #include <linux/isapnp.h>
 
 LIST_HEAD(isapnp_cards);
 LIST_HEAD(isapnp_devices);
 
-#define isapnp_for_each_card(card) \
- for(card = pci_bus_b(isapnp_cards.next); card != pci_bus_b(&isapnp_cards); card = pci_bus_b(card->node.next))
-#define isapnp_for_each_dev(dev) \
- for(dev = pci_dev_g(isapnp_devices.next); dev != pci_dev_g(&isapnp_devices); dev = pci_dev_g(dev->global_list.next))
-
-
-#ifdef CONFIG_PROC_FS
-#include "isapnp_proc.c"
-#endif
-
 #if 0
 #define ISAPNP_REGION_OK
 #endif
@@ -1000,6 +986,7 @@
                 if (isapnp_checksum_value != 0x00)
                         printk("isapnp: checksum for device %i is not valid (0x%x)\n", csn, isapnp_checksum_value);
                 card->checksum = isapnp_checksum_value;
+ INIT_LIST_HEAD(&card->devices);
 
                 list_add_tail(&card->node, &isapnp_cards);
         }
--- drivers/pnp/Makefile.mj Sat Jan 8 18:25:36 2000
+++ drivers/pnp/Makefile Sat Jan 8 18:26:25 2000
@@ -12,18 +12,16 @@
 MOD_SUB_DIRS := $(SUB_DIRS)
 ALL_SUB_DIRS := $(SUB_DIRS)
 
-L_TARGET := pnp.a
-MX_OBJS :=
-LX_OBJS :=
-MI_OBJS :=
-MIX_OBJS :=
+ifeq ($(CONFIG_ISAPNP),m)
+M_OBJS := isa-pnp.o
+endif
 
-ifeq ($(CONFIG_ISAPNP),y)
- LX_OBJS += isapnp.o quirks.o
-else
- ifeq ($(CONFIG_ISAPNP),m)
- MX_OBJS += isapnp.o quirks.o
- endif
+O_TARGET := isa-pnp.o
+OX_OBJS := isapnp.o
+O_OBJS := quirks.o
+
+ifdef CONFIG_PROC_FS
+O_OBJS += isapnp_proc.o
 endif
 
 include $(TOPDIR)/Rules.make
--- Makefile.mj Sat Jan 8 18:24:47 2000
+++ Makefile Sat Jan 8 18:24:47 2000
@@ -203,7 +203,7 @@
 endif
 
 ifeq ($(CONFIG_PNP),y)
-DRIVERS := $(DRIVERS) drivers/pnp/pnp.a
+DRIVERS := $(DRIVERS) drivers/pnp/isa-pnp.o
 endif
 
 ifdef CONFIG_SGI

-
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/



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:12 EST