Skip to content

Commit

Permalink
caif: include linux/io.h
Browse files Browse the repository at this point in the history
The caif_shmcore requires io.h in order to use ioremap, so include that
explicitly to compile in all configurations.

Also add a note about the use of ioremap(), which is not a proper way
to map a DMA buffer into kernel space. It's not completely clear what
the intention is for using ioremap, but it is clear that the result
of ioremap must not simply be accessed using kernel pointers but
should use readl/writel or memcopy_{to,from}io. Assigning the result
of ioremap to a regular pointer that can also be set to something
else is not ok.

Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Mathieu Poirier <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
arndb authored and davem330 committed Apr 21, 2012
1 parent 65f6092 commit 6e4a762
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/caif/caif_shmcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/if_arp.h>
#include <linux/io.h>

#include <net/caif/caif_device.h>
#include <net/caif/caif_shm.h>
Expand Down Expand Up @@ -647,6 +648,9 @@ int caif_shmcore_probe(struct shmdev_layer *pshm_dev)
if (pshm_dev->shm_loopback)
tx_buf->desc_vptr = (unsigned char *)tx_buf->phy_addr;
else
/*
* FIXME: the result of ioremap is not a pointer - arnd
*/
tx_buf->desc_vptr =
ioremap(tx_buf->phy_addr, TX_BUF_SZ);

Expand Down

0 comments on commit 6e4a762

Please sign in to comment.