Commit a814d16f authored by Linus Torvalds's avatar Linus Torvalds Committed by Jeff Garzik

Get rid of non-working and unused "uvirt_to_bus()".

Fix up vmalloc_to_page() and callers (argument is a kernel
virtual address ie should be a "void *")
parent 61000d04
......@@ -173,22 +173,11 @@ static struct hpsb_highlevel *hl_handle = NULL;
* defined way to get at the kernel page tables.
*/
static inline unsigned long uvirt_to_bus(unsigned long adr)
{
unsigned long kva, ret;
kva = page_address(vmalloc_to_page(adr));
ret = virt_to_bus((void *)kva);
MDEBUG(printk("uv2b(%lx-->%lx)", adr, ret));
return ret;
}
static inline unsigned long kvirt_to_bus(unsigned long adr)
{
unsigned long va, kva, ret;
unsigned long kva, ret;
va = VMALLOC_VMADDR(adr);
kva = page_address(vmalloc_to_page(va));
kva = page_address(vmalloc_to_page((void *)adr));
ret = virt_to_bus((void *)kva);
MDEBUG(printk("kv2b(%lx-->%lx)", adr, ret));
return ret;
......@@ -200,10 +189,9 @@ static inline unsigned long kvirt_to_bus(unsigned long adr)
*/
static inline unsigned long kvirt_to_pa(unsigned long adr)
{
unsigned long va, kva, ret;
unsigned long kva, ret;
va = VMALLOC_VMADDR(adr);
kva = page_address(vmalloc_to_page(va));
kva = page_address(vmalloc_to_page((void *)adr));
ret = __pa(kva);
MDEBUG(printk("kv2pa(%lx-->%lx)", adr, ret));
return ret;
......
......@@ -141,24 +141,33 @@ __setup("bttv.radio=", p_radio);
* defined way to get at the kernel page tables.
*/
static inline unsigned long uvirt_to_bus(unsigned long adr)
{
unsigned long kva, ret;
kva = page_address(vmalloc_to_page(adr));
ret = virt_to_bus((void *)kva);
MDEBUG(printk("uv2b(%lx-->%lx)", adr, ret));
return ret;
/*
* Take a vmalloc address, and turn it into
* the aliased kernel virtual address..
*
* CAREFUL! Anybody who does this gets to sit
* in their own cr*p when it comes to virtual
* cache aliases. It's _your_ problem.
*
* Also, note how it only works within one page.
* If you're doing page-crossing stuff, you're on
* your own.
*
* THIS IS BROKEN CODE! You shouldn't do things
* like this.
*/
static inline void *vmalloc_to_virt(void *addr)
{
struct page *page = vmalloc_to_page(addr);
return page_address(page) + (~PAGE_MASK & (unsigned long)addr);
}
static inline unsigned long kvirt_to_bus(unsigned long adr)
static inline unsigned long kvirt_to_bus(unsigned long addr)
{
unsigned long va, kva, ret;
va = VMALLOC_VMADDR(adr);
kva = page_address(vmalloc_to_page(va));
ret = virt_to_bus((void *)kva);
MDEBUG(printk("kv2b(%lx-->%lx)", adr, ret));
unsigned long ret;
ret = virt_to_bus(vmalloc_to_virt((void *)addr));
MDEBUG(printk("kv2b(%lx-->%lx)", addr, ret));
return ret;
}
......@@ -166,21 +175,18 @@ static inline unsigned long kvirt_to_bus(unsigned long adr)
* This is used when initializing the contents of the
* area and marking the pages as reserved.
*/
static inline unsigned long kvirt_to_pa(unsigned long adr)
static inline unsigned long kvirt_to_pa(unsigned long addr)
{
unsigned long va, kva, ret;
va = VMALLOC_VMADDR(adr);
kva = page_address(vmalloc_to_page(va));
ret = __pa(kva);
MDEBUG(printk("kv2pa(%lx-->%lx)", adr, ret));
unsigned long ret;
ret = virt_to_phys(vmalloc_to_virt((void *)addr));
MDEBUG(printk("kv2pa(%lx-->%lx)", addr, ret));
return ret;
}
static void * rvmalloc(signed long size)
{
void * mem;
unsigned long adr, page;
unsigned long adr;
mem=vmalloc_32(size);
if (NULL == mem)
......@@ -191,8 +197,7 @@ static void * rvmalloc(signed long size)
adr=(unsigned long) mem;
while (size > 0)
{
page = kvirt_to_pa(adr);
mem_map_reserve(virt_to_page(__va(page)));
mem_map_reserve(vmalloc_to_page((void *)adr));
adr+=PAGE_SIZE;
size-=PAGE_SIZE;
}
......@@ -202,15 +207,14 @@ static void * rvmalloc(signed long size)
static void rvfree(void * mem, signed long size)
{
unsigned long adr, page;
unsigned long adr;
if (mem)
{
adr=(unsigned long) mem;
while (size > 0)
{
page = kvirt_to_pa(adr);
mem_map_unreserve(virt_to_page(__va(page)));
mem_map_unreserve(vmalloc_to_page((void *)adr));
adr+=PAGE_SIZE;
size-=PAGE_SIZE;
}
......
......@@ -186,10 +186,9 @@ static void reset_camera_struct(struct cam_data *cam);
*/
static inline unsigned long kvirt_to_pa(unsigned long adr)
{
unsigned long va, kva, ret;
unsigned long kva, ret;
va = VMALLOC_VMADDR(adr);
kva = page_address(vmalloc_to_page(va));
kva = page_address(vmalloc_to_page((void *)adr));
ret = __pa(kva);
return ret;
}
......
......@@ -123,10 +123,9 @@ static inline int meye_emptyq(struct meye_queue *queue, int *elem) {
* area and marking the pages as reserved.
*/
static inline unsigned long kvirt_to_pa(unsigned long adr) {
unsigned long va, kva, ret;
unsigned long kva, ret;
va = VMALLOC_VMADDR(adr);
kva = page_address(vmalloc_to_page(va));
kva = page_address(vmalloc_to_page((void *) adr));
ret = __pa(kva);
MDEBUG(printk("kv2pa(%lx-->%lx)\n", adr, ret));
return ret;
......
......@@ -380,10 +380,9 @@ static unsigned char uvQuanTable518[] = OV518_UVQUANTABLE;
static inline unsigned long
kvirt_to_pa(unsigned long adr)
{
unsigned long va, kva, ret;
unsigned long kva, ret;
va = VMALLOC_VMADDR(adr);
kva = page_address(vmalloc_to_page(va));
kva = page_address(vmalloc_to_page((void *)adr));
ret = __pa(kva);
return ret;
}
......
......@@ -184,10 +184,9 @@ static struct video_device pwc_template = {
*/
static inline unsigned long kvirt_to_pa(unsigned long adr)
{
unsigned long va, kva, ret;
unsigned long kva, ret;
va = VMALLOC_VMADDR(adr);
kva = page_address(vmalloc_to_page(va));
kva = page_address(vmalloc_to_page((void *)adr));
ret = __pa(kva);
return ret;
}
......
......@@ -89,10 +89,9 @@ static struct usb_driver se401_driver;
*/
static inline unsigned long kvirt_to_pa(unsigned long adr)
{
unsigned long va, kva, ret;
unsigned long kva, ret;
va = VMALLOC_VMADDR(adr);
kva = page_address(vmalloc_to_page(va));
kva = page_address(vmalloc_to_page((void *)adr));
ret = __pa(kva);
return ret;
}
......
......@@ -68,10 +68,9 @@ static int usbvideo_default_procfs_write_proc(
*/
unsigned long usbvideo_kvirt_to_pa(unsigned long adr)
{
unsigned long va, kva, ret;
unsigned long kva, ret;
va = VMALLOC_VMADDR(adr);
kva = page_address(vmalloc_to_page(va));
kva = page_address(vmalloc_to_page((void *)adr));
ret = __pa(kva);
MDEBUG(printk("kv2pa(%lx-->%lx)", adr, ret));
return ret;
......
......@@ -585,7 +585,7 @@ static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * m
extern struct vm_area_struct *find_extend_vma(struct mm_struct *mm, unsigned long addr);
extern struct page * vmalloc_to_page(unsigned long adr);
extern struct page * vmalloc_to_page(void *addr);
#endif /* __KERNEL__ */
......
......@@ -1480,8 +1480,9 @@ int make_pages_present(unsigned long addr, unsigned long end)
/*
* Map a vmalloc()-space virtual address to the physical page.
*/
struct page * vmalloc_to_page(unsigned long addr)
struct page * vmalloc_to_page(void * vmalloc_addr)
{
unsigned long addr = (unsigned long) vmalloc_addr;
struct page *page = NULL;
pgd_t *pgd = pgd_offset_k(addr);
pmd_t *pmd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment