From patchwork Mon Jul 23 20:03:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 1228761 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 611053FD4F for ; Mon, 23 Jul 2012 20:08:17 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1StOrf-00007e-Ui; Mon, 23 Jul 2012 20:04:24 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1StOrO-00007Q-2X for linux-arm-kernel@lists.infradead.org; Mon, 23 Jul 2012 20:04:09 +0000 Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:21e:67ff:fe11:9c5c]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1StOrH-0007ve-VX; Mon, 23 Jul 2012 22:03:59 +0200 Received: from wsa by dude.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1StOrH-0004AT-7y; Mon, 23 Jul 2012 22:03:59 +0200 Date: Mon, 23 Jul 2012 22:03:59 +0200 From: Wolfram Sang To: Andrew Lunn Subject: Re: [PATCH] I2C: MV64XYZ: Add Device Tree support Message-ID: <20120723200359.GB31645@pengutronix.de> References: <1342954295-13279-1-git-send-email-andrew@lunn.ch> MIME-Version: 1.0 In-Reply-To: <1342954295-13279-1-git-send-email-andrew@lunn.ch> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:6f8:1178:2:21e:67ff:fe11:9c5c X-SA-Exim-Mail-From: wsa@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: sebastian.hesselbarth@googlemail.com, linux-i2c@vger.kernel.org, linux ARM X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Sun, Jul 22, 2012 at 12:51:35PM +0200, Andrew Lunn wrote: > Extends the driver to get properties from device tree. Rather than > pass the N & M factors in DT, use the more standard clock-frequency > property. Calculate N & M at run time. In order to do this, we need to > know tclk. So the driver uses clk_get() etc in order to get the clock > and clk_get_rate() to determine the tclk rate. Not all platforms > however have CLK, so some #ifdefery is needed to ensure the driver > still compiles when CLK is not available. > > Signed-off-by: Andrew Lunn Sparse complained about this: drivers/i2c/busses/i2c-mv64xxx.c:584:54: warning: incorrect type in argument 3 (different signedness) drivers/i2c/busses/i2c-mv64xxx.c:584:54: expected unsigned int [usertype] *out_value drivers/i2c/busses/i2c-mv64xxx.c:584:54: got int * drivers/i2c/busses/i2c-mv64xxx.c:586:41: warning: incorrect type in argument 3 (different signedness) drivers/i2c/busses/i2c-mv64xxx.c:586:41: expected int *best_n drivers/i2c/busses/i2c-mv64xxx.c:586:41: got unsigned int * drivers/i2c/busses/i2c-mv64xxx.c:586:60: warning: incorrect type in argument 4 (different signedness) drivers/i2c/busses/i2c-mv64xxx.c:586:60: expected int *best_m drivers/i2c/busses/i2c-mv64xxx.c:586:60: got unsigned int * I applied your patch with the following fix to -next. Let me know if you agree with that. Regards, Wolfram --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -537,8 +537,8 @@ mv64xxx_calc_freq(const int tclk, const int n, const int m) } static bool __devinit -mv64xxx_find_baud_factors(const int req_freq, const int tclk, int *best_n, - int *best_m) +mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n, + u32 *best_m) { int freq, delta, best_delta = INT_MAX; int m, n; @@ -564,8 +564,7 @@ static int __devinit mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, struct device_node *np) { - int bus_freq; - int tclk; + u32 bus_freq, tclk; int rc = 0; /* CLK is mandatory when using DT to describe the i2c bus. We