[PATCH rtems-libbsd 2/4] usb_template: Configure template driver only for CDC Ethernet
Ahamed Husni
ahamedhusni73 at gmail.com
Wed Jul 28 12:56:17 UTC 2021
Hello Christian,
On Fri, Jul 16, 2021 at 1:18 AM Christian Mauderer <oss at c-mauderer.de>
wrote:
> Hello Husni,
>
> On 06/07/2021 19:00, Husni Faiz 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 <ahamedhusni73 at gmail.com>
> > ---
> > freebsd/sys/dev/usb/template/usb_template.c | 4 ++++
> > freebsd/sys/dev/usb/usb_device.c | 4 ++--
> > 2 files changed, 6 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..fe90d5b7 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
> > 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
> > 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..28ef1b74 100644
> > --- a/freebsd/sys/dev/usb/usb_device.c
> > +++ b/freebsd/sys/dev/usb/usb_device.c
> > @@ -123,7 +123,7 @@ int usb_template = USB_TEMPLATE;
> > int usb_template = -1;
> > #endif
> >
> > -#ifndef __rtems__
> > +#if !defined(__rtems__) || defined(RTEMS_BSD_MODULE_DEV_USB_TEMPLATE)
>
> Shouldn't there be an include for the rtems/bsd/modules.h somewhere if
> you use the RTEMS_BSD_MODULE_DEV_USB_TEMPLATE define?
>
> Fixed in Patch v2
> SYSCTL_PROC(_hw_usb, OID_AUTO, template,
> > CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
> > NULL, 0, sysctl_hw_usb_template,
> > @@ -255,7 +255,7 @@ sysctl_hw_usb_template(SYSCTL_HANDLER_ARGS)
> >
> > return (0);
> > }
> > -#endif /* __rtems__ */
> > +#endif /* !__rtmes__ || RTEMS_BSD_MODULE_DEV_USB_TEMPLATE */
> >
> > /* English is default language */
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210728/70b85ac9/attachment.html>
More information about the devel
mailing list