Re: [patch 2/2] backport of sba sg list management to ccio-dma
Grant Grundler <[email protected]> Sun, 28 Oct 2007 23:30:15 -0600
| Newsgroups | gmane.linux.ports.hppa |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Oct 28, 2007 at 02:45:24PM +0000, Joel Soete wrote: ... > e.g. > # more GetOrder-poc.c ... > give me well same results: > # ./GetOrder-poc > get_order(1) = 0 (0x0); > get_order_poc(1) = 0 (0x0). ... Good! ... > But I need to check more on a detail: > here is the prototype of fls(): > static inline int fls(int x) > > so I need to be sure that the value of ((size - 1) >> (PAGE_SHIFT)) would > always stand in a int (not unsigned but sign) for 32bit (iirc > size_of(unsigned long)==32) and 64bit (size_of(unsigned long)==64) > implementations? Huh? Why do you care how (unsigned long) is handled when the function prototype defines the API to pass in an "int"? FWIW, __fls could be extended to handle unsigned long the same way that __ffs has been...but I don't think we needed to for anything so far. ... >>> return (size ? fls((size - 1) >> (PAGE_SHIFT)): 0); >> fls is inlined already and does the same test for size. > > Yes but here the error (well imo it's an error) came from the unsign long > of (-1 >> PAGE_SHIFT) <> 0 Yeah, we'll have to make sure signed int values are handled correctly too. But something specific to the parisc version of get_order() can deal with sign bits and zero values then call __fls(unsigned long) instead of fls(signed int). grant