Re: pci_alloc_consistent usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> On Tue, 27 May 2003 11:17:40 +0200, Ralf Baechle <ralf@linux-mips.org> said:
ralf> Use the value returned by pci_alloc_consistent in *dma_handle
ralf> instead of trying to do any conversions with of
ralf> pci_alloc_consistent's return value.

How about virt_to_page()?

Currently, many sound drivers (including ALSA) pass a
pci_alloc_consistent's return value to virt_to_page.  While
virt_to_page is defined as below, we can not pass KSEG1 address
(returned by pci_alloc_consistent) to virt_to_page.

#define __pa(x)		((unsigned long) (x) - PAGE_OFFSET)
#define virt_to_page(kaddr)	(mem_map + (__pa(kaddr) >> PAGE_SHIFT))

Following definition can handle this case properly,

#define virt_to_page(kaddr)	(mem_map + (PHYSADDR(kaddr) >> PAGE_SHIFT))

But as ralf said, PHYSADDR() may be is a bit slower then __pa().

Is it worth to change?  Or should we fix the driver using virt_to_page
with pci_alloc_consistent?

---
Atsushi Nemoto


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux