2002-10-03 22:37:29

by Greg KH

[permalink] [raw]
Subject: [BK PATCH] pcibios_* removals for 2.5.40

Hi,

Here's some changesets that remove the pcibios_find_class(),
pci_find_device(), and pcibios_present() functions. These functions
have been marked as obsolete since the 2.2 kernel, so it's about time
that we removed them.

Please pull from: http://linuxusb.bkbits.net/pci-2.5

thanks,

greg k-h

p.s. I'll send these as patches in response to this email to lkml for
those who want to see them.

drivers/net/hp100.c | 4 ++--
drivers/net/tulip/de4x5.c | 4 ++--
drivers/pci/compat.c | 42 ------------------------------------------
drivers/pci/syscall.c | 2 +-
include/linux/pci.h | 27 ++++++++++-----------------
5 files changed, 15 insertions(+), 64 deletions(-)
-----

[email protected], 2002-10-03 14:06:24-07:00, [email protected]
PCI: removed pcibios_present()

drivers/net/hp100.c | 4 ++--
drivers/net/tulip/de4x5.c | 4 ++--
drivers/pci/compat.c | 8 --------
drivers/pci/syscall.c | 2 +-
include/linux/pci.h | 21 ++++++++++-----------
5 files changed, 15 insertions(+), 24 deletions(-)
------

[email protected], 2002-10-03 13:45:53-07:00, [email protected]
PCI: remove pci_find_device()

drivers/pci/compat.c | 17 -----------------
include/linux/pci.h | 3 ---
2 files changed, 20 deletions(-)
------

[email protected], 2002-10-03 13:36:51-07:00, [email protected]
PCI: remove pcibios_find_class()

drivers/pci/compat.c | 17 -----------------
include/linux/pci.h | 3 ---
2 files changed, 20 deletions(-)
------


2002-10-03 22:38:16

by Greg KH

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.682 -> 1.683
# drivers/pci/compat.c 1.3 -> 1.4
# include/linux/pci.h 1.42 -> 1.43
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/03 [email protected] 1.683
# PCI: remove pcibios_find_class()
# --------------------------------------------
#
diff -Nru a/drivers/pci/compat.c b/drivers/pci/compat.c
--- a/drivers/pci/compat.c Thu Oct 3 14:24:18 2002
+++ b/drivers/pci/compat.c Thu Oct 3 14:24:18 2002
@@ -20,22 +20,6 @@
}

int
-pcibios_find_class(unsigned int class, unsigned short index, unsigned char *bus, unsigned char *devfn)
-{
- const struct pci_dev *dev = NULL;
- int cnt = 0;
-
- while ((dev = pci_find_class(class, dev)))
- if (index == cnt++) {
- *bus = dev->bus->number;
- *devfn = dev->devfn;
- return PCIBIOS_SUCCESSFUL;
- }
- return PCIBIOS_DEVICE_NOT_FOUND;
-}
-
-
-int
pcibios_find_device(unsigned short vendor, unsigned short device, unsigned short index,
unsigned char *bus, unsigned char *devfn)
{
@@ -75,5 +59,4 @@
EXPORT_SYMBOL(pcibios_write_config_byte);
EXPORT_SYMBOL(pcibios_write_config_word);
EXPORT_SYMBOL(pcibios_write_config_dword);
-EXPORT_SYMBOL(pcibios_find_class);
EXPORT_SYMBOL(pcibios_find_device);
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h Thu Oct 3 14:24:18 2002
+++ b/include/linux/pci.h Thu Oct 3 14:24:18 2002
@@ -533,7 +533,6 @@
unsigned char where, unsigned short val);
int pcibios_write_config_dword (unsigned char bus, unsigned char dev_fn,
unsigned char where, unsigned int val);
-int pcibios_find_class (unsigned int class_code, unsigned short index, unsigned char *bus, unsigned char *dev_fn);
int pcibios_find_device (unsigned short vendor, unsigned short dev_id,
unsigned short index, unsigned char *bus,
unsigned char *dev_fn);
@@ -661,8 +660,6 @@

#ifndef CONFIG_PCI
static inline int pcibios_present(void) { return 0; }
-static inline int pcibios_find_class (unsigned int class_code, unsigned short index, unsigned char *bus, unsigned char *dev_fn)
-{ return PCIBIOS_DEVICE_NOT_FOUND; }

#define _PCI_NOP(o,s,t) \
static inline int pcibios_##o##_config_##s (u8 bus, u8 dfn, u8 where, t val) \

2002-10-03 22:38:37

by Greg KH

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.683 -> 1.684
# drivers/pci/compat.c 1.4 -> 1.5
# include/linux/pci.h 1.43 -> 1.44
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/03 [email protected] 1.684
# PCI: remove pci_find_device()
# --------------------------------------------
#
diff -Nru a/drivers/pci/compat.c b/drivers/pci/compat.c
--- a/drivers/pci/compat.c Thu Oct 3 14:24:15 2002
+++ b/drivers/pci/compat.c Thu Oct 3 14:24:15 2002
@@ -19,22 +19,6 @@
return !list_empty(&pci_devices);
}

