[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5306BFC4.5000005@elopez.com.ar>
Date: Thu, 20 Feb 2014 23:53:56 -0300
From: Emilio López <emilio@...pez.com.ar>
To: Bjorn Andersson <bjorn.andersson@...ymobile.com>
CC: Rob Herring <robh+dt@...nel.org>, Pawel Moll <pawel.moll@....com>,
Mark Rutland <mark.rutland@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
Rob Landley <rob@...dley.net>,
Wolfram Sang <wsa@...-dreams.de>,
Grant Likely <grant.likely@...aro.org>,
devicetree@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-i2c@...r.kernel.org,
linux-arm-msm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Stephen Boyd <sboyd@...eaurora.org>,
"Ivan T. Ivanov" <iivanov@...sol.com>,
Andy Gross <agross@...eaurora.org>
Subject: Re: [PATCH v3 2/2] i2c: New bus driver for the Qualcomm QUP I2C controller
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@...eaurora.org>
> Cc: Stephen Boyd <sboyd@...eaurora.org>
> Signed-off-by: Ivan T. Ivanov <iivanov@...sol.com>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@...ymobile.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists