1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Make it easier to run this code on RELENG_4.

Submitted by:	luoqi
This commit is contained in:
Josef Karthauser 2003-10-04 22:13:21 +00:00
parent b63331a498
commit 272487f507
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120768
2 changed files with 17 additions and 3 deletions

View File

@ -56,7 +56,9 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#if __FreeBSD_version >= 500000
#include <sys/mutex.h>
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/device.h>
#elif defined(__FreeBSD__)
@ -378,7 +380,7 @@ usb_event_thread(void *arg)
{
struct usb_softc *sc = arg;
#ifdef __FreeBSD__
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
mtx_lock(&Giant);
#endif
@ -428,7 +430,7 @@ usb_task_thread(void *arg)
struct usb_task *task;
int s;
#ifdef __FreeBSD__
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
mtx_lock(&Giant);
#endif
@ -547,7 +549,11 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
case FIOASYNC:
if (*(int *)data)
#if _FreeBSD_version >= 500000
usb_async_proc = p->td_proc;
#else
usb_async_proc = p;
#endif
else
usb_async_proc = 0;
return (0);

View File

@ -166,10 +166,18 @@ usb_block_allocmem(bus_dma_tag_t tag, size_t size, size_t align,
if (p == NULL)
return (USBD_NOMEM);
#if __FreeBSD_version >= 500000
if (bus_dma_tag_create(tag, align, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
size, sizeof(p->segs) / sizeof(p->segs[0]), size,
BUS_DMA_ALLOCNOW, NULL, NULL, &p->tag) == ENOMEM) {
BUS_DMA_ALLOCNOW, NULL, NULL, &p->tag) == ENOMEM)
#else
if (bus_dma_tag_create(tag, align, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
size, sizeof(p->segs) / sizeof(p->segs[0]), size,
BUS_DMA_ALLOCNOW, &p->tag) == ENOMEM)
#endif
{
goto free;
}