/** * usb_hcd_sa1111_remove - shutdown processing for SA-1111-based HCDs * @dev: USB Host Controller being removed * Context: !in_interrupt() * * Reverses the effect of usb_hcd_sa1111_probe(), first invoking * the HCD's stop() method. It is always called from a thread * context, normally "rmmod", "apmd", or something similar. * */ void usb_hcd_sa1111_remove (struct usb_hcd *hcd, struct sa1111_dev *dev) { usb_remove_hcd(hcd); sa1111_stop_hc(dev); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); }
/** * usb_hcd_sa1111_probe - initialize SA-1111-based HCDs * Context: !in_interrupt() * * Allocates basic resources for this USB host controller, and * then invokes the start() method for the HCD associated with it * through the hotplug entry's driver_data. * * Store this function in the HCD's struct pci_driver as probe(). */ int usb_hcd_sa1111_probe (const struct hc_driver *driver, struct sa1111_dev *dev) { struct usb_hcd *hcd; int retval; hcd = usb_create_hcd (driver, &dev->dev, "sa1111"); if (!hcd) return -ENOMEM; hcd->rsrc_start = dev->res.start; hcd->rsrc_len = dev->res.end - dev->res.start + 1; if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { dbg("request_mem_region failed"); retval = -EBUSY; goto err1; } hcd->regs = dev->mapbase; sa1111_start_hc(dev); ohci_hcd_init(hcd_to_ohci(hcd)); retval = usb_add_hcd(hcd, dev->irq[1], IRQF_DISABLED); if (retval == 0) return retval; sa1111_stop_hc(dev); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); err1: usb_put_hcd(hcd); return retval; }
static void ohci_hcd_sa1111_shutdown(struct sa1111_dev *dev) { struct usb_hcd *hcd = sa1111_get_drvdata(dev); if (test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { hcd->driver->shutdown(hcd); sa1111_stop_hc(dev); } }
/** * ohci_hcd_sa1111_remove - shutdown processing for SA-1111-based HCDs * @dev: USB Host Controller being removed * * Reverses the effect of ohci_hcd_sa1111_probe(), first invoking * the HCD's stop() method. */ static int ohci_hcd_sa1111_remove(struct sa1111_dev *dev) { struct usb_hcd *hcd = sa1111_get_drvdata(dev); usb_remove_hcd(hcd); sa1111_stop_hc(dev); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); return 0; }
/** * ohci_hcd_sa1111_probe - initialize SA-1111-based HCDs * * Allocates basic resources for this USB host controller, and * then invokes the start() method for the HCD associated with it. */ static int ohci_hcd_sa1111_probe(struct sa1111_dev *dev) { struct usb_hcd *hcd; int ret; if (usb_disabled()) return -ENODEV; hcd = usb_create_hcd(&ohci_sa1111_hc_driver, &dev->dev, "sa1111"); if (!hcd) return -ENOMEM; hcd->rsrc_start = dev->res.start; hcd->rsrc_len = resource_size(&dev->res); if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { dev_dbg(&dev->dev, "request_mem_region failed\n"); ret = -EBUSY; goto err1; } hcd->regs = dev->mapbase; ret = sa1111_start_hc(dev); if (ret) goto err2; ret = usb_add_hcd(hcd, dev->irq[1], 0); if (ret == 0) return ret; sa1111_stop_hc(dev); err2: release_mem_region(hcd->rsrc_start, hcd->rsrc_len); err1: usb_put_hcd(hcd); return ret; }