usb_mbuf.c (193045) | usb_mbuf.c (193074) |
---|---|
1/* $FreeBSD: head/sys/dev/usb/usb_mbuf.c 193045 2009-05-29 18:46:57Z thompsa $ */ | 1/* $FreeBSD: head/sys/dev/usb/usb_mbuf.c 193074 2009-05-30 00:22:57Z thompsa $ */ |
2/*- 3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 21 unchanged lines hidden (view full) --- 31 * usb2_alloc_mbufs - allocate mbufs to an usbd interface queue 32 * 33 * Returns: 34 * A pointer that should be passed to "free()" when the buffer(s) 35 * should be released. 36 *------------------------------------------------------------------------*/ 37void * 38usb2_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq, | 2/*- 3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 21 unchanged lines hidden (view full) --- 31 * usb2_alloc_mbufs - allocate mbufs to an usbd interface queue 32 * 33 * Returns: 34 * A pointer that should be passed to "free()" when the buffer(s) 35 * should be released. 36 *------------------------------------------------------------------------*/ 37void * 38usb2_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq, |
39 size_t block_size, uint16_t nblocks) | 39 usb_size_t block_size, uint16_t nblocks) |
40{ 41 struct usb_mbuf *m_ptr; 42 uint8_t *data_ptr; 43 void *free_ptr = NULL; | 40{ 41 struct usb_mbuf *m_ptr; 42 uint8_t *data_ptr; 43 void *free_ptr = NULL; |
44 size_t alloc_size; | 44 usb_size_t alloc_size; |
45 46 /* align data */ 47 block_size += ((-block_size) & (USB_HOST_ALIGN - 1)); 48 49 if (nblocks && block_size) { 50 51 alloc_size = (block_size + sizeof(struct usb_mbuf)) * nblocks; 52 --- 25 unchanged lines hidden --- | 45 46 /* align data */ 47 block_size += ((-block_size) & (USB_HOST_ALIGN - 1)); 48 49 if (nblocks && block_size) { 50 51 alloc_size = (block_size + sizeof(struct usb_mbuf)) * nblocks; 52 --- 25 unchanged lines hidden --- |