linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk
@ 2019-12-08 16:09 Simon Geis
  2019-12-08 16:09 ` [PATCH 02/12] PCMCIA: remove trailing whitespaces Simon Geis
                   ` (11 more replies)
  0 siblings, 12 replies; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

Fix the checkpatch warning:
	WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ...
		then pr_err(...  to printk(KERN_ERR ...
and
	WARNING: printk() should include KERN_<LEVEL> facility level
		by using dev_err()/dev_info() according to the message.

Split the assignment of variable 'sock' in in order to get access to
struct_info with the 'container_of' function call.

pr_err is used where no struct pci_dev is available.

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>

---
 drivers/pcmcia/i82092.c | 79 ++++++++++++++++++++++++++++++-----------
 1 file changed, 58 insertions(+), 21 deletions(-)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index aad8a46605be..ba33293b1a34 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -92,11 +92,13 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 			break;
 			
 		default:
-			printk(KERN_ERR "i82092aa: Oops, you did something we didn't think of.\n");
+			dev_err(&dev->dev,
+				"i82092aa: Oops, you did something we didn't think of.\n");
 			ret = -EIO;
 			goto err_out_disable;
 	}
-	printk(KERN_INFO "i82092aa: configured as a %d socket device.\n", socket_count);
+	dev_info(&dev->dev, "i82092aa: configured as a %d socket device.\n",
+		 socket_count);
 
 	if (!request_region(pci_resource_start(dev, 0), 2, "i82092aa")) {
 		ret = -EBUSY;
@@ -130,7 +132,9 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 	/* Register the interrupt handler */
 	dev_dbg(&dev->dev, "Requesting interrupt %i\n", dev->irq);
 	if ((ret = request_irq(dev->irq, i82092aa_interrupt, IRQF_SHARED, "i82092aa", i82092aa_interrupt))) {
-		printk(KERN_ERR "i82092aa: Failed to register IRQ %d, aborting\n", dev->irq);
+		dev_err(&dev->dev,
+			"i82092aa: Failed to register IRQ %d, aborting\n",
+			dev->irq);
 		goto err_out_free_res;
 	}
 
@@ -306,7 +310,7 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 	while (1) {
 		loopcount++;
 		if (loopcount>20) {
-			printk(KERN_ERR "i82092aa: infinite eventloop in interrupt \n");
+			pr_err("i82092aa: infinite eventloop in interrupt\n");
 			break;
 		}
 		
@@ -326,7 +330,8 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 			 
 			if (csc & I365_CSC_DETECT) {
 				events |= SS_DETECT;
-				printk("Card detected in socket %i!\n",i);
+				dev_info(&sockets[i].dev->dev,
+					 "Card detected in socket %i!\n", i);
 			 }
 			
 			if (indirect_read(i,I365_INTCTL) & I365_PC_IOCARD) { 
@@ -417,7 +422,9 @@ static int i82092aa_init(struct pcmcia_socket *sock)
                                                                                                                                                                                                                                               
 static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 {
-	unsigned int sock = container_of(socket, struct socket_info, socket)->number;
+	struct socket_info *sock_info = container_of(socket, struct socket_info,
+						     socket);
+	unsigned int sock = sock_info->number;
 	unsigned int status;
 	
 	enter("i82092aa_get_status");
@@ -458,7 +465,9 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 
 static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *state) 
 {
-	unsigned int sock = container_of(socket, struct socket_info, socket)->number;
+	struct socket_info *sock_info = container_of(socket, struct socket_info,
+						     socket);
+	unsigned int sock = sock_info->number;
 	unsigned char reg;
 	
 	enter("i82092aa_set_socket");
@@ -482,11 +491,11 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 	reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */
 	
 	if (state->flags & SS_PWR_AUTO) {
-		printk("Auto power\n");
+		dev_info(&sock_info->dev->dev, "Auto power\n");
 		reg |= I365_PWR_AUTO;	/* automatic power mngmnt */
 	}
 	if (state->flags & SS_OUTPUT_ENA) {
-		printk("Power Enabled \n");
+		dev_info(&sock_info->dev->dev, "Power Enabled\n");
 		reg |= I365_PWR_OUT;	/* enable power */
 	}
 	
@@ -494,11 +503,15 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 		case 0:	
 			break;
 		case 50: 
-			printk("setting voltage to Vcc to 5V on socket %i\n",sock);
+			dev_info(&sock_info->dev->dev,
+				 "setting voltage to Vcc to 5V on socket %i\n",
+				 sock);
 			reg |= I365_VCC_5V;
 			break;
 		default:
-			printk("i82092aa: i82092aa_set_socket called with invalid VCC power value: %i ", state->Vcc);
+			dev_err(&sock_info->dev->dev,
+				"i82092aa: %s called with invalid VCC power value: %i",
+				__func__, state->Vcc);
 			leave("i82092aa_set_socket");
 			return -EINVAL;
 	}
@@ -506,18 +519,25 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 	
 	switch (state->Vpp) {
 		case 0:	
-			printk("not setting Vpp on socket %i\n",sock);
+			dev_info(&sock_info->dev->dev,
+				 "not setting Vpp on socket %i\n",
+				 sock);
 			break;
 		case 50: 
-			printk("setting Vpp to 5.0 for socket %i\n",sock);
+			dev_info(&sock_info->dev->dev,
+				 "setting Vpp to 5.0 for socket %i\n",
+				 sock);
 			reg |= I365_VPP1_5V | I365_VPP2_5V;
 			break;
 		case 120: 
-			printk("setting Vpp to 12.0\n");
+			dev_info(&sock_info->dev->dev,
+				 "setting Vpp to 12.0\n");
 			reg |= I365_VPP1_12V | I365_VPP2_12V;
 			break;
 		default:
-			printk("i82092aa: i82092aa_set_socket called with invalid VPP power value: %i ", state->Vcc);
+			dev_err(&sock_info->dev->dev,
+				"i82092aa: %s called with invalid VPP power value: %i",
+				__func__, state->Vcc);
 			leave("i82092aa_set_socket");
 			return -EINVAL;
 	}
@@ -555,7 +575,9 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 
 static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_map *io)
 {
-	unsigned int sock = container_of(socket, struct socket_info, socket)->number;
+	struct socket_info *sock_info = container_of(socket, struct socket_info,
+						     socket);
+	unsigned int sock = sock_info->number;
 	unsigned char map, ioctl;
 	
 	enter("i82092aa_set_io_map");
@@ -576,7 +598,10 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_ma
 	if (indirect_read(sock, I365_ADDRWIN) & I365_ENA_IO(map))
 		indirect_resetbit(sock, I365_ADDRWIN, I365_ENA_IO(map));
 
-/*	printk("set_io_map: Setting range to %x - %x \n",io->start,io->stop);  */
+/*	dev_info(&sock_info->dev->dev,
+ *		 "set_io_map: Setting range to %x - %x\n",
+ *		 io->start, io->stop);
+ */
 	
 	/* write the new values */
 	indirect_write16(sock,I365_IO(map)+I365_W_START,io->start);            	
@@ -619,7 +644,8 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 	if ( (mem->card_start > 0x3ffffff) || (region.start > region.end) ||
 	     (mem->speed > 1000) ) {
 		leave("i82092aa_set_mem_map: invalid address / speed");
-		printk("invalid mem map for socket %i: %llx to %llx with a "
+		dev_err(&sock_info->dev->dev,
+			"invalid mem map for socket %i: %llx to %llx with a "
 			"start of %x\n",
 			sock,
 			(unsigned long long)region.start,
@@ -633,7 +659,12 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 	              indirect_resetbit(sock, I365_ADDRWIN, I365_ENA_MEM(map));
 	                 
 	                 
-/* 	printk("set_mem_map: Setting map %i range to %x - %x on socket %i, speed is %i, active = %i \n",map, region.start,region.end,sock,mem->speed,mem->flags & MAP_ACTIVE);  */
+/*	dev_info(&sock_info->dev->dev,
+ *		 "set_mem_map: Setting map %i range to %x - %x on socket %i, "
+ *		 "speed is %i, active = %i\n", map,
+ *		 region.start, region.end, sock,mem->speed,
+ *		 mem->flags & MAP_ACTIVE);
+ */
 
 	/* write the start address */
 	base = I365_MEM(map);
@@ -669,10 +700,16 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 	if (mem->flags & MAP_WRPROT)
 		i |= I365_MEM_WRPROT;
 	if (mem->flags & MAP_ATTRIB) {
-/*		printk("requesting attribute memory for socket %i\n",sock);*/
+/*		dev_info(&sock_info->dev->dev,
+ *			 "requesting attribute memory for socket %i\n",
+ *			 sock);
+ */
 		i |= I365_MEM_REG;
 	} else {
-/*		printk("requesting normal memory for socket %i\n",sock);*/
+/*		dev_info(&sock_info->dev->dev,
+ *			 "requesting normal memory for socket %i\n",
+ *			 sock);
+ */
 	}
 	indirect_write16(sock,base+I365_W_OFF,i);
 	
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 02/12] PCMCIA: remove trailing whitespaces
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
@ 2019-12-08 16:09 ` Simon Geis
  2019-12-08 16:09 ` [PATCH 03/12] PCMCIA: add/remove wrong spaces Simon Geis
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

The identation for the comment block is corrected.

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>

---
 drivers/pcmcia/i82092.c | 233 ++++++++++++++++++++--------------------
 1 file changed, 115 insertions(+), 118 deletions(-)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index ba33293b1a34..4d189af52afb 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
-/* 
+/*
  * Driver for Intel I82092AA PCI-PCMCIA bridge.
  *
  * (C) 2001 Red Hat, Inc.
@@ -53,31 +53,33 @@ static struct pccard_operations i82092aa_operations = {
 
 struct socket_info {
 	int	number;
-	int	card_state; 	/*  0 = no socket,
-				    1 = empty socket, 
-				    2 = card but not initialized,
-				    3 = operational card */
+	int	card_state;
+		/* 0 = no socket,
+		 * 1 = empty socket,
+		 * 2 = card but not initialized,
+		 * 3 = operational card
+		 */
 	unsigned int io_base; 	/* base io address of the socket */
-	
+
 	struct pcmcia_socket socket;
 	struct pci_dev *dev;	/* The PCI device for the socket */
 };
 
 #define MAX_SOCKETS 4
 static struct socket_info sockets[MAX_SOCKETS];
-static int socket_count;  /* shortcut */                                  	                                	
+static int socket_count;	/* shortcut */
 
 
 static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
 	unsigned char configbyte;
 	int i, ret;
-	
+
 	enter("i82092aa_pci_probe");
-	
+
 	if ((ret = pci_enable_device(dev)))
 		return ret;
-		
+
 	pci_read_config_byte(dev, 0x40, &configbyte);  /* PCI Configuration Control */
 	switch(configbyte&6) {
 		case 0:
@@ -90,7 +92,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 		case 6:
 			socket_count = 4;
 			break;
-			
+
 		default:
 			dev_err(&dev->dev,
 				"i82092aa: Oops, you did something we didn't think of.\n");
@@ -104,7 +106,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 		ret = -EBUSY;
 		goto err_out_disable;
 	}
-	
+
 	for (i = 0;i<socket_count;i++) {
 		sockets[i].card_state = 1; /* 1 = present but empty */
 		sockets[i].io_base = pci_resource_start(dev, 0);
@@ -116,7 +118,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 		sockets[i].socket.owner = THIS_MODULE;
 
 		sockets[i].number = i;
-		
+
 		if (card_present(i)) {
 			sockets[i].card_state = 3;
 			dev_dbg(&dev->dev, "i82092aa: slot %i is occupied\n", i);
@@ -124,7 +126,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 			dev_dbg(&dev->dev, "i82092aa: slot %i is vacant\n", i);
 		}
 	}
-		
+
 	/* Now, specifiy that all interrupts are to be done as PCI interrupts */
 	configbyte = 0xFF; /* bitmask, one bit per event, 1 = PCI interrupt, 0 = ISA interrupt */
 	pci_write_config_byte(dev, 0x50, configbyte); /* PCI Interrupt Routing Register */
@@ -162,7 +164,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 	release_region(pci_resource_start(dev, 0), 2);
 err_out_disable:
 	pci_disable_device(dev);
-	return ret;			
+	return ret;
 }
 
 static void i82092aa_pci_remove(struct pci_dev *dev)
@@ -170,7 +172,7 @@ static void i82092aa_pci_remove(struct pci_dev *dev)
 	int i;
 
 	enter("i82092aa_pci_remove");
-	
+
 	free_irq(dev->irq, i82092aa_interrupt);
 
 	for (i = 0; i < socket_count; i++)
@@ -222,7 +224,7 @@ static void indirect_write(int socket, unsigned short reg, unsigned char value)
 	unsigned long flags;
 	spin_lock_irqsave(&port_lock,flags);
 	reg = reg + socket * 0x40;
-	port = sockets[socket].io_base; 
+	port = sockets[socket].io_base;
 	outb(reg,port);
 	outb(value,port+1);
 	spin_unlock_irqrestore(&port_lock,flags);
@@ -235,7 +237,7 @@ static void indirect_setbit(int socket, unsigned short reg, unsigned char mask)
 	unsigned long flags;
 	spin_lock_irqsave(&port_lock,flags);
 	reg = reg + socket * 0x40;
-	port = sockets[socket].io_base; 
+	port = sockets[socket].io_base;
 	outb(reg,port);
 	val = inb(port+1);
 	val |= mask;
@@ -252,7 +254,7 @@ static void indirect_resetbit(int socket, unsigned short reg, unsigned char mask
 	unsigned long flags;
 	spin_lock_irqsave(&port_lock,flags);
 	reg = reg + socket * 0x40;
-	port = sockets[socket].io_base; 
+	port = sockets[socket].io_base;
 	outb(reg,port);
 	val = inb(port+1);
 	val &= ~mask;
@@ -268,14 +270,14 @@ static void indirect_write16(int socket, unsigned short reg, unsigned short valu
 	unsigned long flags;
 	spin_lock_irqsave(&port_lock,flags);
 	reg = reg + socket * 0x40;
-	port = sockets[socket].io_base; 
-	
+	port = sockets[socket].io_base;
+
 	outb(reg,port);
 	val = value & 255;
 	outb(val,port+1);
-	
+
 	reg++;
-	
+
 	outb(reg,port);
 	val = value>>8;
 	outb(val,port+1);
@@ -293,7 +295,7 @@ static int to_cycles(int ns)
 	else
 		return 0;
 }
-    
+
 
 /* Interrupt handler functionality */
 
@@ -304,55 +306,54 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 	int handled = 0;
 
 	unsigned int events, active=0;
-	
+
 /*	enter("i82092aa_interrupt");*/
-	
+
 	while (1) {
 		loopcount++;
 		if (loopcount>20) {
 			pr_err("i82092aa: infinite eventloop in interrupt\n");
 			break;
 		}
-		
+
 		active = 0;
-		
+
 		for (i=0;i<socket_count;i++) {
 			int csc;
 			if (sockets[i].card_state==0) /* Inactive socket, should not happen */
 				continue;
-			
+
 			csc = indirect_read(i,I365_CSC); /* card status change register */
-			
+
 			if (csc==0)  /* no events on this socket */
 			   	continue;
 			handled = 1;
 			events = 0;
-			 
+
 			if (csc & I365_CSC_DETECT) {
 				events |= SS_DETECT;
 				dev_info(&sockets[i].dev->dev,
 					 "Card detected in socket %i!\n", i);
 			 }
-			
-			if (indirect_read(i,I365_INTCTL) & I365_PC_IOCARD) { 
+
+			if (indirect_read(i,I365_INTCTL) & I365_PC_IOCARD) {
 				/* 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 {
 				/* Check for battery/ready events */
 				events |= (csc & I365_CSC_BVD1) ? SS_BATDEAD : 0;
 				events |= (csc & I365_CSC_BVD2) ? SS_BATWARN : 0;
 				events |= (csc & I365_CSC_READY) ? SS_READY : 0;
 			}
-			
+
 			if (events) {
 				pcmcia_parse_events(&sockets[i].socket, events);
 			}
 			active |= events;
 		}
-				
+
 		if (active==0) /* no more events to handle */
-			break;				
-		
+			break;
 	}
 	return IRQ_RETVAL(handled);
 /*	leave("i82092aa_interrupt");*/
@@ -363,22 +364,22 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 /* socket functions */
 
 static int card_present(int socketno)
-{	
+{
 	unsigned int val;
 	enter("card_present");
-	
+
 	if ((socketno<0) || (socketno >= MAX_SOCKETS))
 		return 0;
 	if (sockets[socketno].io_base == 0)
 		return 0;
 
-		
+
 	val = indirect_read(socketno, 1); /* Interface status register */
 	if ((val&12)==12) {
 		leave("card_present 1");
 		return 1;
 	}
-		
+
 	leave("card_present 0");
 	return 0;
 }
@@ -388,25 +389,21 @@ static void set_bridge_state(int sock)
 	enter("set_bridge_state");
 	indirect_write(sock, I365_GBLCTL,0x00);
 	indirect_write(sock, I365_GENCTL,0x00);
-	
+
 	indirect_setbit(sock, I365_INTCTL,0x08);
 	leave("set_bridge_state");
 }
 
 
-
-
-
-      
 static int i82092aa_init(struct pcmcia_socket *sock)
 {
 	int i;
 	struct resource res = { .start = 0, .end = 0x0fff };
         pccard_io_map io = { 0, 0, 0, 0, 1 };
 	pccard_mem_map mem = { .res = &res, };
-        
+
         enter("i82092aa_init");
-                        
+
         for (i = 0; i < 2; i++) {
         	io.map = i;
                 i82092aa_set_io_map(sock, &io);
@@ -415,27 +412,28 @@ static int i82092aa_init(struct pcmcia_socket *sock)
         	mem.map = i;
                 i82092aa_set_mem_map(sock, &mem);
 	}
-	
+
 	leave("i82092aa_init");
 	return 0;
 }
-                                                                                                                                                                                                                                              
+
+
 static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 {
 	struct socket_info *sock_info = container_of(socket, struct socket_info,
 						     socket);
 	unsigned int sock = sock_info->number;
 	unsigned int status;
-	
+
 	enter("i82092aa_get_status");
-	
+
 	status = indirect_read(sock,I365_STATUS); /* Interface Status Register */
 	*value = 0;
-	
+
 	if ((status & I365_CS_DETECT) == I365_CS_DETECT) {
 		*value |= SS_DETECT;
 	}
-		
+
 	/* IO cards have a different meaning of bits 0,1 */
 	/* Also notice the inverse-logic on the bits */
 	if (indirect_read(sock, I365_INTCTL) & I365_PC_IOCARD)	{
@@ -448,13 +446,13 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 		if (!(status & I365_CS_BVD2))
 			*value |= SS_BATWARN;
 	}
-	 
+
 	if (status & I365_CS_WRPROT)
 		(*value) |= SS_WRPROT;	/* card is write protected */
-	 
+
 	if (status & I365_CS_READY)
 		(*value) |= SS_READY;    /* card is not busy */
-	 	
+
 	if (status & I365_CS_POWERON)
 		(*value) |= SS_POWERON;  /* power is applied to the card */
 
@@ -463,33 +461,33 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 }
 
 
-static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *state) 
+static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *state)
 {
 	struct socket_info *sock_info = container_of(socket, struct socket_info,
 						     socket);
 	unsigned int sock = sock_info->number;
 	unsigned char reg;
-	
+
 	enter("i82092aa_set_socket");
-	
+
 	/* First, set the global controller options */
-	
+
 	set_bridge_state(sock);
-	
+
 	/* Values for the IGENC register */
-	
+
 	reg = 0;
 	if (!(state->flags & SS_RESET)) 	/* The reset bit has "inverse" logic */
-		reg = reg | I365_PC_RESET;  
-	if (state->flags & SS_IOCARD) 
+		reg = reg | I365_PC_RESET;
+	if (state->flags & SS_IOCARD)
 		reg = reg | I365_PC_IOCARD;
-		
+
 	indirect_write(sock,I365_INTCTL,reg); /* IGENC, Interrupt and General Control Register */
-	
+
 	/* Power registers */
-	
+
 	reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */
-	
+
 	if (state->flags & SS_PWR_AUTO) {
 		dev_info(&sock_info->dev->dev, "Auto power\n");
 		reg |= I365_PWR_AUTO;	/* automatic power mngmnt */
@@ -498,11 +496,11 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 		dev_info(&sock_info->dev->dev, "Power Enabled\n");
 		reg |= I365_PWR_OUT;	/* enable power */
 	}
-	
+
 	switch (state->Vcc) {
-		case 0:	
+		case 0:
 			break;
-		case 50: 
+		case 50:
 			dev_info(&sock_info->dev->dev,
 				 "setting voltage to Vcc to 5V on socket %i\n",
 				 sock);
@@ -515,21 +513,20 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 			leave("i82092aa_set_socket");
 			return -EINVAL;
 	}
-	
-	
+
 	switch (state->Vpp) {
-		case 0:	
+		case 0:
 			dev_info(&sock_info->dev->dev,
 				 "not setting Vpp on socket %i\n",
 				 sock);
 			break;
-		case 50: 
+		case 50:
 			dev_info(&sock_info->dev->dev,
 				 "setting Vpp to 5.0 for socket %i\n",
 				 sock);
 			reg |= I365_VPP1_5V | I365_VPP2_5V;
 			break;
-		case 120: 
+		case 120:
 			dev_info(&sock_info->dev->dev,
 				 "setting Vpp to 12.0\n");
 			reg |= I365_VPP1_12V | I365_VPP2_12V;
@@ -541,12 +538,12 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 			leave("i82092aa_set_socket");
 			return -EINVAL;
 	}
-	
+
 	if (reg != indirect_read(sock,I365_POWER)) /* only write if changed */
 		indirect_write(sock,I365_POWER,reg);
-		
+
 	/* Enable specific interrupt events */
-	
+
 	reg = 0x00;
 	if (state->csc_mask & SS_DETECT) {
 		reg |= I365_CSC_DETECT;
@@ -555,17 +552,17 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 		if (state->csc_mask & SS_STSCHG)
 			reg |= I365_CSC_STSCHG;
 	} else {
-		if (state->csc_mask & SS_BATDEAD) 
+		if (state->csc_mask & SS_BATDEAD)
 			reg |= I365_CSC_BVD1;
-		if (state->csc_mask & SS_BATWARN) 
+		if (state->csc_mask & SS_BATWARN)
 			reg |= I365_CSC_BVD2;
-		if (state->csc_mask & SS_READY) 
-			reg |= I365_CSC_READY; 
-		                        
+		if (state->csc_mask & SS_READY)
+			reg |= I365_CSC_READY;
+
 	}
-	
+
 	/* now write the value and clear the (probably bogus) pending stuff by doing a dummy read*/
-	
+
 	indirect_write(sock,I365_CSCINT,reg);
 	(void)indirect_read(sock,I365_CSC);
 
@@ -579,12 +576,12 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_ma
 						     socket);
 	unsigned int sock = sock_info->number;
 	unsigned char map, ioctl;
-	
+
 	enter("i82092aa_set_io_map");
-	
+
 	map = io->map;
-	
-	/* Check error conditions */	
+
+	/* Check error conditions */
 	if (map > 1) {
 		leave("i82092aa_set_io_map with invalid map");
 		return -EINVAL;
@@ -594,7 +591,7 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_ma
 		return -EINVAL;
 	}
 
-	/* Turn off the window before changing anything */ 
+	/* Turn off the window before changing anything */
 	if (indirect_read(sock, I365_ADDRWIN) & I365_ENA_IO(map))
 		indirect_resetbit(sock, I365_ADDRWIN, I365_ENA_IO(map));
 
@@ -602,23 +599,23 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_ma
  *		 "set_io_map: Setting range to %x - %x\n",
  *		 io->start, io->stop);
  */
-	
+
 	/* write the new values */
-	indirect_write16(sock,I365_IO(map)+I365_W_START,io->start);            	
-	indirect_write16(sock,I365_IO(map)+I365_W_STOP,io->stop);            	
-	            	
+	indirect_write16(sock,I365_IO(map)+I365_W_START,io->start);
+	indirect_write16(sock,I365_IO(map)+I365_W_STOP,io->stop);
+
 	ioctl = indirect_read(sock,I365_IOCTL) & ~I365_IOCTL_MASK(map);
-	
+
 	if (io->flags & (MAP_16BIT|MAP_AUTOSZ))
 		ioctl |= I365_IOCTL_16BIT(map);
-		
+
 	indirect_write(sock,I365_IOCTL,ioctl);
-	
+
 	/* Turn the window back on if needed */
 	if (io->flags & MAP_ACTIVE)
 		indirect_setbit(sock,I365_ADDRWIN,I365_ENA_IO(map));
-			
-	leave("i82092aa_set_io_map");	
+
+	leave("i82092aa_set_io_map");
 	return 0;
 }
 
@@ -629,18 +626,18 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 	struct pci_bus_region region;
 	unsigned short base, i;
 	unsigned char map;
-	
+
 	enter("i82092aa_set_mem_map");
 
 	pcibios_resource_to_bus(sock_info->dev->bus, &region, mem->res);
-	
+
 	map = mem->map;
 	if (map > 4) {
 		leave("i82092aa_set_mem_map: invalid map");
 		return -EINVAL;
 	}
-	
-	
+
+
 	if ( (mem->card_start > 0x3ffffff) || (region.start > region.end) ||
 	     (mem->speed > 1000) ) {
 		leave("i82092aa_set_mem_map: invalid address / speed");
@@ -653,12 +650,12 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 			mem->card_start);
 		return -EINVAL;
 	}
-	
+
 	/* Turn off the window before changing anything */
 	if (indirect_read(sock, I365_ADDRWIN) & I365_ENA_MEM(map))
 	              indirect_resetbit(sock, I365_ADDRWIN, I365_ENA_MEM(map));
-	                 
-	                 
+
+
 /*	dev_info(&sock_info->dev->dev,
  *		 "set_mem_map: Setting map %i range to %x - %x on socket %i, "
  *		 "speed is %i, active = %i\n", map,
@@ -669,14 +666,14 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 	/* write the start address */
 	base = I365_MEM(map);
 	i = (region.start >> 12) & 0x0fff;
-	if (mem->flags & MAP_16BIT) 
+	if (mem->flags & MAP_16BIT)
 		i |= I365_MEM_16BIT;
 	if (mem->flags & MAP_0WS)
-		i |= I365_MEM_0WS;	
+		i |= I365_MEM_0WS;
 	indirect_write16(sock,base+I365_W_START,i);
-		               
+
 	/* write the stop address */
-	
+
 	i= (region.end >> 12) & 0x0fff;
 	switch (to_cycles(mem->speed)) {
 		case 0:
@@ -691,11 +688,11 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 			i |= I365_MEM_WS1 | I365_MEM_WS0;
 			break;
 	}
-	
+
 	indirect_write16(sock,base+I365_W_STOP,i);
-	
+
 	/* card start */
-	
+
 	i = ((mem->card_start - region.start) >> 12) & 0x3fff;
 	if (mem->flags & MAP_WRPROT)
 		i |= I365_MEM_WRPROT;
@@ -712,11 +709,11 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
  */
 	}
 	indirect_write16(sock,base+I365_W_OFF,i);
