예제 #1
0
static int
wmi_hp_detach(device_t self, int flags)
{
	struct wmi_hp_softc *sc = device_private(self);
	device_t parent = sc->sc_parent;

	(void)acpi_wmi_event_deregister(parent);

	if (sc->sc_sme != NULL)
		sysmon_envsys_unregister(sc->sc_sme);

	if (sc->sc_sensor != NULL)
		kmem_free(sc->sc_sensor, WMI_HP_SENSOR_SIZE);

	if (sc->sc_arg != NULL)
		kmem_free(sc->sc_arg, WMI_HP_METHOD_ARG_SIZE);

	pmf_device_deregister(self);

	if (wmihp_sysctllog != NULL)
		sysctl_teardown(&wmihp_sysctllog);
	wmihp_sysctllog = NULL;
	wmi_hp_sc = NULL;

	return 0;
}
예제 #2
0
static int
apple_smc_fan_detach(device_t self, int flags)
{
	struct apple_smc_fan_softc *sc = device_private(self);

	/* If we registered with sysmon_envsys, unregister.  */
	if (sc->sc_sme != NULL) {
		sysmon_envsys_unregister(sc->sc_sme);
		sc->sc_sme = NULL;

		KASSERT(sc->sc_fans != NULL);
		KASSERT(sc->sc_nfans > 0);
		KASSERT(sc->sc_nfans < 10);

		/* Release the keys and free the memory for fan records. */
		apple_smc_fan_release_keys(sc);
		kmem_free(sc->sc_fans,
		    (sizeof(sc->sc_fans[0]) * sc->sc_nfans));
		sc->sc_fans = NULL;
		sc->sc_nfans = 0;
	}

#if 0				/* XXX sysctl */
	/* Tear down all the sysctl knobs we set up.  */
	sysctl_teardown(&sc->sc_sysctl_log);
#endif

	return 0;
}
예제 #3
0
static int
owtemp_detach(device_t self, int flags)
{
	struct owtemp_softc *sc = device_private(self);

	sysmon_envsys_unregister(sc->sc_sme);

	return 0;
}
예제 #4
0
static int
smsc_detach(device_t self, int flags)
{
	struct smsc_softc *sc = device_private(self);

	sysmon_envsys_unregister(sc->sc_sme);
	bus_space_unmap(sc->sc_iot, sc->sc_ioh, 2);
	return 0;
}
예제 #5
0
파일: swsensor.c 프로젝트: ryo/netbsd-src
static
int
swsensor_fini(void *arg)
{

	sysmon_envsys_unregister(swsensor_sme);

	sysctl_teardown(&swsensor_sysctllog);

	return 0;
}
예제 #6
0
static int hytp14_detach(device_t self, int flags)
{
	struct hytp14_sc *sc = device_private(self);

	if (sc->sc_sme != NULL) {
		sysmon_envsys_unregister(sc->sc_sme);
		sc->sc_sme = NULL;
	}
	
	return 0;
}
예제 #7
0
파일: adm1026.c 프로젝트: ryo/netbsd-src
static int
adm1026_detach(device_t self, int flags)
{
	struct adm1026_softc *sc = device_private(self);

	pmf_device_deregister(self);

	sysmon_envsys_unregister(sc->sc_sme);
	sc->sc_sme = NULL;

	return 0;
}
예제 #8
0
static int
aps_detach(device_t self, int flags)
{
	struct aps_softc *sc = device_private(self);

        callout_stop(&sc->sc_callout);
        callout_destroy(&sc->sc_callout);
	sysmon_envsys_unregister(sc->sc_sme);
	bus_space_unmap(sc->sc_iot, sc->sc_ioh, APS_ADDR_SIZE);

	return 0;
}
예제 #9
0
static int
itesio_isa_detach(device_t self, int flags)
{
	struct itesio_softc *sc = device_private(self);

	if (sc->sc_hwmon_enabled)
		sysmon_envsys_unregister(sc->sc_sme);
	if (sc->sc_hwmon_mapped)
		bus_space_unmap(sc->sc_ec_iot, sc->sc_ec_ioh, 8);
	if (sc->sc_wdt_enabled) {
		sysmon_wdog_unregister(&sc->sc_smw);
		bus_space_unmap(sc->sc_iot, sc->sc_ioh, 2);
	}

	return 0;
}
static int
acpitz_detach(device_t self, int flags)
{
    struct acpitz_softc *sc = device_private(self);
    ACPI_HANDLE hdl;
    ACPI_BUFFER al;
    ACPI_STATUS rv;
    int i;

    callout_halt(&sc->sc_callout, NULL);
    callout_destroy(&sc->sc_callout);

    pmf_device_deregister(self);
    acpi_deregister_notify(sc->sc_node);

    /*
     * Although the device itself should not contain any power
     * resources, we have possibly used the resources of active
     * cooling devices. To unregister these, first fetch a fresh
     * active cooling zone, and then detach the resources from
     * the reference handles contained in the cooling zone.
     */
    acpitz_get_zone(self, 0);

    for (i = 0; i < ATZ_NLEVELS; i++) {

        if (sc->sc_zone.al[i].Pointer == NULL)
            continue;

        al = sc->sc_zone.al[i];
        rv = acpi_eval_reference_handle(al.Pointer, &hdl);

        if (ACPI_SUCCESS(rv))
            acpi_power_deregister(hdl);

        ACPI_FREE(sc->sc_zone.al[i].Pointer);
    }

    if (sc->sc_psl)
        kmem_free(sc->sc_psl, sc->sc_psl_size);

    if (sc->sc_sme != NULL)
        sysmon_envsys_unregister(sc->sc_sme);

    return 0;
}
예제 #11
0
int 
uyurex_detach(device_t self, int flags)
{
	struct uyurex_softc *sc = device_private(self);
	int rv = 0;

	sc->sc_dying = 1;

	callout_halt(&sc->sc_deltach, NULL);
	callout_destroy(&sc->sc_deltach);
	sysmon_envsys_unregister(sc->sc_sme);

	if (sc->sc_ibuf != NULL) {
		free(sc->sc_ibuf, M_USBDEV);
		sc->sc_ibuf = NULL;
	}

	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
	    sc->sc_hdev.sc_dev);

	return (rv);
}
예제 #12
0
static int
thinkpad_detach(device_t self, int flags)
{
	struct thinkpad_softc *sc = device_private(self);
	int i;

	acpi_deregister_notify(sc->sc_node);

	for (i = 0; i < TP_PSW_LAST; i++)
		sysmon_pswitch_unregister(&sc->sc_smpsw[i]);

	if (sc->sc_sme != NULL)
		sysmon_envsys_unregister(sc->sc_sme);

	pmf_device_deregister(self);

	pmf_event_deregister(self, PMFE_DISPLAY_BRIGHTNESS_UP,
	    thinkpad_brightness_up, true);

	pmf_event_deregister(self, PMFE_DISPLAY_BRIGHTNESS_DOWN,
	    thinkpad_brightness_down, true);

	return 0;
}
예제 #13
0
static int
asus_detach(device_t self, int flags)
{
	struct asus_softc *sc = device_private(self);
	int i;

	acpi_deregister_notify(sc->sc_node);

	if (sc->sc_smpsw_valid != false) {

		for (i = 0; i < ASUS_PSW_LAST; i++)
			sysmon_pswitch_unregister(&sc->sc_smpsw[i]);
	}

	if (sc->sc_sme != NULL)
		sysmon_envsys_unregister(sc->sc_sme);

	if (sc->sc_log != NULL)
		sysctl_teardown(&sc->sc_log);

	pmf_device_deregister(self);

	return 0;
}