From 5218e2a490ff088aefd94cd8c7695bf94d237b77 Mon Sep 17 00:00:00 2001 From: augustss Date: Thu, 1 Jun 2000 14:37:51 +0000 Subject: [PATCH] Improve some portability items. --- sys/dev/usb/usb_port.h | 18 ++++++++++++------ sys/dev/usb/usb_subr.c | 8 ++------ sys/dev/usb/usbdi_util.c | 9 ++------- sys/dev/usb/usbdi_util.h | 9 ++------- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 07c19fac274d..b772e6495dce 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -1,4 +1,4 @@ -/* $NetBSD: usb_port.h,v 1.32 2000/06/01 14:29:01 augustss Exp $ */ +/* $NetBSD: usb_port.h,v 1.33 2000/06/01 14:37:51 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */ /* @@ -96,6 +96,8 @@ typedef struct callout usb_callout_t; #define usb_kthread_create1 kthread_create1 #define usb_kthread_create kthread_create +typedef int usb_malloc_type; + #define Ether_ifattach ether_ifattach #define IF_INPUT(ifp, m) (*(ifp)->if_input)((ifp), (m)) @@ -204,6 +206,8 @@ __CONCAT(dname,_detach)(self, flags) \ #define config_pending_incr() #define config_pending_decr() +typedef int usb_malloc_type; + #define mii_attach(x1,x2,x3,x4,x5,x6) mii_phy_probe(x1,x2,x3) #define Ether_ifattach(ifp, eaddr) ether_ifattach(ifp) #define if_deactivate(x) @@ -230,7 +234,7 @@ __CONCAT(dname,_detach)(self, flags) \ #define change_sign16_le change_sign16 #define realloc usb_realloc -void *usb_realloc __P((void *, u_int, int, int)); +void *usb_realloc(void *, u_int, int, int); extern int cold; @@ -255,10 +259,10 @@ typedef char usb_callout_t; #define usb_uncallout(h, f, d) untimeout((f), (d)) #define USB_DECLARE_DRIVER(dname) \ -int __CONCAT(dname,_match) __P((struct device *, void *, void *)); \ -void __CONCAT(dname,_attach) __P((struct device *, struct device *, void *)); \ -int __CONCAT(dname,_detach) __P((struct device *, int)); \ -int __CONCAT(dname,_activate) __P((struct device *, enum devact)); \ +int __CONCAT(dname,_match)(struct device *, void *, void *); \ +void __CONCAT(dname,_attach)(struct device *, struct device *, void *); \ +int __CONCAT(dname,_detach)(struct device *, int); \ +int __CONCAT(dname,_activate)(struct device *, enum devact); \ \ struct cfdriver __CONCAT(dname,_cd) = { \ NULL, #dname, DV_DULL \ @@ -365,6 +369,8 @@ typedef struct callout_handle usb_callout_t; #define powerhook_disestablish(hdl) #define PWR_RESUME 0 +typedef struct malloc_type *usb_malloc_type; + #define USB_DECLARE_DRIVER_INIT(dname, init) \ Static device_probe_t __CONCAT(dname,_match); \ Static device_attach_t __CONCAT(dname,_attach); \ diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 499b5458e495..cda35d2c3b9b 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.78 2000/06/01 14:29:02 augustss Exp $ */ +/* $NetBSD: usb_subr.c,v 1.79 2000/06/01 14:37:51 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ /* @@ -1260,11 +1260,7 @@ usb_disconnect_port(struct usbd_port *up, device_ptr_t parent) } #ifdef __OpenBSD__ -void *usb_realloc(p, size, pool, flags) - void *p; - u_int size; - int pool; - int flags; +void *usb_realloc(void *p, u_int size, int pool, int flags) { void *q; diff --git a/sys/dev/usb/usbdi_util.c b/sys/dev/usb/usbdi_util.c index 0a835e24e3e2..595802b4c2ef 100644 --- a/sys/dev/usb/usbdi_util.c +++ b/sys/dev/usb/usbdi_util.c @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi_util.c,v 1.31 2000/06/01 14:29:02 augustss Exp $ */ +/* $NetBSD: usbdi_util.c,v 1.32 2000/06/01 14:37:51 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi_util.c,v 1.14 1999/11/17 22:33:50 n_hibma Exp $ */ /* @@ -380,12 +380,7 @@ usbd_get_hid_descriptor(usbd_interface_handle ifc) usbd_status usbd_alloc_report_desc(usbd_interface_handle ifc, void **descp, int *sizep, -#if defined(__NetBSD__) || defined(__OpenBSD__) - int mem -#elif defined(__FreeBSD__) - struct malloc_type *mem -#endif - ) + usb_malloc_type mem) { usb_interface_descriptor_t *id; usb_hid_descriptor_t *hid; diff --git a/sys/dev/usb/usbdi_util.h b/sys/dev/usb/usbdi_util.h index fef89fda6466..8b98c1a63161 100644 --- a/sys/dev/usb/usbdi_util.h +++ b/sys/dev/usb/usbdi_util.h @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi_util.h,v 1.21 2000/06/01 14:29:03 augustss Exp $ */ +/* $NetBSD: usbdi_util.h,v 1.22 2000/06/01 14:37:52 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi_util.h,v 1.9 1999/11/17 22:33:50 n_hibma Exp $ */ /* @@ -65,13 +65,8 @@ usbd_status usbd_set_report_async(usbd_interface_handle iface, int type, usbd_status usbd_get_report(usbd_interface_handle iface, int type, int id, void *data, int len); usbd_status usbd_set_idle(usbd_interface_handle iface, int duration,int id); -#if defined(__NetBSD__) || defined(__OpenBSD__) usbd_status usbd_alloc_report_desc(usbd_interface_handle ifc, void **descp, - int *sizep, int mem); -#elif defined(__FreeBSD__) -usbd_status usbd_alloc_report_desc(usbd_interface_handle ifc, void **descp, - int *sizep, struct malloc_type * mem); -#endif + int *sizep, usb_malloc_type mem); usbd_status usbd_get_config(usbd_device_handle dev, u_int8_t *conf); usbd_status usbd_get_string_desc(usbd_device_handle dev, int sindex, int langid,usb_string_descriptor_t *sdesc);