All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/04] staging: dgap: Digi International dgap driver
@ 2014-03-03 21:36 Mark Hounschell
  2014-03-03 21:36 ` [PATCH 01/04] staging: dgap: Remove more degug/tracing code Mark Hounschell
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Mark Hounschell @ 2014-03-03 21:36 UTC (permalink / raw)
  To: driverdev-devel; +Cc: Greg Kroah-Hartman

This patch series fixes some discrepancies noted in a
previous patch series. 

Removes the rest of the debug/tracing code
Removes a nasty macro
Add curly braces back in for a multi-line indent block
Fixes some pr_warns with newline chars in the strings
	Yes, these pr_warns will eventually change
	to dev_warn.

-- 
1.8.1.4

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

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

* [PATCH 01/04] staging: dgap: Remove more degug/tracing code
  2014-03-03 21:36 [PATCH 00/04] staging: dgap: Digi International dgap driver Mark Hounschell
@ 2014-03-03 21:36 ` Mark Hounschell
  2014-03-03 21:36 ` [PATCH 02/04] staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro Mark Hounschell
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Hounschell @ 2014-03-03 21:36 UTC (permalink / raw)
  To: driverdev-devel; +Cc: Greg Kroah-Hartman

This patch removes more, if not all, of the debug/tracing code

Signed-off-by: Mark Hounschell <markh@compro.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/dgap/dgap.c | 27 ---------------------------
 drivers/staging/dgap/dgap.h |  5 -----
 2 files changed, 32 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 698655e..f432f73 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -731,17 +731,6 @@ static void dgap_cleanup_board(struct board_t *brd)
 		brd->re_map_membase = NULL;
 	}
 
-	if (brd->msgbuf_head) {
-		unsigned long flags;
-
-		DGAP_LOCK(dgap_global_lock, flags);
-		brd->msgbuf = NULL;
-		printk("%s", brd->msgbuf_head);
-		kfree(brd->msgbuf_head);
-		brd->msgbuf_head = NULL;
-		DGAP_UNLOCK(dgap_global_lock, flags);
-	}
-
 	/* Free all allocated channels structs */
 	for (i = 0; i < MAXPORTS ; i++)
 		kfree(brd->channels[i]);
@@ -764,7 +753,6 @@ static int dgap_found_board(struct pci_dev *pdev, int id)
 	struct board_t *brd;
 	unsigned int pci_irq;
 	int i = 0;
-	unsigned long flags;
 
 	/* get the board structure and prep it */
 	brd = kzalloc(sizeof(struct board_t), GFP_KERNEL);
@@ -773,14 +761,6 @@ static int dgap_found_board(struct pci_dev *pdev, int id)
 
 	dgap_Board[dgap_NumBoards] = brd;
 
-	/* make a temporary message buffer for the boot messages */
-	brd->msgbuf = brd->msgbuf_head =
-		(char *) kzalloc(sizeof(char) * 8192, GFP_KERNEL);
-	if (!brd->msgbuf) {
-		kfree(brd);
-		return -ENOMEM;
-	}
-
 	/* store the info for the board we've found */
 	brd->magic = DGAP_BOARD_MAGIC;
 	brd->boardnum = dgap_NumBoards;
@@ -870,13 +850,6 @@ static int dgap_found_board(struct pci_dev *pdev, int id)
 	/* init our poll helper tasklet */
 	tasklet_init(&brd->helper_tasklet, dgap_poll_tasklet, (unsigned long) brd);
 
-	DGAP_LOCK(dgap_global_lock, flags);
-	brd->msgbuf = NULL;
-	printk("%s", brd->msgbuf_head);
-	kfree(brd->msgbuf_head);
-	brd->msgbuf_head = NULL;
-	DGAP_UNLOCK(dgap_global_lock, flags);
-
 	i = dgap_do_remap(brd);
 	if (i)
 		brd->state = BOARD_FAILED;
diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h
index e33e591..fd44bfc 100644
--- a/drivers/staging/dgap/dgap.h
+++ b/drivers/staging/dgap/dgap.h
@@ -685,11 +685,6 @@ struct board_t
 	wait_queue_head_t kme_wait;	/* Needed for DPA support */
 
 	u32		conc_dl_status;	/* Status of any pending conc download */
-	/*
-	 *	Mgmt data.
-	 */
-        char		*msgbuf_head;
-        char		*msgbuf;
 };
 
 
-- 
1.8.1.4

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

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

* [PATCH 02/04] staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro
  2014-03-03 21:36 [PATCH 00/04] staging: dgap: Digi International dgap driver Mark Hounschell
  2014-03-03 21:36 ` [PATCH 01/04] staging: dgap: Remove more degug/tracing code Mark Hounschell