-	
+
 	/* Enable the window if necessary */
 	if (mem->flags & MAP_ACTIVE)
 		indirect_setbit(sock, I365_ADDRWIN, I365_ENA_MEM(map));
-	            
+
 	leave("i82092aa_set_mem_map");
 	return 0;
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 03/12]  PCMCIA: add/remove wrong spaces
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
  2019-12-08 16:09 ` [PATCH 02/12] PCMCIA: remove trailing whitespaces Simon Geis
@ 2019-12-08 16:09 ` Simon Geis
  2019-12-08 16:09 ` [PATCH 04/12] PCMCIA: Remove spaces before tabs Simon Geis
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>

---
 drivers/pcmcia/i82092.c | 128 ++++++++++++++++++++--------------------
 1 file changed, 64 insertions(+), 64 deletions(-)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index 4d189af52afb..bb3014ba329e 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -81,7 +81,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 		return ret;
 
 	pci_read_config_byte(dev, 0x40, &configbyte);  /* PCI Configuration Control */
-	switch(configbyte&6) {
+	switch (configbyte&6) {
 		case 0:
 			socket_count = 2;
 			break;
@@ -107,7 +107,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 		goto err_out_disable;
 	}
 
-	for (i = 0;i<socket_count;i++) {
+	for (i = 0; i < socket_count; i++) {
 		sockets[i].card_state = 1; /* 1 = present but empty */
 		sockets[i].io_base = pci_resource_start(dev, 0);
 		sockets[i].socket.features |= SS_CAP_PCCARD;
@@ -140,7 +140,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 		goto err_out_free_res;
 	}
 
-	for (i = 0; i<socket_count; i++) {
+	for (i = 0; i < socket_count; i++) {
 		sockets[i].socket.dev.parent = &dev->dev;
 		sockets[i].socket.ops = &i82092aa_operations;
 		sockets[i].socket.resource_ops = &pccard_nonstatic_ops;
@@ -155,7 +155,7 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 
 err_out_free_sockets:
 	if (i) {
-		for (i--;i>=0;i--) {
+		for (i--; i >= 0; i--) {
 			pcmcia_unregister_socket(&sockets[i].socket);
 		}
 	}
@@ -190,12 +190,12 @@ static unsigned char indirect_read(int socket, unsigned short reg)
 	unsigned short int port;
 	unsigned char val;
 	unsigned long flags;
-	spin_lock_irqsave(&port_lock,flags);
+	spin_lock_irqsave(&port_lock, flags);
 	reg += socket * 0x40;
 	port = sockets[socket].io_base;
-	outb(reg,port);
+	outb(reg, port);
 	val = inb(port+1);
-	spin_unlock_irqrestore(&port_lock,flags);
+	spin_unlock_irqrestore(&port_lock, flags);
 	return val;
 }
 
@@ -205,15 +205,15 @@ static unsigned short indirect_read16(int socket, unsigned short reg)
 	unsigned short int port;
 	unsigned short tmp;
 	unsigned long flags;
-	spin_lock_irqsave(&port_lock,flags);
+	spin_lock_irqsave(&port_lock, flags);
 	reg  = reg + socket * 0x40;
 	port = sockets[socket].io_base;
-	outb(reg,port);
+	outb(reg, port);
 	tmp = inb(port+1);
 	reg++;
-	outb(reg,port);
+	outb(reg, port);
 	tmp = tmp | (inb(port+1)<<8);
-	spin_unlock_irqrestore(&port_lock,flags);
+	spin_unlock_irqrestore(&port_lock, flags);
 	return tmp;
 }
 #endif
@@ -222,12 +222,12 @@ static void indirect_write(int socket, unsigned short reg, unsigned char value)
 {
 	unsigned short int port;
 	unsigned long flags;
-	spin_lock_irqsave(&port_lock,flags);
+	spin_lock_irqsave(&port_lock, flags);
 	reg = reg + socket * 0x40;
 	port = sockets[socket].io_base;
-	outb(reg,port);
-	outb(value,port+1);
-	spin_unlock_irqrestore(&port_lock,flags);
+	outb(reg, port);
+	outb(value, port+1);
+	spin_unlock_irqrestore(&port_lock, flags);
 }
 
 static void indirect_setbit(int socket, unsigned short reg, unsigned char mask)
@@ -235,15 +235,15 @@ static void indirect_setbit(int socket, unsigned short reg, unsigned char mask)
 	unsigned short int port;
 	unsigned char val;
 	unsigned long flags;
-	spin_lock_irqsave(&port_lock,flags);
+	spin_lock_irqsave(&port_lock, flags);
 	reg = reg + socket * 0x40;
 	port = sockets[socket].io_base;
-	outb(reg,port);
+	outb(reg, port);
 	val = inb(port+1);
 	val |= mask;
-	outb(reg,port);
-	outb(val,port+1);
-	spin_unlock_irqrestore(&port_lock,flags);
+	outb(reg, port);
+	outb(val, port+1);
+	spin_unlock_irqrestore(&port_lock, flags);
 }
 
 
@@ -252,15 +252,15 @@ static void indirect_resetbit(int socket, unsigned short reg, unsigned char mask
 	unsigned short int port;
 	unsigned char val;
 	unsigned long flags;
-	spin_lock_irqsave(&port_lock,flags);
+	spin_lock_irqsave(&port_lock, flags);
 	reg = reg + socket * 0x40;
 	port = sockets[socket].io_base;
-	outb(reg,port);
+	outb(reg, port);
 	val = inb(port+1);
 	val &= ~mask;
-	outb(reg,port);
-	outb(val,port+1);
-	spin_unlock_irqrestore(&port_lock,flags);
+	outb(reg, port);
+	outb(val, port+1);
+	spin_unlock_irqrestore(&port_lock, flags);
 }
 
 static void indirect_write16(int socket, unsigned short reg, unsigned short value)
@@ -268,20 +268,20 @@ static void indirect_write16(int socket, unsigned short reg, unsigned short valu
 	unsigned short int port;
 	unsigned char val;
 	unsigned long flags;
-	spin_lock_irqsave(&port_lock,flags);
+	spin_lock_irqsave(&port_lock, flags);
 	reg = reg + socket * 0x40;
 	port = sockets[socket].io_base;
 
-	outb(reg,port);
+	outb(reg, port);
 	val = value & 255;
-	outb(val,port+1);
+	outb(val, port+1);
 
 	reg++;
 
-	outb(reg,port);
+	outb(reg, port);
 	val = value>>8;
-	outb(val,port+1);
-	spin_unlock_irqrestore(&port_lock,flags);
+	outb(val, port+1);
+	spin_unlock_irqrestore(&port_lock, flags);
 }
 
 /* simple helper functions */
@@ -290,7 +290,7 @@ static int cycle_time = 120;
 
 static int to_cycles(int ns)
 {
-	if (cycle_time!=0)
+	if (cycle_time != 0)
 		return ns/cycle_time;
 	else
 		return 0;
@@ -305,27 +305,27 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 	int loopcount = 0;
 	int handled = 0;
 
-	unsigned int events, active=0;
+	unsigned int events, active = 0;
 
 /*	enter("i82092aa_interrupt");*/
 
 	while (1) {
 		loopcount++;
-		if (loopcount>20) {
+		if (loopcount > 20) {
 			pr_err("i82092aa: infinite eventloop in interrupt\n");
 			break;
 		}
 
 		active = 0;
 
-		for (i=0;i<socket_count;i++) {
+		for (i = 0; i < socket_count; i++) {
 			int csc;
-			if (sockets[i].card_state==0) /* Inactive socket, should not happen */
+			if (sockets[i].card_state == 0) /* Inactive socket, should not happen */
 				continue;
 
-			csc = indirect_read(i,I365_CSC); /* card status change register */
+			csc = indirect_read(i, I365_CSC); /* card status change register */
 
-			if (csc==0)  /* no events on this socket */
+			if (csc == 0)  /* no events on this socket */
 			   	continue;
 			handled = 1;
 			events = 0;
@@ -336,7 +336,7 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 					 "Card detected in socket %i!\n", i);
 			 }
 
-			if (indirect_read(i,I365_INTCTL) & I365_PC_IOCARD) {
+			if (indirect_read(i, I365_INTCTL) & I365_PC_IOCARD) {
 				/* For IO/CARDS, bit 0 means "read the card" */
 				events |= (csc & I365_CSC_STSCHG) ? SS_STSCHG : 0;
 			} else {
@@ -352,7 +352,7 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 			active |= events;
 		}
 
-		if (active==0) /* no more events to handle */
+		if (active == 0) /* no more events to handle */
 			break;
 	}
 	return IRQ_RETVAL(handled);
@@ -368,14 +368,14 @@ static int card_present(int socketno)
 	unsigned int val;
 	enter("card_present");
 
-	if ((socketno<0) || (socketno >= MAX_SOCKETS))
+	if ((socketno < 0) || (socketno >= MAX_SOCKETS))
 		return 0;
 	if (sockets[socketno].io_base == 0)
 		return 0;
 
 
 	val = indirect_read(socketno, 1); /* Interface status register */
-	if ((val&12)==12) {
+	if ((val&12) == 12) {
 		leave("card_present 1");
 		return 1;
 	}
@@ -387,10 +387,10 @@ static int card_present(int socketno)
 static void set_bridge_state(int sock)
 {
 	enter("set_bridge_state");
-	indirect_write(sock, I365_GBLCTL,0x00);
-	indirect_write(sock, I365_GENCTL,0x00);
+	indirect_write(sock, I365_GBLCTL, 0x00);
+	indirect_write(sock, I365_GENCTL, 0x00);
 
-	indirect_setbit(sock, I365_INTCTL,0x08);
+	indirect_setbit(sock, I365_INTCTL, 0x08);
 	leave("set_bridge_state");
 }
 
@@ -427,7 +427,7 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 
 	enter("i82092aa_get_status");
 
-	status = indirect_read(sock,I365_STATUS); /* Interface Status Register */
+	status = indirect_read(sock, I365_STATUS); /* Interface Status Register */
 	*value = 0;
 
 	if ((status & I365_CS_DETECT) == I365_CS_DETECT) {
@@ -482,7 +482,7 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 	if (state->flags & SS_IOCARD)
 		reg = reg | I365_PC_IOCARD;
 
-	indirect_write(sock,I365_INTCTL,reg); /* IGENC, Interrupt and General Control Register */
+	indirect_write(sock, I365_INTCTL, reg); /* IGENC, Interrupt and General Control Register */
 
 	/* Power registers */
 
@@ -539,8 +539,8 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 			return -EINVAL;
 	}
 
-	if (reg != indirect_read(sock,I365_POWER)) /* only write if changed */
-		indirect_write(sock,I365_POWER,reg);
+	if (reg != indirect_read(sock, I365_POWER)) /* only write if changed */
+		indirect_write(sock, I365_POWER, reg);
 
 	/* Enable specific interrupt events */
 
@@ -563,8 +563,8 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 
 	/* now write the value and clear the (probably bogus) pending stuff by doing a dummy read*/
 
-	indirect_write(sock,I365_CSCINT,reg);
-	(void)indirect_read(sock,I365_CSC);
+	indirect_write(sock, I365_CSCINT, reg);
+	(void)indirect_read(sock, I365_CSC);
 
 	leave("i82092aa_set_socket");
 	return 0;
@@ -586,7 +586,7 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_ma
 		leave("i82092aa_set_io_map with invalid map");
 		return -EINVAL;
 	}
-	if ((io->start > 0xffff) || (io->stop > 0xffff) || (io->stop < io->start)){
+	if ((io->start > 0xffff) || (io->stop > 0xffff) || (io->stop < io->start)) {
 		leave("i82092aa_set_io_map with invalid io");
 		return -EINVAL;
 	}
@@ -601,19 +601,19 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_ma
  */
 
 	/* write the new values */
-	indirect_write16(sock,I365_IO(map)+I365_W_START,io->start);
-	indirect_write16(sock,I365_IO(map)+I365_W_STOP,io->stop);
+	indirect_write16(sock, I365_IO(map)+I365_W_START, io->start);
+	indirect_write16(sock, I365_IO(map)+I365_W_STOP, io->stop);
 
-	ioctl = indirect_read(sock,I365_IOCTL) & ~I365_IOCTL_MASK(map);
+	ioctl = indirect_read(sock, I365_IOCTL) & ~I365_IOCTL_MASK(map);
 
 	if (io->flags & (MAP_16BIT|MAP_AUTOSZ))
 		ioctl |= I365_IOCTL_16BIT(map);
 
-	indirect_write(sock,I365_IOCTL,ioctl);
+	indirect_write(sock, I365_IOCTL, ioctl);
 
 	/* Turn the window back on if needed */
 	if (io->flags & MAP_ACTIVE)
-		indirect_setbit(sock,I365_ADDRWIN,I365_ENA_IO(map));
+		indirect_setbit(sock, I365_ADDRWIN, I365_ENA_IO(map));
 
 	leave("i82092aa_set_io_map");
 	return 0;
@@ -638,8 +638,8 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 	}
 
 
-	if ( (mem->card_start > 0x3ffffff) || (region.start > region.end) ||
-	     (mem->speed > 1000) ) {
+	if ((mem->card_start > 0x3ffffff) || (region.start > region.end) ||
+	     (mem->speed > 1000)) {
 		leave("i82092aa_set_mem_map: invalid address / speed");
 		dev_err(&sock_info->dev->dev,
 			"invalid mem map for socket %i: %llx to %llx with a "
@@ -670,11 +670,11 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 		i |= I365_MEM_16BIT;
 	if (mem->flags & MAP_0WS)
 		i |= I365_MEM_0WS;
-	indirect_write16(sock,base+I365_W_START,i);
+	indirect_write16(sock, base+I365_W_START, i);
 
 	/* write the stop address */
 
-	i= (region.end >> 12) & 0x0fff;
+	i = (region.end >> 12) & 0x0fff;
 	switch (to_cycles(mem->speed)) {
 		case 0:
 			break;
@@ -689,7 +689,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 			break;
 	}
 
-	indirect_write16(sock,base+I365_W_STOP,i);
+	indirect_write16(sock, base+I365_W_STOP, i);
 
 	/* card start */
 
@@ -708,7 +708,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
  *			 sock);
  */
 	}
-	indirect_write16(sock,base+I365_W_OFF,i);
+	indirect_write16(sock, base+I365_W_OFF, i);
 
 	/* Enable the window if necessary */
 	if (mem->flags & MAP_ACTIVE)
@@ -727,7 +727,7 @@ static void i82092aa_module_exit(void)
 {
 	enter("i82092aa_module_exit");
 	pci_unregister_driver(&i82092aa_pci_driver);
-	if (sockets[0].io_base>0)
+	if (sockets[0].io_base > 0)
 			 release_region(sockets[0].io_base, 2);
 	leave("i82092aa_module_exit");
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 04/12] PCMCIA: Remove spaces before tabs
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
  2019-12-08 16:09 ` [PATCH 02/12] PCMCIA: remove trailing whitespaces Simon Geis
  2019-12-08 16:09 ` [PATCH 03/12] PCMCIA: add/remove wrong spaces Simon Geis
@ 2019-12-08 16:09 ` Simon Geis
  2019-12-08 16:09 ` [PATCH 05/12] PCMCIA: remove braces around single statement blocks Simon Geis
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>

---
 drivers/pcmcia/i82092.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index bb3014ba329e..2f698d021411 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -42,7 +42,7 @@ static struct pci_driver i82092aa_pci_driver = {
 
 /* the pccard structure and its functions */
 static struct pccard_operations i82092aa_operations = {
-	.init 		 	= i82092aa_init,
+	.init			= i82092aa_init,
 	.get_status		= i82092aa_get_status,
 	.set_socket		= i82092aa_set_socket,
 	.set_io_map		= i82092aa_set_io_map,
@@ -59,7 +59,7 @@ struct socket_info {
 		 * 2 = card but not initialized,
 		 * 3 = operational card
 		 */
-	unsigned int io_base; 	/* base io address of the socket */
+	unsigned int io_base;	/* base io address of the socket */
 
 	struct pcmcia_socket socket;
 	struct pci_dev *dev;	/* The PCI device for the socket */
@@ -326,7 +326,7 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 			csc = indirect_read(i, I365_CSC); /* card status change register */
 
 			if (csc == 0)  /* no events on this socket */
-			   	continue;
+				continue;
 			handled = 1;
 			events = 0;
 
@@ -334,7 +334,7 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 				events |= SS_DETECT;
 				dev_info(&sockets[i].dev->dev,
 					 "Card detected in socket %i!\n", i);
-			 }
+			}
 
 			if (indirect_read(i, I365_INTCTL) & I365_PC_IOCARD) {
 				/* For IO/CARDS, bit 0 means "read the card" */
@@ -399,18 +399,18 @@ static int i82092aa_init(struct pcmcia_socket *sock)
 {
 	int i;
 	struct resource res = { .start = 0, .end = 0x0fff };
-        pccard_io_map io = { 0, 0, 0, 0, 1 };
+	pccard_io_map io = { 0, 0, 0, 0, 1 };
 	pccard_mem_map mem = { .res = &res, };
 
-        enter("i82092aa_init");
+	enter("i82092aa_init");
 
-        for (i = 0; i < 2; i++) {
-        	io.map = i;
-                i82092aa_set_io_map(sock, &io);
+	for (i = 0; i < 2; i++) {
+		io.map = i;
+		i82092aa_set_io_map(sock, &io);
 	}
-        for (i = 0; i < 5; i++) {
-        	mem.map = i;
-                i82092aa_set_mem_map(sock, &mem);
+	for (i = 0; i < 5; i++) {
+		mem.map = i;
+		i82092aa_set_mem_map(sock, &mem);
 	}
 
 	leave("i82092aa_init");
@@ -653,7 +653,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 
 	/* Turn off the window before changing anything */
 	if (indirect_read(sock, I365_ADDRWIN) & I365_ENA_MEM(map))
-	              indirect_resetbit(sock, I365_ADDRWIN, I365_ENA_MEM(map));
+		indirect_resetbit(sock, I365_ADDRWIN, I365_ENA_MEM(map));
 
 
 /*	dev_info(&sock_info->dev->dev,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 05/12] PCMCIA: remove braces around single statement blocks
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
                   ` (2 preceding siblings ...)
  2019-12-08 16:09 ` [PATCH 04/12] PCMCIA: Remove spaces before tabs Simon Geis
@ 2019-12-08 16:09 ` Simon Geis
  2019-12-08 16:09 ` [PATCH 06/12] PCMCIA: insert blank line after declarations Simon Geis
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>
---
 drivers/pcmcia/i82092.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index 2f698d021411..0adac6b24915 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -145,9 +145,8 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 		sockets[i].socket.ops = &i82092aa_operations;
 		sockets[i].socket.resource_ops = &pccard_nonstatic_ops;
 		ret = pcmcia_register_socket(&sockets[i].socket);
-		if (ret) {
+		if (ret)
 			goto err_out_free_sockets;
-		}
 	}
 
 	leave("i82092aa_pci_probe");
@@ -155,9 +154,8 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 
 err_out_free_sockets:
 	if (i) {
-		for (i--; i >= 0; i--) {
+		for (i--; i >= 0; i--)
 			pcmcia_unregister_socket(&sockets[i].socket);
-		}
 	}
 	free_irq(dev->irq, i82092aa_interrupt);
 err_out_free_res:
@@ -346,9 +344,8 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 				events |= (csc & I365_CSC_READY) ? SS_READY : 0;
 			}
 
-			if (events) {
+			if (events)
 				pcmcia_parse_events(&sockets[i].socket, events);
-			}
 			active |= events;
 		}
 
@@ -430,9 +427,8 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 	status = indirect_read(sock, I365_STATUS); /* Interface Status Register */
 	*value = 0;
 
-	if ((status & I365_CS_DETECT) == I365_CS_DETECT) {
+	if ((status & I365_CS_DETECT) == I365_CS_DETECT)
 		*value |= SS_DETECT;
-	}
 
 	/* IO cards have a different meaning of bits 0,1 */
 	/* Also notice the inverse-logic on the bits */
@@ -545,9 +541,8 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 	/* Enable specific interrupt events */
 
 	reg = 0x00;
-	if (state->csc_mask & SS_DETECT) {
+	if (state->csc_mask & SS_DETECT)
 		reg |= I365_CSC_DETECT;
-	}
 	if (state->flags & SS_IOCARD) {
 		if (state->csc_mask & SS_STSCHG)
 			reg |= I365_CSC_STSCHG;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 06/12] PCMCIA: insert blank line after declarations
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
                   ` (3 preceding siblings ...)
  2019-12-08 16:09 ` [PATCH 05/12] PCMCIA: remove braces around single statement blocks Simon Geis
@ 2019-12-08 16:09 ` Simon Geis
  2019-12-08 16:09 ` [PATCH 07/12] PCMCIA: change incorrect code indentation Simon Geis
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>

---
 drivers/pcmcia/i82092.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index 0adac6b24915..b9366adfe087 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -188,6 +188,7 @@ static unsigned char indirect_read(int socket, unsigned short reg)
 	unsigned short int port;
 	unsigned char val;
 	unsigned long flags;
+
 	spin_lock_irqsave(&port_lock, flags);
 	reg += socket * 0x40;
 	port = sockets[socket].io_base;
@@ -203,6 +204,7 @@ static unsigned short indirect_read16(int socket, unsigned short reg)
 	unsigned short int port;
 	unsigned short tmp;
 	unsigned long flags;
+
 	spin_lock_irqsave(&port_lock, flags);
 	reg  = reg + socket * 0x40;
 	port = sockets[socket].io_base;
@@ -220,6 +222,7 @@ static void indirect_write(int socket, unsigned short reg, unsigned char value)
 {
 	unsigned short int port;
 	unsigned long flags;
+
 	spin_lock_irqsave(&port_lock, flags);
 	reg = reg + socket * 0x40;
 	port = sockets[socket].io_base;
@@ -233,6 +236,7 @@ static void indirect_setbit(int socket, unsigned short reg, unsigned char mask)
 	unsigned short int port;
 	unsigned char val;
 	unsigned long flags;
+
 	spin_lock_irqsave(&port_lock, flags);
 	reg = reg + socket * 0x40;
 	port = sockets[socket].io_base;
@@ -250,6 +254,7 @@ static void indirect_resetbit(int socket, unsigned short reg, unsigned char mask
 	unsigned short int port;
 	unsigned char val;
 	unsigned long flags;
+
 	spin_lock_irqsave(&port_lock, flags);
 	reg = reg + socket * 0x40;
 	port = sockets[socket].io_base;
@@ -266,6 +271,7 @@ static void indirect_write16(int socket, unsigned short reg, unsigned short valu
 	unsigned short int port;
 	unsigned char val;
 	unsigned long flags;
+
 	spin_lock_irqsave(&port_lock, flags);
 	reg = reg + socket * 0x40;
 	port = sockets[socket].io_base;
@@ -318,6 +324,7 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 
 		for (i = 0; i < socket_count; i++) {
 			int csc;
+
 			if (sockets[i].card_state == 0) /* Inactive socket, should not happen */
 				continue;
 
@@ -363,6 +370,7 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 static int card_present(int socketno)
 {
 	unsigned int val;
+
 	enter("card_present");
 
 	if ((socketno < 0) || (socketno >= MAX_SOCKETS))
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 07/12] PCMCIA: change incorrect code indentation
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
                   ` (4 preceding siblings ...)
  2019-12-08 16:09 ` [PATCH 06/12] PCMCIA: insert blank line after declarations Simon Geis
@ 2019-12-08 16:09 ` Simon Geis
  2019-12-08 16:09 ` [PATCH 08/12] PCMCIA: move assignment out of if condition Simon Geis
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>

---
 drivers/pcmcia/i82092.c | 128 ++++++++++++++++++++--------------------
 1 file changed, 64 insertions(+), 64 deletions(-)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index b9366adfe087..a2be520bc3d3 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -82,22 +82,22 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 
 	pci_read_config_byte(dev, 0x40, &configbyte);  /* PCI Configuration Control */
 	switch (configbyte&6) {
-		case 0:
-			socket_count = 2;
-			break;
-		case 2:
-			socket_count = 1;
-			break;
-		case 4:
-		case 6:
-			socket_count = 4;
-			break;
-
-		default:
-			dev_err(&dev->dev,
-				"i82092aa: Oops, you did something we didn't think of.\n");
-			ret = -EIO;
-			goto err_out_disable;
+	case 0:
+		socket_count = 2;
+		break;
+	case 2:
+		socket_count = 1;
+		break;
+	case 4:
+	case 6:
+		socket_count = 4;
+		break;
+
+	default:
+		dev_err(&dev->dev,
+			"i82092aa: Oops, you did something we didn't think of.\n");
+		ret = -EIO;
+		goto err_out_disable;
 	}
 	dev_info(&dev->dev, "i82092aa: configured as a %d socket device.\n",
 		 socket_count);
@@ -502,45 +502,45 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 	}
 
 	switch (state->Vcc) {
-		case 0:
-			break;
-		case 50:
-			dev_info(&sock_info->dev->dev,
-				 "setting voltage to Vcc to 5V on socket %i\n",
-				 sock);
-			reg |= I365_VCC_5V;
-			break;
-		default:
-			dev_err(&sock_info->dev->dev,
-				"i82092aa: %s called with invalid VCC power value: %i",
-				__func__, state->Vcc);
-			leave("i82092aa_set_socket");
-			return -EINVAL;
+	case 0:
+		break;
+	case 50:
+		dev_info(&sock_info->dev->dev,
+			 "setting voltage to Vcc to 5V on socket %i\n",
+			 sock);
+		reg |= I365_VCC_5V;
+		break;
+	default:
+		dev_err(&sock_info->dev->dev,
+			"i82092aa: %s called with invalid VCC power value: %i",
+			__func__, state->Vcc);
+		leave("i82092aa_set_socket");
+		return -EINVAL;
 	}
 
 	switch (state->Vpp) {
-		case 0:
-			dev_info(&sock_info->dev->dev,
-				 "not setting Vpp on socket %i\n",
-				 sock);
-			break;
-		case 50:
-			dev_info(&sock_info->dev->dev,
-				 "setting Vpp to 5.0 for socket %i\n",
-				 sock);
-			reg |= I365_VPP1_5V | I365_VPP2_5V;
-			break;
-		case 120:
-			dev_info(&sock_info->dev->dev,
-				 "setting Vpp to 12.0\n");
-			reg |= I365_VPP1_12V | I365_VPP2_12V;
-			break;
-		default:
-			dev_err(&sock_info->dev->dev,
-				"i82092aa: %s called with invalid VPP power value: %i",
-				__func__, state->Vcc);
-			leave("i82092aa_set_socket");
-			return -EINVAL;
+	case 0:
+		dev_info(&sock_info->dev->dev,
+			 "not setting Vpp on socket %i\n",
+			 sock);
+		break;
+	case 50:
+		dev_info(&sock_info->dev->dev,
+			 "setting Vpp to 5.0 for socket %i\n",
+			 sock);
+		reg |= I365_VPP1_5V | I365_VPP2_5V;
+		break;
+	case 120:
+		dev_info(&sock_info->dev->dev,
+			 "setting Vpp to 12.0\n");
+		reg |= I365_VPP1_12V | I365_VPP2_12V;
+		break;
+	default:
+		dev_err(&sock_info->dev->dev,
+			"i82092aa: %s called with invalid VPP power value: %i",
+			__func__, state->Vcc);
+		leave("i82092aa_set_socket");
+		return -EINVAL;
 	}
 
 	if (reg != indirect_read(sock, I365_POWER)) /* only write if changed */
@@ -679,17 +679,17 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 
 	i = (region.end >> 12) & 0x0fff;
 	switch (to_cycles(mem->speed)) {
-		case 0:
-			break;
-		case 1:
-			i |= I365_MEM_WS0;
-			break;
-		case 2:
-			i |= I365_MEM_WS1;
-			break;
-		default:
-			i |= I365_MEM_WS1 | I365_MEM_WS0;
-			break;
+	case 0:
+		break;
+	case 1:
+		i |= I365_MEM_WS0;
+		break;
+	case 2:
+		i |= I365_MEM_WS1;
+		break;
+	default:
+		i |= I365_MEM_WS1 | I365_MEM_WS0;
+		break;
 	}
 
 	indirect_write16(sock, base+I365_W_STOP, i);
@@ -731,7 +731,7 @@ static void i82092aa_module_exit(void)
 	enter("i82092aa_module_exit");
 	pci_unregister_driver(&i82092aa_pci_driver);
 	if (sockets[0].io_base > 0)
-			 release_region(sockets[0].io_base, 2);
+		release_region(sockets[0].io_base, 2);
 	leave("i82092aa_module_exit");
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 08/12] PCMCIA: move assignment out of if condition
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
                   ` (5 preceding siblings ...)
  2019-12-08 16:09 ` [PATCH 07/12] PCMCIA: change incorrect code indentation Simon Geis
@ 2019-12-08 16:09 ` Simon Geis
  2019-12-08 16:09 ` [PATCH 09/12] PCMCIA: shorten the lines with over 80 characters Simon Geis
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>

---
 drivers/pcmcia/i82092.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index a2be520bc3d3..33c242f06e0a 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -77,7 +77,8 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 
 	enter("i82092aa_pci_probe");
 
-	if ((ret = pci_enable_device(dev)))
+	ret = pci_enable_device(dev);
+	if (ret)
 		return ret;
 
 	pci_read_config_byte(dev, 0x40, &configbyte);  /* PCI Configuration Control */
@@ -133,7 +134,9 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 
 	/* Register the interrupt handler */
 	dev_dbg(&dev->dev, "Requesting interrupt %i\n", dev->irq);
-	if ((ret = request_irq(dev->irq, i82092aa_interrupt, IRQF_SHARED, "i82092aa", i82092aa_interrupt))) {
+	ret = request_irq(dev->irq, i82092aa_interrupt, IRQF_SHARED,
+			  "i82092aa", i82092aa_interrupt);
+	if (ret) {
 		dev_err(&dev->dev,
 			"i82092aa: Failed to register IRQ %d, aborting\n",
 			dev->irq);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 09/12] PCMCIA: shorten the lines with over 80 characters
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
                   ` (6 preceding siblings ...)
  2019-12-08 16:09 ` [PATCH 08/12] PCMCIA: move assignment out of if condition Simon Geis
@ 2019-12-08 16:09 ` Simon Geis
  2019-12-08 20:52   ` Dominik Brodowski
  2019-12-08 16:09 ` [PATCH 10/12] PCMCIA: include <linux/io.h> instead of <asm/io.h> Simon Geis
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

