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)
 {
        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,
        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,
        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)
        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",
        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",
        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",
        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",
        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",
        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",
        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",