@ 2014-03-03 21:36 ` Mark Hounschell
  2014-03-03 21:50   ` Dan Carpenter
                     ` (2 more replies)
  2014-03-03 21:36 ` [PATCH 03/04] staging: dgap: Add curly braces back in for Multi-line indent block Mark Hounschell
  2014-03-03 21:36 ` [PATCH 04/04] staging: dgap: fix some pr_warns with new lines in the string Mark Hounschell
  3 siblings, 3 replies; 8+ messages in thread
From: Mark Hounschell @ 2014-03-03 21:36 UTC (permalink / raw)
  To: driverdev-devel; +Cc: Greg Kroah-Hartman

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

Signed-off-by: Mark Hounschell <markh@compro.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 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@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 03/04] staging: dgap: Add curly braces back in for Multi-line indent block
  2014-03-03 21:36 [PATCH 00/04] staging: dgap: Digi International dgap driver Mark Hounschell
  2014-03-03 21:36 ` [PATCH 01/04] staging: dgap: Remove more degug/tracing code Mark Hounschell
  2014-03-03 21:36 ` [PATCH 02/04] staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro Mark Hounschell
@ 2014-03-03 21:36 ` Mark Hounschell
  2014-03-03 21:36 ` [PATCH 04/04] staging: dgap: fix some pr_warns with new lines in the string Mark Hounschell
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Hounschell @ 2014-03-03 21:36 UTC (permalink / raw)
  To: driverdev-devel; +Cc: Greg Kroah-Hartman

Multi-line indent blocks get curly braces for readability.

Signed-off-by: Mark Hounschell <markh@compro.net>
---
 drivers/staging/dgap/dgap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 08ef106..869a9f6 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -2381,7 +2381,7 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)
 	 * Determine if this is the last close or not - and if we agree about
 	 * which type of close it is with the Line Discipline
 	 */
-	if ((tty->count == 1) && (un->un_open_count != 1))
+	if ((tty->count == 1) && (un->un_open_count != 1)) {
 		/*
 		 * Uh, oh.  tty->count is 1, which means that the tty
 		 * structure will be freed.  un_open_count should always
@@ -2390,6 +2390,7 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file)
 		 * serial port won't be shutdown.
 		 */
 		un->un_open_count = 1;
+	}
 
 	if (--un->un_open_count < 0)
 		un->un_open_count = 0;
-- 
1.8.1.4

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

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

* [PATCH 04/04] staging: dgap: fix some pr_warns with new lines in the string
  2014-03-03 21:36 [PATCH 00/04] staging: dgap: Digi International dgap driver Mark Hounschell
                   ` (2 preceding siblings ...)
  2014-03-03 21:36 ` [PATCH 03/04] staging: dgap: Add curly braces back in for Multi-line indent block Mark Hounschell
@ 2014-03-03 21:36 ` Mark Hounschell
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Hounschell @ 2014-03-03 21:36 UTC (permalink / raw)
  To: driverdev-devel; +Cc: Greg Kroah-Hartman

This patch fixes some pr_warns that have newline 
chars in the string because they mess up the
output.

