2000-12-11 17:06:13

by Jani Monoses

[permalink] [raw]
Subject: [minor patch] pci.h


Hi Martin
this patch makes computing of pci_resource_len a bit more
straightforward and hopefully still correct.Plus an aesthetic change in a
struct declaration :)

--- /usr/src/clean/linux/include/linux/pci.h Mon Dec 11 16:49:19 2000
+++ pci.h Mon Dec 11 17:54:24 2000
@@ -432,8 +432,7 @@
int (*write_dword)(struct pci_dev *, int where, u32 val);
};

-struct pbus_set_ranges_data
-{
+struct pbus_set_ranges_data {
int found_vga;
unsigned long io_start, io_end;
unsigned long mem_start, mem_end;
@@ -636,9 +635,8 @@
#define pci_resource_end(dev,bar) ((dev)->resource[(bar)].end)
#define pci_resource_flags(dev,bar) ((dev)->resource[(bar)].flags)
#define pci_resource_len(dev,bar) \
- ((pci_resource_start((dev),(bar)) == 0 && \
- pci_resource_end((dev),(bar)) == \
- pci_resource_start((dev),(bar))) ? 0 : \
+ (!(pci_resource_start((dev),(bar)) || \
+ pci_resource_end((dev),(bar))) ? 0 : \
\
(pci_resource_end((dev),(bar)) - \
pci_resource_start((dev),(bar)) + 1))