From 3caa8a56505bece0fc856c96f00a6836d9172c9a Mon Sep 17 00:00:00 2001 From: dyoung Date: Thu, 18 Mar 2010 20:51:42 +0000 Subject: [PATCH] This is *always* compiled with #define rbus 1, so get rid of the conditional compilation. Simplify interrupt (dis)establishment by two source transformations: - cardbus_intr_disestablish(cc, cf, ih); + Cardbus_intr_disestablish(ct, ih); - ih = cardbus_intr_establish(cc, cf, ...); + ih = Cardbus_intr_establish(ct, ...); The identical change to a few other CardBus NICs has not caused any problems, as expected, so I'm going to commit this rather safe change and get on with the work. Testers have been enlisted. I will revisit this change if I get any negative responses. --- sys/dev/cardbus/if_ral_cardbus.c | 21 +++++---------------- sys/dev/cardbus/if_re_cardbus.c | 22 +++++----------------- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/sys/dev/cardbus/if_ral_cardbus.c b/sys/dev/cardbus/if_ral_cardbus.c index 97353c129561..431161c8a4af 100644 --- a/sys/dev/cardbus/if_ral_cardbus.c +++ b/sys/dev/cardbus/if_ral_cardbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ral_cardbus.c,v 1.20 2010/02/26 00:57:02 dyoung Exp $ */ +/* $NetBSD: if_ral_cardbus.c,v 1.21 2010/03/18 20:51:42 dyoung Exp $ */ /* $OpenBSD: if_ral_cardbus.c,v 1.6 2006/01/09 20:03:31 damien Exp $ */ /*- @@ -22,7 +22,7 @@ * CardBus front-end for the Ralink RT2560/RT2561/RT2561S/RT2661 driver. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ral_cardbus.c,v 1.20 2010/02/26 00:57:02 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ral_cardbus.c,v 1.21 2010/03/18 20:51:42 dyoung Exp $"); #include @@ -163,11 +163,6 @@ ral_cardbus_attach(device_t parent, device_t self, return; } -#if rbus -#else - (*cf->cardbus_mem_open)(cc, 0, base, base + csc->sc_mapsize); -#endif - csc->sc_bar_val = base | PCI_MAPREG_TYPE_MEM; /* set up the PCI configuration registers */ @@ -184,8 +179,6 @@ ral_cardbus_detach(device_t self, int flags) struct ral_cardbus_softc *csc = (struct ral_cardbus_softc *)self; struct rt2560_softc *sc = &csc->sc_sc; cardbus_devfunc_t ct = csc->sc_ct; - cardbus_chipset_tag_t cc = ct->ct_cc; - cardbus_function_tag_t cf = ct->ct_cf; int error; error = (*csc->sc_opns->detach)(sc); @@ -194,7 +187,7 @@ ral_cardbus_detach(device_t self, int flags) /* unhook the interrupt handler */ if (csc->sc_ih != NULL) { - cardbus_intr_disestablish(cc, cf, csc->sc_ih); + Cardbus_intr_disestablish(ct, csc->sc_ih); csc->sc_ih = NULL; } @@ -210,8 +203,6 @@ ral_cardbus_enable(struct rt2560_softc *sc) { struct ral_cardbus_softc *csc = (struct ral_cardbus_softc *)sc; cardbus_devfunc_t ct = csc->sc_ct; - cardbus_chipset_tag_t cc = ct->ct_cc; - cardbus_function_tag_t cf = ct->ct_cf; /* power on the socket */ Cardbus_function_enable(ct); @@ -220,7 +211,7 @@ ral_cardbus_enable(struct rt2560_softc *sc) ral_cardbus_setup(csc); /* map and establish the interrupt handler */ - csc->sc_ih = cardbus_intr_establish(cc, cf, csc->sc_intrline, IPL_NET, + csc->sc_ih = Cardbus_intr_establish(ct, csc->sc_intrline, IPL_NET, csc->sc_opns->intr, sc); if (csc->sc_ih == NULL) { aprint_error_dev(&sc->sc_dev, @@ -237,11 +228,9 @@ ral_cardbus_disable(struct rt2560_softc *sc) { struct ral_cardbus_softc *csc = (struct ral_cardbus_softc *)sc; cardbus_devfunc_t ct = csc->sc_ct; - cardbus_chipset_tag_t cc = ct->ct_cc; - cardbus_function_tag_t cf = ct->ct_cf; /* unhook the interrupt handler */ - cardbus_intr_disestablish(cc, cf, csc->sc_ih); + Cardbus_intr_disestablish(ct, csc->sc_ih); csc->sc_ih = NULL; /* power down the socket */ diff --git a/sys/dev/cardbus/if_re_cardbus.c b/sys/dev/cardbus/if_re_cardbus.c index 97589a902ab4..7c12520d6d66 100644 --- a/sys/dev/cardbus/if_re_cardbus.c +++ b/sys/dev/cardbus/if_re_cardbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_re_cardbus.c,v 1.24 2010/02/26 00:57:02 dyoung Exp $ */ +/* $NetBSD: if_re_cardbus.c,v 1.25 2010/03/18 20:51:42 dyoung Exp $ */ /* * Copyright (c) 2004 Jonathan Stone @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_re_cardbus.c,v 1.24 2010/02/26 00:57:02 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_re_cardbus.c,v 1.25 2010/03/18 20:51:42 dyoung Exp $"); #include #include @@ -171,10 +171,6 @@ re_cardbus_attach(device_t parent, device_t self, void *aux) #ifdef RTK_USEIOSPACE if (Cardbus_mapreg_map(ct, RTK_PCI_LOIO, PCI_MAPREG_TYPE_IO, 0, &sc->rtk_btag, &sc->rtk_bhandle, &adr, &csc->sc_mapsize) == 0) { -#if rbus -#else - (*ct->ct_cf->cardbus_io_open)(cc, 0, adr, adr+csc->sc_mapsize); -#endif csc->sc_csr |= PCI_COMMAND_IO_ENABLE; csc->sc_bar_reg = RTK_PCI_LOIO; csc->sc_bar_val = adr | PCI_MAPREG_TYPE_IO; @@ -182,10 +178,6 @@ re_cardbus_attach(device_t parent, device_t self, void *aux) #else if (Cardbus_mapreg_map(ct, RTK_PCI_LOMEM, PCI_MAPREG_TYPE_MEM, 0, &sc->rtk_btag, &sc->rtk_bhandle, &adr, &csc->sc_mapsize) == 0) { -#if rbus -#else - (*ct->ct_cf->cardbus_mem_open)(cc, 0, adr, adr+csc->sc_mapsize); -#endif csc->sc_csr |= PCI_COMMAND_MEM_ENABLE; csc->sc_bar_reg = RTK_PCI_LOMEM; csc->sc_bar_val = adr | PCI_MAPREG_TYPE_MEM; @@ -232,7 +224,7 @@ re_cardbus_detach(device_t self, int flags) * Unhook the interrupt handler. */ if (csc->sc_ih != NULL) - cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, csc->sc_ih); + Cardbus_intr_disestablish(ct, csc->sc_ih); /* * Release bus space and close window. @@ -316,8 +308,6 @@ re_cardbus_enable(struct rtk_softc *sc) { struct re_cardbus_softc *csc = (struct re_cardbus_softc *)sc; cardbus_devfunc_t ct = csc->sc_ct; - cardbus_chipset_tag_t cc = ct->ct_cc; - cardbus_function_tag_t cf = ct->ct_cf; /* * Power on the socket. @@ -332,7 +322,7 @@ re_cardbus_enable(struct rtk_softc *sc) /* * Map and establish the interrupt. */ - csc->sc_ih = cardbus_intr_establish(cc, cf, csc->sc_intrline, + csc->sc_ih = Cardbus_intr_establish(ct, csc->sc_intrline, IPL_NET, re_intr, sc); if (csc->sc_ih == NULL) { aprint_error_dev(sc->sc_dev, @@ -348,11 +338,9 @@ re_cardbus_disable(struct rtk_softc *sc) { struct re_cardbus_softc *csc = (struct re_cardbus_softc *)sc; cardbus_devfunc_t ct = csc->sc_ct; - cardbus_chipset_tag_t cc = ct->ct_cc; - cardbus_function_tag_t cf = ct->ct_cf; /* Unhook the interrupt handler. */ - cardbus_intr_disestablish(cc, cf, csc->sc_ih); + Cardbus_intr_disestablish(ct, csc->sc_ih); csc->sc_ih = NULL; /* Power down the socket. */