示例#1
0
/**
 * monitor_modexit - decommission bus interface driver
 *
 */
static void __exit monitor_modexit(void)
{

    printk(KERN_INFO "\n");
    printk(KERN_INFO "monitor_modexit:\n");

    /* Stop any hotplug actions except unload */
    monitor_exiting = 1;

    /*
     * Architecture specific - free appropriate IRQ
     */

    monitor_free_irq();

#ifdef CONFIG_PM
    if (monitor.pm_info) {
        pm_unregister(monitor.pm_info);
        monitor.pm_info = NULL;
    }
#endif

    /*
     * Force unloading
     */
    monitor_hotplug(MHA_UNLOAD);

#ifdef CONFIG_USBD_PROCFS
    // remove proc filesystem entry *AFTER* the last hotplug,
    // in case it is being used for sync hotplug.
    remove_proc_entry("usb-monitor", NULL);
#endif

    return;
}
示例#2
0
/* perfctr driver should call this instead of pm_unregister() */
void apic_pm_unregister(struct pm_dev *dev)
{
	if (!apic_pm_state.active) {
		pm_unregister(dev);
	} else if (dev == apic_pm_state.perfctr_pmdev) {
		apic_pm_state.perfctr_pmdev = NULL;
		kfree(dev);
	}
}
示例#3
0
static int vibrator_release(struct inode *inode, struct file *file)
{
	count --;
	if(!count)
	{
#ifdef CONFIG_PM
		pm_unregister(pm_dev);
#endif
                AUDPRINTk1("open vibrator \n");
	}
	return 0;
}
示例#4
0
static void __exit s3c2410_ts_exit(void)
{
#ifdef CONFIG_DEVFS_FS	
	devfs_unregister(devfs_tsraw);
	devfs_unregister(devfs_ts_dir);
#endif	
	unregister_chrdev(tsMajor, DEVICE_NAME);
#ifdef CONFIG_PM
	pm_unregister(tsdev.pm_dev);
#endif
	free_irq(IRQ_ADC_DONE, s3c2410_isr_adc);
	free_irq(IRQ_TC, s3c2410_isr_tc);
}
示例#5
0
void cleanup_module(void) 
{ 

    printk(KERN_ALERT "Exiting module and cleaning up \n");

    pm_unregister(ltp_pm_dev); 

    put_disk(gd_ptr);

    del_gendisk(gd_ptr);

    unregister_blkdev(ltp_fs_major, LTP_FS_DEV_NAME);

}
示例#6
0
/*
 * Remove all traces of this driver module from the kernel, so we can't be
 * called.  Note that the device has already been stopped, so we don't have
 * to worry about interrupts or dma.
 */
static void pxa250_irda_net_uninit(struct net_device *dev)
{
	struct pxa250_irda *si = dev->priv;

	dev->hard_start_xmit	= NULL;
	dev->open		= NULL;
	dev->stop		= NULL;
	dev->do_ioctl		= NULL;
	dev->get_stats		= NULL;
	dev->priv		= NULL;

	pm_unregister(si->pmdev);

	kfree(si->tx_buff.head);
	kfree(si->rx_buff.head);
	kfree(si);
}
示例#7
0
文件: includeTest.c 项目: 1587/ltp
static void test_exit_module(void)
{

	int rc;

	pm_unregister(ltp_pm_dev);
	put_disk(gd_ptr);
	del_gendisk(gd_ptr);

	rc = unregister_blkdev(INCLUDEMAJOR, DEVICE_NAME);

	if (rc < 0) {
		printk("unregister failed %d\n", rc);
	} else {
		printk("unregister success\n");
	}
}
示例#8
0
static int audio_release(struct inode *inode, struct file *file)
{
	audio_state_t *state = file->private_data;
	audio_stream_t *os = state->output_stream;
	audio_stream_t *is = state->input_stream;

	DPRINTK("audio_release\n");

	down(&state->sem);

	if (file->f_mode & FMODE_READ) {
		audio_discard_buf(is);
		DMA_FREE(is);
		is->dma_spinref = 0;
		if (state->need_tx_for_rx) {
			os->spin_idle = 0;
			if (!state->wr_ref) {
				DMA_FREE(os);
				os->dma_spinref = 0;
			}
		}
		state->rd_ref = 0;
	}

	if (file->f_mode & FMODE_WRITE) {
		audio_sync(file);
		audio_discard_buf(os);
		if (!state->need_tx_for_rx || !state->rd_ref) {
			DMA_FREE(os);
			os->dma_spinref = 0;
		}
		state->wr_ref = 0;
	}

	if (!AUDIO_ACTIVE(state)) {
	       if (state->hw_shutdown)
		       state->hw_shutdown(state->data);
#ifdef CONFIG_PM
	       pm_unregister(state->pm_dev);
#endif
	}

	up(&state->sem);
	return 0;
}
示例#9
0
static int audio_release(struct inode *inode, struct file *file)
{
	audio_state_t *state = (audio_state_t *)file->private_data;
	DPRINTK("audio_release\n");

	down(&state->sem);

	if (file->f_mode & FMODE_READ) {
		if (state->tx_spinning) {
			sa1100_dma_set_spin(state->output_stream->dma_ch, 0, 0);
			state->tx_spinning = 0;
		}
		audio_clear_buf(state->input_stream);
		if (!state->skip_dma_init) {
			sa1100_free_dma(state->input_stream->dma_ch);
			if (state->need_tx_for_rx && !state->wr_ref)
				sa1100_free_dma(state->output_stream->dma_ch);
		}
		state->rd_ref = 0;
	}

	if (file->f_mode & FMODE_WRITE) {
		audio_sync(file);
		audio_clear_buf(state->output_stream);
		if (!state->skip_dma_init)
			if (!state->need_tx_for_rx || !state->rd_ref)
				sa1100_free_dma(state->output_stream->dma_ch);
		state->wr_ref = 0;
	}

	if (!AUDIO_ACTIVE(state)) {
	       if (state->hw_shutdown)
		       state->hw_shutdown(state->data);
#ifdef CONFIG_PM
	       pm_unregister(state->pm_dev);
#endif
	}

	up(&state->sem);
	return 0;
}
示例#10
0
/**
 * monitor_modinit - commission bus interface driver
 *
 */
