From patchwork Thu May 16 20:38:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 244421 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BC8582C00A7 for ; Fri, 17 May 2013 06:39:01 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751884Ab3EPUjA (ORCPT ); Thu, 16 May 2013 16:39:00 -0400 Received: from caramon.arm.linux.org.uk ([78.32.30.218]:52091 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751481Ab3EPUjA (ORCPT ); Thu, 16 May 2013 16:39:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Date:Sender:Message-Id:Subject:Cc:To:From:References:In-Reply-To; bh=euaXsVdpt+1d9A9xBWxQqyZ+chSJqXPXZAlZvJP0UIw=; b=QRv96Ak8QihzYcbKulxa1sm4e5zIunF4nAs/1455D7W8+8wV7O+MJidY9HEg5f1hUB5Zyi53JGWdP4o7/lYSr5pn54ioLKmQMc7uT78oqnTScV1q8NJwEmn98uVZFc1mgr17JCyZSYdJsPX8YgKXcdOdAsTY01rLnJOi0I+pXUs=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:34852 helo=rmk-PC.arm.linux.org.uk) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1Ud4wG-00081k-I3; Thu, 16 May 2013 21:38:12 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1Ud4wF-0004K5-U1; Thu, 16 May 2013 21:38:11 +0100 In-Reply-To: <20130516202921.GW18614@n2100.arm.linux.org.uk> References: <20130516202921.GW18614@n2100.arm.linux.org.uk> From: Russell King To: linux-arm-kernel@lists.infradead.org Cc: Jason Cooper , Sebastian Hesselbarth , "Mark A. Greer" , Wolfram Sang , "Ben Dooks (embedded platforms)" , linux-i2c@vger.kernel.org Subject: [PATCH 8/9] I2C: mv64xxx: move mv64xxx_i2c_prepare_for_io() Message-Id: Date: Thu, 16 May 2013 21:38:11 +0100 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Move mv64xxx_i2c_prepare_for_io() higher up in the driver to avoid a future forward declaration for this function. Signed-off-by: Russell King --- drivers/i2c/busses/i2c-mv64xxx.c | 52 +++++++++++++++++++------------------- 1 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index d160f8c..7457ef5 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -110,6 +110,32 @@ struct mv64xxx_i2c_data { struct i2c_adapter adapter; }; +static void +mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data, + struct i2c_msg *msg) +{ + u32 dir = 0; + + drv_data->msg = msg; + drv_data->byte_posn = 0; + drv_data->bytes_left = msg->len; + drv_data->aborting = 0; + drv_data->rc = 0; + drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK | + MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN; + + if (msg->flags & I2C_M_RD) + dir = 1; + + if (msg->flags & I2C_M_TEN) { + drv_data->addr1 = 0xf0 | (((u32)msg->addr & 0x300) >> 7) | dir; + drv_data->addr2 = (u32)msg->addr & 0xff; + } else { + drv_data->addr1 = ((u32)msg->addr & 0x7f) << 1 | dir; + drv_data->addr2 = 0; + } +} + /* ***************************************************************************** * @@ -347,32 +373,6 @@ mv64xxx_i2c_intr(int irq, void *dev_id) ***************************************************************************** */ static void -mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data, - struct i2c_msg *msg) -{ - u32 dir = 0; - - drv_data->msg = msg; - drv_data->byte_posn = 0; - drv_data->bytes_left = msg->len; - drv_data->aborting = 0; - drv_data->rc = 0; - drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK | - MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN; - - if (msg->flags & I2C_M_RD) - dir = 1; - - if (msg->flags & I2C_M_TEN) { - drv_data->addr1 = 0xf0 | (((u32)msg->addr & 0x300) >> 7) | dir; - drv_data->addr2 = (u32)msg->addr & 0xff; - } else { - drv_data->addr1 = ((u32)msg->addr & 0x7f) << 1 | dir; - drv_data->addr2 = 0; - } -} - -static void mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data) { long time_left;