Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Get rid of bogus ADW_CALLBACK typedef. Use the r...



details:   https://anonhg.NetBSD.org/src/rev/cc388684800e
branches:  trunk
changeset: 965926:cc388684800e
user:      uwe <uwe%NetBSD.org@localhost>
date:      Sun Oct 06 01:04:49 2019 +0000

description:
Get rid of bogus ADW_CALLBACK typedef.  Use the real callback types
directly.  Since we no longer need the casting dance we can get rid of
ADW_ISR_CALLBACK and ADW_ASYNC_CALLBACK typedefs too.  The diff for
adwlib.h looks larger than it is b/c we need to reorder structure
definitions for the proper callback declaration.  Found by gcc8
-Wcast-function-type.

diffstat:

 sys/dev/ic/adw.c    |    8 +-
 sys/dev/ic/adwlib.c |    8 +-
 sys/dev/ic/adwlib.h |  150 ++++++++++++++++++++++++++--------------------------
 3 files changed, 83 insertions(+), 83 deletions(-)

diffs (236 lines):

diff -r f6afc77db5b3 -r cc388684800e sys/dev/ic/adw.c
--- a/sys/dev/ic/adw.c  Sun Oct 06 00:48:19 2019 +0000
+++ b/sys/dev/ic/adw.c  Sun Oct 06 01:04:49 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adw.c,v 1.54 2016/07/14 04:19:26 msaitoh Exp $      */
+/* $NetBSD: adw.c,v 1.55 2019/10/06 01:04:49 uwe Exp $  */
 
 /*
  * Generic driver for the Advanced Systems Inc. SCSI controllers
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adw.c,v 1.54 2016/07/14 04:19:26 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adw.c,v 1.55 2019/10/06 01:04:49 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -398,8 +398,8 @@
                            "setting. Using automatic termination.\n");
        }
 
-       sc->isr_callback = (ADW_CALLBACK) adw_isr_callback;
-       sc->async_callback = (ADW_CALLBACK) adw_async_callback;
+       sc->isr_callback = adw_isr_callback;
+       sc->async_callback = adw_async_callback;
 
        return 0;
 }
diff -r f6afc77db5b3 -r cc388684800e sys/dev/ic/adwlib.c
--- a/sys/dev/ic/adwlib.c       Sun Oct 06 00:48:19 2019 +0000
+++ b/sys/dev/ic/adwlib.c       Sun Oct 06 01:04:49 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adwlib.c,v 1.42 2019/02/03 03:19:27 mrg Exp $        */
+/* $NetBSD: adwlib.c,v 1.43 2019/10/06 01:04:49 uwe Exp $        */
 
 /*
  * Low level routines for the Advanced Systems Inc. SCSI controllers chips
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adwlib.c,v 1.42 2019/02/03 03:19:27 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adwlib.c,v 1.43 2019/10/06 01:04:49 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2021,7 +2021,7 @@
                }
 
                if (sc->async_callback != 0) {
-                   (*(ADW_ASYNC_CALLBACK)sc->async_callback)(sc, intrb_code);
+                       (*sc->async_callback)(sc, intrb_code);
                }
        }
 
@@ -2098,7 +2098,7 @@
                 * Notify the driver of the completed request by passing
                 * the ADW_SCSI_REQ_Q pointer to its callback function.
                 */
