aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci.h
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2010-10-26 14:03:44 -0400
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2011-03-13 21:07:13 -0400
commitb02d0ed677acb3465e7600366f2353413bf24074 (patch)
tree8efdbb5ea07a387a687aa24f0bcda8ba3a454d76 /drivers/usb/host/xhci.h
parent214f76f7d9198ddd090bd927a4bcd49391bfcd36 (diff)
xhci: Change hcd_priv into a pointer.
Instead of allocating space for the whole xhci_hcd structure at the end of usb_hcd, make the USB core allocate enough space for a pointer to the xhci_hcd structure. This will make it easy to share the xhci_hcd structure across the two roothubs (the USB 3.0 usb_hcd and the USB 2.0 usb_hcd). Deallocate the xhci_hcd at PCI remove time, so the hcd_priv will be deallocated after the usb_hcd is deallocated. We do this by registering a different PCI remove function that calls the usb_hcd_pci_remove() function, and then frees the xhci_hcd. usb_hcd_pci_remove() calls kput() on the usb_hcd structure, which will deallocate the memory that contains the hcd_priv pointer, but not the memory it points to. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/host/xhci.h')
-rw-r--r--drivers/usb/host/xhci.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index c4e70c6d809..daa88581ad6 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1163,6 +1163,7 @@ struct s3_save {
1163 1163
1164/* There is one ehci_hci structure per controller */ 1164/* There is one ehci_hci structure per controller */
1165struct xhci_hcd { 1165struct xhci_hcd {
1166 struct usb_hcd *main_hcd;
1166 /* glue to PCI and HCD framework */ 1167 /* glue to PCI and HCD framework */
1167 struct xhci_cap_regs __iomem *cap_regs; 1168 struct xhci_cap_regs __iomem *cap_regs;
1168 struct xhci_op_regs __iomem *op_regs; 1169 struct xhci_op_regs __iomem *op_regs;
@@ -1266,12 +1267,12 @@ struct xhci_hcd {
1266/* convert between an HCD pointer and the corresponding EHCI_HCD */ 1267/* convert between an HCD pointer and the corresponding EHCI_HCD */
1267static inline struct xhci_hcd *hcd_to_xhci(struct usb_hcd *hcd) 1268static inline struct xhci_hcd *hcd_to_xhci(struct usb_hcd *hcd)
1268{ 1269{
1269 return (struct xhci_hcd *) (hcd->hcd_priv); 1270 return *((struct xhci_hcd **) (hcd->hcd_priv));
1270} 1271}
1271 1272
1272static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci) 1273static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci)
1273{ 1274{
1274 return container_of((void *) xhci, struct usb_hcd, hcd_priv); 1275 return xhci->main_hcd;
1275} 1276}
1276 1277
1277#ifdef CONFIG_USB_XHCI_HCD_DEBUGGING 1278#ifdef CONFIG_USB_XHCI_HCD_DEBUGGING