Commit 5bfe25ee authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] arlan iomem annotations and cleanups

iomem annotations + couple of bad implementations of offsetof() replaced with
the real thing.
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
parent 6e857169
......@@ -153,7 +153,7 @@ static inline int arlan_drop_tx(struct net_device *dev)
int arlan_command(struct net_device *dev, int command_p)
{
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
struct arlan_conf_stru *conf = priv->Conf;
int udelayed = 0;
int i = 0;
......@@ -368,7 +368,7 @@ int arlan_command(struct net_device *dev, int command_p)
if (!registrationBad(dev))
{
setInterruptEnable(dev);
memset_io((void *) arlan->commandParameter, 0, 0xf);
memset_io(arlan->commandParameter, 0, 0xf);
WRITESHMB(arlan->commandByte, ARLAN_COM_INT | ARLAN_COM_RX_ENABLE);
WRITESHMB(arlan->commandParameter[0], conf->rxParameter);
arlan_interrupt_lancpu(dev);
......@@ -398,9 +398,9 @@ int arlan_command(struct net_device *dev, int command_p)
priv->last_rx_int_ack_time + us2ticks(conf->rx_tweak2)))
{
setInterruptEnable(dev);
memset_io((void *) arlan->commandParameter, 0, 0xf);
memset_io(arlan->commandParameter, 0, 0xf);
WRITESHMB(arlan->commandByte, ARLAN_COM_TX_ENABLE | ARLAN_COM_INT);
memcpy_toio((void *) arlan->commandParameter, &TXLAST(dev), 14);
memcpy_toio(arlan->commandParameter, &TXLAST(dev), 14);
// for ( i=1 ; i < 15 ; i++) printk("%02x:",READSHMB(arlan->commandParameter[i]));
priv->tx_last_sent = jiffies;
arlan_interrupt_lancpu(dev);
......@@ -664,7 +664,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
int i;
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
struct arlan_conf_stru *conf = priv->Conf;
int tailStarts = 0x800;
......@@ -673,9 +673,9 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
ARLAN_DEBUG_ENTRY("arlan_hw_tx");
if (TXHEAD(dev).offset)
headEnds = (((TXHEAD(dev).offset + TXHEAD(dev).length - (((int) arlan->txBuffer) - ((int) arlan))) / 64) + 1) * 64;
headEnds = (((TXHEAD(dev).offset + TXHEAD(dev).length - offsetof(struct arlan_shmem, txBuffer)) / 64) + 1) * 64;
if (TXTAIL(dev).offset)
tailStarts = 0x800 - (((TXTAIL(dev).offset - (((int) arlan->txBuffer) - ((int) arlan))) / 64) + 2) * 64;
tailStarts = 0x800 - (((TXTAIL(dev).offset - offsetof(struct arlan_shmem, txBuffer)) / 64) + 2) * 64;
if (!TXHEAD(dev).offset && length < tailStarts)
......@@ -684,7 +684,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
printk(KERN_ERR "TXHEAD insert, tailStart %d\n", tailStarts);
TXHEAD(dev).offset =
(((int) arlan->txBuffer) - ((int) arlan));
offsetof(struct arlan_shmem, txBuffer);
TXHEAD(dev).length = length - ARLAN_FAKE_HDR_LEN;
for (i = 0; i < 6; i++)
TXHEAD(dev).dest[i] = buf[i];
......@@ -692,7 +692,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
TXHEAD(dev).retries = conf->txRetries; /* 0 is use default */
TXHEAD(dev).routing = conf->txRouting;
TXHEAD(dev).scrambled = conf->txScrambled;
memcpy_toio(((char *) arlan + TXHEAD(dev).offset), buf + ARLAN_FAKE_HDR_LEN, TXHEAD(dev).length);
memcpy_toio((char __iomem *)arlan + TXHEAD(dev).offset, buf + ARLAN_FAKE_HDR_LEN, TXHEAD(dev).length);
}
else if (!TXTAIL(dev).offset && length < (0x800 - headEnds))
{
......@@ -700,7 +700,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
printk(KERN_ERR "TXTAIL insert, headEnd %d\n", headEnds);
TXTAIL(dev).offset =
(((int) arlan->txBuffer) - ((int) arlan)) + 0x800 - (length / 64 + 2) * 64;
offsetof(struct arlan_shmem, txBuffer) + 0x800 - (length / 64 + 2) * 64;
TXTAIL(dev).length = length - ARLAN_FAKE_HDR_LEN;
for (i = 0; i < 6; i++)
TXTAIL(dev).dest[i] = buf[i];
......@@ -708,7 +708,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
TXTAIL(dev).retries = conf->txRetries;
TXTAIL(dev).routing = conf->txRouting;
TXTAIL(dev).scrambled = conf->txScrambled;
memcpy_toio(((char *) arlan + TXTAIL(dev).offset), buf + ARLAN_FAKE_HDR_LEN, TXTAIL(dev).length);
memcpy_toio(((char __iomem *)arlan + TXTAIL(dev).offset), buf + ARLAN_FAKE_HDR_LEN, TXTAIL(dev).length);
}
else
{
......@@ -765,7 +765,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
static int arlan_hw_config(struct net_device *dev)
{
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
struct arlan_conf_stru *conf = priv->Conf;
ARLAN_DEBUG_ENTRY("arlan_hw_config");
......@@ -848,7 +848,7 @@ static int arlan_read_card_configuration(struct net_device *dev)
{
u_char tlx415;
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
struct arlan_conf_stru *conf = priv->Conf;
ARLAN_DEBUG_ENTRY("arlan_read_card_configuration");
......@@ -972,7 +972,7 @@ static int lastFoundAt = 0xbe000;
static int __init arlan_check_fingerprint(unsigned long memaddr)
{
static const char probeText[] = "TELESYSTEM SLW INC. ARLAN \0";
volatile struct arlan_shmem *arlan = (struct arlan_shmem *) memaddr;
volatile struct arlan_shmem __iomem *arlan = (struct arlan_shmem *) memaddr;
unsigned long paddr = virt_to_phys((void *) memaddr);
char tempBuf[49];
......@@ -1111,7 +1111,7 @@ static int __init arlan_probe_here(struct net_device *dev,
static int arlan_open(struct net_device *dev)
{
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
int ret = 0;
ARLAN_DEBUG_ENTRY("arlan_open");
......@@ -1406,7 +1406,7 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short
int i = 0;
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
struct arlan_conf_stru *conf = priv->Conf;
......@@ -1509,7 +1509,7 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short
skb->dev = dev;
skbtmp = skb_put(skb, pkt_len);
memcpy_fromio(skbtmp + ARLAN_FAKE_HDR_LEN, ((char *) arlan) + rxOffset, pkt_len - ARLAN_FAKE_HDR_LEN);
memcpy_fromio(skbtmp + ARLAN_FAKE_HDR_LEN, ((char __iomem *) arlan) + rxOffset, pkt_len - ARLAN_FAKE_HDR_LEN);
memcpy_fromio(skbtmp, arlan->ultimateDestAddress, 6);
memcpy_fromio(skbtmp + 6, arlan->rxSrc, 6);
WRITESHMB(arlan->rxStatus, 0x00);
......@@ -1558,7 +1558,7 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short
static void arlan_process_interrupt(struct net_device *dev)
{
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
u_char rxStatus = READSHMB(arlan->rxStatus);
u_char txStatus = READSHMB(arlan->txStatus);
u_short rxOffset = READSHMS(arlan->rxOffset);
......@@ -1661,7 +1661,7 @@ static irqreturn_t arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
struct net_device *dev = dev_id;
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
u_char rxStatus = READSHMB(arlan->rxStatus);
u_char txStatus = READSHMB(arlan->txStatus);
......@@ -1718,7 +1718,7 @@ static long alignLong(volatile u_char * ptr)
static struct net_device_stats *arlan_statistics(struct net_device *dev)
{
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
ARLAN_DEBUG_ENTRY("arlan_statistics");
......@@ -1748,7 +1748,7 @@ static struct net_device_stats *arlan_statistics(struct net_device *dev)
static void arlan_set_multicast(struct net_device *dev)
{
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
struct arlan_conf_stru *conf = priv->Conf;
int board_conf_needed = 0;
......
......@@ -59,7 +59,7 @@ static const char *arlan_diagnostic_info_string(struct net_device *dev)
{
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
u_char diagnosticInfo;
READSHM(diagnosticInfo, arlan->diagnosticInfo, u_char);
......@@ -115,7 +115,7 @@ static const char *arlan_hardware_type_string(struct net_device *dev)
{
u_char hardwareType;
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
READSHM(hardwareType, arlan->hardwareType, u_char);
switch (hardwareType)
......@@ -192,7 +192,7 @@ static void arlan_print_diagnostic_info(struct net_device *dev)
u_short diagnosticOffset;
u_char hardwareType;
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
// ARLAN_DEBUG_ENTRY("arlan_print_diagnostic_info");
......@@ -258,7 +258,7 @@ static int arlan_hw_test_memory(struct net_device *dev)
int memlen = sizeof(struct arlan_shmem) - 0xF; /* avoid control register */
volatile char *arlan_mem = (char *) (dev->mem_start);
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
char pattern;
ptr = NULL;
......@@ -324,7 +324,7 @@ static int arlan_setup_card_by_book(struct net_device *dev)
{
u_char irqLevel, configuredStatusFlag;
struct arlan_private *priv = netdev_priv(dev);
volatile struct arlan_shmem *arlan = priv->card;
volatile struct arlan_shmem __iomem *arlan = priv->card;
// ARLAN_DEBUG_ENTRY("arlan_setup_card");
......
......@@ -332,7 +332,7 @@ struct TxParam
/* Information that need to be kept for each board. */
struct arlan_private {
struct net_device_stats stats;
struct arlan_shmem * card;
struct arlan_shmem __iomem * card;
struct arlan_shmem * conf;
struct arlan_conf_stru * Conf;
......@@ -407,10 +407,8 @@ struct arlan_private {
#define TXHEAD(dev) (((struct arlan_private *)netdev_priv(dev))->txRing[0])
#define TXTAIL(dev) (((struct arlan_private *)netdev_priv(dev))->txRing[1])
#define TXBuffStart(dev) \
((int)(((struct arlan_private *)netdev_priv(dev))->card)->txBuffer) - ((int)(((struct arlan_private *)netdev_priv(dev))->card) )
#define TXBuffEnd(dev) \
((int)(((struct arlan_private *)netdev_priv(dev))->card)->rxBuffer) - ((int)(((struct arlan_private *)netdev_priv(dev))->card)
#define TXBuffStart(dev) offsetof(struct arlan_shmem, txBuffer)
#define TXBuffEnd(dev) offsetof(struct arlan_shmem, xxBuffer)
#define READSHM(to,from,atype) {\
atype tmp;\
......
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