diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2006-08-30 11:29:56 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-27 14:58:56 -0400 |
commit | dd990f16a39d4e615c0b70a0ab50b79b32bfb16d (patch) | |
tree | 471ab506eb21fadf05eaea7c47a33266b9e7a7d7 | |
parent | a6d2bb9ff919b4685bd684620ec7a1ffa8bf2349 (diff) |
usbcore: Add flag for whether a host controller uses DMA
This patch (as770b) introduces a new field to usb_bus: a flag
indicating whether or not the host controller uses DMA. This serves
to encapsulate the computation. It also means we will have only one
spot to update if the DMA API changes.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/core/hcd.c | 8 | ||||
-rw-r--r-- | include/linux/usb.h | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 2102c4deec1e..0cc14206920a 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1152,7 +1152,7 @@ doit: | |||
1152 | /* lower level hcd code should use *_dma exclusively, | 1152 | /* lower level hcd code should use *_dma exclusively, |
1153 | * unless it uses pio or talks to another transport. | 1153 | * unless it uses pio or talks to another transport. |
1154 | */ | 1154 | */ |
1155 | if (hcd->self.controller->dma_mask) { | 1155 | if (hcd->self.uses_dma) { |
1156 | if (usb_pipecontrol (urb->pipe) | 1156 | if (usb_pipecontrol (urb->pipe) |
1157 | && !(urb->transfer_flags & URB_NO_SETUP_DMA_MAP)) | 1157 | && !(urb->transfer_flags & URB_NO_SETUP_DMA_MAP)) |
1158 | urb->setup_dma = dma_map_single ( | 1158 | urb->setup_dma = dma_map_single ( |
@@ -1585,8 +1585,9 @@ void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb, struct pt_regs | |||
1585 | at_root_hub = (urb->dev == hcd->self.root_hub); | 1585 | at_root_hub = (urb->dev == hcd->self.root_hub); |
1586 | urb_unlink (urb); | 1586 | urb_unlink (urb); |
1587 | 1587 | ||
1588 | /* lower level hcd code should use *_dma exclusively */ | 1588 | /* lower level hcd code should use *_dma exclusively if the |
1589 | if (hcd->self.controller->dma_mask && !at_root_hub) { | 1589 | * host controller does DMA */ |
1590 | if (hcd->self.uses_dma && !at_root_hub) { | ||
1590 | if (usb_pipecontrol (urb->pipe) | 1591 | if (usb_pipecontrol (urb->pipe) |
1591 | && !(urb->transfer_flags & URB_NO_SETUP_DMA_MAP)) | 1592 | && !(urb->transfer_flags & URB_NO_SETUP_DMA_MAP)) |
1592 | dma_unmap_single (hcd->self.controller, urb->setup_dma, | 1593 | dma_unmap_single (hcd->self.controller, urb->setup_dma, |
@@ -1710,6 +1711,7 @@ struct usb_hcd *usb_create_hcd (const struct hc_driver *driver, | |||
1710 | hcd->self.release = &hcd_release; | 1711 | hcd->self.release = &hcd_release; |
1711 | hcd->self.controller = dev; | 1712 | hcd->self.controller = dev; |
1712 | hcd->self.bus_name = bus_name; | 1713 | hcd->self.bus_name = bus_name; |
1714 | hcd->self.uses_dma = (dev->dma_mask != NULL); | ||
1713 | 1715 | ||
1714 | init_timer(&hcd->rh_timer); | 1716 | init_timer(&hcd->rh_timer); |
1715 | hcd->rh_timer.function = rh_timer_func; | 1717 | hcd->rh_timer.function = rh_timer_func; |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 4709033f8fa7..09661759621f 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -269,6 +269,7 @@ struct usb_bus { | |||
269 | struct device *controller; /* host/master side hardware */ | 269 | struct device *controller; /* host/master side hardware */ |
270 | int busnum; /* Bus number (in order of reg) */ | 270 | int busnum; /* Bus number (in order of reg) */ |
271 | char *bus_name; /* stable id (PCI slot_name etc) */ | 271 | char *bus_name; /* stable id (PCI slot_name etc) */ |
272 | u8 uses_dma; /* Does the host controller use DMA? */ | ||
272 | u8 otg_port; /* 0, or number of OTG/HNP port */ | 273 | u8 otg_port; /* 0, or number of OTG/HNP port */ |
273 | unsigned is_b_host:1; /* true during some HNP roleswitches */ | 274 | unsigned is_b_host:1; /* true during some HNP roleswitches */ |
274 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ | 275 | unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ |