Lines Matching refs:device

55 /* device state for register/unregister */
57 /* DMA device drivers private pointer */
60 /* to track list of channels from this DMA device */
66 * before it's safe to allow the DMA device driver to detach.
91 /* shortcut to device callbacks */
96 * it's safe to free up this channel so the DMA device driver can
113 /* pointer back to our device */
155 static void dcopy_device_cleanup(dcopy_device_handle_t device,
218 /* Initialize the list we use to track device register/unregister */
298 * can happen if there aren't any DMA device registered.
328 dcopy_device_handle_t device;
346 * removed on the device.
349 device = (*channel)->ch_device;
350 mutex_enter(&device->dc_devchan_list.dl_mutex);
351 device->dc_removing_cnt--;
352 if (device->dc_removing_cnt == 0) {
355 mutex_exit(&device->dc_devchan_list.dl_mutex);
361 * device state and call back into the DMA device driver to tell them
362 * the device is free.
365 dcopy_device_cleanup(device, B_TRUE);
605 struct dcopy_device_s *device;
610 /* initialize the per device state */
611 device = kmem_zalloc(sizeof (*device), KM_SLEEP);
612 device->dc_device_private = device_private;
613 device->dc_info = *info;
614 device->dc_removing_cnt = 0;
615 device->dc_cb = info->di_cb;
618 * we have a per device channel list so we can remove a device in the
621 e = dcopy_list_init(&device->dc_devchan_list,
634 channel->ch_device = device;
666 dcopy_list_push(&device->dc_devchan_list, channel);
669 /* add the device to device list */
670 dcopy_list_push(&dcopy_statep->d_device_list, device);
673 * add the device's dma channels to the global channel list (where
678 channel = list_head(&device->dc_devchan_list.dl_list);
683 channel = list_next(&device->dc_devchan_list.dl_list, channel);
688 *handle = device;
696 channel = list_head(&device->dc_devchan_list.dl_list);
699 channel = dcopy_list_pop(&device->dc_devchan_list);
708 dcopy_list_fini(&device->dc_devchan_list);
710 kmem_free(device, sizeof (*device));
724 dcopy_device_handle_t device;
730 device = *handle;
738 mutex_enter(&device->dc_devchan_list.dl_mutex);
739 channel = list_head(&device->dc_devchan_list.dl_list);
744 * need to be removed in the device state too.
749 device->dc_removing_cnt++;
753 channel = list_next(&device->dc_devchan_list.dl_list, channel);
755 mutex_exit(&device->dc_devchan_list.dl_mutex);
760 * up the device state after they are freed up.
766 dcopy_device_cleanup(device, B_FALSE);
777 dcopy_device_cleanup(dcopy_device_handle_t device, boolean_t do_callback)
782 * remove all the channels in the device list, free them, and clean up
786 channel = list_head(&device->dc_devchan_list.dl_list);
788 device->dc_devchan_list.dl_cnt--;
789 list_remove(&device->dc_devchan_list.dl_list, channel);
794 channel = list_head(&device->dc_devchan_list.dl_list);
798 list_remove(&dcopy_statep->d_device_list.dl_list, device);
803 * notify the DMA device driver that the device is free to be
807 device->dc_cb->cb_unregister_complete(
808 device->dc_device_private, DCOPY_SUCCESS);
811 dcopy_list_fini(&device->dc_devchan_list);
812 kmem_free(device, sizeof (*device));
835 * when we get a completion notification from the device, go through