Commit d4122577 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[PATCH] pcmcia: pd6729: cleanups

From:  Komuro <komurojun-mbn@nifty.com>

line length fixes and x = x | y => x |= y cleanups
Signed-off-by: default avatarDominik Brodowski <linux@brodo.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1e45773d
...@@ -43,7 +43,8 @@ static spinlock_t port_lock = SPIN_LOCK_UNLOCKED; ...@@ -43,7 +43,8 @@ static spinlock_t port_lock = SPIN_LOCK_UNLOCKED;
/* basic value read/write functions */ /* basic value read/write functions */
static unsigned char indirect_read(struct pd6729_socket *socket, unsigned short reg) static unsigned char indirect_read(struct pd6729_socket *socket,
unsigned short reg)
{ {
unsigned long port; unsigned long port;
unsigned char val; unsigned char val;
...@@ -59,7 +60,8 @@ static unsigned char indirect_read(struct pd6729_socket *socket, unsigned short ...@@ -59,7 +60,8 @@ static unsigned char indirect_read(struct pd6729_socket *socket, unsigned short
return val; return val;
} }
static unsigned short indirect_read16(struct pd6729_socket *socket, unsigned short reg) static unsigned short indirect_read16(struct pd6729_socket *socket,
unsigned short reg)
{ {
unsigned long port; unsigned long port;
unsigned short tmp; unsigned short tmp;
...@@ -78,7 +80,8 @@ static unsigned short indirect_read16(struct pd6729_socket *socket, unsigned sho ...@@ -78,7 +80,8 @@ static unsigned short indirect_read16(struct pd6729_socket *socket, unsigned sho
return tmp; return tmp;
} }
static void indirect_write(struct pd6729_socket *socket, unsigned short reg, unsigned char value) static void indirect_write(struct pd6729_socket *socket, unsigned short reg,
unsigned char value)
{ {
unsigned long port; unsigned long port;
unsigned long flags; unsigned long flags;
...@@ -91,7 +94,8 @@ static void indirect_write(struct pd6729_socket *socket, unsigned short reg, uns ...@@ -91,7 +94,8 @@ static void indirect_write(struct pd6729_socket *socket, unsigned short reg, uns
spin_unlock_irqrestore(&port_lock, flags); spin_unlock_irqrestore(&port_lock, flags);
} }
static void indirect_setbit(struct pd6729_socket *socket, unsigned short reg, unsigned char mask) static void indirect_setbit(struct pd6729_socket *socket, unsigned short reg,
unsigned char mask)
{ {
unsigned long port; unsigned long port;
unsigned char val; unsigned char val;
...@@ -108,7 +112,8 @@ static void indirect_setbit(struct pd6729_socket *socket, unsigned short reg, un ...@@ -108,7 +112,8 @@ static void indirect_setbit(struct pd6729_socket *socket, unsigned short reg, un
spin_unlock_irqrestore(&port_lock, flags); spin_unlock_irqrestore(&port_lock, flags);
} }
static void indirect_resetbit(struct pd6729_socket *socket, unsigned short reg, unsigned char mask) static void indirect_resetbit(struct pd6729_socket *socket, unsigned short reg,
unsigned char mask)
{ {
unsigned long port; unsigned long port;
unsigned char val; unsigned char val;
...@@ -125,7 +130,8 @@ static void indirect_resetbit(struct pd6729_socket *socket, unsigned short reg, ...@@ -125,7 +130,8 @@ static void indirect_resetbit(struct pd6729_socket *socket, unsigned short reg,
spin_unlock_irqrestore(&port_lock, flags); spin_unlock_irqrestore(&port_lock, flags);
} }
static void indirect_write16(struct pd6729_socket *socket, unsigned short reg, unsigned short value) static void indirect_write16(struct pd6729_socket *socket, unsigned short reg,
unsigned short value)
{ {
unsigned long port; unsigned long port;
unsigned char val; unsigned char val;
...@@ -160,7 +166,8 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev, struct pt_regs *regs) ...@@ -160,7 +166,8 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev, struct pt_regs *regs)
while (1) { while (1) {
loopcount++; loopcount++;
if (loopcount > 20) { if (loopcount > 20) {
printk(KERN_ERR "pd6729: infinite eventloop in interrupt\n"); printk(KERN_ERR "pd6729: infinite eventloop "
"in interrupt\n");
break; break;
} }
...@@ -182,14 +189,19 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev, struct pt_regs *regs) ...@@ -182,14 +189,19 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev, struct pt_regs *regs)
dprintk("Card detected in socket %i!\n", i); dprintk("Card detected in socket %i!\n", i);
} }
if (indirect_read(&socket[i], I365_INTCTL) & I365_PC_IOCARD) { if (indirect_read(&socket[i], I365_INTCTL)
& I365_PC_IOCARD) {
/* For IO/CARDS, bit 0 means "read the card" */ /* For IO/CARDS, bit 0 means "read the card" */
events |= (csc & I365_CSC_STSCHG) ? SS_STSCHG : 0; events |= (csc & I365_CSC_STSCHG)
? SS_STSCHG : 0;
} else { } else {
/* Check for battery/ready events */ /* Check for battery/ready events */
events |= (csc & I365_CSC_BVD1) ? SS_BATDEAD : 0; events |= (csc & I365_CSC_BVD1)
events |= (csc & I365_CSC_BVD2) ? SS_BATWARN : 0; ? SS_BATDEAD : 0;
events |= (csc & I365_CSC_READY) ? SS_READY : 0; events |= (csc & I365_CSC_BVD2)
? SS_BATWARN : 0;
events |= (csc & I365_CSC_READY)
? SS_READY : 0;
} }
if (events) { if (events) {
...@@ -216,7 +228,8 @@ static void set_bridge_state(struct pd6729_socket *socket) ...@@ -216,7 +228,8 @@ static void set_bridge_state(struct pd6729_socket *socket)
static int pd6729_get_status(struct pcmcia_socket *sock, u_int *value) static int pd6729_get_status(struct pcmcia_socket *sock, u_int *value)
{ {
struct pd6729_socket *socket = container_of(sock, struct pd6729_socket, socket); struct pd6729_socket *socket
= container_of(sock, struct pd6729_socket, socket);
unsigned int status; unsigned int status;
unsigned int data; unsigned int data;
struct pd6729_socket *t; struct pd6729_socket *t;
...@@ -265,7 +278,8 @@ static int pd6729_get_status(struct pcmcia_socket *sock, u_int *value) ...@@ -265,7 +278,8 @@ static int pd6729_get_status(struct pcmcia_socket *sock, u_int *value)
static int pd6729_get_socket(struct pcmcia_socket *sock, socket_state_t *state) static int pd6729_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
{ {
struct pd6729_socket *socket = container_of(sock, struct pd6729_socket, socket); struct pd6729_socket *socket
= container_of(sock, struct pd6729_socket, socket);
unsigned char reg, vcc, vpp; unsigned char reg, vcc, vpp;
state->flags = 0; state->flags = 0;
...@@ -342,7 +356,8 @@ static int pd6729_get_socket(struct pcmcia_socket *sock, socket_state_t *state) ...@@ -342,7 +356,8 @@ static int pd6729_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
{ {
struct pd6729_socket *socket = container_of(sock, struct pd6729_socket, socket); struct pd6729_socket *socket
= container_of(sock, struct pd6729_socket, socket);
unsigned char reg; unsigned char reg;
/* First, set the global controller options */ /* First, set the global controller options */
...@@ -354,9 +369,9 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) ...@@ -354,9 +369,9 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
reg = 0; reg = 0;
/* The reset bit has "inverse" logic */ /* The reset bit has "inverse" logic */
if (!(state->flags & SS_RESET)) if (!(state->flags & SS_RESET))
reg = reg | I365_PC_RESET; reg |= I365_PC_RESET;
if (state->flags & SS_IOCARD) if (state->flags & SS_IOCARD)
reg = reg | I365_PC_IOCARD; reg |= I365_PC_IOCARD;
/* IGENC, Interrupt and General Control Register */ /* IGENC, Interrupt and General Control Register */
indirect_write(socket, I365_INTCTL, reg); indirect_write(socket, I365_INTCTL, reg);
...@@ -390,7 +405,8 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) ...@@ -390,7 +405,8 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V);
break; break;
default: default:
dprintk("pd6729: pd6729_set_socket called with invalid VCC power value: %i\n", dprintk("pd6729: pd6729_set_socket called with "
"invalid VCC power value: %i\n",
state->Vcc); state->Vcc);
return -EINVAL; return -EINVAL;
} }
...@@ -452,9 +468,11 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) ...@@ -452,9 +468,11 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
return 0; return 0;
} }
static int pd6729_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) static int pd6729_set_io_map(struct pcmcia_socket *sock,
struct pccard_io_map *io)
{ {
struct pd6729_socket *socket = container_of(sock, struct pd6729_socket, socket); struct pd6729_socket *socket
= container_of(sock, struct pd6729_socket, socket);
unsigned char map, ioctl; unsigned char map, ioctl;
map = io->map; map = io->map;
...@@ -469,7 +487,8 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *i ...@@ -469,7 +487,8 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *i
if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map)) if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map))
indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map)); indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map));
/* dprintk("set_io_map: Setting range to %x - %x\n", io->start, io->stop);*/ /* dprintk("set_io_map: Setting range to %x - %x\n",
io->start, io->stop);*/
/* write the new values */ /* write the new values */
indirect_write16(socket, I365_IO(map)+I365_W_START, io->start); indirect_write16(socket, I365_IO(map)+I365_W_START, io->start);
...@@ -490,9 +509,11 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *i ...@@ -490,9 +509,11 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *i
return 0; return 0;
} }
static int pd6729_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *mem) static int pd6729_set_mem_map(struct pcmcia_socket *sock,
struct pccard_mem_map *mem)
{ {
struct pd6729_socket *socket = container_of(sock, struct pd6729_socket, socket); struct pd6729_socket *socket
= container_of(sock, struct pd6729_socket, socket);
unsigned short base, i; unsigned short base, i;
unsigned char map; unsigned char map;
...@@ -504,8 +525,6 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map ...@@ -504,8 +525,6 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map
if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) { if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) {
printk("pd6729_set_mem_map: invalid address / speed"); printk("pd6729_set_mem_map: invalid address / speed");
/* printk("invalid mem map for socket %i : %lx to %lx with a start of %x\n",
sock, mem->res->start, mem->res->end, mem->card_start); */
return -EINVAL; return -EINVAL;
} }
...@@ -551,11 +570,11 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map ...@@ -551,11 +570,11 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map
if (mem->flags & MAP_WRPROT) if (mem->flags & MAP_WRPROT)
i |= I365_MEM_WRPROT; i |= I365_MEM_WRPROT;
if (mem->flags & MAP_ATTRIB) { if (mem->flags & MAP_ATTRIB) {
/* dprintk("requesting attribute memory for socket %i\n", /* dprintk("requesting attribute memory for socket %i\n",
socket->number);*/ socket->number);*/
i |= I365_MEM_REG; i |= I365_MEM_REG;
} else { } else {
/* dprintk("requesting normal memory for socket %i\n", /* dprintk("requesting normal memory for socket %i\n",
socket->number);*/ socket->number);*/
} }
indirect_write16(socket, base + I365_W_OFF, i); indirect_write16(socket, base + I365_W_OFF, i);
...@@ -604,13 +623,15 @@ static struct pccard_operations pd6729_operations = { ...@@ -604,13 +623,15 @@ static struct pccard_operations pd6729_operations = {
.set_mem_map = pd6729_set_mem_map, .set_mem_map = pd6729_set_mem_map,
}; };
static int __devinit pd6729_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit pd6729_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id)
{ {
int i, j, ret; int i, j, ret;
char configbyte; char configbyte;
struct pd6729_socket *socket; struct pd6729_socket *socket;
socket = kmalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS, GFP_KERNEL); socket = kmalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS,
GFP_KERNEL);
if (!socket) if (!socket)
return -ENOMEM; return -ENOMEM;
...@@ -619,13 +640,11 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, const struct pci_devi ...@@ -619,13 +640,11 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, const struct pci_devi
if ((ret = pci_enable_device(dev))) if ((ret = pci_enable_device(dev)))
goto err_out_free_mem; goto err_out_free_mem;
printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge at 0x%lx on irq %d\n", printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge "
pci_resource_start(dev, 0), dev->irq); "at 0x%lx on irq %d\n", pci_resource_start(dev, 0), dev->irq);
printk(KERN_INFO "pd6729: configured as a %d socket device.\n", MAX_SOCKETS);
/* /*
* Since we have no memory BARs some firmware we may not * Since we have no memory BARs some firmware may not
* have had PCI_COMMAND_MEM enabled, yet the device needs * have had PCI_COMMAND_MEMORY enabled, yet the device needs it.
* it.
*/ */
pci_read_config_byte(dev, PCI_COMMAND, &configbyte); pci_read_config_byte(dev, PCI_COMMAND, &configbyte);
if (!(configbyte & PCI_COMMAND_MEMORY)) { if (!(configbyte & PCI_COMMAND_MEMORY)) {
...@@ -666,7 +685,8 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, const struct pci_devi ...@@ -666,7 +685,8 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, const struct pci_devi
for (i = 0; i < MAX_SOCKETS; i++) { for (i = 0; i < MAX_SOCKETS; i++) {
ret = pcmcia_register_socket(&socket[i].socket); ret = pcmcia_register_socket(&socket[i].socket);
if (ret) { if (ret) {
printk(KERN_INFO "pd6729: pcmcia_register_socket failed.\n"); printk(KERN_INFO "pd6729: pcmcia_register_socket "
"failed.\n");
for (j = 0; j < i ; j++) for (j = 0; j < i ; j++)
pcmcia_unregister_socket(&socket[j].socket); pcmcia_unregister_socket(&socket[j].socket);
goto err_out_free_res2; goto err_out_free_res2;
......
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