[PATCH 02/04] staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch removes the DGAP_VERIFY_BOARD macro and inserts its
code where required because of checkpatch error.

Signed-off-by: Mark Hounschell <markh@xxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/dgap/dgap.c | 100 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 80 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index f432f73..08ef106 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -6077,23 +6077,20 @@ static void dgap_remove_driver_sysfiles(struct pci_driver *dgap_driver)
 	driver_remove_file(driverfs, &driver_attr_state);
 }
 
-#define DGAP_VERIFY_BOARD(p, bd)			\
-	if (!p)						\
-		return 0;				\
-							\
-	bd = dev_get_drvdata(p);			\
-	if (!bd || bd->magic != DGAP_BOARD_MAGIC)	\
-		return 0;				\
-	if (bd->state != BOARD_READY)			\
-		return 0;				\
-
 static ssize_t dgap_ports_state_show(struct device *p, struct device_attribute *attr, char *buf)
 {
 	struct board_t *bd;
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	if (!p)
+		return 0;
+
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGAP_BOARD_MAGIC)
+		return 0;
+	if (bd->state != BOARD_READY)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++) {
 		count += snprintf(buf + count, PAGE_SIZE - count,
@@ -6110,7 +6107,14 @@ static ssize_t dgap_ports_baud_show(struct device *p, struct device_attribute *a
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	if (!p)
+		return 0;
+
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGAP_BOARD_MAGIC)
+		return 0;
+	if (bd->state != BOARD_READY)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++) {
 		count +=  snprintf(buf + count, PAGE_SIZE - count,
@@ -6126,7 +6130,14 @@ static ssize_t dgap_ports_msignals_show(struct device *p, struct device_attribut
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	if (!p)
+		return 0;
+
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGAP_BOARD_MAGIC)
+		return 0;
+	if (bd->state != BOARD_READY)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++) {
 		if (bd->channels[i]->ch_open_count)
@@ -6152,7 +6163,14 @@ static ssize_t dgap_ports_iflag_show(struct device *p, struct device_attribute *
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	if (!p)
+		return 0;
+
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGAP_BOARD_MAGIC)
+		return 0;
+	if (bd->state != BOARD_READY)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -6167,7 +6185,14 @@ static ssize_t dgap_ports_cflag_show(struct device *p, struct device_attribute *
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	if (!p)
+		return 0;
+
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGAP_BOARD_MAGIC)
+		return 0;
+	if (bd->state != BOARD_READY)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -6182,7 +6207,14 @@ static ssize_t dgap_ports_oflag_show(struct device *p, struct device_attribute *
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	if (!p)
+		return 0;
+
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGAP_BOARD_MAGIC)
+		return 0;
+	if (bd->state != BOARD_READY)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -6197,7 +6229,14 @@ static ssize_t dgap_ports_lflag_show(struct device *p, struct device_attribute *
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	if (!p)
+		return 0;
+
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGAP_BOARD_MAGIC)
+		return 0;
+	if (bd->state != BOARD_READY)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -6212,7 +6251,14 @@ static ssize_t dgap_ports_digi_flag_show(struct device *p, struct device_attribu
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	if (!p)
+		return 0;
+
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGAP_BOARD_MAGIC)
+		return 0;
+	if (bd->state != BOARD_READY)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -6227,7 +6273,14 @@ static ssize_t dgap_ports_rxcount_show(struct device *p, struct device_attribute
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	if (!p)
+		return 0;
+
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGAP_BOARD_MAGIC)
+		return 0;
+	if (bd->state != BOARD_READY)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n",
@@ -6242,7 +6295,14 @@ static ssize_t dgap_ports_txcount_show(struct device *p, struct device_attribute
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	if (!p)
+		return 0;
+
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGAP_BOARD_MAGIC)
+		return 0;
+	if (bd->state != BOARD_READY)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n",
-- 
1.8.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux