From 7b0866b032b4e8f2b7009622e912888953bf16cf Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Fri, 1 Feb 2013 07:05:43 +0000 Subject: [PATCH] Make use of USB ID sections configurable. --- sys/dev/usb/usb_freebsd.h | 1 + sys/dev/usb/usb_freebsd_loader.h | 1 + sys/dev/usb/usb_lookup.c | 2 +- sys/dev/usb/usbdi.h | 9 +++++++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/usb_freebsd.h b/sys/dev/usb/usb_freebsd.h index b599b7423649..e93bee7692b3 100644 --- a/sys/dev/usb/usb_freebsd.h +++ b/sys/dev/usb/usb_freebsd.h @@ -43,6 +43,7 @@ #define USB_HAVE_MSCTEST 1 #define USB_HAVE_PF 1 #define USB_HAVE_ROOT_MOUNT_HOLD 1 +#define USB_HAVE_ID_SECTION 1 #define USB_TD_GET_PROC(td) (td)->td_proc #define USB_PROC_GET_GID(td) (td)->p_pgid diff --git a/sys/dev/usb/usb_freebsd_loader.h b/sys/dev/usb/usb_freebsd_loader.h index bb3250a770f1..566f9222099b 100644 --- a/sys/dev/usb/usb_freebsd_loader.h +++ b/sys/dev/usb/usb_freebsd_loader.h @@ -43,6 +43,7 @@ #define USB_HAVE_MSCTEST 0 #define USB_HAVE_PF 0 #define USB_HAVE_ROOT_MOUNT_HOLD 0 +#define USB_HAVE_ID_SECTION 0 #define USB_TD_GET_PROC(td) (td)->td_proc #define USB_PROC_GET_GID(td) (td)->p_pgid diff --git a/sys/dev/usb/usb_lookup.c b/sys/dev/usb/usb_lookup.c index 769f9b652736..f3dc55109d50 100644 --- a/sys/dev/usb/usb_lookup.c +++ b/sys/dev/usb/usb_lookup.c @@ -178,7 +178,7 @@ usbd_lookup_id_by_uaa(const struct usb_device_id *id, usb_size_t sizeof_id, #define MFL_SIZE "0" #endif -#ifdef KLD_MODULE +#if defined(KLD_MODULE) && (USB_HAVE_ID_SECTION != 0) static const char __section("bus_autoconf_format") __used usb_id_format[] = { /* Declare that three different sections use the same format */ diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index d39a84d95d8e..26f77694b950 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -241,12 +241,21 @@ struct usb_config { * have your driver module automatically loaded in host, device or * both modes respectivly: */ +#if USB_HAVE_ID_SECTION #define STRUCT_USB_HOST_ID \ struct usb_device_id __section("usb_host_id") #define STRUCT_USB_DEVICE_ID \ struct usb_device_id __section("usb_device_id") #define STRUCT_USB_DUAL_ID \ struct usb_device_id __section("usb_dual_id") +#else +#define STRUCT_USB_HOST_ID \ + struct usb_device_id +#define STRUCT_USB_DEVICE_ID \ + struct usb_device_id +#define STRUCT_USB_DUAL_ID \ + struct usb_device_id +#endif /* USB_HAVE_ID_SECTION */ /* * The following structure is used when looking up an USB driver for