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