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@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; \
-
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@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel