linux/drivers
Linus Torvalds 8c8def26bf PCI: allow matching of prefetchable resources to non-prefetchable windows
I'm not entirely sure it needs to go into 32, but it's probably the right
thing to do. Another way of explaining the patch is:

 - we currently pick the _first_ exactly matching bus resource entry, but
   the _last_ inexactly matching one. Normally first/last shouldn't
   matter, but bus resource entries aren't actually all created equal: in
   a transparent bus, the last resources will be the parent resources,
   which we should generally try to avoid unless we have no choice. So
   "first matching" is the thing we should always aim for.

 - the patch is a bit bigger than it needs to be, because I simplified the
   logic at the same time. It used to be a fairly incomprehensible

	if ((res->flags & IORESOURCE_PREFETCH) && !(r->flags & IORESOURCE_PREFETCH))
		best = r;       /* Approximating prefetchable by non-prefetchable */

   and technically, all the patch did was to make that complex choice be
   even more complex (it basically added a "&& !best" to say that if we
   already gound a non-prefetchable window for the prefetchable resource,
   then we won't override an earlier one with that later one: remember
   "first matching").

 - So instead of that complex one with three separate conditionals in one,
   I split it up a bit, and am taking advantage of the fact that we
   already handled the exact case, so if 'res->flags' has the PREFETCH
   bit, then we already know that 'r->flags' will _not_ have it. So the
   simplified code drops the redundant test, and does the new '!best' test
   separately. It also uses 'continue' as a way to ignore the bus
   resource we know doesn't work (ie a prefetchable bus resource is _not_
   acceptable for anything but an exact match), so it turns into:

	/* We can't insert a non-prefetch resource inside a prefetchable parent .. */
	if (r->flags & IORESOURCE_PREFETCH)
		continue;
	/* .. but we can put a prefetchable resource inside a non-prefetchable one */
	if (!best)
		best = r;

   instead. With the comments, it's now six lines instead of two, but it's
   conceptually simpler, and I _could_ have written it as two lines:

	if ((res->flags & IORESOURCE_PREFETCH) && !best)
		best = r;	/* Approximating prefetchable by non-prefetchable */

   but I thought that was too damn subtle.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-11-11 08:19:52 +00:00
..
accessibility
acpi PCI: PCIe AER: honor ACPI HEST FIRMWARE FIRST mode 2009-11-04 13:06:25 -08:00
amba
ata sata_via: Remove redundant device ID for VIA VT8261 2009-11-03 14:27:06 -05:00
atm net: Make setsockopt() optlen be unsigned. 2009-09-30 16:12:20 -07:00
auxdisplay
base PM: Remove some debug messages producing too much noise 2009-11-03 11:18:18 +01:00
block xen: move Xen-testing predicates to common header 2009-11-04 08:47:24 -08:00
bluetooth
cdrom
char xen: move Xen-testing predicates to common header 2009-11-04 08:47:24 -08:00
clocksource
connector connector: Fix incompatible pointer type warning 2009-10-06 01:39:51 -07:00
cpufreq
cpuidle cpuidle: always return with interrupts enabled 2009-10-29 07:39:31 -07:00
crypto
dca
dio
dma
edac edac: i5100 fix initialization code 2009-10-29 07:39:30 -07:00
eisa
firewire Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 2009-10-14 15:36:19 -07:00
firmware iSCSI/iBFT: use proper address translation 2009-10-05 12:05:40 -07:00
gpio twl4030-gpio: remove __devexit markings from remove func 2009-10-29 07:39:30 -07:00
gpu Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel 2009-11-04 07:05:43 -08:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2009-10-13 10:10:33 -07:00
hwmon Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2009-10-29 08:14:58 -07:00
i2c i2c-mpc: Do not generate STOP after read. 2009-11-02 23:28:47 +00:00
ide Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6 2009-10-29 09:22:34 -07:00
idle
ieee1394 headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
ieee802154
infiniband headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
input xen: move Xen-testing predicates to common header 2009-11-04 08:47:24 -08:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2009-10-29 09:22:08 -07:00
leds leds: leds-pca9532 - Drop unused module parameters 2009-10-04 22:53:43 +02:00
lguest headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
macintosh powerpc/pmac: Fix issues with sleep on some powerbooks 2009-10-14 16:58:35 +11:00
mca
md Merge branch 'for-linus' of git://neil.brown.name/md 2009-10-31 12:12:19 -07:00
media headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
memstick
message headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
mfd mfd: Do not dereference null pointer in twl4030 error path 2009-10-27 00:20:33 +01:00
misc headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
mmc omap_hsmmc: add missing probe handler hook 2009-10-29 07:39:25 -07:00
mtd UBI: fix check on unsigned long 2009-10-20 10:13:49 +03:00
net xen: move Xen-testing predicates to common header 2009-11-04 08:47:24 -08:00
nubus
of of: Remove nested function 2009-10-15 09:58:27 -06:00
oprofile oprofile: warn on freeing event buffer too early 2009-10-09 21:32:05 +02:00
parisc
parport
pci PCI: allow matching of prefetchable resources to non-prefetchable windows 2009-11-11 08:19:52 +00:00
pcmcia pccard: configure CLS on attach 2009-11-04 08:47:11 -08:00
platform Merge branch 'misc' into release 2009-10-15 00:47:13 -04:00
pnp vsprintf: use %pR, %pr instead of %pRt, %pRf 2009-11-04 13:06:41 -08:00
power
pps
ps3
rapidio
regulator
rtc headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
s390 Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6 2009-10-31 12:14:56 -07:00
sbus
scsi dpt_i2o: Fix typo of EINVAL 2009-10-31 12:11:38 -07:00
serial Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2009-11-03 07:44:01 -08:00
sfi SFI: remove __init from sfi_verify_table 2009-10-03 01:16:12 -04:00
sh
sn
spi ARM: 5741/1: pl022: fix peripheral id for ST vendor 2009-10-05 17:55:55 +01:00
ssb
staging Staging: fix wireless drivers depends 2009-10-30 14:47:44 -07:00
tc
telephony
thermal
uio headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
usb USB: fsl_udc_core: Fix kernel oops on module removal 2009-10-30 14:57:33 -07:00
uwb headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
video xen: move Xen-testing predicates to common header 2009-11-04 08:47:24 -08:00
virtio virtio: order used ring after used index read 2009-10-29 08:50:37 +10:30
vlynq
w1 ds2482: Discard obsolete detect method 2009-10-04 22:53:41 +02:00
watchdog watchdog: Fix rio watchdog probe function 2009-10-14 01:18:26 -07:00
xen xen: move Xen-testing predicates to common header 2009-11-04 08:47:24 -08:00
zorro
Kconfig
Makefile