From: Andrew Morton <akpm@osdl.org>
To: linuxppc-dev@ozlabs.org
Cc: Greg KH <greg@kroah.com>
Subject: [patch] make ppc build with 64-bit resource.start, end
Date: Tue, 22 Feb 2005 23:28:03 -0800 [thread overview]
Message-ID: <20050222232803.2c621a1b.akpm@osdl.org> (raw)
Could someone please double-check that this is an equivalent
transformation?
(wtf is that code doing, btw?)
Greg's tree changes resource.start and resource.end to u64. So ppc fails to
link due to missing 64-bit divide helpers. Fix.
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
25-akpm/arch/ppc/kernel/pci.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff -puN arch/ppc/kernel/pci.c~ppc32-64-bit-resource-fix arch/ppc/kernel/pci.c
--- 25/arch/ppc/kernel/pci.c~ppc32-64-bit-resource-fix 2005-02-22 23:27:09.000000000 -0800
+++ 25-akpm/arch/ppc/kernel/pci.c 2005-02-22 23:27:33.000000000 -0800
@@ -21,6 +21,7 @@
#include <asm/byteorder.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
+#include <asm/div64.h>
#undef DEBUG
@@ -1088,6 +1089,18 @@ do_update_p2p_io_resource(struct pci_bus
#endif
}
+
+static u64 push_end(struct resource *res, u64 size)
+{
+ u64 end;
+
+ end = res->end + size;
+ do_div(end, size + 1);
+ end *= size + 1;
+ end += size;
+ return end;
+}
+
/* This function is pretty basic and actually quite broken for the
* general case, it's enough for us right now though. It's supposed
* to tell us if we need to open an IO range at all or not and what
@@ -1100,10 +1113,6 @@ check_for_io_childs(struct pci_bus *bus,
int i;
int rc = 0;
-#define push_end(res, size) do { unsigned long __sz = (size) ; \
- res->end = ((res->end + __sz) / (__sz + 1)) * (__sz + 1) + __sz; \
- } while (0)
-
list_for_each_entry(dev, &bus->devices, bus_list) {
u16 class = dev->class >> 8;
@@ -1117,7 +1126,7 @@ check_for_io_childs(struct pci_bus *bus,
for (i=0; i<PCI_NUM_RESOURCES; i++) {
struct resource *r;
- unsigned long r_size;
+ u64 r_size;
if (dev->class >> 8 == PCI_CLASS_BRIDGE_PCI
&& i >= PCI_BRIDGE_RESOURCES)
_
reply other threads:[~2005-02-23 7:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050222232803.2c621a1b.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=greg@kroah.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).