All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: Jolly Shah <jolly.shah@xilinx.com>
Cc: "ard.biesheuvel@linaro.org" <ard.biesheuvel@linaro.org>,
	Ingo Molnar <mingo@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	matt@codeblueprint.co.uk, Sudeep Holla <sudeep.holla@arm.com>,
	hkallweit1@gmail.com, Kees Cook <keescook@chromium.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Michal Simek <michal.simek@xilinx.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-clk <linux-clk@vger.kernel.org>,
	rajanv@xilinx.com,
	Linux ARM Mailing List <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	DTML <devicetree@vger.kernel.org>, Jolly Shah <jollys@xilinx.com>
Subject: Re: [PATCH v11 08/11] firmware: xilinx: Add debugfs for query data API
Date: Sat, 8 Sep 2018 18:15:11 -0700	[thread overview]
Message-ID: <CAOesGMjMcznFAQj0L-=J5+gJ5ENsdejqP2SdYomu=C9bJqG+YQ@mail.gmail.com> (raw)
In-Reply-To: <1533318808-10781-9-git-send-email-jollys@xilinx.com>

Hi,

I noticed the below when I was reviewing the code for merge into
arm-soc. Would you mind following up with an incremental patch? I
don't think we need to ask Michal to respin for this:

On Fri, Aug 3, 2018 at 10:53 AM, Jolly Shah <jolly.shah@xilinx.com> wrote:
> From: Rajan Vaja <rajanv@xilinx.com>
>
> Add debugfs file to query platform specific data from firmware
> using debugfs interface.
>
> Signed-off-by: Rajan Vaja <rajanv@xilinx.com>
> Signed-off-by: Jolly Shah <jollys@xilinx.com>
> ---
>  drivers/firmware/xilinx/zynqmp-debug.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/drivers/firmware/xilinx/zynqmp-debug.c b/drivers/firmware/xilinx/zynqmp-debug.c
> index fc11db9..4532bd0 100644
> --- a/drivers/firmware/xilinx/zynqmp-debug.c
> +++ b/drivers/firmware/xilinx/zynqmp-debug.c
> @@ -33,6 +33,7 @@ static char debugfs_buf[PAGE_SIZE];
>  static struct pm_api_info pm_api_list[] = {
>         PM_API(PM_GET_API_VERSION),
>         PM_API(PM_IOCTL),
> +       PM_API(PM_QUERY_DATA),
>  };
>
>  /**
> @@ -105,6 +106,32 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
>                         sprintf(debugfs_buf, "IOCTL return value: %u\n",
>                                 pm_api_ret[1]);
>                 break;
> +       case PM_QUERY_DATA:
> +       {
> +               struct zynqmp_pm_query_data qdata = {0};
> +
> +               qdata.qid = pm_api_arg[0];
> +               qdata.arg1 = pm_api_arg[1];
> +               qdata.arg2 = pm_api_arg[2];
> +               qdata.arg3 = pm_api_arg[3];

This is usually a pattern we try to avoid (having full code blocks in
a switch statement, and local variables).

Please move the declaration of qdata to the top of the function so you
can drop the braces.

> +
> +               ret = eemi_ops->query_data(qdata, pm_api_ret);
> +               if (ret)
> +                       break;
> +
> +               if (qdata.qid == PM_QID_CLOCK_GET_NAME)
> +                       sprintf(debugfs_buf, "Clock name = %s\n",
> +                               (char *)pm_api_ret);
> +               else if (qdata.qid == PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS)
> +                       sprintf(debugfs_buf, "Multiplier = %d, Divider = %d\n",
> +                               pm_api_ret[1], pm_api_ret[2]);
> +               else
> +                       sprintf(debugfs_buf,
> +                               "data[0] = 0x%08x\ndata[1] = 0x%08x\n data[2] = 0x%08x\ndata[3] = 0x%08x\n",
> +                               pm_api_ret[0], pm_api_ret[1],
> +                               pm_api_ret[2], pm_api_ret[3]);

If you anticipate more qids here later, a switch could be nicer than a
sequence of if/else.



-Olof

WARNING: multiple messages have this Message-ID (diff)
From: olof@lixom.net (Olof Johansson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v11 08/11] firmware: xilinx: Add debugfs for query data API
Date: Sat, 8 Sep 2018 18:15:11 -0700	[thread overview]
Message-ID: <CAOesGMjMcznFAQj0L-=J5+gJ5ENsdejqP2SdYomu=C9bJqG+YQ@mail.gmail.com> (raw)
In-Reply-To: <1533318808-10781-9-git-send-email-jollys@xilinx.com>

Hi,

I noticed the below when I was reviewing the code for merge into
arm-soc. Would you mind following up with an incremental patch? I
don't think we need to ask Michal to respin for this:

On Fri, Aug 3, 2018 at 10:53 AM, Jolly Shah <jolly.shah@xilinx.com> wrote:
> From: Rajan Vaja <rajanv@xilinx.com>
>
> Add debugfs file to query platform specific data from firmware
> using debugfs interface.
>
> Signed-off-by: Rajan Vaja <rajanv@xilinx.com>
> Signed-off-by: Jolly Shah <jollys@xilinx.com>
> ---
>  drivers/firmware/xilinx/zynqmp-debug.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/drivers/firmware/xilinx/zynqmp-debug.c b/drivers/firmware/xilinx/zynqmp-debug.c
> index fc11db9..4532bd0 100644
> --- a/drivers/firmware/xilinx/zynqmp-debug.c
> +++ b/drivers/firmware/xilinx/zynqmp-debug.c
> @@ -33,6 +33,7 @@ static char debugfs_buf[PAGE_SIZE];
>  static struct pm_api_info pm_api_list[] = {
>         PM_API(PM_GET_API_VERSION),
>         PM_API(PM_IOCTL),
> +       PM_API(PM_QUERY_DATA),
>  };
>
>  /**
> @@ -105,6 +106,32 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
>                         sprintf(debugfs_buf, "IOCTL return value: %u\n",
>                                 pm_api_ret[1]);
>                 break;
> +       case PM_QUERY_DATA:
> +       {
> +               struct zynqmp_pm_query_data qdata = {0};
> +
> +               qdata.qid = pm_api_arg[0];
> +               qdata.arg1 = pm_api_arg[1];
> +               qdata.arg2 = pm_api_arg[2];
> +               qdata.arg3 = pm_api_arg[3];

This is usually a pattern we try to avoid (having full code blocks in
a switch statement, and local variables).

Please move the declaration of qdata to the top of the function so you
can drop the braces.

> +
> +               ret = eemi_ops->query_data(qdata, pm_api_ret);
> +               if (ret)
> +                       break;
> +
> +               if (qdata.qid == PM_QID_CLOCK_GET_NAME)
> +                       sprintf(debugfs_buf, "Clock name = %s\n",
> +                               (char *)pm_api_ret);
> +               else if (qdata.qid == PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS)
> +                       sprintf(debugfs_buf, "Multiplier = %d, Divider = %d\n",
> +                               pm_api_ret[1], pm_api_ret[2]);
> +               else
> +                       sprintf(debugfs_buf,
> +                               "data[0] = 0x%08x\ndata[1] = 0x%08x\n data[2] = 0x%08x\ndata[3] = 0x%08x\n",
> +                               pm_api_ret[0], pm_api_ret[1],
> +                               pm_api_ret[2], pm_api_ret[3]);

If you anticipate more qids here later, a switch could be nicer than a
sequence of if/else.



-Olof

  reply	other threads:[~2018-09-09  1:15 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03 17:53 [PATCH v11 00/11] drivers: Introduce firmware dnd clock river for ZynqMP core Jolly Shah
2018-08-03 17:53 ` Jolly Shah
2018-08-03 17:53 ` Jolly Shah
2018-08-03 17:53 ` [PATCH v11 01/11] dt-bindings: firmware: Add bindings for ZynqMP firmware Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53 ` [PATCH v11 02/11] firmware: xilinx: Add Zynqmp firmware driver Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53 ` [PATCH v11 03/11] firmware: xilinx: Add zynqmp IOCTL API for device control Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-09-09  1:18   ` Olof Johansson
2018-09-09  1:18     ` Olof Johansson
2018-09-09 19:20     ` Moritz Fischer
2018-09-09 19:20       ` Moritz Fischer
2018-09-10 12:35       ` Michal Simek
2018-09-10 12:35         ` Michal Simek
2018-09-10 12:35         ` Michal Simek
2018-09-10  8:43     ` Sudeep Holla
2018-09-10  8:43       ` Sudeep Holla
2018-09-10 12:34     ` Michal Simek
2018-09-10 12:34       ` Michal Simek
2018-09-10 12:34       ` Michal Simek
2018-09-10 19:17     ` Jolly Shah
2018-09-10 19:17       ` Jolly Shah
2018-09-10 19:17       ` Jolly Shah
2018-09-10 19:17       ` Jolly Shah
2018-09-11 10:02       ` Sudeep Holla
2018-09-11 10:02         ` Sudeep Holla
2018-09-11 10:02         ` Sudeep Holla
2018-09-11 15:03       ` Olof Johansson
2018-09-11 15:03         ` Olof Johansson
2018-09-11 15:03         ` Olof Johansson
2018-09-11 15:03         ` Olof Johansson
2018-09-11 19:20         ` Jolly Shah
2018-09-11 19:20           ` Jolly Shah
2018-09-11 19:20           ` Jolly Shah
2018-09-11 19:20           ` Jolly Shah
2018-09-23 13:10           ` Olof Johansson
2018-09-23 13:10             ` Olof Johansson
2018-09-23 13:10             ` Olof Johansson
2018-09-23 13:10             ` Olof Johansson
2018-09-24 18:26             ` Jolly Shah
2018-09-24 18:26               ` Jolly Shah
2018-09-24 18:26               ` Jolly Shah
2018-09-24 18:26               ` Jolly Shah
2018-08-03 17:53 ` [PATCH v11 04/11] firmware: xilinx: Add query data API Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53 ` [PATCH v11 05/11] firmware: xilinx: Add clock APIs Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53 ` [PATCH v11 06/11] firmware: xilinx: Add debugfs interface Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53 ` [PATCH v11 07/11] firmware: xilinx: Add debugfs for IOCTL API Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53 ` [PATCH v11 08/11] firmware: xilinx: Add debugfs for query data API Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-09-09  1:15   ` Olof Johansson [this message]
2018-09-09  1:15     ` Olof Johansson
2018-09-10 19:19     ` Jolly Shah
2018-09-10 19:19       ` Jolly Shah
2018-09-10 19:19       ` Jolly Shah
2018-09-10 19:19       ` Jolly Shah
2018-08-03 17:53 ` [PATCH v11 09/11] dt-bindings: clock: Add bindings for ZynqMP clock driver Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53 ` [PATCH v11 10/11] drivers: clk: Add " Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53 ` [PATCH v11 11/11] firmware: xilinx: Replace init call with probe method Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-03 17:53   ` Jolly Shah
2018-08-24 22:04 ` [PATCH v11 00/11] drivers: Introduce firmware dnd clock river for ZynqMP core Jolly Shah
2018-08-24 22:04   ` Jolly Shah
2018-08-24 22:04   ` Jolly Shah
2018-08-24 22:04   ` Jolly Shah

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='CAOesGMjMcznFAQj0L-=J5+gJ5ENsdejqP2SdYomu=C9bJqG+YQ@mail.gmail.com' \
    --to=olof@lixom.net \
    --cc=ard.biesheuvel@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hkallweit1@gmail.com \
    --cc=jolly.shah@xilinx.com \
    --cc=jollys@xilinx.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matt@codeblueprint.co.uk \
    --cc=michal.simek@xilinx.com \
    --cc=mingo@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=rajanv@xilinx.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=sudeep.holla@arm.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.