diff mbox series

[3/3] firmware: scmi: fix inline comments and minor coding style issues

Message ID 20210218125444.4090-3-etienne.carriere@linaro.org
State New
Headers show
Series [1/3] firmware: scmi: voltage regulator | expand

Commit Message

Etienne Carriere Feb. 18, 2021, 12:54 p.m. UTC
Fix inline comments and empty line in scmi driver and test files.
Condition SCMI clock and reset tests to U-Boot configuration.

Change-Id: Iac37398cedc1942cf1cc114fc60cbe04c599313e
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>

---
 arch/sandbox/include/asm/scmi_test.h       |  5 +++--
 drivers/firmware/scmi/sandbox-scmi_agent.c |  4 ++--
 test/dm/scmi.c                             | 21 ++++++++++++---------
 3 files changed, 17 insertions(+), 13 deletions(-)

-- 
2.17.1

Comments

Simon Glass Feb. 19, 2021, 4:52 a.m. UTC | #1
Hi Etienne,

On Thu, 18 Feb 2021 at 05:55, Etienne Carriere
<etienne.carriere@linaro.org> wrote:
>

> Fix inline comments and empty line in scmi driver and test files.

> Condition SCMI clock and reset tests to U-Boot configuration.

>

> Change-Id: Iac37398cedc1942cf1cc114fc60cbe04c599313e

> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>

> ---

>  arch/sandbox/include/asm/scmi_test.h       |  5 +++--

>  drivers/firmware/scmi/sandbox-scmi_agent.c |  4 ++--

>  test/dm/scmi.c                             | 21 ++++++++++++---------

>  3 files changed, 17 insertions(+), 13 deletions(-)

>

> diff --git a/arch/sandbox/include/asm/scmi_test.h b/arch/sandbox/include/asm/scmi_test.h

> index 9b7031531..2930e686d 100644

> --- a/arch/sandbox/include/asm/scmi_test.h

> +++ b/arch/sandbox/include/asm/scmi_test.h

