コード例 #1
0
ファイル: sdio_intf.c プロジェクト: yangkunming99/linux_inic
static int __devinit rtl8195a_init_one(struct sdio_func *func, const struct sdio_device_id *id)
{
	int status = _FAIL;
	PADAPTER padapter;
	struct dvobj_priv *dvobj;

	DBG_871X("%s():++\n",__FUNCTION__);
	DBG_871X("+rtw_drv_init: vendor=0x%04x device=0x%04x class=0x%02x\n", func->vendor, func->device, func->class);
	
	// 1. init sdio bus
	if ((dvobj = sdio_dvobj_init(func)) == NULL) {
		goto exit;
	}
	
  	// 2. init device interface 
	if ((padapter = rtw_sdio_if1_init(dvobj, id)) == NULL) {
		DBG_871X("rtw_init_adapter Failed!\n");
		goto free_dvobj;
	}
	
	// 3. dev_alloc_name && register_netdev
	if((rtw_drv_register_netdev(padapter)) != _SUCCESS) {
		goto free_adapter;
	}	

	// 4. register for irq hander
	if (sdio_alloc_irq(dvobj) != _SUCCESS)
	{
		goto free_adapter;
	}

	status = _SUCCESS;
	
free_adapter:
	if (status != _SUCCESS && padapter) {
		rtw_sdio_if1_deinit(padapter);
	}	
free_dvobj:
	if (status != _SUCCESS)
		sdio_dvobj_deinit(func);
	
exit:
	return status == _SUCCESS?0:-ENODEV;
}
コード例 #2
0
ファイル: usb_intf.c プロジェクト: Abioy/kasan
static int rtw_drv_init(struct usb_interface *pusb_intf,
			const struct usb_device_id *pdid)
{
	struct rtw_adapter *if1 = NULL;
	struct dvobj_priv *dvobj;
	int status = _FAIL;

	RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_init\n"));

	/* Initialize dvobj_priv */
	dvobj = usb_dvobj_init(pusb_intf);
	if (!dvobj) {
		RT_TRACE(_module_hci_intfs_c_, _drv_err_,
			 ("initialize device object priv Failed!\n"));
		goto exit;
	}

	if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid);
	if (!if1) {
		DBG_8723A("rtw_init_primary_adapter Failed!\n");
		goto free_dvobj;
	}

	/* dev_alloc_name && register_netdev */
	status = rtw_drv_register_netdev(if1);
	if (status != _SUCCESS)
		goto free_if1;
	RT_TRACE(_module_hci_intfs_c_, _drv_err_,
		 ("-871x_drv - drv_init, success!\n"));

	status = _SUCCESS;

free_if1:
	if (status != _SUCCESS && if1)
		rtw_usb_if1_deinit(if1);
free_dvobj:
	if (status != _SUCCESS)
		usb_dvobj_deinit(pusb_intf);
exit:
	return status == _SUCCESS ? 0 : -ENODEV;
}
コード例 #3
0
/*
 * drv_init() - a device potentially for us
 *
 * notes: drv_init() is called when the bus driver has located a card for us to support.
 *        We accept the new device by returning 0.
 */
static int /*__devinit*/  rtw_drv_probe(struct spi_device *spi)
{
	int status = _FAIL;
	struct dvobj_priv *dvobj;
	struct net_device *pnetdev;
	PADAPTER if1 = NULL, if2 = NULL;


	DBG_8192C("RTW: %s line:%d", __FUNCTION__, __LINE__);

	if ((dvobj = gspi_dvobj_init(spi)) == NULL) {
		DBG_871X("%s: Initialize device object priv Failed!\n", __FUNCTION__);
		goto exit;
	}

	if ((if1 = rtw_gspi_if1_init(dvobj)) == NULL) {
		DBG_871X("rtw_init_primary_adapter Failed!\n");
		goto free_dvobj;
	}

#ifdef CONFIG_CONCURRENT_MODE
	if ((if2 = rtw_drv_if2_init(if1, NULL, spi_set_intf_ops)) == NULL) {
		goto free_if1;
	}
#endif

	//dev_alloc_name && register_netdev
	if((status = rtw_drv_register_netdev(if1)) != _SUCCESS) {
		goto free_if2;
	}

#ifdef CONFIG_HOSTAPD_MLME
	hostapd_mode_init(if1);
#endif

#ifdef CONFIG_PLATFORM_RTD2880B
	DBG_871X("wlan link up\n");
	rtd2885_wlan_netlink_sendMsg("linkup", "8712");
#endif

	if (gspi_alloc_irq(dvobj) != _SUCCESS)
		goto free_if2;

#ifdef CONFIG_GLOBAL_UI_PID
	if(ui_pid[1]!=0) {
		DBG_871X("ui_pid[1]:%d\n",ui_pid[1]);
		rtw_signal_process(ui_pid[1], SIGUSR2);
		}
#endif

	RT_TRACE(_module_hci_intfs_c_,_drv_err_,("-871x_drv - drv_init, success!\n"));

	status = _SUCCESS;

free_if2:
	if (status != _SUCCESS && if2) {
		#ifdef CONFIG_CONCURRENT_MODE
		rtw_drv_if2_stop(if2);
		rtw_drv_if2_free(if2);
		#endif
	}

free_if1:
	if (status != _SUCCESS && if1) {
		rtw_gspi_if1_deinit(if1);
	}

free_dvobj:
	if (status != _SUCCESS)
		gspi_dvobj_deinit(spi);

exit:
	return status == _SUCCESS?0:-ENODEV;
}