lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191208160947.20694-12-simon.geis@fau.de>
Date:   Sun,  8 Dec 2019 17:09:46 +0100
From:   Simon Geis <simon.geis@....de>
To:     Dominik Brodowski <linux@...inikbrodowski.net>
Cc:     Simon Geis <simon.geis@....de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Colin Ian King <colin.king@...onical.com>,
        Adam Zerella <adam.zerella@...il.com>,
        linux-kernel@...r.kernel.org, linux-kernel@...cs.fau.de,
        Lukas Panzer <lukas.panzer@....de>
Subject: [PATCH 11/12] PCMCIA: use dev_dbg instead of enter/leave

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@....de>
Signed-off-by: Lukas Panzer <lukas.panzer@....de>
Signed-off-by: Simon Geis <simon.geis@....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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