[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ptimer: Rename PTIMER_POLICY_DEFAULT to PTIMER_POLICY_LEGACY
From: |
Peter Maydell |
Subject: |
Re: [PATCH] ptimer: Rename PTIMER_POLICY_DEFAULT to PTIMER_POLICY_LEGACY |
Date: |
Mon, 16 May 2022 14:35:02 +0100 |
On Mon, 16 May 2022 at 14:10, Francisco Iglesias
<francisco.iglesias@xilinx.com> wrote:
>
> On Mon, May 16, 2022 at 11:30:58AM +0100, Peter Maydell wrote:
> > The traditional ptimer behaviour includes a collection of weird edge
> > case behaviours. In 2016 we improved the ptimer implementation to
> > fix these and generally make the behaviour more flexible, with
> > ptimers opting in to the new behaviour by passing an appropriate set
> > of policy flags to ptimer_init(). For backwards-compatibility, we
> > defined PTIMER_POLICY_DEFAULT (which sets no flags) to give the old
> > weird behaviour.
> >
> > This turns out to be a poor choice of name, because people writing
> > new devices which use ptimers are misled into thinking that the
> > default is probably a sensible choice of flags, when in fact it is
> > almost always not what you want. Rename PTIMER_POLICY_DEFAULT to
> > PTIMER_POLICY_LEGACY and beef up the comment to more clearly say that
> > new devices should not be using it.
> >
> > The code-change part of this commit was produced by
> > sed -i -e 's/PTIMER_POLICY_DEFAULT/PTIMER_POLICY_LEGACY/g' $(git grep -l
> > PTIMER_POLICY_DEFAULT)
> >
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > --- a/tests/unit/ptimer-test.c
> > +++ b/tests/unit/ptimer-test.c
> > @@ -768,7 +768,7 @@ static void add_ptimer_tests(uint8_t policy)
> > char policy_name[256] = "";
> > char *tmp;
> >
> > - if (policy == PTIMER_POLICY_DEFAULT) {
> > + if (policy == PTIMER_POLICY_LEGACY) {
> > g_sprintf(policy_name, "default");
>
> Hi Peter,
>
> It might be that above is clearer after this patch with "legacy"
Oops, yes, we should adjust the test name string there too.
thanks
-- PMM