{"id":833337,"url":"http://patchwork.ozlabs.org/api/1.2/patches/833337/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-i2c/patch/20171102124731.10484-4-wsa+renesas@sang-engineering.com/","project":{"id":35,"url":"http://patchwork.ozlabs.org/api/1.2/projects/35/?format=json","name":"Linux I2C development","link_name":"linux-i2c","list_id":"linux-i2c.vger.kernel.org","list_email":"linux-i2c@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20171102124731.10484-4-wsa+renesas@sang-engineering.com>","list_archive_url":null,"date":"2017-11-02T12:47:29","name":"[RFT,3/5] i2c: sh_mobile: manually \"inline\" two short functions","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c818bcaa94410250aef430236eee5b60b78fd862","submitter":{"id":69646,"url":"http://patchwork.ozlabs.org/api/1.2/people/69646/?format=json","name":"Wolfram Sang","email":"wsa+renesas@sang-engineering.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-i2c/patch/20171102124731.10484-4-wsa+renesas@sang-engineering.com/mbox/","series":[{"id":11496,"url":"http://patchwork.ozlabs.org/api/1.2/series/11496/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-i2c/list/?series=11496","date":"2017-11-02T12:47:26","name":"i2c: sh_mobile: refactor HW init/deinit","version":1,"mbox":"http://patchwork.ozlabs.org/series/11496/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/833337/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/833337/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-i2c-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3ySPxs2qH1z9sNc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  2 Nov 2017 23:47:45 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1755188AbdKBMrn (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 2 Nov 2017 08:47:43 -0400","from sauhun.de ([88.99.104.3]:33858 \"EHLO pokefinder.org\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1754894AbdKBMrm (ORCPT <rfc822;linux-i2c@vger.kernel.org>);\n\tThu, 2 Nov 2017 08:47:42 -0400","from localhost (p54B33C39.dip0.t-ipconnect.de [84.179.60.57])\n\tby pokefinder.org (Postfix) with ESMTPSA id EBCE32C3230;\n\tThu,  2 Nov 2017 13:47:40 +0100 (CET)"],"From":"Wolfram Sang <wsa+renesas@sang-engineering.com>","To":"linux-i2c@vger.kernel.org","Cc":"linux-renesas-soc@vger.kernel.org,\n\tYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,\n\tJacopo Mondi <jacopo@jmondi.org>,\n\tWolfram Sang <wsa+renesas@sang-engineering.com>","Subject":"[PATCH RFT 3/5] i2c: sh_mobile: manually \"inline\" two short\n\tfunctions","Date":"Thu,  2 Nov 2017 13:47:29 +0100","Message-Id":"<20171102124731.10484-4-wsa+renesas@sang-engineering.com>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20171102124731.10484-1-wsa+renesas@sang-engineering.com>","References":"<20171102124731.10484-1-wsa+renesas@sang-engineering.com>","Sender":"linux-i2c-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-i2c.vger.kernel.org>","X-Mailing-List":"linux-i2c@vger.kernel.org"},"content":"Those two functions are very short and only called once. The code\nbecomes easier to understand if the code is directly put into the main\nxfer function.\n\nSigned-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>\n---\n drivers/i2c/busses/i2c-sh_mobile.c | 28 +++++++++-------------------\n 1 file changed, 9 insertions(+), 19 deletions(-)","diff":"diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c\nindex a1253df9574594..cdd7a746b9d1ed 100644\n--- a/drivers/i2c/busses/i2c-sh_mobile.c\n+++ b/drivers/i2c/busses/i2c-sh_mobile.c\n@@ -298,23 +298,6 @@ static int sh_mobile_i2c_init(struct sh_mobile_i2c_data *pd)\n \treturn 0;\n }\n \n-static void activate_ch(struct sh_mobile_i2c_data *pd)\n-{\n-\t/* Wake up device and enable clock */\n-\tpm_runtime_get_sync(pd->dev);\n-\tclk_prepare_enable(pd->clk);\n-}\n-\n-static void deactivate_ch(struct sh_mobile_i2c_data *pd)\n-{\n-\t/* Disable channel */\n-\tiic_set_clr(pd, ICCR, 0, ICCR_ICE);\n-\n-\t/* Disable clock and mark device as idle */\n-\tclk_disable_unprepare(pd->clk);\n-\tpm_runtime_put_sync(pd->dev);\n-}\n-\n static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,\n \t\t\t    enum sh_mobile_i2c_op op, unsigned char data)\n {\n@@ -717,7 +700,9 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,\n \tint i;\n \tlong timeout;\n \n-\tactivate_ch(pd);\n+\t/* Wake up device and enable clock */\n+\tpm_runtime_get_sync(pd->dev);\n+\tclk_prepare_enable(pd->clk);\n \n \t/* Process all messages */\n \tfor (i = 0; i < num; i++) {\n@@ -754,7 +739,12 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,\n \t\t\tbreak;\n \t}\n \n-\tdeactivate_ch(pd);\n+\t/* Disable channel */\n+\tiic_set_clr(pd, ICCR, 0, ICCR_ICE);\n+\n+\t/* Disable clock and mark device as idle */\n+\tclk_disable_unprepare(pd->clk);\n+\tpm_runtime_put_sync(pd->dev);\n \n \tif (!err)\n \t\terr = num;\n","prefixes":["RFT","3/5"]}