Date: Wed, 22 Sep 2010 01:20:05 +0000 (UTC) From: Weongyo Jeong <weongyo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r212987 - user/weongyo/usb/sys/dev/usb Message-ID: <201009220120.o8M1K5NE012277@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009220120.o8M1K5NE012277>