-int
-pcibios_find_device(unsigned short vendor, unsigned short device, unsigned short index,
- unsigned char *bus, unsigned char *devfn)
-{
- const struct pci_dev *dev = NULL;
- int cnt = 0;
-
- while ((dev = pci_find_device(vendor, device, dev)))
- if (index == cnt++) {
- *bus = dev->bus->number;
- *devfn = dev->devfn;
- return PCIBIOS_SUCCESSFUL;
- }
- return PCIBIOS_DEVICE_NOT_FOUND;
-}
-
#define PCI_OP(rw,size,type) \
int pcibios_##rw##_config_##size (unsigned char bus, unsigned char dev_fn, \
unsigned char where, unsigned type val) \
@@ -59,4 +43,3 @@
EXPORT_SYMBOL(pcibios_write_config_byte);
EXPORT_SYMBOL(pcibios_write_config_word);
EXPORT_SYMBOL(pcibios_write_config_dword);
-EXPORT_SYMBOL(pcibios_find_device);
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h Thu Oct 3 14:24:15 2002
+++ b/include/linux/pci.h Thu Oct 3 14:24:15 2002
@@ -533,9 +533,6 @@
unsigned char where, unsigned short val);
int pcibios_write_config_dword (unsigned char bus, unsigned char dev_fn,
unsigned char where, unsigned int val);
-int pcibios_find_device (unsigned short vendor, unsigned short dev_id,
- unsigned short index, unsigned char *bus,
- unsigned char *dev_fn);

/* Generic PCI functions used internally */

2002-10-03 22:40:19

by Greg KH

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.684 -> 1.685
# drivers/net/tulip/de4x5.c 1.14 -> 1.15
# drivers/pci/syscall.c 1.1 -> 1.2
# drivers/pci/compat.c 1.5 -> 1.6
# drivers/net/hp100.c 1.8 -> 1.9
# include/linux/pci.h 1.44 -> 1.45
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/03 [email protected] 1.685
# PCI: removed pcibios_present()
# --------------------------------------------
#
diff -Nru a/drivers/net/hp100.c b/drivers/net/hp100.c
--- a/drivers/net/hp100.c Thu Oct 3 14:24:12 2002
+++ b/drivers/net/hp100.c Thu Oct 3 14:24:12 2002
@@ -412,7 +412,7 @@
/* First: scan PCI bus(es) */