Signed-off-by: Mark Hounschell <markh@compro.net>
---
 drivers/staging/dgap/dgap.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 869a9f6..07f7636 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -1406,13 +1406,17 @@ static int dgap_tty_init(struct board_t *brd)
 		brd->nasync = brd->maxports;
 
 	if (true_count != brd->nasync) {
-		if ((brd->type == PPCM) && (true_count == 64))
-			pr_warn("dgap: %s configured for %d ports, has %d ports.\nPlease make SURE the EBI cable running from the card\nto each EM module is plugged into EBI IN!\n",
+		if ((brd->type == PPCM) && (true_count == 64)) {
+			pr_warn("dgap: %s configured for %d ports, has %d ports.\n",
 				brd->name, brd->nasync, true_count);
-		else if ((brd->type == PPCM) && (true_count == 0))
-			pr_warn("dgap: %s configured for %d ports, has %d ports.\nPlease make SURE the EBI cable running from the card\nto each EM module is plugged into EBI IN!\n",
+			pr_warn("dgap: Please make SURE the EBI cable running from the card\n");
+			pr_warn("dgap: to each EM module is plugged into EBI IN!\n");
+		} else if ((brd->type == PPCM) && (true_count == 0)) {
+			pr_warn("dgap: %s configured for %d ports, has %d ports.\n",
 				brd->name, brd->nasync, true_count);
-		else
+			pr_warn("dgap: Please make SURE the EBI cable running from the card\n");
+			pr_warn("dgap: to each EM module is plugged into EBI IN!\n");
+		} else
 			pr_warn("dgap: %s configured for %d ports, has %d ports.\n",
 				brd->name, brd->nasync, true_count);
 
-- 
1.8.1.4

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

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

* Re: [PATCH 02/04] staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro
  2014-03-03 21:36 ` [PATCH 02/04] staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro Mark Hounschell
@ 2014-03-03 21:50   ` Dan Carpenter
       [not found]   ` <1308815623.172657.1393883413171.JavaMail.root@mx2.compro.net>
  2014-03-04 14:33   ` [PATCH 02/04 v2] " Mark Hounschell
  2 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-03-03 21:50 UTC (permalink / raw)
  To: Mark Hounschell; +Cc: Greg Kroah-Hartman, driverdev-devel

On Mon, Mar 03, 2014 at 04:36:23PM -0500, Mark Hounschell wrote:
> This patch removes the DGAP_VERIFY_BOARD macro and inserts its
> code where required because of checkpatch error.
> 
> Signed-off-by: Mark Hounschell <markh@compro.net>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  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;				\
> -

You might want do consider a dgap_get_board() function.

struct board_t *dgap_get_board(struct device *p)
{
	struct board_t *bd;

	if (!p)
		return NULL;
	bd = dev_get_drvdata(p);
	if (!bd || bd->magic != DGAP_BOARD_MAGIC || bd->state != BOARD_READY)
		return NULL;

	return bd;
}

Then in the caller it looks like:

	bd = dgap_get_board(p);
	if (!bd)
		return NULL;

regards,
dan carpenter

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

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

* Re: [PATCH 02/04] staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro
       [not found]   ` <1308815623.172657.1393883413171.JavaMail.root@mx2.compro.net>
@ 2014-03-03 22:00     ` Mark Hounschell
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Hounschell @ 2014-03-03 22:00 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg Kroah-Hartman, driverdev-devel

On 03/03/2014 04:50 PM, Dan Carpenter wrote:
> On Mon, Mar 03, 2014 at 04:36:23PM -0500, Mark Hounschell wrote:
>> This patch removes the DGAP_VERIFY_BOARD macro and inserts its
>> code where required because of checkpatch error.
>>
>> Signed-off-by: Mark Hounschell <markh@compro.net>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> ---
>>   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;				\
>> -
>
> You might want do consider a dgap_get_board() function.
>
> struct board_t *dgap_get_board(struct device *p)
> {
> 	struct board_t *bd;
>
> 	if (!p)
> 		return NULL;
> 	bd = dev_get_drvdata(p);
> 	if (!bd || bd->magic != DGAP_BOARD_MAGIC || bd->state != BOARD_READY)
> 		return NULL;
>
> 	return bd;
> }
>
> Then in the caller it looks like:
>
> 	bd = dgap_get_board(p);
> 	if (!bd)
> 		return NULL;
>
> regards,
> dan carpenter

Yep, I thought of that. I'll work it up that way.

thanks
Mark

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

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

* [PATCH 02/04 v2] staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro
  2014-03-03 21:36 ` [PATCH 02/04] staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro Mark Hounschell
  2014-03-03 21:50   ` Dan Carpenter
       [not found]   ` <1308815623.172657.1393883413171.JavaMail.root@mx2.compro.net>
@ 2014-03-04 14:33   ` Mark Hounschell
  2 siblings, 0 replies; 8+ messages in thread
From: Mark Hounschell @ 2014-03-04 14:33 UTC (permalink / raw)
  To: driverdev-devel; +Cc: Greg Kroah-Hartman

This patch replaces the DGAP_VERIFY_BOARD macro with
the dgap_verify_board function because of checkpatch error.

Signed-off-by: Mark Hounschell <markh@compro.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/dgap/dgap.c | 62 +++++++++++++++++++++++++++++++--------------
 1 file changed, 43 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index f432f73..7f8b497 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -6077,15 +6077,19 @@ 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 struct board_t *dgap_verify_board(struct device *p)
+{
+	struct board_t *bd;
+
+	if (!p)
+		return NULL;
+
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGAP_BOARD_MAGIC || bd->state != BOARD_READY)
+		return NULL;
+
+	return bd;
+}
 
 static ssize_t dgap_ports_state_show(struct device *p, struct device_attribute *attr, char *buf)
 {
@@ -6093,7 +6097,9 @@ static ssize_t dgap_ports_state_show(struct device *p, struct device_attribute *
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	bd = dgap_verify_board(p);
+	if (!bd)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++) {
 		count += snprintf(buf + count, PAGE_SIZE - count,
@@ -6110,7 +6116,9 @@ 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);
+	bd = dgap_verify_board(p);
+	if (!bd)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++) {
 		count +=  snprintf(buf + count, PAGE_SIZE - count,
@@ -6126,7 +6134,9 @@ static ssize_t dgap_ports_msignals_show(struct device *p, struct device_attribut
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	bd = dgap_verify_board(p);
+	if (!bd)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++) {
 		if (bd->channels[i]->ch_open_count)
@@ -6152,7 +6162,9 @@ static ssize_t dgap_ports_iflag_show(struct device *p, struct device_attribute *
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	bd = dgap_verify_board(p);
+	if (!bd)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -6167,7 +6179,9 @@ static ssize_t dgap_ports_cflag_show(struct device *p, struct device_attribute *
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	bd = dgap_verify_board(p);
+	if (!bd)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -6182,7 +6196,9 @@ static ssize_t dgap_ports_oflag_show(struct device *p, struct device_attribute *
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	bd = dgap_verify_board(p);
+	if (!bd)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -6197,7 +6213,9 @@ static ssize_t dgap_ports_lflag_show(struct device *p, struct device_attribute *
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	bd = dgap_verify_board(p);
+	if (!bd)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -6212,7 +6230,9 @@ 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);
+	bd = dgap_verify_board(p);
+	if (!bd)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
@@ -6227,7 +6247,9 @@ static ssize_t dgap_ports_rxcount_show(struct device *p, struct device_attribute
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	bd = dgap_verify_board(p);
+	if (!bd)
+		return 0;
 
 	for (i = 0; i < bd->nasync; i++)
 		count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n",
@@ -6242,7 +6264,9 @@ static ssize_t dgap_ports_txcount_show(struct device *p, struct device_attribute
 	int count = 0;
 	int i = 0;
 
-	DGAP_VERIFY_BOARD(p, bd);
+	bd = dgap_verify_board(p);
+	if (!bd)
+		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@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2014-03-04 14:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-03 21:36 [PATCH 00/04] staging: dgap: Digi International dgap driver Mark Hounschell
2014-03-03 21:36 ` [PATCH 01/04] staging: dgap: Remove more degug/tracing code Mark Hounschell
2014-03-03 21:36 ` [PATCH 02/04] staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro Mark Hounschell
2014-03-03 21:50   ` Dan Carpenter
     [not found]   ` <1308815623.172657.1393883413171.JavaMail.root@mx2.compro.net>
2014-03-03 22:00     ` Mark Hounschell
2014-03-04 14:33   ` [PATCH 02/04 v2] " Mark Hounschell
2014-03-03 21:36 ` [PATCH 03/04] staging: dgap: Add curly braces back in for Multi-line indent block Mark Hounschell
2014-03-03 21:36 ` [PATCH 04/04] staging: dgap: fix some pr_warns with new lines in the string Mark Hounschell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.