mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "J. German Rivera" <German.Rivera@freescale.com>
Cc: gregkh@linuxfoundation.org, arnd@arndb.de,
	linux-kernel@vger.kernel.org, stuart.yoder@freescale.com,
	Kim.Phillips@freescale.com, scottwood@freescale.com,
	agraf@suse.de, linuxppc-release@linux.freescale.net
Subject: Re: [PATCH 1/4] drivers/bus: Added Freescale Management Complex APIs
Date: Thu, 11 Sep 2014 11:45:16 -0700	[thread overview]
Message-ID: <1410461116.9942.15.camel@joe-AO725> (raw)
In-Reply-To: <1410456864-27890-2-git-send-email-German.Rivera@freescale.com>

On Thu, 2014-09-11 at 12:34 -0500, J. German Rivera wrote:
> APIs to access the Management Complex (MC) hardware
> module of Freescale LS2 SoCs. This patch includes
> APIs to check the MC firmware version and to manipulate
> DPRC objects in the MC.

> diff --git a/drivers/bus/fsl-mc/dpmng.c b/drivers/bus/fsl-mc/dpmng.c
[]
> +int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info)
> +{
> +	struct mc_command cmd = { 0 };
> +	int err;
> +
> +	cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION,
> +					  DPMNG_CMDSZ_GET_VERSION,
> +					  MC_CMD_PRI_LOW, 0);
> +
> +	err = mc_send_command(mc_io, &cmd);
> +	if (!err)
> +		DPMNG_RSP_GET_VERSION(cmd, mc_ver_info);
> +
> +	return err;

I think it better style to read when the
failure case is handled immediately by
a return or a "goto out" and the successful
case code is at the same indent level

	err = mc_send_command_(etc...)
	if (err)
		return err;

	DPMNG_RSP_GET_VERSION(cmd, mc_ver_info);

	return 0;
}

> diff --git a/drivers/bus/fsl-mc/dprc.c b/drivers/bus/fsl-mc/dprc.c

> +int dprc_get_container_id(struct fsl_mc_io *mc_io, int *container_id)
> +{
> +	struct mc_command cmd = { 0 };
> +	int err;
> +
> +	cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONT_ID,
> +					  DPRC_CMDSZ_GET_CONT_ID,
> +					  MC_CMD_PRI_LOW, 0);
> +
> +	err = mc_send_command(mc_io, &cmd);
> +	if (!err)
> +		DPRC_RSP_GET_CONTAINER_ID(cmd, *container_id);
> +
> +	return err;
> +}

Same sort of thing as above.
Actively fail on err and proceed at the same indent
level on success.

> +
> +int dprc_open(struct fsl_mc_io *mc_io, int container_id, uint16_t *dprc_handle)
> +{
> +	int err;
> +	struct mc_command cmd = { 0 };
> +
> +	cmd.header = mc_encode_cmd_header(MC_DPRC_CMDID_OPEN,
> +					  MC_CMD_OPEN_SIZE, MC_CMD_PRI_LOW, 0);
> +
> +	DPRC_CMD_OPEN(cmd, container_id);
> +
> +	err = mc_send_command(mc_io, &cmd);
> +	if (!err)
> +		*dprc_handle = MC_CMD_HDR_READ_AUTHID(cmd.header);
> +
> +	return err;
> +}

etc.

I didn't read any more.


  reply	other threads:[~2014-09-11 18:45 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 17:34 [PATCH 0/4] drivers/bus: Freescale Management Complex bus driver patch series J. German Rivera
2014-09-11 17:34 ` [PATCH 1/4] drivers/bus: Added Freescale Management Complex APIs J. German Rivera
2014-09-11 18:45   ` Joe Perches [this message]
2014-09-17 16:35     ` German Rivera
2014-09-15 23:44   ` Kim Phillips
2014-09-16  4:31     ` Scott Wood
2014-09-16 19:28       ` Kim Phillips
2014-09-16 19:58         ` Scott Wood
2014-09-18  4:17     ` German Rivera
2014-09-18 13:14       ` Alexander Graf
2014-09-18 20:22         ` Kim Phillips
2014-09-18 23:03           ` Scott Wood
2014-09-18 23:13           ` Stuart Yoder
2014-09-18 23:29             ` Scott Wood
2014-09-18 23:46               ` Stuart Yoder
2014-09-19  3:05           ` German Rivera
2014-09-19 17:19             ` Kim Phillips
2014-09-19 19:06               ` Stuart Yoder
2014-09-19 20:24                 ` Kim Phillips
2014-09-19 20:32                   ` Alexander Graf
2014-09-19 20:41                     ` Scott Wood
2014-09-19 21:46                       ` Alexander Graf
2014-09-20 15:36                         ` Stuart Yoder
2014-09-19 21:37                     ` Stuart Yoder
2014-09-19 21:30                   ` Stuart Yoder
2014-09-19  0:18         ` Stuart Yoder
2014-09-19  2:34         ` German Rivera
2014-09-19 18:25         ` Stuart Yoder
2014-09-19 20:58           ` Kim Phillips
2014-09-22 14:42             ` Stuart Yoder
2014-09-22 14:57               ` <gregkh@linuxfoundation.org>
2014-09-22 15:01                 ` Stuart Yoder
2014-09-18 23:39     ` Stuart Yoder
2014-09-18 23:53       ` Scott Wood
2014-09-11 17:34 ` [PATCH 2/4] drivers/bus: Freescale Management Complex (fsl-mc) bus driver J. German Rivera
2014-09-11 18:49   ` Joe Perches
2014-09-17 23:50     ` German Rivera
2014-09-11 17:34 ` [PATCH 3/4] drivers/bus: Device driver for FSL-MC DPRC devices J. German Rivera
2014-09-11 17:34 ` [PATCH 4/4] Update MAINTAINERS file J. German Rivera
2014-09-15 23:44 ` [PATCH 0/4] drivers/bus: Freescale Management Complex bus driver patch series Kim Phillips
2014-09-18  0:20   ` German Rivera
2014-09-18 12:58     ` Alexander Graf
2014-09-19  0:31       ` German Rivera

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=1410461116.9942.15.camel@joe-AO725 \
    --to=joe@perches.com \
    --cc=German.Rivera@freescale.com \
    --cc=Kim.Phillips@freescale.com \
    --cc=agraf@suse.de \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-release@linux.freescale.net \
    --cc=scottwood@freescale.com \
    --cc=stuart.yoder@freescale.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®