<div dir="ltr"><div class="gmail_default" style="font-size:small">Hello Christian,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I fixed this.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks,</div><div class="gmail_default" style="font-size:small">Niteesh.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 6, 2020 at 5:20 PM Christian Mauderer <<a href="mailto:oss@c-mauderer.de">oss@c-mauderer.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Some style comments:<br>
<br>
On 04/06/2020 19:43, G S Niteesh Babu wrote:<br>
> This file is the RTEMS implementation of ofw_if.h in FreeBSD. The<br>
> ofw_if.h in FreeBSD is an autogenerated header file that maps the<br>
> OF_function calls to their respective implementation. But in RTEMS<br>
> this file maps the OF_functions directly to their FDT implementation.<br>
> ---<br>
> cpukit/libfreebsd/dev/ofw/ofw_if.h | 63 ++++++++++++++++++++++++++++++<br>
> 1 file changed, 63 insertions(+)<br>
> create mode 100644 cpukit/libfreebsd/dev/ofw/ofw_if.h<br>
> <br>
> diff --git a/cpukit/libfreebsd/dev/ofw/ofw_if.h b/cpukit/libfreebsd/dev/ofw/ofw_if.h<br>
> new file mode 100644<br>
> index 0000000000..7b9bcaa24a<br>
> --- /dev/null<br>
> +++ b/cpukit/libfreebsd/dev/ofw/ofw_if.h<br>
> @@ -0,0 +1,63 @@<br>
> +/* SPDX-License-Identifier: BSD-2-Clause<br>
> +<br>
> + *<br>
> + * @file<br>
> + *<br>
> + * @ingroup LIBFREEBSDOFW<br>
> + *<br>
> + * @brief Declaration of OFW functions.<br>
> + */<br>
> +<br>
> +/*<br>
> + * Copyright (C) <2020> Niteesh Babu <<a href="mailto:niteesh.gs@gmail.com" target="_blank">niteesh.gs@gmail.com</a>><br>
> + *<br>
> + * Redistribution and use in source and binary forms, with or without<br>
> + * modification, are permitted provided that the following conditions<br>
> + * are met:<br>
> + * 1. Redistributions of source code must retain the above copyright<br>
> + * notice, this list of conditions and the following disclaimer.<br>
> + * 2. Redistributions in binary form must reproduce the above copyright<br>
> + * notice, this list of conditions and the following disclaimer in the<br>
> + * documentation and/or other materials provided with the distribution.<br>
> + *<br>
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"<br>
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br>
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE<br>
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br>
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS<br>
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN<br>
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)<br>
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE<br>
> + * POSSIBILITY OF SUCH DAMAGE.<br>
> + */<br>
> +<br>
> +#ifndef _LIBFREEBSD_OFW_IF_H<br>
> +#define _LIBFREEBSD_OFW_IF_H<br>
> +<br>
> +#include <sys/types.h><br>
> +#include "openfirm.h"<br>
> +<br>
> +typedef void* ofw_t;<br>
> +<br>
> +int OFW_INIT(ofw_t ofw_obj, void *cookie);<br>
> +phandle_t OFW_PEER(ofw_t ofw_obj, phandle_t node);<br>
> +phandle_t OFW_CHILD(ofw_t ofw_obj, phandle_t node);<br>
> +phandle_t OFW_PARENT(ofw_t ofw_obj, phandle_t node);<br>
> +phandle_t OFW_INSTANCE_TO_PACKAGE(ofw_t ofw_obj, ihandle_t instance);<br>
> +ssize_t OFW_GETPROPLEN(ofw_t ofw_obj, phandle_t package, const char *propname);<br>
> +ssize_t OFW_GETPROP(ofw_t ofw_obj, phandle_t package, const char *propname,<br>
> + void *buf, size_t buflen);<br>
<br>
If we use FreeBSD Kernel style (which I would suggest for code that has<br>
to do with FreeBSD) you should indent the second line one tab more. Means<br>
<br>
ssize_t OFW_GETPROP(ofw_t ofw_obj, ...,<br>
void *buf, size_t buflen);<br>
<br>
That is:<br>
<br>
ssize_t OFW_GETPROP(ofw_t ofw_obj, ...,<br>
<1*tab><4*space>void *buf, size_t buflen);<br>
<br>
Take a look at some FreeBSD headers for that. For example<br>
rtems-libbsd/freebsd/sys/sys/rwlock.h.<br>
<br>
<br>
> +int OFW_NEXTPROP(ofw_t ofw_obj, phandle_t package, const char *prev, char *buf,<br>
> + size_t size);<br>
> +int OFW_SETPROP(ofw_t ofw_obj, phandle_t package, const char *propname,<br>
> + const void *buf, size_t len);<br>
> +ssize_t OFW_CANON(ofw_t ofw_obj, const char *device, char *buf, size_t len);<br>
> +phandle_t OFW_FINDDEVICE(ofw_t ofw_obj, const char *device);<br>
> +ssize_t OFW_INSTANCE_TO_PATH(ofw_t ofw_obj, ihandle_t instance, char *buf,<br>
> + size_t len);<br>
> +ssize_t OFW_PACKAGE_TO_PATH(ofw_t ofw_obj, phandle_t package, char *buf,<br>
> + size_t len);<br>
> +<br>
> +#endif /* _LIBFREEBSD_OFW_IF_H */<br>
> <br>
</blockquote></div>