<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 28 Jul 2021, 17:27 Husni Faiz, <<a href="mailto:ahamedhusni73@gmail.com">ahamedhusni73@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Add the conditional macro to prevent the driver from referencing<br>
the templates which are not imported yet.<br>
<br>
Include functions which adds the hw.usb.template sysctl variable.<br>
<br>
Signed-off-by: Husni Faiz <<a href="mailto:ahamedhusni73@gmail.com" target="_blank" rel="noreferrer">ahamedhusni73@gmail.com</a>><br>
---<br>
freebsd/sys/dev/usb/template/usb_template.c | 4 ++++<br>
freebsd/sys/dev/usb/usb_device.c | 8 ++++++--<br>
2 files changed, 10 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/freebsd/sys/dev/usb/template/usb_template.c b/freebsd/sys/dev/usb/template/usb_template.c<br>
index 0650da15..76567e85 100644<br>
--- a/freebsd/sys/dev/usb/template/usb_template.c<br>
+++ b/freebsd/sys/dev/usb/template/usb_template.c<br>
@@ -1433,12 +1433,15 @@ usb_temp_setup_by_index(struct usb_device *udev, uint16_t index)<br>
usb_error_t err;<br>
<br>
switch (index) {<br>
+#ifndef __rtems__<br>
case USB_TEMP_MSC:<br>
err = usb_temp_setup(udev, &usb_template_msc);<br>
break;<br>
+#endif /* __rtems__ */<br>
case USB_TEMP_CDCE:<br>
err = usb_temp_setup(udev, &usb_template_cdce);<br>
break;<br>
+#ifndef __rtems__<br>
case USB_TEMP_MTP:<br>
err = usb_temp_setup(udev, &usb_template_mtp);<br>
break;<br>
@@ -1469,6 +1472,7 @@ usb_temp_setup_by_index(struct usb_device *udev, uint16_t index)<br>
case USB_TEMP_CDCEEM:<br>
err = usb_temp_setup(udev, &usb_template_cdceem);<br>
break;<br>
+#endif /* __rtems__ */<br>
default:<br>
return (USB_ERR_INVAL);<br>
}<br>
diff --git a/freebsd/sys/dev/usb/usb_device.c b/freebsd/sys/dev/usb/usb_device.c<br>
index ee240949..619cae5a 100644<br>
--- a/freebsd/sys/dev/usb/usb_device.c<br>
+++ b/freebsd/sys/dev/usb/usb_device.c<br>
@@ -28,6 +28,10 @@<br>
* SUCH DAMAGE.<br>
*/<br>
<br>
+#ifdef __rtems__<br>
+#include <rtems/bsd/modules.h><br>
+#endif<br>
+<br>
#ifdef USB_GLOBAL_INCLUDE_FILE<br>
#include USB_GLOBAL_INCLUDE_FILE<br>
#else<br>
@@ -123,7 +127,7 @@ int usb_template = USB_TEMPLATE;<br>
int usb_template = -1;<br>
#endif<br>
<br>
-#ifndef __rtems__<br>
+#if !defined(__rtems__) || defined(RTEMS_BSD_MODULE_DEV_USB_TEMPLATE)<br>
SYSCTL_PROC(_hw_usb, OID_AUTO, template,<br>
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,<br>
NULL, 0, sysctl_hw_usb_template,<br>
@@ -255,7 +259,7 @@ sysctl_hw_usb_template(SYSCTL_HANDLER_ARGS)<br>
<br>
return (0);<br>
}<br>
-#endif /* __rtems__ */<br>
+#endif /* !__rtmes__ || RTEMS_BSD_MODULE_DEV_USB_TEMPLATE */<br></blockquote></div></div><div dir="auto">Ah, a typo here (rtmes). Should I send a new set of patches?</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
/* English is default language */<br>
<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div></div></div>