Adding a new variable 'int check' in 'i82092aa_interrupt' in which the
flags are stored for comparison. This makes it possible to shorten 
the lines to less than 80 characters.

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>

---
 drivers/pcmcia/i82092.c | 73 +++++++++++++++++++++++++++--------------
 1 file changed, 49 insertions(+), 24 deletions(-)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index 33c242f06e0a..fcc0d8a4209d 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -70,7 +70,8 @@ static struct socket_info sockets[MAX_SOCKETS];
 static int socket_count;	/* shortcut */
 
 
-static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
+static int i82092aa_pci_probe(struct pci_dev *dev,
+			      const struct pci_device_id *id)
 {
 	unsigned char configbyte;
 	int i, ret;
@@ -81,7 +82,9 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 	if (ret)
 		return ret;
 
-	pci_read_config_byte(dev, 0x40, &configbyte);  /* PCI Configuration Control */
+	/* PCI Configuration Control */
+	pci_read_config_byte(dev, 0x40, &configbyte);
+
 	switch (configbyte&6) {
 	case 0:
 		socket_count = 2;
@@ -122,15 +125,19 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
 
 		if (card_present(i)) {
 			sockets[i].card_state = 3;
-			dev_dbg(&dev->dev, "i82092aa: slot %i is occupied\n", i);
+			dev_dbg(&dev->dev,
+				"i82092aa: slot %i is occupied\n", i);
 		} else {
 			dev_dbg(&dev->dev, "i82092aa: slot %i is vacant\n", i);
 		}
 	}
 
 	/* Now, specifiy that all interrupts are to be done as PCI interrupts */
-	configbyte = 0xFF; /* bitmask, one bit per event, 1 = PCI interrupt, 0 = ISA interrupt */
-	pci_write_config_byte(dev, 0x50, configbyte); /* PCI Interrupt Routing Register */
+	/* bitmask, one bit per event, 1 = PCI interrupt, 0 = ISA interrupt */
+	configbyte = 0xFF;
+
+	/* PCI Interrupt Routing Register */
+	pci_write_config_byte(dev, 0x50, configbyte);
 
 	/* Register the interrupt handler */
 	dev_dbg(&dev->dev, "Requesting interrupt %i\n", dev->irq);
@@ -252,7 +259,8 @@ static void indirect_setbit(int socket, unsigned short reg, unsigned char mask)
 }
 
 
