Exemple #1
0
static int
cir_modcmd(modcmd_t cmd, void *opaque)
{
	int error = 0;
#ifdef _MODULE
	int bmaj = -1, cmaj = -1;
#endif

	switch (cmd) {
	case MODULE_CMD_INIT:
#ifdef _MODULE
		error = config_init_component(cfdriver_ioconf_cir,
		    cfattach_ioconf_cir, cfdata_ioconf_cir);
		if (error)
			return error;
		error = devsw_attach("cir", NULL, &bmaj, &cir_cdevsw, &cmaj);
		if (error)
			config_fini_component(cfdriver_ioconf_cir,
			    cfattach_ioconf_cir, cfdata_ioconf_cir);
#endif
		return error;
	case MODULE_CMD_FINI:
#ifdef _MODULE
		devsw_detach(NULL, &cir_cdevsw);
		return config_fini_component(cfdriver_ioconf_cir,
		    cfattach_ioconf_cir, cfdata_ioconf_cir);
#endif
		return error;
	default:
		return ENOTTY;
	}
}
Exemple #2
0
static int
ld_virtio_modcmd(modcmd_t cmd, void *opaque)
{
#ifdef _MODULE
	/*
	 * We ignore the cfdriver_vec[] that ioconf provides, since
	 * the cfdrivers are attached already.
	 */
	static struct cfdriver * const no_cfdriver_vec[] = { NULL };
#endif
	int error = 0;
 
#ifdef _MODULE
	switch (cmd) {
	case MODULE_CMD_INIT:
		error = config_init_component(no_cfdriver_vec,
		    cfattach_ioconf_ld_virtio, cfdata_ioconf_ld_virtio);
		break;
	case MODULE_CMD_FINI:
		error = config_fini_component(no_cfdriver_vec,
		    cfattach_ioconf_ld_virtio, cfdata_ioconf_ld_virtio);
		break;
	default:
		error = ENOTTY;
		break;
	}
#endif

	return error;
}
static int
wmihp_modcmd(modcmd_t cmd, void *aux)
{
	int rv = 0;

	switch (cmd) {

	case MODULE_CMD_INIT:

#ifdef _MODULE
		rv = config_init_component(cfdriver_ioconf_wmihp,
		    cfattach_ioconf_wmihp, cfdata_ioconf_wmihp);
#endif
		break;

	case MODULE_CMD_FINI:

#ifdef _MODULE
		rv = config_fini_component(cfdriver_ioconf_wmihp,
		    cfattach_ioconf_wmihp, cfdata_ioconf_wmihp);
#endif
		break;

	default:
		rv = ENOTTY;
	}

	return rv;
}
Exemple #4
0
static int
gpioiic_modcmd(modcmd_t cmd, void *opaque)
{
	int error;

	error = 0;
	switch (cmd) {
	case MODULE_CMD_INIT:
#ifdef _MODULE
		error = config_init_component(cfdriver_ioconf_gpioiic,
		    cfattach_ioconf_gpioiic, cfdata_ioconf_gpioiic);
		if (error)
			aprint_error("%s: unable to init component\n",
			    gpioiic_cd.cd_name);
#endif
		break;
	case MODULE_CMD_FINI:
#ifdef _MODULE
		config_fini_component(cfdriver_ioconf_gpioiic,
		    cfattach_ioconf_gpioiic, cfdata_ioconf_gpioiic);
#endif
		break;
	default:
		error = ENOTTY;
	}
	return error;
}
static int
spdmem_modcmd(modcmd_t cmd, void *opaque)
{
	int error = 0;
#ifdef _MODULE
	static struct sysctllog *spdmem_sysctl_clog;
#endif

	switch (cmd) {
	case MODULE_CMD_INIT:
#ifdef _MODULE
		error = config_init_component(cfdriver_ioconf_spdmem,
		    cfattach_ioconf_spdmem, cfdata_ioconf_spdmem);
#endif
		return error;
	case MODULE_CMD_FINI:
#ifdef _MODULE
		error = config_fini_component(cfdriver_ioconf_spdmem,
		    cfattach_ioconf_spdmem, cfdata_ioconf_spdmem);
		sysctl_teardown(&spdmem_sysctl_clog);
#endif
		return error;
	default:
		return ENOTTY;
	}
}
Exemple #6
0
static int
wbsio_modcmd(modcmd_t cmd, void *opaque)
{
	switch (cmd) {
	case MODULE_CMD_INIT:
#ifdef _MODULE
		return config_init_component(cfdriver_ioconf_wbsio,
		    cfattach_ioconf_wbsio, cfdata_ioconf_wbsio);
#else
		return 0;
#endif
	case MODULE_CMD_FINI:
#ifdef _MODULE
		return config_fini_component(cfdriver_ioconf_wbsio,
		    cfattach_ioconf_wbsio, cfdata_ioconf_wbsio);
#else
		return 0;
#endif
	default:
		return ENOTTY;
	}
}
static int
coram_modcmd(modcmd_t cmd, void *v)
{
	int error = 0;

	switch (cmd) {
	case MODULE_CMD_INIT:
#ifdef _MODULE
		error = config_init_component(cfdriver_ioconf_coram,
		    cfattach_ioconf_coram, cfdata_ioconf_coram);
#endif
		return error;
	case MODULE_CMD_FINI:
#ifdef _MODULE
		error = config_fini_component(cfdriver_ioconf_coram,
		    cfattach_ioconf_coram, cfdata_ioconf_coram);
#endif
		return error;
	default:
		return ENOTTY;
	}
}
static int
sisdrm_modcmd(modcmd_t cmd, void *arg)
{
	int error = 0;

	switch (cmd) {
	case MODULE_CMD_INIT:
#ifdef _MODULE
		error = config_init_component(cfdriver_ioconf_sisdrm,
		    cfattach_ioconf_sisdrm, cfdata_ioconf_sisdrm);
#endif
		break;
	case MODULE_CMD_FINI:
#ifdef _MODULE
		error = config_fini_component(cfdriver_ioconf_sisdrm,
		    cfattach_ioconf_sisdrm, cfdata_ioconf_sisdrm);
#endif
		break;
	default:
		return ENOTTY;
	}

	return error;
}