> @@ -24,6 +24,7 @@ struct sandbox_scmi_clk {

>

>  /**

>   * struct sandbox_scmi_reset - Simulated reset controller exposed by SCMI

> + * @id:                Identifier of the reset controller used in the SCMI protocol

>   * @asserted:  Reset control state: true if asserted, false if desasserted

>   */

>  struct sandbox_scmi_reset {

> @@ -48,8 +49,8 @@ struct sandbox_scmi_voltd {

>   * @idx:       Identifier for the SCMI agent, its index

>   * @clk:       Simulated clocks

>   * @clk_count: Simulated clocks array size

> - * @clk:       Simulated reset domains

> - * @clk_count: Simulated reset domains array size

> + * @reset:     Simulated reset domains

> + * @reset_count: Simulated reset domains array size

>   * @voltd:      Simulated voltage domains (regulators)

>   * @voltd_count: Simulated voltage domains array size

>   */

> diff --git a/drivers/firmware/scmi/sandbox-scmi_agent.c b/drivers/firmware/scmi/sandbox-scmi_agent.c

> index 3eafc49bd..56125a57b 100644

> --- a/drivers/firmware/scmi/sandbox-scmi_agent.c

> +++ b/drivers/firmware/scmi/sandbox-scmi_agent.c

> @@ -18,7 +18,7 @@

>   * processing. It simulates few of the SCMI services for some of the

>   * SCMI protocols embedded in U-Boot. Currently:

>   * - SCMI clock protocol: emulate 2 agents each exposing few clocks

> - * - SCMI reset protocol: emulate 1 agents each exposing a reset

> + * - SCMI reset protocol: emulate 1 agent exposing a reset controller

>   * - SCMI voltage domain protocol: emulate 1 agent exposing 2 regulators

>   *

>   * Agent #0 simulates 2 clocks, 1 reset domain and 1 voltage domain.

> @@ -29,7 +29,7 @@

>   *

>   * All clocks and regulators are default disabled and reset controller down.

>   *

> - * This Driver exports sandbox_scmi_service_ct() for the test sequence to

> + * This Driver exports sandbox_scmi_service_ctx() for the test sequence to

>   * get the state of the simulated services (clock state, rate, ...) and

>   * check back-end device state reflects the request send through the

>   * various uclass devices, as clocks and reset controllers.

> diff --git a/test/dm/scmi.c b/test/dm/scmi.c

> index f21a3ff97..cc611c1e0 100644

> --- a/test/dm/scmi.c

> +++ b/test/dm/scmi.c

> @@ -57,18 +57,24 @@ static int ut_assert_scmi_state_postprobe(struct unit_test_state *uts,

>         ut_asserteq(2, scmi_ctx->agent_count);

>

>         ut_assertnonnull(scmi_ctx->agent[0]);

> -       ut_asserteq(2, scmi_ctx->agent[0]->clk_count);

> -       ut_assertnonnull(scmi_ctx->agent[0]->clk);

> -       ut_asserteq(1, scmi_ctx->agent[0]->reset_count);

> -       ut_assertnonnull(scmi_ctx->agent[0]->reset);

> +       if (IS_ENABLED(CONFIG_CLK_SCMI)) {


Why are these needed? Are these options not enabled on sandbox? The
goal is to test all the code, not part of it.

> +               ut_asserteq(2, scmi_ctx->agent[0]->clk_count);

> +               ut_assertnonnull(scmi_ctx->agent[0]->clk);

> +       }

> +       if (IS_ENABLED(CONFIG_RESET_SCMI)) {

> +               ut_asserteq(1, scmi_ctx->agent[0]->reset_count);

> +               ut_assertnonnull(scmi_ctx->agent[0]->reset);

> +       }

>         if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)) {

>                 ut_asserteq(2, scmi_ctx->agent[0]->voltd_count);

>                 ut_assertnonnull(scmi_ctx->agent[0]->voltd);

>         }

>

>         ut_assertnonnull(scmi_ctx->agent[1]);

> -       ut_assertnonnull(scmi_ctx->agent[1]->clk);

> -       ut_asserteq(1, scmi_ctx->agent[1]->clk_count);

> +       if (IS_ENABLED(CONFIG_CLK_SCMI)) {

> +               ut_assertnonnull(scmi_ctx->agent[1]->clk);

> +               ut_asserteq(1, scmi_ctx->agent[1]->clk_count);

> +       }

>


Regards,
Simon
Etienne Carriere Feb. 19, 2021, 6:17 a.m. UTC | #2
Hello Simon,

On Fri, 19 Feb 2021 at 05:52, Simon Glass <sjg@chromium.org> wrote:
>

> Hi Etienne,

>

> On Thu, 18 Feb 2021 at 05:55, Etienne Carriere

> <etienne.carriere@linaro.org> wrote:

> >

> > Fix inline comments and empty line in scmi driver and test files.

> > Condition SCMI clock and reset tests to U-Boot configuration.

> >

> > Change-Id: Iac37398cedc1942cf1cc114fc60cbe04c599313e

> > Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>

> > ---

> >  arch/sandbox/include/asm/scmi_test.h       |  5 +++--

> >  drivers/firmware/scmi/sandbox-scmi_agent.c |  4 ++--

> >  test/dm/scmi.c                             | 21 ++++++++++++---------

> >  3 files changed, 17 insertions(+), 13 deletions(-)

> >

> > diff --git a/arch/sandbox/include/asm/scmi_test.h b/arch/sandbox/include/asm/scmi_test.h

> > index 9b7031531..2930e686d 100644

> > --- a/arch/sandbox/include/asm/scmi_test.h

> > +++ b/arch/sandbox/include/asm/scmi_test.h

> > @@ -24,6 +24,7 @@ struct sandbox_scmi_clk {

> >

> >  /**

> >   * struct sandbox_scmi_reset - Simulated reset controller exposed by SCMI

> > + * @id:                Identifier of the reset controller used in the SCMI protocol

> >   * @asserted:  Reset control state: true if asserted, false if desasserted

> >   */

> >  struct sandbox_scmi_reset {

> > @@ -48,8 +49,8 @@ struct sandbox_scmi_voltd {

> >   * @idx:       Identifier for the SCMI agent, its index

> >   * @clk:       Simulated clocks

> >   * @clk_count: Simulated clocks array size

> > - * @clk:       Simulated reset domains

> > - * @clk_count: Simulated reset domains array size

> > + * @reset:     Simulated reset domains

> > + * @reset_count: Simulated reset domains array size

> >   * @voltd:      Simulated voltage domains (regulators)

> >   * @voltd_count: Simulated voltage domains array size

> >   */

> > diff --git a/drivers/firmware/scmi/sandbox-scmi_agent.c b/drivers/firmware/scmi/sandbox-scmi_agent.c

> > index 3eafc49bd..56125a57b 100644

> > --- a/drivers/firmware/scmi/sandbox-scmi_agent.c

> > +++ b/drivers/firmware/scmi/sandbox-scmi_agent.c

> > @@ -18,7 +18,7 @@

> >   * processing. It simulates few of the SCMI services for some of the

> >   * SCMI protocols embedded in U-Boot. Currently:

> >   * - SCMI clock protocol: emulate 2 agents each exposing few clocks

> > - * - SCMI reset protocol: emulate 1 agents each exposing a reset

> > + * - SCMI reset protocol: emulate 1 agent exposing a reset controller

> >   * - SCMI voltage domain protocol: emulate 1 agent exposing 2 regulators

> >   *

> >   * Agent #0 simulates 2 clocks, 1 reset domain and 1 voltage domain.

> > @@ -29,7 +29,7 @@

> >   *

> >   * All clocks and regulators are default disabled and reset controller down.

> >   *

> > - * This Driver exports sandbox_scmi_service_ct() for the test sequence to

> > + * This Driver exports sandbox_scmi_service_ctx() for the test sequence to

> >   * get the state of the simulated services (clock state, rate, ...) and

> >   * check back-end device state reflects the request send through the

> >   * various uclass devices, as clocks and reset controllers.

> > diff --git a/test/dm/scmi.c b/test/dm/scmi.c

> > index f21a3ff97..cc611c1e0 100644

> > --- a/test/dm/scmi.c

> > +++ b/test/dm/scmi.c

> > @@ -57,18 +57,24 @@ static int ut_assert_scmi_state_postprobe(struct unit_test_state *uts,

> >         ut_asserteq(2, scmi_ctx->agent_count);

> >

> >         ut_assertnonnull(scmi_ctx->agent[0]);

> > -       ut_asserteq(2, scmi_ctx->agent[0]->clk_count);

> > -       ut_assertnonnull(scmi_ctx->agent[0]->clk);

> > -       ut_asserteq(1, scmi_ctx->agent[0]->reset_count);

> > -       ut_assertnonnull(scmi_ctx->agent[0]->reset);

> > +       if (IS_ENABLED(CONFIG_CLK_SCMI)) {

>

> Why are these needed? Are these options not enabled on sandbox? The

> goal is to test all the code, not part of it.


I thought this source file should be flexible to adapt to
configuration in case one changes it for some tests.
I saw a few other occurrences in the test/dm/*. But looking again it's
true there are very very few, almost none.

Fair, i'll discard these config tests in my patch series and post a v2.

Thanks,
Etienne

>

> > +               ut_asserteq(2, scmi_ctx->agent[0]->clk_count);

> > +               ut_assertnonnull(scmi_ctx->agent[0]->clk);

> > +       }

> > +       if (IS_ENABLED(CONFIG_RESET_SCMI)) {

> > +               ut_asserteq(1, scmi_ctx->agent[0]->reset_count);

> > +               ut_assertnonnull(scmi_ctx->agent[0]->reset);

> > +       }

> >         if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)) {

> >                 ut_asserteq(2, scmi_ctx->agent[0]->voltd_count);

> >                 ut_assertnonnull(scmi_ctx->agent[0]->voltd);

> >         }

> >

> >         ut_assertnonnull(scmi_ctx->agent[1]);

> > -       ut_assertnonnull(scmi_ctx->agent[1]->clk);

> > -       ut_asserteq(1, scmi_ctx->agent[1]->clk_count);

> > +       if (IS_ENABLED(CONFIG_CLK_SCMI)) {

> > +               ut_assertnonnull(scmi_ctx->agent[1]->clk);

> > +               ut_asserteq(1, scmi_ctx->agent[1]->clk_count);

> > +       }

> >

>

> Regards,

> Simon
diff mbox series

Patch

diff --git a/arch/sandbox/include/asm/scmi_test.h b/arch/sandbox/include/asm/scmi_test.h
index 9b7031531..2930e686d 100644
--- a/arch/sandbox/include/asm/scmi_test.h
+++ b/arch/sandbox/include/asm/scmi_test.h
@@ -24,6 +24,7 @@  struct sandbox_scmi_clk {
 
 /**
  * struct sandbox_scmi_reset - Simulated reset controller exposed by SCMI
+ * @id:		Identifier of the reset controller used in the SCMI protocol
  * @asserted:	Reset control state: true if asserted, false if desasserted
  */
 struct sandbox_scmi_reset {
@@ -48,8 +49,8 @@  struct sandbox_scmi_voltd {
  * @idx:	Identifier for the SCMI agent, its index
  * @clk:	Simulated clocks
  * @clk_count:	Simulated clocks array size
- * @clk:	Simulated reset domains
- * @clk_count:	Simulated reset domains array size
+ * @reset:	Simulated reset domains
+ * @reset_count: Simulated reset domains array size
  * @voltd:	 Simulated voltage domains (regulators)
  * @voltd_count: Simulated voltage domains array size
  */
diff --git a/drivers/firmware/scmi/sandbox-scmi_agent.c b/drivers/firmware/scmi/sandbox-scmi_agent.c
index 3eafc49bd..56125a57b 100644
--- a/drivers/firmware/scmi/sandbox-scmi_agent.c
+++ b/drivers/firmware/scmi/sandbox-scmi_agent.c
@@ -18,7 +18,7 @@ 
  * processing. It simulates few of the SCMI services for some of the
  * SCMI protocols embedded in U-Boot. Currently:
  * - SCMI clock protocol: emulate 2 agents each exposing few clocks
- * - SCMI reset protocol: emulate 1 agents each exposing a reset
+ * - SCMI reset protocol: emulate 1 agent exposing a reset controller
  * - SCMI voltage domain protocol: emulate 1 agent exposing 2 regulators
  *
  * Agent #0 simulates 2 clocks, 1 reset domain and 1 voltage domain.
@@ -29,7 +29,7 @@ 
  *
  * All clocks and regulators are default disabled and reset controller down.
  *
- * This Driver exports sandbox_scmi_service_ct() for the test sequence to
+ * This Driver exports sandbox_scmi_service_ctx() for the test sequence to
  * get the state of the simulated services (clock state, rate, ...) and
  * check back-end device state reflects the request send through the
  * various uclass devices, as clocks and reset controllers.
diff --git a/test/dm/scmi.c b/test/dm/scmi.c
index f21a3ff97..cc611c1e0 100644
--- a/test/dm/scmi.c
+++ b/test/dm/scmi.c
@@ -57,18 +57,24 @@  static int ut_assert_scmi_state_postprobe(struct unit_test_state *uts,
 	ut_asserteq(2, scmi_ctx->agent_count);
 
 	ut_assertnonnull(scmi_ctx->agent[0]);
-	ut_asserteq(2, scmi_ctx->agent[0]->clk_count);
-	ut_assertnonnull(scmi_ctx->agent[0]->clk);
-	ut_asserteq(1, scmi_ctx->agent[0]->reset_count);
-	ut_assertnonnull(scmi_ctx->agent[0]->reset);
+	if (IS_ENABLED(CONFIG_CLK_SCMI)) {
+		ut_asserteq(2, scmi_ctx->agent[0]->clk_count);
+		ut_assertnonnull(scmi_ctx->agent[0]->clk);
+	}
+	if (IS_ENABLED(CONFIG_RESET_SCMI)) {
+		ut_asserteq(1, scmi_ctx->agent[0]->reset_count);
+		ut_assertnonnull(scmi_ctx->agent[0]->reset);
+	}
 	if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)) {
 		ut_asserteq(2, scmi_ctx->agent[0]->voltd_count);
 		ut_assertnonnull(scmi_ctx->agent[0]->voltd);
 	}
 
 	ut_assertnonnull(scmi_ctx->agent[1]);
-	ut_assertnonnull(scmi_ctx->agent[1]->clk);
-	ut_asserteq(1, scmi_ctx->agent[1]->clk_count);
+	if (IS_ENABLED(CONFIG_CLK_SCMI)) {
+		ut_assertnonnull(scmi_ctx->agent[1]->clk);
+		ut_asserteq(1, scmi_ctx->agent[1]->clk_count);
+	}
 
 	return 0;
 }
@@ -113,7 +119,6 @@  static int dm_test_scmi_sandbox_agent(struct unit_test_state *uts)
 
 	return ret;
 }
-
 DM_TEST(dm_test_scmi_sandbox_agent, UT_TESTF_SCAN_FDT);
 
 static int dm_test_scmi_clocks(struct unit_test_state *uts)
@@ -175,7 +180,6 @@  static int dm_test_scmi_clocks(struct unit_test_state *uts)
 
 	return release_sandbox_scmi_test_devices(uts, dev);
 }
-
 DM_TEST(dm_test_scmi_clocks, UT_TESTF_SCAN_FDT);
 
 static int dm_test_scmi_resets(struct unit_test_state *uts)
@@ -206,7 +210,6 @@  static int dm_test_scmi_resets(struct unit_test_state *uts)
 
 	return release_sandbox_scmi_test_devices(uts, dev);
 }
-
 DM_TEST(dm_test_scmi_resets, UT_TESTF_SCAN_FDT);
 
 static int dm_test_scmi_voltage_domains(struct unit_test_state *uts)