-static void indirect_resetbit(int socket, unsigned short reg, unsigned char mask)
+static void indirect_resetbit(int socket,
+			      unsigned short reg, unsigned char mask)
 {
 	unsigned short int port;
 	unsigned char val;
@@ -269,7 +277,8 @@ static void indirect_resetbit(int socket, unsigned short reg, unsigned char mask
 	spin_unlock_irqrestore(&port_lock, flags);
 }
 
-static void indirect_write16(int socket, unsigned short reg, unsigned short value)
+static void indirect_write16(int socket,
+			     unsigned short reg, unsigned short value)
 {
 	unsigned short int port;
 	unsigned char val;
@@ -327,11 +336,14 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 
 		for (i = 0; i < socket_count; i++) {
 			int csc;
+			int check;
 
-			if (sockets[i].card_state == 0) /* Inactive socket, should not happen */
+			/* Inactive socket, should not happen */
+			if (sockets[i].card_state == 0)
 				continue;
 
-			csc = indirect_read(i, I365_CSC); /* card status change register */
+			/* card status change register */
+			csc = indirect_read(i, I365_CSC);
 
 			if (csc == 0)  /* no events on this socket */
 				continue;
@@ -346,12 +358,16 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 
 			if (indirect_read(i, I365_INTCTL) & I365_PC_IOCARD) {
 				/* For IO/CARDS, bit 0 means "read the card" */
-				events |= (csc & I365_CSC_STSCHG) ? SS_STSCHG : 0;
+				check = I365_CSC_STSCHG;
+				events |= (csc & check) ? SS_STSCHG : 0;
 			} else {
 				/* Check for battery/ready events */
-				events |= (csc & I365_CSC_BVD1) ? SS_BATDEAD : 0;
-				events |= (csc & I365_CSC_BVD2) ? SS_BATWARN : 0;
-				events |= (csc & I365_CSC_READY) ? SS_READY : 0;
+				check = I365_CSC_BVD1;
+				events |= (csc & check) ? SS_BATDEAD : 0;
+				check = I365_CSC_BVD2;
+				events |= (csc & check) ? SS_BATWARN : 0;
+				check = I365_CSC_READY;
+				events |= (csc & check) ? SS_READY : 0;
 			}
 
 			if (events)
@@ -435,7 +451,8 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 
 	enter("i82092aa_get_status");
 
-	status = indirect_read(sock, I365_STATUS); /* Interface Status Register */
+	/* Interface Status Register */
+	status = indirect_read(sock, I365_STATUS);
 	*value = 0;
 
 	if ((status & I365_CS_DETECT) == I365_CS_DETECT)
@@ -468,7 +485,8 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 }
 
 
-static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *state)
+static int i82092aa_set_socket(struct pcmcia_socket *socket,
+			       socket_state_t *state)
 {
 	struct socket_info *sock_info = container_of(socket, struct socket_info,
 						     socket);
@@ -484,12 +502,14 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 	/* Values for the IGENC register */
 
 	reg = 0;
-	if (!(state->flags & SS_RESET)) 	/* The reset bit has "inverse" logic */
+	/* The reset bit has "inverse" logic */
+	if (!(state->flags & SS_RESET))
 		reg = reg | I365_PC_RESET;
 	if (state->flags & SS_IOCARD)
 		reg = reg | I365_PC_IOCARD;
 
-	indirect_write(sock, I365_INTCTL, reg); /* IGENC, Interrupt and General Control Register */
+	/* IGENC, Interrupt and General Control Register */
+	indirect_write(sock, I365_INTCTL, reg);
 
 	/* Power registers */
 
@@ -567,7 +587,9 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 
 	}
 
-	/* now write the value and clear the (probably bogus) pending stuff by doing a dummy read*/
+	/* now write the value and clear the (probably bogus) pending stuff
+	 * by doing a dummy read
+	 */
 
 	indirect_write(sock, I365_CSCINT, reg);
 	(void)indirect_read(sock, I365_CSC);
@@ -576,7 +598,8 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *sta
 	return 0;
 }
 
