tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: MODULE_CLASS_DRIVER and locators stuff

On Sat, 03 May 2008 22:30:38 +0900 (JST)
Masao Uebayashi <> wrote:

> I think you can call the module_driver_load equivalent function from
> mi_modcmd() passing those (*_cd, *_cai, *_cf) arguments.

Based on this suggestion I modified the code. Now the module's code
passes them to module_driver_load/unload:
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/device.h>

extern const struct cfiattrdata audiobuscf_iattrdata;

static int locs[] = { -1, -1 };
static const struct cfiattrdata * const attrs[] = {
        &audiobuscf_iattrdata, NULL

DRIVER_MODULE(MODULE_CLASS_DRIVER, auich, pci, locs, attrs, NULL);

static int
auich_modcmd(modcmd_t cmd, void *arg)
        int error = 0;

        switch (cmd) {
        case MODULE_CMD_INIT:
                error = module_driver_load(auich_cfdrivers,
                    auich_cfattachinit, auich_cfdata);
        case MODULE_CMD_FINI:
                error = module_driver_unload(auich_cfdrivers,
                    auich_cfattachinit, auich_cfdata);
                return ENOTTY;

        return error;

Juan Romero Pardines - xtraeme at gmail|netbsd dot org
        The NetBSD Project

Make your own NetBSD/x86 Live CD:

Home | Main Index | Thread Index | Old Index