On 29/7/21 4:20 pm, Christian MAUDERER wrote: > Hello Chris, > > Am 29.07.21 um 02:07 schrieb Chris Johns: >> On 29/7/21 1:10 am, Ahamed Husni wrote: >>> >>> >>> On Wed, 28 Jul 2021, 17:27 Husni Faiz, <ahamedhusn...@gmail.com >>> <mailto:ahamedhusn...@gmail.com>> wrote: >>> >>> Add the conditional macro to prevent the driver from referencing >>> the templates which are not imported yet. >>> >>> Include functions which adds the hw.usb.template sysctl variable. >>> >>> Signed-off-by: Husni Faiz <ahamedhusn...@gmail.com >>> <mailto:ahamedhusn...@gmail.com>> >>> --- >>> freebsd/sys/dev/usb/template/usb_template.c | 4 ++++ >>> freebsd/sys/dev/usb/usb_device.c | 8 ++++++-- >>> 2 files changed, 10 insertions(+), 2 deletions(-) >>> >>> diff --git a/freebsd/sys/dev/usb/template/usb_template.c >>> b/freebsd/sys/dev/usb/template/usb_template.c >>> index 0650da15..76567e85 100644 >>> --- a/freebsd/sys/dev/usb/template/usb_template.c >>> +++ b/freebsd/sys/dev/usb/template/usb_template.c >>> @@ -1433,12 +1433,15 @@ usb_temp_setup_by_index(struct usb_device >>> *udev, >>> uint16_t index) >>> usb_error_t err; >>> >>> switch (index) { >>> +#ifndef __rtems__ >>> case USB_TEMP_MSC: >>> err = usb_temp_setup(udev, &usb_template_msc); >>> break; >>> +#endif /* __rtems__ */ >>> case USB_TEMP_CDCE: >>> err = usb_temp_setup(udev, &usb_template_cdce); >>> break; >>> +#ifndef __rtems__ >>> case USB_TEMP_MTP: >>> err = usb_temp_setup(udev, &usb_template_mtp); >>> break; >>> @@ -1469,6 +1472,7 @@ usb_temp_setup_by_index(struct usb_device *udev, >>> uint16_t index) >>> case USB_TEMP_CDCEEM: >>> err = usb_temp_setup(udev, &usb_template_cdceem); >>> break; >>> +#endif /* __rtems__ */ >>> default: >>> return (USB_ERR_INVAL); >>> } >>> diff --git a/freebsd/sys/dev/usb/usb_device.c >>> b/freebsd/sys/dev/usb/usb_device.c >>> index ee240949..619cae5a 100644 >>> --- a/freebsd/sys/dev/usb/usb_device.c >>> +++ b/freebsd/sys/dev/usb/usb_device.c >>> @@ -28,6 +28,10 @@ >>> * SUCH DAMAGE. >>> */ >>> >>> +#ifdef __rtems__ >>> +#include <rtems/bsd/modules.h> >>> +#endif >>> + >>> #ifdef USB_GLOBAL_INCLUDE_FILE >>> #include USB_GLOBAL_INCLUDE_FILE >>> #else >>> @@ -123,7 +127,7 @@ int usb_template = USB_TEMPLATE; >>> int usb_template = -1; >>> #endif >>> >>> -#ifndef __rtems__ >>> +#if !defined(__rtems__) || defined(RTEMS_BSD_MODULE_DEV_USB_TEMPLATE) >> >> Is doing this supported by the freebsd-to-rtems.py script? > > I sure hope that it is. I know that I used similar constructions in the past > and > it seems that I'm not the only one, because I'm sure that I haven't touched > some > of these files:
Hmm I thought this was being handled but it seems it is not. > (Hope that get's through the mail well enoguth that it is readable. If not: > Just > grep for "defined(__rtems__)" yourself.) > > I don't think that our script touches the "#ifdef(__rtems__)" except maybe in > some special header cases, does it? I thought that's basically how the rebase > works: Just copying all that stuff unchanged to freebsd-org and then do a > rebase > with all changes. The guards are more or less to make it simpler to see what's > been added by RTEMS. Yes. Chris _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel