public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: emilio@elopez•com.ar (Emilio López)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v3 2/2] i2c: New bus driver for the Qualcomm QUP I2C controller
Date: Thu, 20 Feb 2014 23:53:56 -0300	[thread overview]
Message-ID: <5306BFC4.5000005@elopez.com.ar> (raw)
In-Reply-To: <1392943090-30556-3-git-send-email-bjorn.andersson@sonymobile.com>

Hi Bjorn,

El 20/02/14 21:38, Bjorn Andersson escribi?:
> This bus driver supports the QUP i2c hardware controller in the Qualcomm SOCs.
> The Qualcomm Universal Peripheral Engine (QUP) is a general purpose data path
> engine with input/output FIFOs and an embedded i2c mini-core. The driver
> supports FIFO mode (for low bandwidth applications) and block mode (interrupt
> generated for each block-size data transfer).
>
> Cc: Andy Gross <agross@codeaurora•org>
> Cc: Stephen Boyd <sboyd@codeaurora•org>
> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol•com>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile•com>
> ---

I'm not familiar with the subsystem nor the hardware, so I had a look 
around for general stuff. I have some minor comments to make on the 
probe code.

(snip)
> +static int qup_i2c_probe(struct platform_device *pdev)
> +{
> +	static const int blk_sizes[] = {4, 16, 32};
> +	struct device_node *node = pdev->dev.of_node;
> +	struct qup_i2c_dev *qup;
> +	unsigned long one_bit_t;
> +	struct resource *res;
> +	u32 val, io_mode, hw_ver, size;
> +	int ret, fs_div, hs_div;
> +	int src_clk_freq;
> +	int clk_freq;
> +
> +	qup = devm_kzalloc(&pdev->dev, sizeof(*qup), GFP_KERNEL);
> +	if (!qup)
> +		return -ENOMEM;
> +
> +	qup->dev = &pdev->dev;
> +	init_completion(&qup->xfer);
> +	platform_set_drvdata(pdev, qup);
> +
> +	clk_freq = 100000;
> +	if (!of_property_read_u32(node, "clock-frequency", &val))
> +		clk_freq = val;

val will be modified only if no error occurs, so you may rewrite this 
bit as

+	u32 clk_freq = 100000;
...
+	of_property_read_u32(node, "clock-frequency", &clk_freq)

> +
> +	/* We support frequencies up to FAST Mode (400KHz) */
> +	if (clk_freq <= 0 || clk_freq > 400000) {

And you can drop the < check when it's unsigned.

> +		dev_err(qup->dev, "clock frequency not supported %d\n",
> +			clk_freq);
> +		return -EIO;

EIO?

Cheers,

Emilio

  parent reply	other threads:[~2014-02-21  2:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-21  0:38 [PATCH v3 0/2] Qualcomm Universal Peripheral (QUP) I2C controller Bjorn Andersson
2014-02-21  0:38 ` [PATCH v3 1/2] i2c: qup: Add device tree bindings information Bjorn Andersson
2014-02-21 11:01   ` Mark Rutland
2014-02-21  0:38 ` [PATCH v3 2/2] i2c: New bus driver for the Qualcomm QUP I2C controller Bjorn Andersson
2014-02-21  0:52   ` Joe Perches
2014-02-24 17:51     ` Bjorn Andersson
2014-02-21  2:53   ` Emilio López [this message]
2014-02-24 18:00     ` Bjorn Andersson
2014-02-21  8:16   ` Maxime Ripard
2014-02-24 18:03     ` Bjorn Andersson
2014-02-21 11:06   ` Mark Rutland
2014-02-25 16:07     ` Bjorn Andersson
2014-02-25 16:56       ` Andy Gross
2014-02-21 15:35   ` Kumar Gala
2014-02-24 10:33     ` Ivan T. Ivanov
2014-02-24 17:40       ` Josh Cartwright
2014-02-24 18:05         ` Bjorn Andersson
2014-03-05 16:44   ` Wolfram Sang

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=5306BFC4.5000005@elopez.com.ar \
    --to=emilio@elopez$(echo .)com.ar \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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