All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
To: Andy Gross <agross@codeaurora.org>
Cc: "linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Kumar Gala <galak@codeaurora.org>,
	"linux-soc@vger.kernel.org" <linux-soc@vger.kernel.org>
Subject: Re: [PATCH 1/6] soc: qcom: gsbi: Add support for ADM CRCI muxing
Date: Tue, 27 Jan 2015 19:11:50 -0800	[thread overview]
Message-ID: <20150128031149.GM11960@sonymobile.com> (raw)
In-Reply-To: <1422396644-21714-2-git-send-email-agross@codeaurora.org>

On Tue 27 Jan 14:10 PST 2015, Andy Gross wrote:

This solution looks good, just some style things.

> diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c
[..]
> +#define MAX_GSBI		12
> +
> +#define TCSR_ADM_CRCI_BASE	0x70
> +
> +struct crci_config {
> +	u32 num_rows;
> +	const u32 *array;

Making this:
 const u32 (*array)[MAX_GSBI];

> +};
> +
> +static const u32 crci_ipq8064[][MAX_GSBI] = {
> +	{
> +		0x000003, 0x00000c, 0x000030, 0x0000c0,
> +		0x000300, 0x000c00, 0x003000, 0x00c000,
> +		0x030000, 0x0c0000, 0x300000, 0xc00000
> +	},
> +	{
> +		0x000003, 0x00000c, 0x000030, 0x0000c0,
> +		0x000300, 0x000c00, 0x003000, 0x00c000,
> +		0x030000, 0x0c0000, 0x300000, 0xc00000
> +	},
> +};
> +
> +static const struct crci_config config_ipq8064 = {
> +	.num_rows = ARRAY_SIZE(crci_ipq8064),
> +	.array = crci_ipq8064[0],

...so that you can make this:
 .array = crci_ipq8064,

> +};
[..]
> @@ -45,6 +152,20 @@ static int gsbi_probe(struct platform_device *pdev)
[..]
> +	if (config)
> +		for (i = 0; i < config->num_rows; i++) {
> +			if (gsbi->mode == GSBI_PROT_SPI)
> +				val = config->array[i*MAX_GSBI + gsbi_num - 1];

...will give you:
 config->array[i][gsbi_num - 1];

> +			else
> +				val = 0;
> +
> +			regmap_update_bits(gsbi->tcsr,
> +				TCSR_ADM_CRCI_BASE + 0x4*i,
> +				config->array[i*MAX_GSBI + gsbi_num - 1], val);

To me this would be cleaner:

mask = config->array[i][gsbi_num - 1];
if (gsbi->mode == GSBI_PRO_SPI)
	regmap_update_bits(gsbi->tcsr, TCSR_ADM_CRCI_BASE + i * 4, mask, mask);
else
	regmap_update_bits(gsbi->tcsr, TCSR_ADM_CRCI_BASE + i * 4, mask, 0);

> +		}
> +
There should be an extra set of {} around the if statment body.

Regards,
Bjorn

WARNING: multiple messages have this Message-ID (diff)
From: bjorn.andersson@sonymobile.com (Bjorn Andersson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/6] soc: qcom: gsbi: Add support for ADM CRCI muxing
Date: Tue, 27 Jan 2015 19:11:50 -0800	[thread overview]
Message-ID: <20150128031149.GM11960@sonymobile.com> (raw)
In-Reply-To: <1422396644-21714-2-git-send-email-agross@codeaurora.org>

On Tue 27 Jan 14:10 PST 2015, Andy Gross wrote:

This solution looks good, just some style things.

> diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c
[..]
> +#define MAX_GSBI		12
> +
> +#define TCSR_ADM_CRCI_BASE	0x70
> +
> +struct crci_config {
> +	u32 num_rows;
> +	const u32 *array;

Making this:
 const u32 (*array)[MAX_GSBI];

> +};
> +
> +static const u32 crci_ipq8064[][MAX_GSBI] = {
> +	{
> +		0x000003, 0x00000c, 0x000030, 0x0000c0,
> +		0x000300, 0x000c00, 0x003000, 0x00c000,
> +		0x030000, 0x0c0000, 0x300000, 0xc00000
> +	},
> +	{
> +		0x000003, 0x00000c, 0x000030, 0x0000c0,
> +		0x000300, 0x000c00, 0x003000, 0x00c000,
> +		0x030000, 0x0c0000, 0x300000, 0xc00000
> +	},
> +};
> +
> +static const struct crci_config config_ipq8064 = {
> +	.num_rows = ARRAY_SIZE(crci_ipq8064),
> +	.array = crci_ipq8064[0],

...so that you can make this:
 .array = crci_ipq8064,

> +};
[..]
> @@ -45,6 +152,20 @@ static int gsbi_probe(struct platform_device *pdev)
[..]
> +	if (config)
> +		for (i = 0; i < config->num_rows; i++) {
> +			if (gsbi->mode == GSBI_PROT_SPI)
> +				val = config->array[i*MAX_GSBI + gsbi_num - 1];

...will give you:
 config->array[i][gsbi_num - 1];

> +			else
> +				val = 0;
> +
> +			regmap_update_bits(gsbi->tcsr,
> +				TCSR_ADM_CRCI_BASE + 0x4*i,
> +				config->array[i*MAX_GSBI + gsbi_num - 1], val);

To me this would be cleaner:

mask = config->array[i][gsbi_num - 1];
if (gsbi->mode == GSBI_PRO_SPI)
	regmap_update_bits(gsbi->tcsr, TCSR_ADM_CRCI_BASE + i * 4, mask, mask);
else
	regmap_update_bits(gsbi->tcsr, TCSR_ADM_CRCI_BASE + i * 4, mask, 0);

> +		}
> +
There should be an extra set of {} around the if statment body.

Regards,
Bjorn

  reply	other threads:[~2015-01-28  3:11 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27 22:10 [PATCH 0/6] GSBI CRCI Autoconfiguration Support Andy Gross
2015-01-27 22:10 ` Andy Gross
2015-01-27 22:10 ` [PATCH 1/6] soc: qcom: gsbi: Add support for ADM CRCI muxing Andy Gross
2015-01-27 22:10   ` Andy Gross
2015-01-28  3:11   ` Bjorn Andersson [this message]
2015-01-28  3:11     ` Bjorn Andersson
2015-01-28 17:26     ` Andy Gross
2015-01-28 17:26       ` Andy Gross
2015-01-28  9:05   ` Stanimir Varbanov
2015-01-28  9:05     ` Stanimir Varbanov
2015-01-28  9:05     ` Stanimir Varbanov
2015-01-28 17:27     ` Andy Gross
2015-01-28 17:27       ` Andy Gross
2015-01-28 17:27       ` Andy Gross
2015-01-29  2:11   ` Stephen Boyd
2015-01-29  2:11     ` Stephen Boyd
2015-01-29  5:41     ` Andy Gross
2015-01-29  5:41       ` Andy Gross
2015-01-29  6:45       ` Stephen Boyd
2015-01-29  6:45         ` Stephen Boyd
2015-01-27 22:10 ` [PATCH 2/6] mfd: qcom,tcsr: Add device tree binding for TCSR Andy Gross
2015-01-27 22:10   ` Andy Gross
2015-01-27 22:10   ` Andy Gross
     [not found] ` <1422396644-21714-1-git-send-email-agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-01-27 22:10   ` [PATCH 3/6] ARM: DT: apq8064: Add TCSR support Andy Gross
2015-01-27 22:10     ` Andy Gross
2015-01-27 22:10     ` Andy Gross
2015-01-27 22:10 ` [PATCH 4/6] ARM: DT: ipq8064: " Andy Gross
2015-01-27 22:10   ` Andy Gross
2015-01-27 22:10 ` [PATCH 5/6] ARM: DT: msm8660: " Andy Gross
2015-01-27 22:10   ` Andy Gross
2015-01-27 22:10 ` [PATCH 6/6] ARM: DT: msm8960: " Andy Gross
2015-01-27 22:10   ` Andy Gross

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=20150128031149.GM11960@sonymobile.com \
    --to=bjorn.andersson@sonymobile.com \
    --cc=agross@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    /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.