From patchwork Mon Dec 18 21:57:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 10121937 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7D26A60327 for ; Mon, 18 Dec 2017 21:58:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F9CA28BF0 for ; Mon, 18 Dec 2017 21:58:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6449728D70; Mon, 18 Dec 2017 21:58:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EB0428BF0 for ; Mon, 18 Dec 2017 21:58:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965371AbdLRV6L (ORCPT ); Mon, 18 Dec 2017 16:58:11 -0500 Received: from sauhun.de ([88.99.104.3]:40896 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965312AbdLRV6J (ORCPT ); Mon, 18 Dec 2017 16:58:09 -0500 Received: from localhost (p54B33BFB.dip0.t-ipconnect.de [84.179.59.251]) by pokefinder.org (Postfix) with ESMTPSA id D4F6F2C631A; Mon, 18 Dec 2017 22:58:07 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Yoshihiro Shimoda , Wolfram Sang Subject: [RFC PATCH 2/7] i2c: sh_mobile: allow setup callback to return errno Date: Mon, 18 Dec 2017 22:57:57 +0100 Message-Id: <20171218215802.28591-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171218215802.28591-1-wsa+renesas@sang-engineering.com> References: <20171218215802.28591-1-wsa+renesas@sang-engineering.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The setup callback will be more generic and, thus, need to be able to return error codes. Change the return type to 'int' for that. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-sh_mobile.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 1ac896e46b390c..a3a377a10fa789 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c @@ -149,7 +149,7 @@ struct sh_mobile_i2c_data { struct sh_mobile_dt_config { int clks_per_count; - void (*setup)(struct sh_mobile_i2c_data *pd); + int (*setup)(struct sh_mobile_i2c_data *pd); }; #define IIC_FLAG_HAS_ICIC67 (1 << 0) @@ -749,7 +749,7 @@ static const struct i2c_algorithm sh_mobile_i2c_algorithm = { * r8a7740 chip has lasting errata on I2C I/O pad reset. * this is work-around for it. */ -static void sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd) +static int sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd) { iic_set_clr(pd, ICCR, ICCR_ICE, 0); iic_rd(pd, ICCR); /* dummy read */ @@ -770,6 +770,8 @@ static void sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd) udelay(10); iic_wr(pd, ICCR, ICCR_TRS); udelay(10); + + return 0; } static const struct sh_mobile_dt_config default_dt_config = { @@ -881,8 +883,11 @@ static int sh_mobile_i2c_probe(struct platform_device *dev) if (config) { pd->clks_per_count = config->clks_per_count; - if (config->setup) - config->setup(pd); + if (config->setup) { + ret = config->setup(pd); + if (ret) + return ret; + } } ret = sh_mobile_i2c_init(pd);