-               (*(ADW_ISR_CALLBACK)sc->isr_callback)(sc, scsiq);
+               (*sc->isr_callback)(sc, scsiq);
                /*
                 * Note: After the driver callback function is called, 'scsiq'
                 * can no longer be referenced.
diff -r f6afc77db5b3 -r cc388684800e sys/dev/ic/adwlib.h
--- a/sys/dev/ic/adwlib.h       Sun Oct 06 00:48:19 2019 +0000
+++ b/sys/dev/ic/adwlib.h       Sun Oct 06 01:04:49 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: adwlib.h,v 1.21 2012/10/27 17:18:18 chs Exp $        */
+/*      $NetBSD: adwlib.h,v 1.22 2019/10/06 01:04:49 uwe Exp $        */
 
 /*
  * Definitions for low level routines and data structures
@@ -717,80 +717,6 @@
 
 
 /*
- * Adapter operation variable structure.
- *
- * One structure is required per host adapter.
- *
- * Field naming convention:
- *
- *  *_able indicates both whether a feature should be enabled or disabled
- *  and whether a device is capable of the feature. At initialization
- *  this field may be set, but later if a device is found to be incapable
- *  of the feature, the field is cleared.
- */
-#define        CCB_HASH_SIZE   32      /* hash table size for phystokv */
-#define        CCB_HASH_SHIFT  9
-#define CCB_HASH(x)    ((((x)) >> CCB_HASH_SHIFT) & (CCB_HASH_SIZE - 1))
-
-typedef int (* ADW_CALLBACK) (int);
-
-typedef struct adw_softc {
-
-       device_t                sc_dev;
-
-       bus_space_tag_t         sc_iot;
-       bus_space_handle_t      sc_ioh;
-       bus_dma_tag_t           sc_dmat;
-       bus_dmamap_t            sc_dmamap_control; /* maps the control structures */
-       bus_dmamap_t            sc_dmamap_carrier; /* maps the carrier structures */
-       void                    *sc_ih;
-
-       struct adw_control      *sc_control; /* control structures */
-
-       struct adw_ccb          *sc_ccbhash[CCB_HASH_SIZE];
-       TAILQ_HEAD(, adw_ccb)   sc_free_ccb, sc_waiting_ccb;
-       TAILQ_HEAD(adw_pending_ccb, adw_ccb)    sc_pending_ccb;
-       struct scsipi_adapter   sc_adapter;
-       struct scsipi_channel   sc_channel;
-
-       int                     sc_freeze_dev[ADW_MAX_TID+1];
-
-       ADW_CALLBACK    isr_callback;   /* pointer to function, called in AdwISR() */
-       ADW_CALLBACK    async_callback; /* pointer to function, called in AdwISR() */
-       u_int16_t       bios_ctrl;      /* BIOS control word, EEPROM word 12 */
-       u_int16_t       wdtr_able;      /* try WDTR for a device */
-       u_int16_t       sdtr_able;      /* try SDTR for a device */
-       u_int16_t       ultra_able;     /* try SDTR Ultra speed for a device */
-       u_int16_t       sdtr_speed1;    /* EEPROM SDTR Speed for TID 0-3   */
-       u_int16_t       sdtr_speed2;    /* EEPROM SDTR Speed for TID 4-7   */
-       u_int16_t       sdtr_speed3;    /* EEPROM SDTR Speed for TID 8-11  */
-       u_int16_t       sdtr_speed4;    /* EEPROM SDTR Speed for TID 12-15 */
-       u_int16_t       tagqng_able;    /* try tagged queuing with a device */
-       u_int16_t       ppr_able;       /* PPR message capable per TID bitmask. */
-       u_int16_t       start_motor;    /* start motor command allowed */
-       u_int8_t        max_dvc_qng;    /* maximum number of tagged commands per device */
-       u_int8_t        scsi_reset_wait; /* delay in seconds after scsi bus reset */
-       u_int8_t        chip_no;        /* should be assigned by caller */
-       u_int8_t        max_host_qng;   /* maximum number of Q'ed command allowed */
-       u_int8_t        irq_no;         /* IRQ number */
-       u_int8_t        chip_type;      /* chip SCSI target ID */
-       u_int16_t       no_scam;        /* scam_tolerant of EEPROM */
-       u_int32_t       drv_ptr;        /* driver pointer to private structure */
-       u_int8_t        chip_scsi_id;   /* chip SCSI target ID */
-       u_int8_t        bist_err_code;
-       u_int16_t       carr_pending_cnt;  /* Count of pending carriers. */
-       struct adw_carrier      *carr_freelist; /* Carrier free list. */
-       struct adw_carrier      *icq_sp; /* Initiator command queue stopper pointer. */
-       struct adw_carrier      *irq_sp; /* Initiator response queue stopper pointer. */
- /*
-  * Note: The following fields will not be used after initialization. The
-  * driver may discard the buffer after initialization is done.
-  */
-  ADW_DVC_CFG cfg; /* temporary configuration structure  */
-} ADW_SOFTC;
-
-
-/*
  * ADW_SCSI_REQ_Q - microcode request structure
  *
  * All fields in this structure up to byte 60 are used by the microcode.
@@ -884,6 +810,80 @@
 
 
 /*
+ * Adapter operation variable structure.
+ *
+ * One structure is required per host adapter.
+ *
+ * Field naming convention:
+ *
+ *  *_able indicates both whether a feature should be enabled or disabled
+ *  and whether a device is capable of the feature. At initialization
+ *  this field may be set, but later if a device is found to be incapable
+ *  of the feature, the field is cleared.
+ */
+#define        CCB_HASH_SIZE   32      /* hash table size for phystokv */
+#define        CCB_HASH_SHIFT  9
+#define CCB_HASH(x)    ((((x)) >> CCB_HASH_SHIFT) & (CCB_HASH_SIZE - 1))
+
+typedef struct adw_softc {
+
+       device_t                sc_dev;
+
+       bus_space_tag_t         sc_iot;
+       bus_space_handle_t      sc_ioh;
+       bus_dma_tag_t           sc_dmat;
+       bus_dmamap_t            sc_dmamap_control; /* maps the control structures */
+       bus_dmamap_t            sc_dmamap_carrier; /* maps the carrier structures */
+       void                    *sc_ih;
+
+       struct adw_control      *sc_control; /* control structures */
+
+       struct adw_ccb          *sc_ccbhash[CCB_HASH_SIZE];
+       TAILQ_HEAD(, adw_ccb)   sc_free_ccb, sc_waiting_ccb;
+       TAILQ_HEAD(adw_pending_ccb, adw_ccb)    sc_pending_ccb;
+       struct scsipi_adapter   sc_adapter;
+       struct scsipi_channel   sc_channel;
+
+       int                     sc_freeze_dev[ADW_MAX_TID+1];
+
+       /* pointers to functions, called in AdwISR() */
+       void (*isr_callback)(struct adw_softc *, ADW_SCSI_REQ_Q *);
+       void (*async_callback)(struct adw_softc *, u_int8_t);
+
+       u_int16_t       bios_ctrl;      /* BIOS control word, EEPROM word 12 */
+       u_int16_t       wdtr_able;      /* try WDTR for a device */
+       u_int16_t       sdtr_able;      /* try SDTR for a device */
+       u_int16_t       ultra_able;     /* try SDTR Ultra speed for a device */
+       u_int16_t       sdtr_speed1;    /* EEPROM SDTR Speed for TID 0-3   */
+       u_int16_t       sdtr_speed2;    /* EEPROM SDTR Speed for TID 4-7   */
+       u_int16_t       sdtr_speed3;    /* EEPROM SDTR Speed for TID 8-11  */
+       u_int16_t       sdtr_speed4;    /* EEPROM SDTR Speed for TID 12-15 */
+       u_int16_t       tagqng_able;    /* try tagged queuing with a device */
+       u_int16_t       ppr_able;       /* PPR message capable per TID bitmask. */
+       u_int16_t       start_motor;    /* start motor command allowed */
+       u_int8_t        max_dvc_qng;    /* maximum number of tagged commands per device */
+       u_int8_t        scsi_reset_wait; /* delay in seconds after scsi bus reset */
+       u_int8_t        chip_no;        /* should be assigned by caller */
+       u_int8_t        max_host_qng;   /* maximum number of Q'ed command allowed */
+       u_int8_t        irq_no;         /* IRQ number */
+       u_int8_t        chip_type;      /* chip SCSI target ID */
+       u_int16_t       no_scam;        /* scam_tolerant of EEPROM */
+       u_int32_t       drv_ptr;        /* driver pointer to private structure */
+       u_int8_t        chip_scsi_id;   /* chip SCSI target ID */
+       u_int8_t        bist_err_code;
+       u_int16_t       carr_pending_cnt;  /* Count of pending carriers. */
+       struct adw_carrier      *carr_freelist; /* Carrier free list. */
+       struct adw_carrier      *icq_sp; /* Initiator command queue stopper pointer. */
+       struct adw_carrier      *irq_sp; /* Initiator response queue stopper pointer. */
+ /*
+  * Note: The following fields will not be used after initialization. The
+  * driver may discard the buffer after initialization is done.
+  */
+  ADW_DVC_CFG cfg; /* temporary configuration structure  */
+} ADW_SOFTC;
+
+
+/*
  * Microcode idle loop commands
  */
 #define IDLE_CMD_COMPLETED           0



Home | Main Index | Thread Index | Old Index