static int __init monitor_modinit(void)
{

    printk(KERN_INFO "usbdm: %s\n", __usbd_module_info);

    // Initialize data structures _before_ installing interrupt handlers
    monitor.status = MONITOR_UNKNOWN;

    monitor.monitor_bh.routine = monitor_bh;
    monitor.monitor_bh.data = NULL;
    // XXX monitor.monitor_bh.sync = 0;

    monitor.hotplug_bh.routine = hotplug_bh;
    monitor.hotplug_bh.data = NULL;
    // XXX monitor.hotplug_bh.sync = 0;


    /*
     * Architecture specific - request IRQ
     */

    if (!monitor_request_irq()) {
        monitor.have_irq++;
    }
    else {
        printk(KERN_DEBUG"usbdm: request irq failed\n");
    }

#ifdef CONFIG_PM
    /*
     * Architecture specific - register with power management
     */

    monitor.pm_info = NULL;

    if (!(monitor.pm_info = pm_register(PM_USB_DEV, PM_SYS_UNKNOWN, monitor_pm_event))) {
        printk(KERN_ERR "%s: couldn't register for power management\n", __FUNCTION__);
        if (monitor.have_irq) {
            free_irq(IRQ_GPIO12, &monitor); 
        }
        return 1;
    }
    monitor.pm_info->state = 0;
#endif

#ifdef CONFIG_USBD_PROCFS
    {
        struct proc_dir_entry *p;

        // create proc filesystem entries
        if ((p = create_proc_entry("usb-monitor", 0, 0)) == NULL) {
            if (monitor.have_irq) {
    		monitor_free_irq();
                monitor.have_irq = 0;
            }
#ifdef CONFIG_PM
            if (monitor.pm_info) {
                pm_unregister(monitor.pm_info);
                monitor.pm_info = NULL;
            }
#endif
            return -ENOMEM;
	}
        p->proc_fops = &usbd_monitor_proc_operations_functions;
    }
#endif

    // Find out if the cable is connected 
    // and load USBD modules if we are.
    
    monitor_event();

    printk(KERN_INFO "monitor_modinit: finished\n");

    return 0;
}
示例#11
0
/* bi_modexit - decommission bus interface driver
 */
void __exit bi_modexit(void)
{
    struct usb_bus_instance *bus;
    struct usb_device_instance *device;
    struct bi_data *data;

    dbgENTER(dbgflg_usbdbi_init,1);

    if ((device = device_array[0])) {

        // XXX moved to usbd_deregister_device()
        //device->status = USBD_CLOSING;

        udc_disconnect();
        udc_disable();

        // XXX XXX
        if (dbgflg_usbdbi_tick > 0) {
            ticker_killoff();
        }

        bus = device->bus;
        data = bus->privdata;

        // XXX
        usbd_device_event(device, DEVICE_RESET, 0);
        usbd_device_event(device, DEVICE_POWER_INTERRUPTION, 0);
        usbd_device_event(device, DEVICE_HUB_RESET, 0);

        dbg_init(1,"DEVICE_DESTROY");
        usbd_device_event(device, DEVICE_DESTROY, 0);

        dbg_init(1,"DISABLE ENDPOINTS");
        bi_disable_endpoints(device);

        dbg_init(1,"UDC_DISABLE");
        //udc_disable();

        dbg_init(1,"BI_UDC_EXIT");
        bi_udc_exit();

        device_array[0] = NULL;
        bus->privdata = NULL;


#ifdef CONFIG_PM
        dbg_init(1,"PM_UNREGISTER(pm_dev#%p)",pm_dev);
        if (pm_dev) {
            pm_unregister(pm_dev);
        }
#endif
        dbg_init(1,"DEREGISTER DEVICE");
        usbd_deregister_device(device);
        bus->device = NULL;

        dbg_init(1,"kfree(data#%p)",data);
        if (data) {
            kfree(data);
        }

        if (bus->serial_number_str) {
            kfree(bus->serial_number_str);
        }

        dbg_init(1,"DEREGISTER BUS");
        usbd_deregister_bus(bus);

    }
    else {
        dbg_init(0,"device is NULL");
    }
    dbg_init(1,"BI_EXIT");
    bi_exit();
    dbgLEAVE(dbgflg_usbdbi_init,1);
}
示例#12
0
/** 
 *  @brief This function removes the card.
 *  
 *  @param priv    A pointer to card
 *  @return 	   WLAN_STATUS_SUCCESS
 */