#ifdef CONFIG_PCI
- if (pcibios_present()) {
+ if (pci_present()) {
int pci_index;
struct pci_dev *pci_dev = NULL;
int pci_id_index;
@@ -2960,7 +2960,7 @@
{
int i, cards;

- if (hp100_port == 0 && !EISA_bus && !pcibios_present())
+ if (hp100_port == 0 && !EISA_bus && !pci_present())
printk("hp100: You should not use auto-probing with insmod!\n");

/* Loop on all possible base addresses */
diff -Nru a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
--- a/drivers/net/tulip/de4x5.c Thu Oct 3 14:24:12 2002
+++ b/drivers/net/tulip/de4x5.c Thu Oct 3 14:24:12 2002
@@ -2190,7 +2190,7 @@

if (lastPCI == NO_MORE_PCI) return;

- if (!pcibios_present()) {
+ if (!pci_present()) {
lastPCI = NO_MORE_PCI;
return; /* No PCI bus in this machine! */
}
@@ -5872,7 +5872,7 @@
if (EISA_signature(name, EISA_ID)) j++;
}
#endif
- if (!pcibios_present()) return j;
+ if (!pci_present()) return j;

for (i=0; (pdev=pci_find_class(class, pdev))!= NULL; i++) {
vendor = pdev->vendor;
diff -Nru a/drivers/pci/compat.c b/drivers/pci/compat.c
--- a/drivers/pci/compat.c Thu Oct 3 14:24:12 2002
+++ b/drivers/pci/compat.c Thu Oct 3 14:24:12 2002
@@ -13,12 +13,6 @@

/* Obsolete functions, these will be going away... */

-int
-pcibios_present(void)
-{
- return !list_empty(&pci_devices);
-}
-
#define PCI_OP(rw,size,type) \
int pcibios_##rw##_config_##size (unsigned char bus, unsigned char dev_fn, \
unsigned char where, unsigned type val) \
@@ -35,8 +29,6 @@
PCI_OP(write, word, short)
PCI_OP(write, dword, int)

-
-EXPORT_SYMBOL(pcibios_present);
EXPORT_SYMBOL(pcibios_read_config_byte);
EXPORT_SYMBOL(pcibios_read_config_word);
EXPORT_SYMBOL(pcibios_read_config_dword);
diff -Nru a/drivers/pci/syscall.c b/drivers/pci/syscall.c
--- a/drivers/pci/syscall.c Thu Oct 3 14:24:12 2002
+++ b/drivers/pci/syscall.c Thu Oct 3 14:24:12 2002
@@ -98,7 +98,7 @@

if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if (!pcibios_present())
+ if (!pci_present())
return -ENOSYS;

dev = pci_find_slot(bus, dfn);
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h Thu Oct 3 14:24:12 2002
+++ b/include/linux/pci.h Thu Oct 3 14:24:12 2002
@@ -322,15 +322,6 @@

#define PCI_ANY_ID (~0)

-#define pci_present pcibios_present
-
-
-#define pci_for_each_dev_reverse(dev) \
- for(dev = pci_dev_g(pci_devices.prev); dev != pci_dev_g(&pci_devices); dev = pci_dev_g(dev->global_list.prev))
-
-#define pci_for_each_bus(bus) \
-for(bus = pci_bus_b(pci_root_buses.next); bus != pci_bus_b(&pci_root_buses); bus = pci_bus_b(bus->node.next))
-
/*
* The pci_dev structure is used to describe both PCI and ISAPnP devices.
*/
@@ -503,8 +494,17 @@
/* these external functions are only available when PCI support is enabled */
#ifdef CONFIG_PCI

+static inline int pci_present(void)
+{
+ return !list_empty(&pci_devices);
+}
+
#define pci_for_each_dev(dev) \
for(dev = pci_dev_g(pci_devices.next); dev != pci_dev_g(&pci_devices); dev = pci_dev_g(dev->global_list.next))
+#define pci_for_each_dev_reverse(dev) \
+ for(dev = pci_dev_g(pci_devices.prev); dev != pci_dev_g(&pci_devices); dev = pci_dev_g(dev->global_list.prev))
+#define pci_for_each_bus(bus) \
+ for(bus = pci_bus_b(pci_root_buses.next); bus != pci_bus_b(&pci_root_buses); bus = pci_bus_b(bus->node.next))

void pcibios_fixup_bus(struct pci_bus *);
int pcibios_enable_device(struct pci_dev *, int mask);
@@ -520,7 +520,6 @@

/* Backward compatibility, don't use in new code! */

-int pcibios_present(void);
int pcibios_read_config_byte (unsigned char bus, unsigned char dev_fn,
unsigned char where, unsigned char *val);
int pcibios_read_config_word (unsigned char bus, unsigned char dev_fn,
@@ -656,7 +655,7 @@
*/

#ifndef CONFIG_PCI
-static inline int pcibios_present(void) { return 0; }
+static inline int pci_present(void) { return 0; }

#define _PCI_NOP(o,s,t) \
static inline int pcibios_##o##_config_##s (u8 bus, u8 dfn, u8 where, t val) \

2002-10-04 16:57:21

by Greg KH

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

On Fri, Oct 04, 2002 at 09:33:08AM -0700, Linus Torvalds wrote:
>
> On Thu, 3 Oct 2002, Greg KH wrote:
> >
> > Here's some changesets that remove the pcibios_find_class(),
> > pci_find_device(), and pcibios_present() functions. These functions
> > have been marked as obsolete since the 2.2 kernel, so it's about time
> > that we removed them.
>
> They are still in use by a lot of drivers..

Not all that many drivers:

pcibios_find_class is used in the following files:
drivers/net/aironet4500_card.c
drivers/net/wan/lmc/lmc_main.c

The lmc driver has only had 1 janitor cleanup in all of 2.5, and the
aironet4500_card driver has had only trivial changes too. But I'll try
to fix them up, if anyone uses them, and I break them, I'm sure I'll
hear about it :)

pcibios_find_device is used in only 11 different drivers. I'll go clean
up those instances too.

And I thought I caught all of the places that pcibios_present() was used
already, but I'll go verify that again.

> I hate to break even more drivers at this point in 2.5.x, and so quite
> frankly I'd rather just do this in early 2.7.x instead. Unless
> somebody really steps up to the plate and also fixes the drivers
> ("it's a ton of fun, and imagine all the adoration you'll get from
> teenage girls/boys/ninja turtles for doing it")

I'll clean them all up and resubmit these changes to you when finished.

thanks,

greg k-h
(who can't wait for the ninja turtles to finally start adoring him!)

2002-10-04 16:25:50

by Linus Torvalds

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40


On Thu, 3 Oct 2002, Greg KH wrote:
>
> Here's some changesets that remove the pcibios_find_class(),
> pci_find_device(), and pcibios_present() functions. These functions
> have been marked as obsolete since the 2.2 kernel, so it's about time
> that we removed them.

They are still in use by a lot of drivers.. I hate to break even more
drivers at this point in 2.5.x, and so quite frankly I'd rather just do
this in early 2.7.x instead. Unless somebody really steps up to the plate
and also fixes the drivers ("it's a ton of fun, and imagine all the
adoration you'll get from teenage girls/boys/ninja turtles for doing it")

Linus

2002-10-04 17:25:44

by Linus Torvalds

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40


On 4 Oct 2002, Alan Cox wrote:
>
> Ermm Greg fixed the drivers using it too.

Ehhmm... The patch description says "remove pci_find_device()", which is
used all over the map and isn't even deprecated (even though it probably
should be, and people should just register their drivers correctly).

The actual patches themselves actually remove pcibios_find_device(), which
_is_ deprecated. But it's still used in a number of drivers. And no, Greg
did _not_ fix them up - do a simple grep if you don't believe me.

Linus

2002-10-04 16:40:07

by Alan

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

On Fri, 2002-10-04 at 17:33, Linus Torvalds wrote:
> They are still in use by a lot of drivers.. I hate to break even more
> drivers at this point in 2.5.x, and so quite frankly I'd rather just do
> this in early 2.7.x instead. Unless somebody really steps up to the plate
> and also fixes the drivers ("it's a ton of fun, and imagine all the
> adoration you'll get from teenage girls/boys/ninja turtles for doing it")

Ermm Greg fixed the drivers using it too.

Alan

2002-10-04 17:16:23

by Alan

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

On Fri, 2002-10-04 at 17:59, Greg KH wrote:
> greg k-h
> (who can't wait for the ninja turtles to finally start adoring him!)

You clean the drivers up and I'll buy you a chocolate and marshmallow
pizza next time we meet

2002-10-04 17:58:46

by Greg KH

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

On Fri, Oct 04, 2002 at 10:30:41AM -0700, Linus Torvalds wrote:
>
> On 4 Oct 2002, Alan Cox wrote:
> >
> > Ermm Greg fixed the drivers using it too.
>
> Ehhmm... The patch description says "remove pci_find_device()", which is
> used all over the map and isn't even deprecated (even though it probably
> should be, and people should just register their drivers correctly).

Argh, that's a typo. It should say:
"remove pcibios_find_device()"
as that's what I did.

That function has been depreciated for some time. I did look into
trying to get rid of pci_find_device() but that's just too much work to
do right now (and there are a few places in the kernel that seem to
really need to use that function, as there's no other way to do some
fixups.)

So yes, removing pci_find_device() should be a 2.7 thing, not a 2.5
thing.

thanks,

greg k-h

2002-10-04 17:58:49

by Jeff Garzik

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

Linus Torvalds wrote:
> On Thu, 3 Oct 2002, Greg KH wrote:
>
>>Here's some changesets that remove the pcibios_find_class(),
>>pci_find_device(), and pcibios_present() functions. These functions
>>have been marked as obsolete since the 2.2 kernel, so it's about time
>>that we removed them.
>
>
> They are still in use by a lot of drivers.. I hate to break even more
> drivers at this point in 2.5.x, and so quite frankly I'd rather just do
> this in early 2.7.x instead. Unless somebody really steps up to the plate
> and also fixes the drivers ("it's a ton of fun, and imagine all the
> adoration you'll get from teenage girls/boys/ninja turtles for doing it")


Removing pcibios_present() makes a lot of sense, I have considered it
deprecated for quite a while now.

Further (more a note to Greg), often the pci[bios]_present() call can be
removed completely: when it is followed by a pci_find_xxx or
pci_register_driver() probe, which will obviously not find anything if
PCI bus is absent, the pci_present() call can be removed completely.

I would love to deprecate pcibios_{read,write}_foo but I don't think we
can remove them yet. Likewise for pcibios_find_xxx... I haven't look at
all the examples, but I would be worried about breaking ancient (but
working) code.

That said, if you wanna do the cleanup, I wouldn't object to removing
pcibios_find_xxx...

Jeff


2002-10-04 18:01:50

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

Em Fri, Oct 04, 2002 at 06:28:38PM +0100, Alan Cox escreveu:
> On Fri, 2002-10-04 at 17:59, Greg KH wrote:
> > greg k-h
> > (who can't wait for the ninja turtles to finally start adoring him!)
>
> You clean the drivers up and I'll buy you a chocolate and marshmallow
> pizza next time we meet

Hey, I'll use this to bait janitors for working on ACPI and ATM 8)
The "ninja turtle" thing is way cool too, I'll use that as well.

- Arnaldo

2002-10-04 20:49:51

by Greg KH

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.674.3.3 -> 1.674.3.4
# drivers/char/rocket.c 1.12 -> 1.13
# drivers/scsi/inia100.c 1.10 -> 1.11
# drivers/sbus/sbus.c 1.15 -> 1.16
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/04 [email protected] 1.674.3.4
# PCI: fixed remaining usages of pcibios_present() that I missed previously.
# --------------------------------------------
#
diff -Nru a/drivers/char/rocket.c b/drivers/char/rocket.c
--- a/drivers/char/rocket.c Fri Oct 4 13:47:29 2002
+++ b/drivers/char/rocket.c Fri Oct 4 13:47:29 2002
@@ -1993,7 +1993,7 @@
isa_boards_found++;
}
#ifdef CONFIG_PCI
- if (pcibios_present()) {
+ if (pci_present()) {
if(isa_boards_found < NUM_BOARDS)
pci_boards_found = init_PCI(isa_boards_found);
} else {
diff -Nru a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c
--- a/drivers/sbus/sbus.c Fri Oct 4 13:47:29 2002
+++ b/drivers/sbus/sbus.c Fri Oct 4 13:47:29 2002
@@ -312,7 +312,7 @@
nd = prom_searchsiblings(topnd, "sbus");
if(nd == 0) {
#ifdef CONFIG_PCI
- if (!pcibios_present()) {
+ if (!pci_present()) {
prom_printf("Neither SBUS nor PCI found.\n");
prom_halt();
} else {
diff -Nru a/drivers/scsi/inia100.c b/drivers/scsi/inia100.c
--- a/drivers/scsi/inia100.c Fri Oct 4 13:47:29 2002
+++ b/drivers/scsi/inia100.c Fri Oct 4 13:47:29 2002
@@ -208,7 +208,7 @@
/*
* PCI-bus probe.
*/
- if (pcibios_present()) {
+ if (pci_present()) {
/*
* Note: I removed the struct pci_device_list stuff since this
* driver only cares about one device ID. If that changes in

2002-10-04 20:48:50

by Greg KH

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

Hm, looks like Alan owes me a yummy pizza now...

It wasn't that hard to fix up the remaining drivers that used these
functions, here's some changesets that fix up all of the drivers except
two of them.

Please pull from: http://linuxusb.bkbits.net/pci-2.5

Here's a summary of the status of these pcibios functions after applying
these changesets:

pcibios_present()
- shows up in a grep in the following files:
drivers/char/ip2main.c
drivers/net/wan/lmc/lmc_ver.h
drivers/net/wan/sdladrv.c
drivers/scsi/gdth.c
drivers/scsi/megaraid.c
drivers/scsi/qla1280.c
drivers/scsi/sym53c8xx.c
drivers/scsi/sym53c8xx_comm.h
drivers/scsi/tmscsim.c
include/linux/compatmac.h
Every one of these instances are for backwards compatibility with
older kernel versions and will not be used when building for 2.5

pcibios_find_class()
- completely gone from the 2.5 tree.

pcibios_find_device()
- the following drivers use it for when they are compiled for older
kernels:
drivers/scsi/sym53c8xx.c
drivers/scsi/sym53c8xx_comm.h
drivers/char/ip2main.c
drivers/char/rio/rio_linux.c
drivers/char/sx.c
drivers/net/wan/sdladrv.c
drivers/scsi/gdth.c
drivers/scsi/megaraid.c
drivers/scsi/tmscsim.c
So these instances are safe.

I did not fix up the following two drivers:
drivers/char/rocket.c
This driver does not build at all right now for 2.5 due
to cli() and other assorted api changes over time in
2.5. Also, the PCI probe logic seems very fragile, and
I do not want to disturb the current sequence without
fully knowing what the correct board type and number
sequence should be.
drivers/isdn/eicon/lincfg.c
Again the probe sequence seems touchy, and Kai (the ISDN
maintainer) said he would fix it up properly once these
patches were accepted.


So the only thing that is broken after these changesets is one isdn
driver (which will be soon fixed by the maintainer), and the rocket.c
driver, which was broken before these changesets :)

Please apply.

Sorry about the one misleading changeset comment, I couldn't figure out
how to go back and change it, and if you really object to it, I'll
rebuild the tree from scratch with it corrected.

thanks,

greg k-h

p.s. I'll send the changesets that I've added since the last set as patches in
response to this email to lkml for those who want to see them.

drivers/char/rocket.c | 2 -
drivers/net/aironet4500_card.c | 43 +++++++++++------------------------------
drivers/net/hp100.c | 4 +--
drivers/net/tulip/de4x5.c | 4 +--
drivers/net/wan/lmc/lmc_main.c | 18 +----------------
drivers/pci/compat.c | 42 ----------------------------------------
drivers/pci/syscall.c | 2 -
drivers/sbus/sbus.c | 2 -
drivers/scsi/53c7,8xx.c | 13 ++++--------
drivers/scsi/inia100.c | 2 -
include/linux/pci.h | 27 +++++++++----------------
11 files changed, 37 insertions(+), 122 deletions(-)
-----

[email protected], 2002-10-04 12:49:31-07:00, [email protected]
PCI: remove pcibios_find_device() from the 53c7,8xx.c SCSI driver

drivers/scsi/53c7,8xx.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
------

[email protected], 2002-10-04 11:41:16-07:00, [email protected]
PCI: remove usages of pcibios_find_class()

drivers/net/aironet4500_card.c | 43 +++++++++++------------------------------
drivers/net/wan/lmc/lmc_main.c | 18 +----------------
2 files changed, 14 insertions(+), 47 deletions(-)
------

[email protected], 2002-10-04 10:28:07-07:00, [email protected]
PCI: fixed remaining usages of pcibios_present() that I missed previously.

drivers/char/rocket.c | 2 +-
drivers/sbus/sbus.c | 2 +-
drivers/scsi/inia100.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
------

[email protected], 2002-10-03 14:06:24-07:00, [email protected]
PCI: removed pcibios_present()

drivers/net/hp100.c | 4 ++--
drivers/net/tulip/de4x5.c | 4 ++--
drivers/pci/compat.c | 8 --------
drivers/pci/syscall.c | 2 +-
include/linux/pci.h | 21 ++++++++++-----------
5 files changed, 15 insertions(+), 24 deletions(-)
------

[email protected], 2002-10-03 13:45:53-07:00, [email protected]
PCI: remove pci_find_device()

drivers/pci/compat.c | 17 -----------------
include/linux/pci.h | 3 ---
2 files changed, 20 deletions(-)
------

[email protected], 2002-10-03 13:36:51-07:00, [email protected]
PCI: remove pcibios_find_class()

drivers/pci/compat.c | 17 -----------------
include/linux/pci.h | 3 ---
2 files changed, 20 deletions(-)
------

2002-10-04 20:51:24

by Greg KH

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.674.3.4 -> 1.674.3.5
# drivers/net/wan/lmc/lmc_main.c 1.8 -> 1.9
# drivers/net/aironet4500_card.c 1.9 -> 1.10
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/04 [email protected] 1.674.3.5
# PCI: remove usages of pcibios_find_class()
# --------------------------------------------
#
diff -Nru a/drivers/net/aironet4500_card.c b/drivers/net/aironet4500_card.c
--- a/drivers/net/aironet4500_card.c Fri Oct 4 13:47:26 2002
+++ b/drivers/net/aironet4500_card.c Fri Oct 4 13:47:26 2002
@@ -70,9 +70,6 @@
MODULE_LICENSE("GPL");


-static int reverse_probe;
-
-
static int awc_pci_init(struct net_device * dev, struct pci_dev *pdev,
int ioaddr, int cis_addr, int mem_addr,u8 pci_irq_line) ;

@@ -80,38 +77,29 @@
int awc4500_pci_probe(struct net_device *dev)
{
int cards_found = 0;
- static int pci_index; /* Static, for multiple probe calls. */
u8 pci_irq_line = 0;
// int p;
-
- unsigned char awc_pci_dev, awc_pci_bus;
-
+ struct pci_dev *pdev = NULL;
+
if (!pci_present())
return -1;

- for (;pci_index < 0xff; pci_index++) {
- u16 vendor, device, pci_command, new_command;
+ while ((pdev = pci_find_class (PCI_CLASS_NETWORK_OTHER << 8, pdev))) {
+ u16 pci_command, new_command;
u32 pci_memaddr;
u32 pci_ioaddr;
u32 pci_cisaddr;
- struct pci_dev *pdev;

- if (pcibios_find_class (PCI_CLASS_NETWORK_OTHER << 8,
- reverse_probe ? 0xfe - pci_index : pci_index,
- &awc_pci_bus, &awc_pci_dev) != PCIBIOS_SUCCESSFUL){
- if (reverse_probe){
- continue;
- } else {
- break;
- }
- }
- pdev = pci_find_slot(awc_pci_bus, awc_pci_dev);
- if (!pdev)
+ if (pdev->vendor != PCI_VENDOR_ID_AIRONET)
+ continue;
+ if ((pdev->device != PCI_DEVICE_AIRONET_4800_1) &&
+ (pdev->device != PCI_DEVICE_AIRONET_4800) &&
+ (pdev->device != PCI_DEVICE_AIRONET_4500))
continue;
+
if (pci_enable_device(pdev))
continue;
- vendor = pdev->vendor;
- device = pdev->device;
+
pci_irq_line = pdev->irq;
pci_memaddr = pci_resource_start (pdev, 0);
pci_cisaddr = pci_resource_start (pdev, 1);
@@ -120,13 +108,6 @@
// printk("\n pci capabilities %x and ptr %x \n",pci_caps,pci_caps_ptr);
/* Remove I/O space marker in bit 0. */

- if (vendor != PCI_VENDOR_ID_AIRONET)
- continue;
- if (device != PCI_DEVICE_AIRONET_4800_1 &&
- device != PCI_DEVICE_AIRONET_4800 &&
- device != PCI_DEVICE_AIRONET_4500 )
- continue;
-
// if (check_region(pci_ioaddr, AIRONET4X00_IO_SIZE) ||
// check_region(pci_cisaddr, AIRONET4X00_CIS_SIZE) ||
// check_region(pci_memaddr, AIRONET4X00_MEM_SIZE)) {
@@ -151,7 +132,7 @@

udelay(1000);
*/
- if (device == PCI_DEVICE_AIRONET_4800)
+ if (pdev->device == PCI_DEVICE_AIRONET_4800)
pci_write_config_dword(pdev, 0x40, 0x40000000);

if (awc_pci_init(dev, pdev, pci_ioaddr,pci_cisaddr,pci_memaddr,pci_irq_line)){
diff -Nru a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
--- a/drivers/net/wan/lmc/lmc_main.c Fri Oct 4 13:47:26 2002
+++ b/drivers/net/wan/lmc/lmc_main.c Fri Oct 4 13:47:26 2002
@@ -1045,8 +1045,8 @@
unsigned int pci_irq_line;
u16 vendor, subvendor, device, subdevice;
u32 foundaddr = 0;
- unsigned char pci_bus, pci_device_fn;
u8 intcf = 0;
+ struct pci_dev *pdev = NULL;

/* The card is only available on PCI, so if we don't have a
* PCI bus, we are in trouble.
@@ -1057,21 +1057,7 @@
return -1;
}
/* Loop basically until we don't find anymore. */
- while (pci_index < 0xff){
- struct pci_dev *pdev;
- /* The tulip is considered an ethernet class of card... */
- if (pcibios_find_class (PCI_CLASS_NETWORK_ETHERNET << 8,
- pci_index, &pci_bus,
- &pci_device_fn) != PCIBIOS_SUCCESSFUL) {
- /* No card found on this pass */
- break;
- }
- /* Read the info we need to determine if this is
- * our card or not
- */
- pdev = pci_find_slot (pci_bus, pci_device_fn);
- if (!pdev) break;
-
+ while ((pdev = pci_find_class (PCI_CLASS_NETWORK_ETHERNET << 8, pdev))) {
if (pci_enable_device(pdev))
break;

2002-10-04 20:52:06

by Greg KH

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.674.3.5 -> 1.674.3.6
# drivers/scsi/53c7,8xx.c 1.11 -> 1.12
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/04 [email protected] 1.674.3.6
# PCI: remove pcibios_find_device() from the 53c7,8xx.c SCSI driver
# --------------------------------------------
#
diff -Nru a/drivers/scsi/53c7,8xx.c b/drivers/scsi/53c7,8xx.c
--- a/drivers/scsi/53c7,8xx.c Fri Oct 4 13:47:23 2002
+++ b/drivers/scsi/53c7,8xx.c Fri Oct 4 13:47:23 2002
@@ -1533,8 +1533,7 @@
int i;
int current_override;
int count; /* Number of boards detected */
- unsigned char pci_bus, pci_device_fn;
- static short pci_index=0; /* Device index to PCI BIOS calls */
+ struct pci_dev *pdev = NULL;

tpnt->proc_name = "ncr53c7xx";

@@ -1563,13 +1562,11 @@

if (pci_present()) {
for (i = 0; i < NPCI_CHIP_IDS; ++i)
- for (pci_index = 0;
- !pcibios_find_device (PCI_VENDOR_ID_NCR,
- pci_chip_ids[i].pci_device_id, pci_index, &pci_bus,
- &pci_device_fn);
- ++pci_index)
+ while ((pdev = pci_find_device (PCI_VENDOR_ID_NCR,
+ pci_chip_ids[i].pci_device_id,
+ pdev)))
if (!ncr_pci_init (tpnt, BOARD_GENERIC, pci_chip_ids[i].chip,
- pci_bus, pci_device_fn, /* no options */ 0))
+ pdev->bus->number, pdev->devfn, /* no options */ 0))
++count;
}
return count;

2002-10-04 21:31:48

by Jeff Garzik

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

Greg KH wrote:
> diff -Nru a/drivers/net/aironet4500_card.c b/drivers/net/aironet4500_card.c
> --- a/drivers/net/aironet4500_card.c Fri Oct 4 13:47:26 2002
> +++ b/drivers/net/aironet4500_card.c Fri Oct 4 13:47:26 2002
> @@ -80,38 +77,29 @@
> int awc4500_pci_probe(struct net_device *dev)
> {
> int cards_found = 0;
> - static int pci_index; /* Static, for multiple probe calls. */
> u8 pci_irq_line = 0;
> // int p;
> -
> - unsigned char awc_pci_dev, awc_pci_bus;
> -
> + struct pci_dev *pdev = NULL;
> +
> if (!pci_present())
> return -1;

pci_present can be eliminated



2002-10-04 21:29:39

by Jeff Garzik

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

Greg KH wrote:
> @@ -1563,13 +1562,11 @@
>
> if (pci_present()) {

an example of pci_present() that can be eliminated, as I described earlier


> for (i = 0; i < NPCI_CHIP_IDS; ++i)
> - for (pci_index = 0;
> - !pcibios_find_device (PCI_VENDOR_ID_NCR,
> - pci_chip_ids[i].pci_device_id, pci_index, &pci_bus,
> - &pci_device_fn);
> - ++pci_index)
> + while ((pdev = pci_find_device (PCI_VENDOR_ID_NCR,
> + pci_chip_ids[i].pci_device_id,
> + pdev)))
> if (!ncr_pci_init (tpnt, BOARD_GENERIC, pci_chip_ids[i].chip,
> - pci_bus, pci_device_fn, /* no options */ 0))
> + pdev->bus->number, pdev->devfn, /* no options */ 0))


can you eliminate the need of ncr_pci_init to have number/devfn args?


2002-10-04 21:49:54

by Greg KH

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

On Fri, Oct 04, 2002 at 05:34:40PM -0400, Jeff Garzik wrote:
> Greg KH wrote:
> >@@ -1563,13 +1562,11 @@
> >
> > if (pci_present()) {
>
> an example of pci_present() that can be eliminated, as I described earlier

I agree I could have done more invasive work on these drivers, they sure
need it :)

But I was going for a minimal set of patches to remove the pcibios_*
functions and still let things work.

> > for (i = 0; i < NPCI_CHIP_IDS; ++i)
> >- for (pci_index = 0;
> >- !pcibios_find_device (PCI_VENDOR_ID_NCR,
> >- pci_chip_ids[i].pci_device_id, pci_index, &pci_bus,
> >- &pci_device_fn);
> >- ++pci_index)
> >+ while ((pdev = pci_find_device (PCI_VENDOR_ID_NCR,
> >+ pci_chip_ids[i].pci_device_id,
> >+ pdev)))
> > if (!ncr_pci_init (tpnt, BOARD_GENERIC,
> > pci_chip_ids[i].chip, - pci_bus, pci_device_fn, /* no
> >options */ 0))
> >+ pdev->bus->number, pdev->devfn, /* no options */ 0))
>
>
> can you eliminate the need of ncr_pci_init to have number/devfn args?

No, it wouldn't be that easy, as that function is called from other
places. That driver needs some major work, as it still is not converted
over to the proper DMA fixes that went into the tree a long time ago.

thanks,

greg k-h

2002-10-04 21:35:16

by Jeff Garzik

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

Greg KH wrote:
> # This is a BitKeeper generated patch for the following project:
> # Project Name: Linux kernel tree
> # This patch format is intended for GNU patch command version 2.5 or higher.
> # This patch includes the following deltas:
> # ChangeSet 1.674.3.3 -> 1.674.3.4
> # drivers/char/rocket.c 1.12 -> 1.13
> # drivers/scsi/inia100.c 1.10 -> 1.11
> # drivers/sbus/sbus.c 1.15 -> 1.16
> #
> # The following is the BitKeeper ChangeSet Log
> # --------------------------------------------
> # 02/10/04 [email protected] 1.674.3.4
> # PCI: fixed remaining usages of pcibios_present() that I missed previously.
> # --------------------------------------------
> #
> diff -Nru a/drivers/char/rocket.c b/drivers/char/rocket.c
> --- a/drivers/char/rocket.c Fri Oct 4 13:47:29 2002
> +++ b/drivers/char/rocket.c Fri Oct 4 13:47:29 2002
> @@ -1993,7 +1993,7 @@
> isa_boards_found++;
> }
> #ifdef CONFIG_PCI
> - if (pcibios_present()) {
> + if (pci_present()) {
> if(isa_boards_found < NUM_BOARDS)
> pci_boards_found = init_PCI(isa_boards_found);
> } else {

can be greatly simplified -- just simply all the code in the ifdef to
"if (isa_boards_found...) ...init_PCI..."


> diff -Nru a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c
> --- a/drivers/sbus/sbus.c Fri Oct 4 13:47:29 2002
> +++ b/drivers/sbus/sbus.c Fri Oct 4 13:47:29 2002
> @@ -312,7 +312,7 @@
> nd = prom_searchsiblings(topnd, "sbus");
> if(nd == 0) {
> #ifdef CONFIG_PCI
> - if (!pcibios_present()) {
> + if (!pci_present()) {
> prom_printf("Neither SBUS nor PCI found.\n");
> prom_halt();
> } else {

I wonder if this is intentional arch code should not be changed... David?


> diff -Nru a/drivers/scsi/inia100.c b/drivers/scsi/inia100.c
> --- a/drivers/scsi/inia100.c Fri Oct 4 13:47:29 2002
> +++ b/drivers/scsi/inia100.c Fri Oct 4 13:47:29 2002
> @@ -208,7 +208,7 @@
> /*
> * PCI-bus probe.
> */
> - if (pcibios_present()) {
> + if (pci_present()) {

test looks like it can be eliminated completely

2002-10-04 21:51:17

by Greg KH

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

On Fri, Oct 04, 2002 at 05:40:07PM -0400, Jeff Garzik wrote:
> >diff -Nru a/drivers/char/rocket.c b/drivers/char/rocket.c
> >--- a/drivers/char/rocket.c Fri Oct 4 13:47:29 2002
> >+++ b/drivers/char/rocket.c Fri Oct 4 13:47:29 2002
> >@@ -1993,7 +1993,7 @@
> > isa_boards_found++;
> > }
> > #ifdef CONFIG_PCI
> >- if (pcibios_present()) {
> >+ if (pci_present()) {
> > if(isa_boards_found < NUM_BOARDS)
> > pci_boards_found = init_PCI(isa_boards_found);
> > } else {
>
> can be greatly simplified -- just simply all the code in the ifdef to
> "if (isa_boards_found...) ...init_PCI..."

Heh, again, this driver needs some major work in regards to PCI
cleanups, it's quite old. It can probably be converted over to use the
drivers/serial core too.

thanks,

greg k-h

2002-10-04 22:09:03

by Russell King

[permalink] [raw]
Subject: Re: [BK PATCH] pcibios_* removals for 2.5.40

On Fri, Oct 04, 2002 at 02:53:51PM -0700, Greg KH wrote:
> Heh, again, this driver needs some major work in regards to PCI
> cleanups, it's quite old. It can probably be converted over to use the
> drivers/serial core too.

I have a version of this which is mostly converted; its pending me fixing
the write() method in the core driver.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html