-static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_map *io)
+static int i82092aa_set_io_map(struct pcmcia_socket *socket,
+			       struct pccard_io_map *io)
 {
 	struct socket_info *sock_info = container_of(socket, struct socket_info,
 						     socket);
@@ -592,7 +615,8 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_ma
 		leave("i82092aa_set_io_map with invalid map");
 		return -EINVAL;
 	}
-	if ((io->start > 0xffff) || (io->stop > 0xffff) || (io->stop < io->start)) {
+	if ((io->start > 0xffff) || (io->stop > 0xffff)
+				 || (io->stop < io->start)) {
 		leave("i82092aa_set_io_map with invalid io");
 		return -EINVAL;
 	}
@@ -625,9 +649,11 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_ma
 	return 0;
 }
 
-static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_map *mem)
+static int i82092aa_set_mem_map(struct pcmcia_socket *socket,
+				struct pccard_mem_map *mem)
 {
-	struct socket_info *sock_info = container_of(socket, struct socket_info, socket);
+	struct socket_info *sock_info = container_of(socket, struct socket_info,
+						     socket);
 	unsigned int sock = sock_info->number;
 	struct pci_bus_region region;
 	unsigned short base, i;
@@ -648,8 +674,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
 	     (mem->speed > 1000)) {
 		leave("i82092aa_set_mem_map: invalid address / speed");
 		dev_err(&sock_info->dev->dev,
-			"invalid mem map for socket %i: %llx to %llx with a "
-			"start of %x\n",
+			"invalid mem map for socket %i: %llx to %llx with a start of %x\n",
 			sock,
 			(unsigned long long)region.start,
 			(unsigned long long)region.end,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 10/12] PCMCIA: include <linux/io.h> instead of <asm/io.h>
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
                   ` (7 preceding siblings ...)
  2019-12-08 16:09 ` [PATCH 09/12] PCMCIA: shorten the lines with over 80 characters Simon Geis
@ 2019-12-08 16:09 ` Simon Geis
  2019-12-08 20:54   ` Dominik Brodowski
  2019-12-08 16:09 ` [PATCH 11/12] PCMCIA: use dev_dbg instead of enter/leave Simon Geis
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>

---
 drivers/pcmcia/i82092.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index fcc0d8a4209d..fb2654a95f28 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -18,7 +18,7 @@
 
 #include <pcmcia/ss.h>
 
-#include <asm/io.h>
+#include <linux/io.h>
 
 #include "i82092aa.h"
 #include "i82365.h"
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 11/12] PCMCIA: use dev_dbg instead of enter/leave
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
                   ` (8 preceding siblings ...)
  2019-12-08 16:09 ` [PATCH 10/12] PCMCIA: include <linux/io.h> instead of <asm/io.h> Simon Geis
@ 2019-12-08 16:09 ` Simon Geis
  2019-12-08 20:57   ` Dominik Brodowski
  2019-12-08 16:09 ` [PATCH 12/12] PCMCIA: remove ifdef 0 block Simon Geis
  2019-12-08 20:41 ` [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Dominik Brodowski
  11 siblings, 1 reply; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

Using dev_dbg() instead of the enter()/leave()
macro. This allows the usage of format strings.
Remove the now unused macro definition in i82092aa.h.

pr_debug is used where no struct pci_dev is available.

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>

---
 drivers/pcmcia/i82092.c   | 91 ++++++++++++++++++++++++++-------------
 drivers/pcmcia/i82092aa.h | 11 -----
 2 files changed, 62 insertions(+), 40 deletions(-)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index fb2654a95f28..a2d1e457d931 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -76,7 +76,8 @@ static int i82092aa_pci_probe(struct pci_dev *dev,
 	unsigned char configbyte;
 	int i, ret;
 
-	enter("i82092aa_pci_probe");
+	dev_dbg(&dev->dev, "Enter: %s, %s line %i\n",
+			__func__, __FILE__, __LINE__);
 
 	ret = pci_enable_device(dev);
 	if (ret)
@@ -159,7 +160,9 @@ static int i82092aa_pci_probe(struct pci_dev *dev,
 			goto err_out_free_sockets;
 	}
 
-	leave("i82092aa_pci_probe");
+	dev_dbg(&dev->dev, "Leave: %s, %s line %i\n",
+			__func__, __FILE__, __LINE__);
+
 	return 0;
 
 err_out_free_sockets:
@@ -179,14 +182,16 @@ static void i82092aa_pci_remove(struct pci_dev *dev)
 {
 	int i;
 
-	enter("i82092aa_pci_remove");
+	dev_dbg(&dev->dev, "Enter: %s, %s line %i\n",
+			__func__, __FILE__, __LINE__);
 
 	free_irq(dev->irq, i82092aa_interrupt);
 
 	for (i = 0; i < socket_count; i++)
 		pcmcia_unregister_socket(&sockets[i].socket);
 
-	leave("i82092aa_pci_remove");
+	dev_dbg(&dev->dev, "Leave: %s, %s line %i\n",
+			__func__, __FILE__, __LINE__);
 }
 
 static DEFINE_SPINLOCK(port_lock);
@@ -323,7 +328,7 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 
 	unsigned int events, active = 0;
 
-/*	enter("i82092aa_interrupt");*/
+	pr_debug("Enter: %s, %s line %i\n", __func__, __FILE__, __LINE__);
 
 	while (1) {
 		loopcount++;
@@ -378,8 +383,9 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev)
 		if (active == 0) /* no more events to handle */
 			break;
 	}
+
+	pr_debug("Leave: %s, %s line %i\n", __func__, __FILE__, __LINE__);
 	return IRQ_RETVAL(handled);
-/*	leave("i82092aa_interrupt");*/
 }
 
 
@@ -390,7 +396,8 @@ static int card_present(int socketno)
 {
 	unsigned int val;
 
-	enter("card_present");
+	dev_dbg(&sockets[socketno].dev->dev, "Enter: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 
 	if ((socketno < 0) || (socketno >= MAX_SOCKETS))
 		return 0;
@@ -400,22 +407,28 @@ static int card_present(int socketno)
 
 	val = indirect_read(socketno, 1); /* Interface status register */
 	if ((val&12) == 12) {
-		leave("card_present 1");
+		dev_dbg(&sockets[socketno].dev->dev, "Leave: %s 1, %s line %i\n",
+				__func__, __FILE__, __LINE__);
 		return 1;
 	}
 
-	leave("card_present 0");
+	dev_dbg(&sockets[socketno].dev->dev, "Leave: %s 0, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 	return 0;
 }
 
 static void set_bridge_state(int sock)
 {
-	enter("set_bridge_state");
+	dev_dbg(&sockets[sock].dev->dev, "Enter: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
+
 	indirect_write(sock, I365_GBLCTL, 0x00);
 	indirect_write(sock, I365_GENCTL, 0x00);
 
 	indirect_setbit(sock, I365_INTCTL, 0x08);
-	leave("set_bridge_state");
+
+	dev_dbg(&sockets[sock].dev->dev, "Leave: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 }
 
 
@@ -423,10 +436,13 @@ static int i82092aa_init(struct pcmcia_socket *sock)
 {
 	int i;
 	struct resource res = { .start = 0, .end = 0x0fff };
+	struct socket_info *sock_info = container_of(sock, struct socket_info,
+						     socket);
 	pccard_io_map io = { 0, 0, 0, 0, 1 };
 	pccard_mem_map mem = { .res = &res, };
 
-	enter("i82092aa_init");
+	dev_dbg(&sock_info->dev->dev, "Enter: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 
 	for (i = 0; i < 2; i++) {
 		io.map = i;
@@ -437,7 +453,8 @@ static int i82092aa_init(struct pcmcia_socket *sock)
 		i82092aa_set_mem_map(sock, &mem);
 	}
 
-	leave("i82092aa_init");
+	dev_dbg(&sock_info->dev->dev, "Leave: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 	return 0;
 }
 
@@ -449,7 +466,8 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 	unsigned int sock = sock_info->number;
 	unsigned int status;
 
-	enter("i82092aa_get_status");
+	dev_dbg(&sock_info->dev->dev, "Enter: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 
 	/* Interface Status Register */
 	status = indirect_read(sock, I365_STATUS);
@@ -480,7 +498,8 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 	if (status & I365_CS_POWERON)
 		(*value) |= SS_POWERON;  /* power is applied to the card */
 
-	leave("i82092aa_get_status");
+	dev_dbg(&sock_info->dev->dev, "Leave: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 	return 0;
 }
 
@@ -493,7 +512,8 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket,
 	unsigned int sock = sock_info->number;
 	unsigned char reg;
 
-	enter("i82092aa_set_socket");
+	dev_dbg(&sock_info->dev->dev, "Enter: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 
 	/* First, set the global controller options */
 
@@ -537,7 +557,8 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket,
 		dev_err(&sock_info->dev->dev,
 			"i82092aa: %s called with invalid VCC power value: %i",
 			__func__, state->Vcc);
-		leave("i82092aa_set_socket");
+		dev_dbg(&sock_info->dev->dev, "Leave: %s, %s line %i\n",
+			__func__, __FILE__, __LINE__);
 		return -EINVAL;
 	}
 
@@ -562,7 +583,8 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket,
 		dev_err(&sock_info->dev->dev,
 			"i82092aa: %s called with invalid VPP power value: %i",
 			__func__, state->Vcc);
-		leave("i82092aa_set_socket");
+		dev_dbg(&sock_info->dev->dev, "Leave: %s, %s line %i\n",
+			__func__, __FILE__, __LINE__);
 		return -EINVAL;
 	}
 
@@ -594,7 +616,8 @@ static int i82092aa_set_socket(struct pcmcia_socket *socket,
 	indirect_write(sock, I365_CSCINT, reg);
 	(void)indirect_read(sock, I365_CSC);
 
-	leave("i82092aa_set_socket");
+	dev_dbg(&sock_info->dev->dev, "Leave: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 	return 0;
 }
 
@@ -606,18 +629,21 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket,
 	unsigned int sock = sock_info->number;
 	unsigned char map, ioctl;
 
-	enter("i82092aa_set_io_map");
+	dev_dbg(&sock_info->dev->dev, "Enter: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 
 	map = io->map;
 
 	/* Check error conditions */
 	if (map > 1) {
-		leave("i82092aa_set_io_map with invalid map");
+		dev_dbg(&sock_info->dev->dev, "Leave: %s with invalid map, %s line %i\n",
+			__func__, __FILE__, __LINE__);
 		return -EINVAL;
 	}
 	if ((io->start > 0xffff) || (io->stop > 0xffff)
 				 || (io->stop < io->start)) {
-		leave("i82092aa_set_io_map with invalid io");
+		dev_dbg(&sock_info->dev->dev, "Leave: %s with invalid io, %s line %i\n",
+			__func__, __FILE__, __LINE__);
 		return -EINVAL;
 	}
 
@@ -645,7 +671,8 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket,
 	if (io->flags & MAP_ACTIVE)
 		indirect_setbit(sock, I365_ADDRWIN, I365_ENA_IO(map));
 
-	leave("i82092aa_set_io_map");
+	dev_dbg(&sock_info->dev->dev, "Leave: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 	return 0;
 }
 
@@ -659,20 +686,23 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket,
 	unsigned short base, i;
 	unsigned char map;
 
-	enter("i82092aa_set_mem_map");
+	dev_dbg(&sock_info->dev->dev, "Enter: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 
 	pcibios_resource_to_bus(sock_info->dev->bus, &region, mem->res);
 
 	map = mem->map;
 	if (map > 4) {
-		leave("i82092aa_set_mem_map: invalid map");
+		dev_dbg(&sock_info->dev->dev, "Leave: %s: invalid map, %s line %i\n",
+			__func__, __FILE__, __LINE__);
 		return -EINVAL;
 	}
 
 
 	if ((mem->card_start > 0x3ffffff) || (region.start > region.end) ||
 	     (mem->speed > 1000)) {
-		leave("i82092aa_set_mem_map: invalid address / speed");
+		dev_dbg(&sock_info->dev->dev, "Leave: %s: invalid address / speed, %s line %i\n",
+			__func__, __FILE__, __LINE__);
 		dev_err(&sock_info->dev->dev,
 			"invalid mem map for socket %i: %llx to %llx with a start of %x\n",
 			sock,
@@ -745,7 +775,8 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket,
 	if (mem->flags & MAP_ACTIVE)
 		indirect_setbit(sock, I365_ADDRWIN, I365_ENA_MEM(map));
 
-	leave("i82092aa_set_mem_map");
+	dev_dbg(&sock_info->dev->dev, "Leave: %s, %s line %i\n",
+		__func__, __FILE__, __LINE__);
 	return 0;
 }
 
@@ -756,11 +787,13 @@ static int i82092aa_module_init(void)
 
 static void i82092aa_module_exit(void)
 {
-	enter("i82092aa_module_exit");
+	pr_debug("Enter: %s, %s line %i\n", __func__, __FILE__, __LINE__);
+
 	pci_unregister_driver(&i82092aa_pci_driver);
 	if (sockets[0].io_base > 0)
 		release_region(sockets[0].io_base, 2);
-	leave("i82092aa_module_exit");
+
+	pr_debug("Leave: %s, %s line %i\n", __func__, __FILE__, __LINE__);
 }
 
 module_init(i82092aa_module_init);
diff --git a/drivers/pcmcia/i82092aa.h b/drivers/pcmcia/i82092aa.h
index 4586c43c78e2..0f851acab7e5 100644
--- a/drivers/pcmcia/i82092aa.h
+++ b/drivers/pcmcia/i82092aa.h
@@ -4,17 +4,6 @@
 
 #include <linux/interrupt.h>
 
-/* Debuging defines */
-#ifdef NOTRACE
-#define enter(x)   printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__)
-#define leave(x)   printk("Leave: %s, %s line %i\n",x,__FILE__,__LINE__)
-#else
-#define enter(x)   do {} while (0)
-#define leave(x)   do {} while (0)
-#endif
-
-
-
 /* prototypes */
 
 static int  i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *id);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 12/12] PCMCIA: remove ifdef 0 block
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
                   ` (9 preceding siblings ...)
  2019-12-08 16:09 ` [PATCH 11/12] PCMCIA: use dev_dbg instead of enter/leave Simon Geis
@ 2019-12-08 16:09 ` Simon Geis
  2019-12-08 20:58   ` Dominik Brodowski
  2019-12-08 20:41 ` [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Dominik Brodowski
  11 siblings, 1 reply; 17+ messages in thread
From: Simon Geis @ 2019-12-08 16:09 UTC (permalink / raw)
  To: Dominik Brodowski
  Cc: Simon Geis, Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

indirect_read16 is similar to indirect_read with the exception that 
it reads 16 instead of 8 bit.

Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
Signed-off-by: Simon Geis <simon.geis@fau.de>

---
 drivers/pcmcia/i82092.c | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index a2d1e457d931..9024d1d9478e 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -213,26 +213,6 @@ static unsigned char indirect_read(int socket, unsigned short reg)
 	return val;
 }
 
-#if 0
-static unsigned short indirect_read16(int socket, unsigned short reg)
-{
-	unsigned short int port;
-	unsigned short tmp;
-	unsigned long flags;
-
-	spin_lock_irqsave(&port_lock, flags);
-	reg  = reg + socket * 0x40;
-	port = sockets[socket].io_base;
-	outb(reg, port);
-	tmp = inb(port+1);
-	reg++;
-	outb(reg, port);
-	tmp = tmp | (inb(port+1)<<8);
-	spin_unlock_irqrestore(&port_lock, flags);
-	return tmp;
-}
-#endif
-
 static void indirect_write(int socket, unsigned short reg, unsigned char value)
 {
 	unsigned short int port;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk
  2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
                   ` (10 preceding siblings ...)
  2019-12-08 16:09 ` [PATCH 12/12] PCMCIA: remove ifdef 0 block Simon Geis
@ 2019-12-08 20:41 ` Dominik Brodowski
  11 siblings, 0 replies; 17+ messages in thread
From: Dominik Brodowski @ 2019-12-08 20:41 UTC (permalink / raw)
  To: Simon Geis
  Cc: Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

On Sun, Dec 08, 2019 at 05:09:36PM +0100, Simon Geis wrote:
> Fix the checkpatch warning:
> 	WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ...
> 		then pr_err(...  to printk(KERN_ERR ...
> and
> 	WARNING: printk() should include KERN_<LEVEL> facility level
> 		by using dev_err()/dev_info() according to the message.

Thanks for the patch! The actual diff looks fine, but the commit message
still needs some refinement. Please do not repeat the checkpatch warnings
(removing them from existing files is not a goal in itself!), but
describe the goal of the patch ("Improve the log output by using the
device-aware dev_err()/dev_info() functions. While at it, update one
remaining printk(KERN_ERR ...) call to the preferred pr_err() call.")

> Split the assignment of variable 'sock' in in order to get access to
> struct_info with the 'container_of' function call.

As that merely describes what the code does, it is not needed in the
commit message.

> pr_err is used where no struct pci_dev is available.

If you describe the goal of the patch above, that becomes clear by itself.
So you may want to remove this line as well.

Thanks,
	Dominik

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 09/12] PCMCIA: shorten the lines with over 80 characters
  2019-12-08 16:09 ` [PATCH 09/12] PCMCIA: shorten the lines with over 80 characters Simon Geis
@ 2019-12-08 20:52   ` Dominik Brodowski
  0 siblings, 0 replies; 17+ messages in thread
From: Dominik Brodowski @ 2019-12-08 20:52 UTC (permalink / raw)
  To: Simon Geis
  Cc: Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

On Sun, Dec 08, 2019 at 05:09:44PM +0100, Simon Geis wrote:
> Adding a new variable 'int check' in 'i82092aa_interrupt' in which the
> flags are stored for comparison. This makes it possible to shorten 
> the lines to less than 80 characters.

... but this makes the code *less* readable, IMO. So this part of the patch
needs more thought, I think...

Thanks,
	Dominik

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 10/12] PCMCIA: include <linux/io.h> instead of <asm/io.h>
  2019-12-08 16:09 ` [PATCH 10/12] PCMCIA: include <linux/io.h> instead of <asm/io.h> Simon Geis
@ 2019-12-08 20:54   ` Dominik Brodowski
  0 siblings, 0 replies; 17+ messages in thread
From: Dominik Brodowski @ 2019-12-08 20:54 UTC (permalink / raw)
  To: Simon Geis
  Cc: Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

On Sun, Dec 08, 2019 at 05:09:45PM +0100, Simon Geis wrote:
> Co-developed-by: Lukas Panzer <lukas.panzer@fau.de>
> Signed-off-by: Lukas Panzer <lukas.panzer@fau.de>
> Signed-off-by: Simon Geis <simon.geis@fau.de>

Why is linux/io.h preferred here instead of asm/io.h?

Thanks,
	Dominik

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 11/12] PCMCIA: use dev_dbg instead of enter/leave
  2019-12-08 16:09 ` [PATCH 11/12] PCMCIA: use dev_dbg instead of enter/leave Simon Geis
@ 2019-12-08 20:57   ` Dominik Brodowski
  0 siblings, 0 replies; 17+ messages in thread
From: Dominik Brodowski @ 2019-12-08 20:57 UTC (permalink / raw)
  To: Simon Geis
  Cc: Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

On Sun, Dec 08, 2019 at 05:09:46PM +0100, Simon Geis wrote:
> Using dev_dbg() instead of the enter()/leave()
> macro. This allows the usage of format strings.
> Remove the now unused macro definition in i82092aa.h.

Could you re-use enter()/leave() (maybe with a new parameter
to pass the struct pci_dev) here instead? That may save a few lines, instead
of prolonging the file?

Thanks,
	Dominik

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 12/12] PCMCIA: remove ifdef 0 block
  2019-12-08 16:09 ` [PATCH 12/12] PCMCIA: remove ifdef 0 block Simon Geis
@ 2019-12-08 20:58   ` Dominik Brodowski
  0 siblings, 0 replies; 17+ messages in thread
From: Dominik Brodowski @ 2019-12-08 20:58 UTC (permalink / raw)
  To: Simon Geis
  Cc: Greg Kroah-Hartman, Thomas Gleixner, Colin Ian King,
	Adam Zerella, linux-kernel, linux-kernel, Lukas Panzer

On Sun, Dec 08, 2019 at 05:09:47PM +0100, Simon Geis wrote:
> indirect_read16 is similar to indirect_read with the exception that 
> it reads 16 instead of 8 bit.

... and, most importantly, indirect_read16 is unused in this module.

Thanks,
	Dominik

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-12-08 21:18 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-08 16:09 [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Simon Geis
2019-12-08 16:09 ` [PATCH 02/12] PCMCIA: remove trailing whitespaces Simon Geis
2019-12-08 16:09 ` [PATCH 03/12] PCMCIA: add/remove wrong spaces Simon Geis
2019-12-08 16:09 ` [PATCH 04/12] PCMCIA: Remove spaces before tabs Simon Geis
2019-12-08 16:09 ` [PATCH 05/12] PCMCIA: remove braces around single statement blocks Simon Geis
2019-12-08 16:09 ` [PATCH 06/12] PCMCIA: insert blank line after declarations Simon Geis
2019-12-08 16:09 ` [PATCH 07/12] PCMCIA: change incorrect code indentation Simon Geis
2019-12-08 16:09 ` [PATCH 08/12] PCMCIA: move assignment out of if condition Simon Geis
2019-12-08 16:09 ` [PATCH 09/12] PCMCIA: shorten the lines with over 80 characters Simon Geis
2019-12-08 20:52   ` Dominik Brodowski
2019-12-08 16:09 ` [PATCH 10/12] PCMCIA: include <linux/io.h> instead of <asm/io.h> Simon Geis
2019-12-08 20:54   ` Dominik Brodowski
2019-12-08 16:09 ` [PATCH 11/12] PCMCIA: use dev_dbg instead of enter/leave Simon Geis
2019-12-08 20:57   ` Dominik Brodowski
2019-12-08 16:09 ` [PATCH 12/12] PCMCIA: remove ifdef 0 block Simon Geis
2019-12-08 20:58   ` Dominik Brodowski
2019-12-08 20:41 ` [PATCH 01/12] PCMCIA: use dev_err/dev_info instead of printk Dominik Brodowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).