Writing Device Drivers

dev_ops Structure

static struct dev_ops xx_dev_ops = {
    DEVO_REV,                  /* devo_rev */
    0,                         /* devo_refcnt  */
    xxgetinfo,                 /* devo_getinfo: getinfo(9E) */
    nulldev,                   /* devo_identify: identify(9E) */
    xxprobe,                   /* devo_probe: probe(9E) */
    xxattach,                  /* devo_attach: attach(9E) */
    xxdetach,                  /* devo_detach: detach(9E) */
    nodev,                     /* devo_reset: see devo_quiesce */
    &xx_cb_ops,                /* devo_cb_ops */
    NULL,                      /* devo_bus_ops */
    &xxpower,                  /* devo_power: power(9E) */
    ddi_quiesce_not_needed,    /* devo_quiesce: quiesce(9E) */
};

The dev_ops(9S) structure enables the kernel to find the autoconfiguration entry points of the device driver. The devo_rev field identifies the revision number of the structure. This field must be set to DEVO_REV. The devo_refcnt field must be initialized to zero. The function address fields should be filled in with the address of the appropriate driver entry point, except in the following cases:

The devo_cb_ops member should include the address of the cb_ops(9S) structure. The devo_bus_ops field must be set to NULL.