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, ...); Tested by Juraj Hercek.
This commit is contained in:
parent
fcbd1014fb
commit
30882f2250
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_rtk_cardbus.c,v 1.43 2010/02/26 00:57:02 dyoung Exp $ */
|
||||
/* $NetBSD: if_rtk_cardbus.c,v 1.44 2010/03/11 17:24:27 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Masanori Kanaoka
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_rtk_cardbus.c,v 1.43 2010/02/26 00:57:02 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_rtk_cardbus.c,v 1.44 2010/03/11 17:24:27 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "rnd.h"
|
||||
@ -207,10 +207,6 @@ rtk_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;
|
||||
@ -218,10 +214,6 @@ rtk_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;
|
||||
@ -269,7 +261,7 @@ rtk_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.
|
||||
@ -353,8 +345,6 @@ rtk_cardbus_enable(struct rtk_softc *sc)
|
||||
{
|
||||
struct rtk_cardbus_softc *csc = (struct rtk_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.
|
||||
@ -369,7 +359,7 @@ rtk_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, rtk_intr, sc);
|
||||
if (csc->sc_ih == NULL) {
|
||||
aprint_error_dev(sc->sc_dev,
|
||||
@ -385,11 +375,9 @@ rtk_cardbus_disable(struct rtk_softc *sc)
|
||||
{
|
||||
struct rtk_cardbus_softc *csc = (struct rtk_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. */
|
||||
|
Loading…
Reference in New Issue
Block a user