From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: xen-devel@lists.xenproject.org, michal.orzel@amd.com,
xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com,
consulting@bugseng.com, bertrand.marquis@arm.com, julien@xen.org,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [XEN PATCH v2 1/3] drivers: char: address violation of MISRA C Rule 20.7
Date: Fri, 03 May 2024 12:18:15 +0200 [thread overview]
Message-ID: <82c375da8e1144b150e73c265ae206d6@bugseng.com> (raw)
In-Reply-To: <83741df3-b951-4351-88c1-2b7bb7b1e16e@suse.com>
On 2024-05-03 12:10, Jan Beulich wrote:
> On 03.05.2024 09:29, Nicola Vetrini wrote:
>> On 2024-05-01 21:57, Stefano Stabellini wrote:
>>> On Tue, 30 Apr 2024, Nicola Vetrini wrote:
>>>> MISRA C Rule 20.7 states: "Expressions resulting from the expansion
>>>> of macro parameters shall be enclosed in parentheses". Therefore,
>>>> some
>>>> macro definitions should gain additional parentheses to ensure that
>>>> all
>>>> current and future users will be safe with respect to expansions
>>>> that
>>>> can possibly alter the semantics of the passed-in macro parameter.
>>>>
>>>> No functional chage.
>>>>
>>>> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
>>>
>>> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
>>>
>>>
>>>> ---
>>>> Changes in v2:
>>>> - drop excess parentheses from val parameter.
>>>> ---
>>>> xen/drivers/char/omap-uart.c | 5 +++--
>>>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/xen/drivers/char/omap-uart.c
>>>> b/xen/drivers/char/omap-uart.c
>>>> index 03b5b66e7acb..e0128225f927 100644
>>>> --- a/xen/drivers/char/omap-uart.c
>>>> +++ b/xen/drivers/char/omap-uart.c
>>>> @@ -48,8 +48,9 @@
>>>> /* System configuration register */
>>>> #define UART_OMAP_SYSC_DEF_CONF 0x0d /* autoidle mode, wakeup
>>>> is
>>>> enabled */
>>>>
>>>> -#define omap_read(uart, off) readl((uart)->regs +
>>>> (off<<REG_SHIFT))
>>>> -#define omap_write(uart, off, val) writel((val), (uart)->regs +
>>>> (off<<REG_SHIFT))
>>>> +#define omap_read(uart, off) readl((uart)->regs + ((off) <<
>>>> REG_SHIFT))
>>>> +#define omap_write(uart, off, val) writel(val, (uart)->regs + \
>>>> + ((off) <<
>>>> REG_SHIFT))
>>>
>>> the alignment looks off but could be fixed on commit
>>>
>>
>> Can you clarify what you mean here? I aligned readl and writeln and
>> the
>> operands in writel to avoid the line being too long.
>
> #define omap_write(uart, off, val) writel(val, \
> (uart)->regs + ((off) <<
> REG_SHIFT))
>
> The main point being that before you start splitting an argument
> following
> another one on the same line, you'd move that argument to a new line.
>
> Jan
Oh, ok. Didn't think of that. Thanks, can amend it
--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)
next prev parent reply other threads:[~2024-05-03 10:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 14:28 [XEN PATCH v2 0/3] address violations of MISRA C Rule 20.7 Nicola Vetrini
2024-04-30 14:28 ` [XEN PATCH v2 1/3] drivers: char: address violation " Nicola Vetrini
2024-05-01 19:57 ` Stefano Stabellini
2024-05-03 7:29 ` Nicola Vetrini
2024-05-03 10:10 ` Jan Beulich
2024-05-03 10:18 ` Nicola Vetrini [this message]
2024-04-30 14:28 ` [XEN PATCH v2 2/3] xen/unaligned: " Nicola Vetrini
2024-04-30 15:13 ` Jan Beulich
2024-04-30 15:25 ` Nicola Vetrini
2024-04-30 14:28 ` [XEN PATCH v2 3/3] xen/pci: address violations " Nicola Vetrini
2024-04-30 15:15 ` Jan Beulich
2024-05-14 9:11 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=82c375da8e1144b150e73c265ae206d6@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=ayan.kumar.halder@amd.com \
--cc=bertrand.marquis@arm.com \
--cc=consulting@bugseng.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
--cc=xenia.ragiadakou@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.