Commit d545a6bc authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] icom iomem annotations and NULL noise removals

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6ef194f6
...@@ -105,25 +105,25 @@ static const struct pci_device_id icom_pci_table[] = { ...@@ -105,25 +105,25 @@ static const struct pci_device_id icom_pci_table[] = {
}; };
struct lookup_proc_table start_proc[4] = { struct lookup_proc_table start_proc[4] = {
{0, ICOM_CONTROL_START_A}, {NULL, ICOM_CONTROL_START_A},
{0, ICOM_CONTROL_START_B}, {NULL, ICOM_CONTROL_START_B},
{0, ICOM_CONTROL_START_C}, {NULL, ICOM_CONTROL_START_C},
{0, ICOM_CONTROL_START_D} {NULL, ICOM_CONTROL_START_D}
}; };
struct lookup_proc_table stop_proc[4] = { struct lookup_proc_table stop_proc[4] = {
{0, ICOM_CONTROL_STOP_A}, {NULL, ICOM_CONTROL_STOP_A},
{0, ICOM_CONTROL_STOP_B}, {NULL, ICOM_CONTROL_STOP_B},
{0, ICOM_CONTROL_STOP_C}, {NULL, ICOM_CONTROL_STOP_C},
{0, ICOM_CONTROL_STOP_D} {NULL, ICOM_CONTROL_STOP_D}
}; };
struct lookup_int_table int_mask_tbl[4] = { struct lookup_int_table int_mask_tbl[4] = {
{0, ICOM_INT_MASK_PRC_A}, {NULL, ICOM_INT_MASK_PRC_A},
{0, ICOM_INT_MASK_PRC_B}, {NULL, ICOM_INT_MASK_PRC_B},
{0, ICOM_INT_MASK_PRC_C}, {NULL, ICOM_INT_MASK_PRC_C},
{0, ICOM_INT_MASK_PRC_D}, {NULL, ICOM_INT_MASK_PRC_D},
}; };
...@@ -148,23 +148,23 @@ static void free_port_memory(struct icom_port *icom_port) ...@@ -148,23 +148,23 @@ static void free_port_memory(struct icom_port *icom_port)
if (icom_port->recv_buf) { if (icom_port->recv_buf) {
pci_free_consistent(dev, 4096, icom_port->recv_buf, pci_free_consistent(dev, 4096, icom_port->recv_buf,
icom_port->recv_buf_pci); icom_port->recv_buf_pci);
icom_port->recv_buf = 0; icom_port->recv_buf = NULL;
} }
if (icom_port->xmit_buf) { if (icom_port->xmit_buf) {
pci_free_consistent(dev, 4096, icom_port->xmit_buf, pci_free_consistent(dev, 4096, icom_port->xmit_buf,
icom_port->xmit_buf_pci); icom_port->xmit_buf_pci);
icom_port->xmit_buf = 0; icom_port->xmit_buf = NULL;
} }
if (icom_port->statStg) { if (icom_port->statStg) {
pci_free_consistent(dev, 4096, icom_port->statStg, pci_free_consistent(dev, 4096, icom_port->statStg,
icom_port->statStg_pci); icom_port->statStg_pci);
icom_port->statStg = 0; icom_port->statStg = NULL;
} }
if (icom_port->xmitRestart) { if (icom_port->xmitRestart) {
pci_free_consistent(dev, 4096, icom_port->xmitRestart, pci_free_consistent(dev, 4096, icom_port->xmitRestart,
icom_port->xmitRestart_pci); icom_port->xmitRestart_pci);
icom_port->xmitRestart = 0; icom_port->xmitRestart = NULL;
} }
} }
...@@ -344,17 +344,17 @@ static void start_processor(struct icom_port *icom_port) ...@@ -344,17 +344,17 @@ static void start_processor(struct icom_port *icom_port)
static void load_code(struct icom_port *icom_port) static void load_code(struct icom_port *icom_port)
{ {
const struct firmware *fw; const struct firmware *fw;
char *iram_ptr; char __iomem *iram_ptr;
int index; int index;
int status = 0; int status = 0;
char *dram_ptr = (char *) icom_port->dram; void __iomem *dram_ptr = icom_port->dram;
dma_addr_t temp_pci; dma_addr_t temp_pci;
unsigned char *new_page = NULL; unsigned char *new_page = NULL;
unsigned char cable_id = NO_CABLE; unsigned char cable_id = NO_CABLE;
struct pci_dev *dev = icom_port->adapter->pci_dev; struct pci_dev *dev = icom_port->adapter->pci_dev;
/* Clear out any pending interrupts */ /* Clear out any pending interrupts */
writew(0x3FFF, (void *) icom_port->int_reg); writew(0x3FFF, icom_port->int_reg);
trace(icom_port, "CLEAR_INTERRUPTS", 0); trace(icom_port, "CLEAR_INTERRUPTS", 0);
...@@ -378,7 +378,7 @@ static void load_code(struct icom_port *icom_port) ...@@ -378,7 +378,7 @@ static void load_code(struct icom_port *icom_port)
goto load_code_exit; goto load_code_exit;
} }
iram_ptr = (char *) icom_port->dram + ICOM_IRAM_OFFSET; iram_ptr = (char __iomem *)icom_port->dram + ICOM_IRAM_OFFSET;
for (index = 0; index < fw->size; index++) for (index = 0; index < fw->size; index++)
writeb(fw->data[index], &iram_ptr[index]); writeb(fw->data[index], &iram_ptr[index]);
...@@ -398,7 +398,7 @@ static void load_code(struct icom_port *icom_port) ...@@ -398,7 +398,7 @@ static void load_code(struct icom_port *icom_port)
goto load_code_exit; goto load_code_exit;
} }
iram_ptr = (char *) icom_port->dram + ICOM_IRAM_OFFSET; iram_ptr = (char __iomem *) icom_port->dram + ICOM_IRAM_OFFSET;
for (index = ICOM_DCE_IRAM_OFFSET; index < fw->size; index++) for (index = ICOM_DCE_IRAM_OFFSET; index < fw->size; index++)
writeb(fw->data[index], &iram_ptr[index]); writeb(fw->data[index], &iram_ptr[index]);
...@@ -490,7 +490,7 @@ static void load_code(struct icom_port *icom_port) ...@@ -490,7 +490,7 @@ static void load_code(struct icom_port *icom_port)
if (status != 0) { if (status != 0) {
/* Clear out any pending interrupts */ /* Clear out any pending interrupts */
writew(0x3FFF, (void *) icom_port->int_reg); writew(0x3FFF, icom_port->int_reg);
/* Turn off port */ /* Turn off port */
writeb(ICOM_DISABLE, &(icom_port->dram->disable)); writeb(ICOM_DISABLE, &(icom_port->dram->disable));
...@@ -514,8 +514,8 @@ static int startup(struct icom_port *icom_port) ...@@ -514,8 +514,8 @@ static int startup(struct icom_port *icom_port)
trace(icom_port, "STARTUP", 0); trace(icom_port, "STARTUP", 0);
if (icom_port->dram == 0x00000000) { if (!icom_port->dram) {
/* should NEVER be zero */ /* should NEVER be NULL */
dev_err(&icom_port->adapter->pci_dev->dev, dev_err(&icom_port->adapter->pci_dev->dev,
"Unusable Port, port configuration missing\n"); "Unusable Port, port configuration missing\n");
return -ENODEV; return -ENODEV;
...@@ -556,9 +556,9 @@ static int startup(struct icom_port *icom_port) ...@@ -556,9 +556,9 @@ static int startup(struct icom_port *icom_port)
int_mask_tbl[port].global_int_mask = &icom_port->global_reg->int_mask_2; int_mask_tbl[port].global_int_mask = &icom_port->global_reg->int_mask_2;
if (port == 0 || port == 2) if (port == 0 || port == 2)
writew(0x00FF,(void *) icom_port->int_reg); writew(0x00FF, icom_port->int_reg);
else else
writew(0x3F00,(void *) icom_port->int_reg); writew(0x3F00, icom_port->int_reg);
if (port < 4) { if (port < 4) {
temp = readl(int_mask_tbl[port].global_int_mask); temp = readl(int_mask_tbl[port].global_int_mask);
writel(temp & ~int_mask_tbl[port].processor_id, int_mask_tbl[port].global_int_mask); writel(temp & ~int_mask_tbl[port].processor_id, int_mask_tbl[port].global_int_mask);
...@@ -859,7 +859,7 @@ static void process_interrupt(u16 port_int_reg, ...@@ -859,7 +859,7 @@ static void process_interrupt(u16 port_int_reg,
static irqreturn_t icom_interrupt(int irq, void *dev_id, static irqreturn_t icom_interrupt(int irq, void *dev_id,
struct pt_regs *regs) struct pt_regs *regs)
{ {
unsigned long int_reg; void __iomem * int_reg;
u32 adapter_interrupts; u32 adapter_interrupts;
u16 port_int_reg; u16 port_int_reg;
struct icom_adapter *icom_adapter; struct icom_adapter *icom_adapter;
...@@ -871,7 +871,7 @@ static irqreturn_t icom_interrupt(int irq, void *dev_id, ...@@ -871,7 +871,7 @@ static irqreturn_t icom_interrupt(int irq, void *dev_id,
if ((icom_adapter->version | ADAPTER_V2) == ADAPTER_V2) { if ((icom_adapter->version | ADAPTER_V2) == ADAPTER_V2) {
int_reg = icom_adapter->base_addr + 0x8024; int_reg = icom_adapter->base_addr + 0x8024;
adapter_interrupts = readl((void *) int_reg); adapter_interrupts = readl(int_reg);
if (adapter_interrupts & 0x00003FFF) { if (adapter_interrupts & 0x00003FFF) {
/* port 2 interrupt, NOTE: for all ADAPTER_V2, port 2 will be active */ /* port 2 interrupt, NOTE: for all ADAPTER_V2, port 2 will be active */
...@@ -892,14 +892,14 @@ static irqreturn_t icom_interrupt(int irq, void *dev_id, ...@@ -892,14 +892,14 @@ static irqreturn_t icom_interrupt(int irq, void *dev_id,
} }
/* Clear out any pending interrupts */ /* Clear out any pending interrupts */
writel(adapter_interrupts, (void *) int_reg); writel(adapter_interrupts, int_reg);
int_reg = icom_adapter->base_addr + 0x8004; int_reg = icom_adapter->base_addr + 0x8004;
} else { } else {
int_reg = icom_adapter->base_addr + 0x4004; int_reg = icom_adapter->base_addr + 0x4004;
} }
adapter_interrupts = readl((void *) int_reg); adapter_interrupts = readl(int_reg);
if (adapter_interrupts & 0x00003FFF) { if (adapter_interrupts & 0x00003FFF) {
/* port 0 interrupt, NOTE: for all adapters, port 0 will be active */ /* port 0 interrupt, NOTE: for all adapters, port 0 will be active */
...@@ -919,10 +919,10 @@ static irqreturn_t icom_interrupt(int irq, void *dev_id, ...@@ -919,10 +919,10 @@ static irqreturn_t icom_interrupt(int irq, void *dev_id,
} }
/* Clear out any pending interrupts */ /* Clear out any pending interrupts */
writel(adapter_interrupts, (void *) int_reg); writel(adapter_interrupts, int_reg);
/* flush the write */ /* flush the write */
adapter_interrupts = readl((void *) int_reg); adapter_interrupts = readl(int_reg);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -1383,18 +1383,16 @@ static int __devinit icom_init_ports(struct icom_adapter *icom_adapter) ...@@ -1383,18 +1383,16 @@ static int __devinit icom_init_ports(struct icom_adapter *icom_adapter)
static void icom_port_active(struct icom_port *icom_port, struct icom_adapter *icom_adapter, int port_num) static void icom_port_active(struct icom_port *icom_port, struct icom_adapter *icom_adapter, int port_num)
{ {
if (icom_adapter->version == ADAPTER_V1) { if (icom_adapter->version == ADAPTER_V1) {
icom_port->global_reg = (struct icom_regs *) ((char *) icom_port->global_reg = icom_adapter->base_addr + 0x4000;
icom_adapter->base_addr + 0x4000); icom_port->int_reg = icom_adapter->base_addr +
icom_port->int_reg = (unsigned long) icom_adapter->base_addr +
0x4004 + 2 - 2 * port_num; 0x4004 + 2 - 2 * port_num;
} else { } else {
icom_port->global_reg = (struct icom_regs *) ((char *) icom_port->global_reg = icom_adapter->base_addr + 0x8000;
icom_adapter->base_addr + 0x8000);
if (icom_port->port < 2) if (icom_port->port < 2)
icom_port->int_reg = (unsigned long) icom_adapter->base_addr + icom_port->int_reg = icom_adapter->base_addr +
0x8004 + 2 - 2 * icom_port->port; 0x8004 + 2 - 2 * icom_port->port;
else else
icom_port->int_reg = (unsigned long) icom_adapter->base_addr + icom_port->int_reg = icom_adapter->base_addr +
0x8024 + 2 - 2 * (icom_port->port - 2); 0x8024 + 2 - 2 * (icom_port->port - 2);
} }
} }
...@@ -1410,9 +1408,8 @@ static int __init icom_load_ports(struct icom_adapter *icom_adapter) ...@@ -1410,9 +1408,8 @@ static int __init icom_load_ports(struct icom_adapter *icom_adapter)
if (icom_port->status == ICOM_PORT_ACTIVE) { if (icom_port->status == ICOM_PORT_ACTIVE) {
icom_port_active(icom_port, icom_adapter, port_num); icom_port_active(icom_port, icom_adapter, port_num);
icom_port->dram = (struct func_dram *) ((char *) icom_port->dram = icom_adapter->base_addr +
icom_adapter->base_addr + 0x2000 * icom_port->port;
0x2000 * icom_port->port);
icom_port->adapter = icom_adapter; icom_port->adapter = icom_adapter;
...@@ -1495,7 +1492,7 @@ static void icom_remove_adapter(struct icom_adapter *icom_adapter) ...@@ -1495,7 +1492,7 @@ static void icom_remove_adapter(struct icom_adapter *icom_adapter)
} }
free_irq(icom_adapter->irq_number, (void *) icom_adapter); free_irq(icom_adapter->irq_number, (void *) icom_adapter);
iounmap((void *) icom_adapter->base_addr); iounmap(icom_adapter->base_addr);
icom_free_adapter(icom_adapter); icom_free_adapter(icom_adapter);
pci_release_regions(icom_adapter->pci_dev); pci_release_regions(icom_adapter->pci_dev);
} }
...@@ -1572,8 +1569,7 @@ static int __devinit icom_probe(struct pci_dev *dev, ...@@ -1572,8 +1569,7 @@ static int __devinit icom_probe(struct pci_dev *dev,
goto probe_exit1; goto probe_exit1;
} }
icom_adapter->base_addr = icom_adapter->base_addr = ioremap(icom_adapter->base_addr_pci,
(unsigned long) ioremap(icom_adapter->base_addr_pci,
pci_resource_len(dev, 0)); pci_resource_len(dev, 0));
if (!icom_adapter->base_addr) if (!icom_adapter->base_addr)
...@@ -1614,7 +1610,7 @@ static int __devinit icom_probe(struct pci_dev *dev, ...@@ -1614,7 +1610,7 @@ static int __devinit icom_probe(struct pci_dev *dev,
return 0; return 0;
probe_exit2: probe_exit2:
iounmap((void *) icom_adapter->base_addr); iounmap(icom_adapter->base_addr);
probe_exit1: probe_exit1:
icom_free_adapter(icom_adapter); icom_free_adapter(icom_adapter);
......
...@@ -234,9 +234,9 @@ struct icom_port { ...@@ -234,9 +234,9 @@ struct icom_port {
unsigned char cable_id; unsigned char cable_id;
unsigned char read_status_mask; unsigned char read_status_mask;
unsigned char ignore_status_mask; unsigned char ignore_status_mask;
unsigned long int_reg; void __iomem * int_reg;
struct icom_regs *global_reg; struct icom_regs __iomem *global_reg;
struct func_dram *dram; struct func_dram __iomem *dram;
int port; int port;
struct statusArea *statStg; struct statusArea *statStg;
dma_addr_t statStg_pci; dma_addr_t statStg_pci;
...@@ -256,7 +256,7 @@ struct icom_port { ...@@ -256,7 +256,7 @@ struct icom_port {
}; };
struct icom_adapter { struct icom_adapter {
unsigned long base_addr; void __iomem * base_addr;
unsigned long base_addr_pci; unsigned long base_addr_pci;
unsigned char irq_number; unsigned char irq_number;
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
...@@ -278,12 +278,12 @@ struct icom_adapter { ...@@ -278,12 +278,12 @@ struct icom_adapter {
extern void iCom_sercons_init(void); extern void iCom_sercons_init(void);
struct lookup_proc_table { struct lookup_proc_table {
u32 *global_control_reg; u32 __iomem *global_control_reg;
unsigned long processor_id; unsigned long processor_id;
}; };
struct lookup_int_table { struct lookup_int_table {
u32 *global_int_mask; u32 __iomem *global_int_mask;
unsigned long processor_id; unsigned long processor_id;
}; };
......
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