static int
wlan_remove_card(void *card)
{
    wlan_private *priv = &w99702_priv_data0;
    wlan_adapter *Adapter;
    //struct net_device *dev;
    struct cyg_netdevtab_entry *dev;
	struct eth_drv_sc *sc;
    union iwreq_data wrqu;

    ENTER();

    if (!priv) {
        LEAVE();
        return WLAN_STATUS_SUCCESS;
    }

    Adapter = priv->adapter;

    if (!Adapter) {
        LEAVE();
        return WLAN_STATUS_SUCCESS;
    }

    dev = priv->wlan_dev.netdev;
	sc = (struct eth_drv_sc *)dev->device_instance;
	
   // wake_up_interruptible(&Adapter->ds_awake_q);
   cyg_cond_broadcast(&Adapter->ds_cond_q);

    if (Adapter->CurCmd) {
        diag_printf("Wake up current cmdwait_q\n");
//        wake_up_interruptible(&Adapter->CurCmd->cmdwait_q);
		cyg_flag_setbits( &Adapter->CurCmd->cmdwait_flag_q, 3 );
    }

    Adapter->CurCmd = NULL;

    if (Adapter->PSMode == Wlan802_11PowerModeMAX_PSP) {
        Adapter->PSMode = Wlan802_11PowerModeCAM;
        PSWakeup(priv, HostCmd_OPTION_WAITFORRSP);
    }
    if (Adapter->IsDeepSleep == TRUE) {
        Adapter->IsDeepSleep = FALSE;
        sbi_exit_deep_sleep(priv);
    }

    memset(wrqu.ap_addr.sa_data, 0xaa, ETH_ALEN);
    wrqu.ap_addr.sa_family = ARPHRD_ETHER;
    wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);

    /* Disable interrupts on the card as we cannot handle them after RESET */
    sbi_disable_host_int(priv);

    PrepareAndSendCommand(priv, HostCmd_CMD_802_11_RESET, 0, 0, 0, NULL);

    cyg_thread_delay(20);
    //udelay(200*1000);

#ifdef ENABLE_PM
    pm_unregister(wlan_pm_dev);
#endif

    /* Flush all the packets upto the OS before stopping */
   // wlan_send_rxskbQ(priv);
   eth_drv_dsr(0, 0, (cyg_addrword_t)sc);
    cleanup_txqueues(priv);
   // os_stop_queue(priv);
   // os_carrier_off(priv);

    Adapter->SurpriseRemoved = TRUE;

    /* Stop the thread servicing the interrupts */
    //wake_up_interruptible(&priv->MainThread.waitQ);
    cyg_flag_setbits( &priv->MainThread.waitQ_flag_q, 1 );

#ifdef REASSOCIATION
    //wake_up_interruptible(&priv->ReassocThread.waitQ);
    cyg_flag_setbits( &priv->ReassocThread.waitQ_flag_q, 1 );
#endif /* REASSOCIATION */

#ifdef PROC_DEBUG
    wlan_debug_remove(priv);
#endif
   // wlan_proc_remove(priv);

    diag_printf("unregester dev\n");
    sbi_unregister_dev(priv);

    diag_printf("Free Adapter\n");
    wlan_free_adapter(priv);

    /* Last reference is our one */
//    diag_printf("refcnt = %d\n", atomic_read(&dev->refcnt));

 //   diag_printf("netdev_finish_unregister: %s%s.\n", dev->name,
 //          (dev->features & NETIF_F_DYNALLOC) ? "" : ", old style");

 //   unregister_netdev(dev);

    diag_printf("Unregister finish\n");

    priv->wlan_dev.netdev = NULL;
    //free_netdev(dev);
    //wlanpriv = NULL;

    LEAVE();
    return WLAN_STATUS_SUCCESS;
}