Print this page
LOCAL: devfs_clean before trying to offline to release refs to dev_info


5873          * Invoke notify if offlining
5874          */
5875         if (flags & NDI_DEVI_OFFLINE) {
5876                 RIO_DEBUG((CE_NOTE, "devi_detach_node: offlining dip=%p",
5877                     (void *)dip));
5878                 if (e_ddi_offline_notify(dip) != DDI_SUCCESS) {
5879                         RIO_DEBUG((CE_NOTE, "devi_detach_node: offline NACKed"
5880                             "dip=%p", (void *)dip));
5881                         return (NDI_FAILURE);
5882                 }
5883         }
5884 
5885         if (flags & NDI_POST_EVENT) {
5886                 if (i_ddi_devi_attached(pdip)) {
5887                         if (ddi_get_eventcookie(dip, DDI_DEVI_REMOVE_EVENT,
5888                             &cookie) == NDI_SUCCESS)
5889                                 (void) ndi_post_event(dip, dip, cookie, NULL);
5890                 }
5891         }
5892 







5893         if (i_ddi_detachchild(dip, flags) != DDI_SUCCESS) {
5894                 if (flags & NDI_DEVI_OFFLINE) {
5895                         RIO_DEBUG((CE_NOTE, "devi_detach_node: offline failed."
5896                             " Calling e_ddi_offline_finalize with result=%d. "
5897                             "dip=%p", DDI_FAILURE, (void *)dip));
5898                         e_ddi_offline_finalize(dip, DDI_FAILURE);
5899                 }
5900                 return (NDI_FAILURE);
5901         }
5902 
5903         if (flags & NDI_DEVI_OFFLINE) {
5904                 RIO_DEBUG((CE_NOTE, "devi_detach_node: offline succeeded."
5905                     " Calling e_ddi_offline_finalize with result=%d, "
5906                     "dip=%p", DDI_SUCCESS, (void *)dip));
5907                 e_ddi_offline_finalize(dip, DDI_SUCCESS);
5908         }
5909 
5910         if (flags & NDI_AUTODETACH)
5911                 return (NDI_SUCCESS);
5912 




5873          * Invoke notify if offlining
5874          */
5875         if (flags & NDI_DEVI_OFFLINE) {
5876                 RIO_DEBUG((CE_NOTE, "devi_detach_node: offlining dip=%p",
5877                     (void *)dip));
5878                 if (e_ddi_offline_notify(dip) != DDI_SUCCESS) {
5879                         RIO_DEBUG((CE_NOTE, "devi_detach_node: offline NACKed"
5880                             "dip=%p", (void *)dip));
5881                         return (NDI_FAILURE);
5882                 }
5883         }
5884 
5885         if (flags & NDI_POST_EVENT) {
5886                 if (i_ddi_devi_attached(pdip)) {
5887                         if (ddi_get_eventcookie(dip, DDI_DEVI_REMOVE_EVENT,
5888                             &cookie) == NDI_SUCCESS)
5889                                 (void) ndi_post_event(dip, dip, cookie, NULL);
5890                 }
5891         }
5892 
5893         /*
5894          * dv_mknod places a hold on the dev_info_t for each devfs node
5895          * created.  If we're to succeed in detaching this device, we must
5896          * first release all outstanding references held by devfs.
5897          */
5898         (void) devfs_clean(pdip, NULL, DV_CLEAN_FORCE);
5899 
5900         if (i_ddi_detachchild(dip, flags) != DDI_SUCCESS) {
5901                 if (flags & NDI_DEVI_OFFLINE) {
5902                         RIO_DEBUG((CE_NOTE, "devi_detach_node: offline failed."
5903                             " Calling e_ddi_offline_finalize with result=%d. "
5904                             "dip=%p", DDI_FAILURE, (void *)dip));
5905                         e_ddi_offline_finalize(dip, DDI_FAILURE);
5906                 }
5907                 return (NDI_FAILURE);
5908         }
5909 
5910         if (flags & NDI_DEVI_OFFLINE) {
5911                 RIO_DEBUG((CE_NOTE, "devi_detach_node: offline succeeded."
5912                     " Calling e_ddi_offline_finalize with result=%d, "
5913                     "dip=%p", DDI_SUCCESS, (void *)dip));
5914                 e_ddi_offline_finalize(dip, DDI_SUCCESS);
5915         }
5916 
5917         if (flags & NDI_AUTODETACH)
5918                 return (NDI_SUCCESS);
5919