Module Name: src Committed By: uwe Date: Sun Oct 6 00:48:19 UTC 2019
Modified Files: src/sys/dev/ic: adv.c adv.h advlib.c advlib.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ic/adv.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/adv.h cvs rdiff -u -r1.27 -r1.28 src/sys/dev/ic/advlib.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/advlib.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/adv.c diff -u src/sys/dev/ic/adv.c:1.48 src/sys/dev/ic/adv.c:1.49 --- src/sys/dev/ic/adv.c:1.48 Wed Aug 29 16:51:51 2018 +++ src/sys/dev/ic/adv.c Sun Oct 6 00:48:19 2019 @@ -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 @@ adv_init(ASC_SOFTC *sc) 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); } Index: src/sys/dev/ic/adv.h diff -u src/sys/dev/ic/adv.h:1.13 src/sys/dev/ic/adv.h:1.14 --- src/sys/dev/ic/adv.h:1.13 Sun Dec 11 12:21:25 2005 +++ src/sys/dev/ic/adv.h Sun Oct 6 00:48:19 2019 @@ -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; Index: src/sys/dev/ic/advlib.c diff -u src/sys/dev/ic/advlib.c:1.27 src/sys/dev/ic/advlib.c:1.28 --- src/sys/dev/ic/advlib.c:1.27 Sat Nov 13 13:52:00 2010 +++ src/sys/dev/ic/advlib.c Sun Oct 6 00:48:19 2019 @@ -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 @@ AscIsrQDone(ASC_SOFTC *sc) 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 @@ AscIsrQDone(ASC_SOFTC *sc) ASC_SET_CHIP_CONTROL(iot, ioh, 0); } } - (*asc_isr_callback) (sc, scsiq); + (*sc->isr_callback)(sc, scsiq); return (1); } else { @@ -2818,11 +2815,8 @@ AscRiscHaltedAbortCCB(ASC_SOFTC *sc, ADV 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 @@ AscRiscHaltedAbortCCB(ASC_SOFTC *sc, ADV 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 @@ AscRiscHaltedAbortTIX(ASC_SOFTC *sc, u_i 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 @@ AscRiscHaltedAbortTIX(ASC_SOFTC *sc, u_i 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); } } } Index: src/sys/dev/ic/advlib.h diff -u src/sys/dev/ic/advlib.h:1.19 src/sys/dev/ic/advlib.h:1.20 --- src/sys/dev/ic/advlib.h:1.19 Sat Oct 27 17:18:18 2012 +++ src/sys/dev/ic/advlib.h Sun Oct 6 00:48:19 2019 @@ -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 @@ typedef struct ext_msg #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 @@ typedef struct asc_softc 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;