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 ASC_CALLBACK typedef. Use the r...



details:   https://anonhg.NetBSD.org/src/rev/5859663147c1
branches:  trunk
changeset: 460068:5859663147c1
user:      uwe <uwe%NetBSD.org@localhost>
date:      Sun Oct 06 00:48:19 2019 +0000

description:
Get rid of bogus ASC_CALLBACK typedef.  Use the real callback type
(which is almost ASC_ISR_CALLBACK).  Since we no longer need the
casting dance we can get rid of the temporary variables, and since we
don't need the temporary variables we don't need the ASC_ISR_CALLBACK
typedef either.  Found by gcc8 -Wcast-function-type.

diffstat:

 sys/dev/ic/adv.c    |   6 +++---
 sys/dev/ic/adv.h    |   5 +----
 sys/dev/ic/advlib.c |  21 ++++++---------------
 sys/dev/ic/advlib.h |   6 ++----
 4 files changed, 12 insertions(+), 26 deletions(-)

diffs (154 lines):

diff -r 7fa549c4a861 -r 5859663147c1 sys/dev/ic/adv.c
--- a/sys/dev/ic/adv.c  Sun Oct 06 00:27:50 2019 +0000
+++ b/sys/dev/ic/adv.c  Sun Oct 06 00:48:19 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adv.c,v 1.48 2018/08/29 16:51:51 rin Exp $     */
+/*     $NetBSD: adv.c,v 1.49 2019/10/06 00:48:19 uwe Exp $     */
 
 /*
  * Generic driver for the Advanced Systems Inc. Narrow SCSI controllers
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: adv.c,v 1.48 2018/08/29 16:51:51 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adv.c,v 1.49 2019/10/06 00:48:19 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -405,7 +405,7 @@
                        aprint_normal("unknown warning %d\n", warn);
                }
        }
-       sc->isr_callback = (ASC_CALLBACK) adv_narrow_isr_callback;
+       sc->isr_callback = adv_narrow_isr_callback;
 
        return (0);
 }
diff -r 7fa549c4a861 -r 5859663147c1 sys/dev/ic/adv.h
--- a/sys/dev/ic/adv.h  Sun Oct 06 00:27:50 2019 +0000
+++ b/sys/dev/ic/adv.h  Sun Oct 06 00:48:19 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: adv.h,v 1.13 2005/12/11 12:21:25 christos Exp $        */
+/*      $NetBSD: adv.h,v 1.14 2019/10/06 00:48:19 uwe Exp $        */
 
 /*
  * Generic driver definitions and exported functions for the Advanced
@@ -43,9 +43,6 @@
 
 /******************************************************************************/
 
