svn commit: r212987 - user/weongyo/usb/sys/dev/usb
Weongyo Jeong
weongyo at FreeBSD.org
Wed Sep 22 01:20:06 UTC 2010
Author: weongyo
Date: Wed Sep 22 01:20:05 2010
New Revision: 212987
URL: http://svn.freebsd.org/changeset/base/212987
Log:
Changes the style to access pc->pages information based on the array
index to make easy to check the maximum boundary of the array.
Modified:
user/weongyo/usb/sys/dev/usb/usb_busdma.c
Modified: user/weongyo/usb/sys/dev/usb/usb_busdma.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/usb_busdma.c Wed Sep 22 00:54:50 2010 (r212986)
+++ user/weongyo/usb/sys/dev/usb/usb_busdma.c Wed Sep 22 01:20:05 2010 (r212987)
@@ -82,6 +82,7 @@ usbd_get_page(struct usb_page_cache *pc,
struct usb_page_search *res)
{
struct usb_page *page;
+ int index;
#if USB_HAVE_BUSDMA
if (pc->pages != NULL) {
@@ -93,18 +94,19 @@ usbd_get_page(struct usb_page_cache *pc,
offset += pc->page_offset_buf;
/* compute destination page */
page = pc->pages;
+ index = 0;
if (pc->ismultiseg) {
- page += (offset / USB_PAGE_SIZE);
+ index += (offset / USB_PAGE_SIZE);
offset %= USB_PAGE_SIZE;
res->length = USB_PAGE_SIZE - offset;
- res->physaddr = page->physaddr + offset;
+ res->physaddr = page[index].physaddr + offset;
} else {
res->length = 0 - 1;
- res->physaddr = page->physaddr + offset;
+ res->physaddr = page[index].physaddr + offset;
}
if (!pc->buffer) {
/* Case 1b - Non Kernel Virtual Address */
- res->buffer = USB_ADD_BYTES(page->buffer, offset);
+ res->buffer = USB_ADD_BYTES(page[index].buffer, offset);
}
return;
}
More information about the svn-src-user
mailing list