static int sw_ohci_hcd_remove(struct platform_device *pdev)
{
	struct usb_hcd *hcd = NULL;
	struct sw_hci_hcd *sw_ohci = NULL;

	if(pdev == NULL){
		DMSG_PANIC("ERR: Argment is invalid\n");
		return -1;
	}

	hcd = platform_get_drvdata(pdev);
	if(hcd == NULL){
		DMSG_PANIC("ERR: hcd is null\n");
		return -1;
	}

	sw_ohci = pdev->dev.platform_data;
	if(sw_ohci == NULL){
		DMSG_PANIC("ERR: sw_ohci is null\n");
		return -1;
	}

	DMSG_INFO("[%s%d]: remove, pdev->name: %s, pdev->id: %d, sw_ohci: 0x%p\n",
		      ohci_name, sw_ohci->usbc_no, pdev->name, pdev->id, sw_ohci);


	usb_remove_hcd(hcd);

	sw_stop_ohc(sw_ohci);
	sw_ohci->probe = 0;

	usb_put_hcd(hcd);

	sw_release_io_resource(pdev, sw_ohci);

	sw_ohci->hcd = NULL;

    if(sw_ohci->host_init_state){
	    g_sw_ohci[sw_ohci->usbc_no] = NULL;
	}

	platform_set_drvdata(pdev, NULL);

	return 0;
}
示例#2
0
static int sw_ehci_hcd_remove(struct platform_device *pdev)
{
	struct usb_hcd *hcd = NULL;
	struct sw_hci_hcd *sw_ehci = NULL;

	if (pdev == NULL)
		return -EINVAL;

	hcd = platform_get_drvdata(pdev);
	if (hcd == NULL)
		return -ENODATA;

	sw_ehci = pdev->dev.platform_data;
	if (sw_ehci == NULL)
		return -ENODATA;

	pr_debug("[%s%d]: remove, pdev->name: %s, pdev->id: %d, sw_ehci:"
		" 0x%p\n", SW_EHCI_NAME, sw_ehci->usbc_no, pdev->name, pdev->id,
		sw_ehci);

	usb_remove_hcd(hcd);

	sw_release_io_resource(pdev, sw_ehci);

	usb_put_hcd(hcd);

	sw_stop_ehci(sw_ehci);
	sw_ehci->probe = 0;

	sw_ehci->hcd = NULL;

	if (sw_ehci->host_init_state)
		g_sw_ehci[sw_ehci->usbc_no] = NULL;

	platform_set_drvdata(pdev, NULL);

	return 0;
}