-/* second level interrupt callback type definition */
-typedef int (* ASC_ISR_CALLBACK) (ASC_SOFTC *, ASC_QDONE_INFO *);
-
 struct adv_ccb
 {
        ASC_SG_HEAD     sghead;
diff -r 7fa549c4a861 -r 5859663147c1 sys/dev/ic/advlib.c
--- a/sys/dev/ic/advlib.c       Sun Oct 06 00:27:50 2019 +0000
+++ b/sys/dev/ic/advlib.c       Sun Oct 06 00:48:19 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: advlib.c,v 1.27 2010/11/13 13:52:00 uebayasi Exp $        */
+/*      $NetBSD: advlib.c,v 1.28 2019/10/06 00:48:19 uwe Exp $        */
 
 /*
  * Low level routines for the Advanced Systems Inc. SCSI controllers chips
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: advlib.c,v 1.27 2010/11/13 13:52:00 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: advlib.c,v 1.28 2019/10/06 00:48:19 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1549,10 +1549,7 @@
        u_int8_t        cur_target_qng;
        ASC_QDONE_INFO  scsiq_buf;
        ASC_QDONE_INFO *scsiq;
-       ASC_ISR_CALLBACK asc_isr_callback;
-
-
-       asc_isr_callback = (ASC_ISR_CALLBACK) sc->isr_callback;
+
        n_q_used = 1;
        scsiq = (ASC_QDONE_INFO *) & scsiq_buf;
        done_q_tail = ASC_GET_VAR_DONE_QTAIL(iot, ioh);
@@ -1631,7 +1628,7 @@
                                        ASC_SET_CHIP_CONTROL(iot, ioh, 0);
                                }
                        }
-                       (*asc_isr_callback) (sc, scsiq);
+                       (*sc->isr_callback)(sc, scsiq);
 
                        return (1);
                } else {
@@ -2818,11 +2815,8 @@
        u_int8_t        q_no;
        ASC_QDONE_INFO  scsiq_buf;
        ASC_QDONE_INFO *scsiq;
-       ASC_ISR_CALLBACK asc_isr_callback;
        int             last_int_level;
 
-
-       asc_isr_callback = (ASC_ISR_CALLBACK) sc->isr_callback;
        last_int_level = DvcEnterCritical();
        scsiq = (ASC_QDONE_INFO *) & scsiq_buf;
 
@@ -2840,7 +2834,7 @@
                                AscWriteLramDWord(iot, ioh, q_addr + ASC_SCSIQ_D_CCBPTR, 0L);
                                AscWriteLramByte(iot, ioh, q_addr + ASC_SCSIQ_B_STATUS,
                                                 scsiq->q_status);
-                               (*asc_isr_callback) (sc, scsiq);
+                               (*sc->isr_callback)(sc, scsiq);
                                return (1);
                        }
                }
@@ -2860,11 +2854,8 @@
        u_int8_t        q_no;
        ASC_QDONE_INFO  scsiq_buf;
        ASC_QDONE_INFO *scsiq;
-       ASC_ISR_CALLBACK asc_isr_callback;
        int             last_int_level;
 
-
-       asc_isr_callback = (ASC_ISR_CALLBACK) sc->isr_callback;
        last_int_level = DvcEnterCritical();
        scsiq = (ASC_QDONE_INFO *) & scsiq_buf;
        for (q_no = ASC_MIN_ACTIVE_QNO; q_no <= sc->max_total_qng; q_no++) {
@@ -2879,7 +2870,7 @@
                                AscWriteLramDWord(iot, ioh, q_addr + ASC_SCSIQ_D_CCBPTR, 0L);
                                AscWriteLramByte(iot, ioh, q_addr + ASC_SCSIQ_B_STATUS,
                                                 scsiq->q_status);
-                               (*asc_isr_callback) (sc, scsiq);
+                               (*sc->isr_callback)(sc, scsiq);
                        }
                }
        }
diff -r 7fa549c4a861 -r 5859663147c1 sys/dev/ic/advlib.h
--- a/sys/dev/ic/advlib.h       Sun Oct 06 00:27:50 2019 +0000
+++ b/sys/dev/ic/advlib.h       Sun Oct 06 00:48:19 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: advlib.h,v 1.19 2012/10/27 17:18:18 chs Exp $        */
+/*      $NetBSD: advlib.h,v 1.20 2019/10/06 00:48:19 uwe Exp $        */
 
 /*
  * Definitions for low level routines and data structures
@@ -833,8 +833,6 @@
 #define        CCB_HASH_SHIFT  9
 #define CCB_HASH(x)    ((((long)(x))>>CCB_HASH_SHIFT) & (CCB_HASH_SIZE - 1))
 
-typedef int (* ASC_CALLBACK) (int);
-
 typedef struct asc_softc
 {
        device_t                sc_dev;
@@ -866,7 +864,7 @@
        u_int16_t               bug_fix_cntl;
        u_int16_t               bus_type;
 
-       ASC_CALLBACK            isr_callback;
+       void (*isr_callback)(struct asc_softc *, ASC_QDONE_INFO *);
 
        ASC_SCSI_BIT_ID_TYPE    init_sdtr;
        ASC_SCSI_BIT_ID_TYPE    sdtr_done;



Home | Main Index | Thread Index | Old Index