Writing Device Drivers

Creating and Updating Properties

To create a property for a driver, or to update an existing property, use one of the DDI driver update interfaces, such as ddi_prop_update_int(9F) or ddi_prop_update_string(9F), with the appropriate type for the property you want to create. (See Table 4–1 for a list of available property interfaces.) These interfaces are typically called from the driver's attach(9E) entry point. In this example, the attach() routine creates a string property called pm-hardware-state and gives it the value needs-suspend-resume:


     /* The following code is to tell cpr that this device
     * needs to be suspended and resumed.
     */
    (void) ddi_prop_update_string(device, dip,
         "pm-hardware-state", "needs-suspend-resume");