From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Lengfeld Subject: Re: [PATCH 06/12] i2c: omap: Add the master_xfer_irqless hook Date: Tue, 16 Apr 2019 00:05:46 +0200 Message-ID: <20190415220546.bvrp7jodgdq7phwg@porty> References: <20190403124019.8947-1-wsa+renesas@sang-engineering.com> <20190403124019.8947-7-wsa+renesas@sang-engineering.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Content-Disposition: inline In-Reply-To: <20190403124019.8947-7-wsa+renesas@sang-engineering.com> Sender: linux-kernel-owner@vger.kernel.org To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peter Rosin , linux-omap@vger.kernel.org, linux-tegra@vger.kernel.org, Linus Walleij , Andy Shevchenko , Tero Kristo , Keerthy , Simon Horman List-Id: linux-tegra@vger.kernel.org Hi Wolfram, the subject line of this patch i2c: omap: Add the master_xfer_irqless hook still contains the old name of the callback '_irqless'. It should be '_atomic' instead. On Wed, Apr 03, 2019 at 02:40:13PM +0200, Wolfram Sang wrote: > Add the master_xfer_irqless hook to enable i2c transactions Here again. It should be 'master_xfer_atomic'. > in irq disabled contexts like the poweroff case. > > Signed-off-by: Tero Kristo > Signed-off-by: Keerthy > [wsa: simplified code a little: 'timeout = !ret'] > Reviewed-by: Simon Horman > Signed-off-by: Wolfram Sang > --- > drivers/i2c/busses/i2c-omap.c | 76 +++++++++++++++++++++++++++++++++++-------- > 1 file changed, 63 insertions(+), 13 deletions(-) > snipped > @@ -648,15 +650,28 @@ static void omap_i2c_resize_fifo(struct omap_i2c_dev *omap, u8 size, bool is_rx) > (1000 * omap->speed / 8); > } > > +static void omap_i2c_wait(struct omap_i2c_dev *omap) > +{ > + u16 stat; > + u16 mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG); > + int count = 0; > + > + do { > + stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG); > + count++; > + } while (!(stat & mask) && count < 5); > +} > + > /* > * Low level master read/write transaction. > */ > static int omap_i2c_xfer_msg(struct i2c_adapter *adap, > - struct i2c_msg *msg, int stop) > + struct i2c_msg *msg, int stop, bool polling) Nitpick. In the patches for the other drivers the boolean flag is called 'atomic' and not 'polling'. > { > struct omap_i2c_dev *omap = i2c_get_adapdata(adap); > unsigned long timeout; > u16 w; > + int ret; > > dev_dbg(omap->dev, "addr: 0x%04x, len: %d, flags: 0x%x, stop: %d\n", > msg->addr, msg->len, msg->flags, stop); sniped > @@ -1165,14 +1204,25 @@ omap_i2c_isr_thread(int this_irq, void *dev_id) > } > } while (stat); > > - omap_i2c_complete_cmd(omap, err); > + return err; > +} > + > +static irqreturn_t > +omap_i2c_isr_thread(int this_irq, void *dev_id) > +{ > + int ret; > + struct omap_i2c_dev *omap = dev_id; > + > + ret = omap_i2c_xfer_data(omap); > + if (ret != -EAGAIN) > + omap_i2c_complete_cmd(omap, ret); > > -out: > return IRQ_HANDLED; > } > > static const struct i2c_algorithm omap_i2c_algo = { > - .master_xfer = omap_i2c_xfer, > + .master_xfer = omap_i2c_xfer_irq, > + .master_xfer_atomic = omap_i2c_xfer_polling, When consistency with other drivers is a goal, the functions should be named like: .master_xfe = omap_i2c_xfer, .master_xfer_atomic = omap_i2c_xfer_atomic, The first without a suffix and the second with the '_atomic' suffix. Kind regards, Stefan From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_NEOMUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD51AC10F0E for ; Mon, 15 Apr 2019 22:06:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74EEE218A1 for ; Mon, 15 Apr 2019 22:06:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Fdq5iMRa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74EEE218A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=stefanchrist.eu Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kf+XNW4L428DKPcPPvvETtPvygJKPeqKJaPcE/gZBsM=; b=Fdq5iMRaEn50yy jmQnxhCaQidyz1Sh1BypTCfT6MkKOUY4v94yMveuslbnL2HgIZfVRtZKbeSthoPRTrWjNGlv5JfKq PGso+llTOpvDfmxduU6qsgTeLs0SOptv8kl/1F/bbqLqqSeSUrWYC5bfpjDl5h/NFWx/rWLypNMH1 qzMO/95eFJU2zEsB2mummL+a+/bSqz/aLHr2m8velcdDfs1jYdI3uBXt9Bwq55vTiz7J/H4D00zh+ It0Y7CsMFy3Ekn2Yw1qi6xf4T3UguYT37uLrEDnw1+NSiLa8dcm+lujSOtBzjdhrNBq5mOgHaw1yJ g05bsx7M5ItZeiptG53Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG9jc-0002wG-Cq; Mon, 15 Apr 2019 22:05:52 +0000 Received: from stcim.de ([2a01:4f8:120:63a3::2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG9jZ-0002vt-GR for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2019 22:05:51 +0000 Received: from xdsl-89-0-59-235.nc.de ([89.0.59.235] helo=porty) by stcim with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hG9jX-00010l-Eu; Tue, 16 Apr 2019 00:05:47 +0200 Date: Tue, 16 Apr 2019 00:05:46 +0200 From: Stefan Lengfeld To: Wolfram Sang Subject: Re: [PATCH 06/12] i2c: omap: Add the master_xfer_irqless hook Message-ID: <20190415220546.bvrp7jodgdq7phwg@porty> References: <20190403124019.8947-1-wsa+renesas@sang-engineering.com> <20190403124019.8947-7-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190403124019.8947-7-wsa+renesas@sang-engineering.com> X-PGP-Key: https://stefanchrist.eu/personal/Stefan_Lengfeld_0xE44A23B289092311.asc User-Agent: NeoMutt/20180716 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_150549_700990_52C54B2A X-CRM114-Status: GOOD ( 17.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tero Kristo , Andy Shevchenko , Keerthy , Linus Walleij , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org, Simon Horman , linux-omap@vger.kernel.org, Peter Rosin , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Wolfram, the subject line of this patch i2c: omap: Add the master_xfer_irqless hook still contains the old name of the callback '_irqless'. It should be '_atomic' instead. On Wed, Apr 03, 2019 at 02:40:13PM +0200, Wolfram Sang wrote: > Add the master_xfer_irqless hook to enable i2c transactions Here again. It should be 'master_xfer_atomic'. > in irq disabled contexts like the poweroff case. > > Signed-off-by: Tero Kristo > Signed-off-by: Keerthy > [wsa: simplified code a little: 'timeout = !ret'] > Reviewed-by: Simon Horman > Signed-off-by: Wolfram Sang > --- > drivers/i2c/busses/i2c-omap.c | 76 +++++++++++++++++++++++++++++++++++-------- > 1 file changed, 63 insertions(+), 13 deletions(-) > snipped > @@ -648,15 +650,28 @@ static void omap_i2c_resize_fifo(struct omap_i2c_dev *omap, u8 size, bool is_rx) > (1000 * omap->speed / 8); > } > > +static void omap_i2c_wait(struct omap_i2c_dev *omap) > +{ > + u16 stat; > + u16 mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG); > + int count = 0; > + > + do { > + stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG); > + count++; > + } while (!(stat & mask) && count < 5); > +} > + > /* > * Low level master read/write transaction. > */ > static int omap_i2c_xfer_msg(struct i2c_adapter *adap, > - struct i2c_msg *msg, int stop) > + struct i2c_msg *msg, int stop, bool polling) Nitpick. In the patches for the other drivers the boolean flag is called 'atomic' and not 'polling'. > { > struct omap_i2c_dev *omap = i2c_get_adapdata(adap); > unsigned long timeout; > u16 w; > + int ret; > > dev_dbg(omap->dev, "addr: 0x%04x, len: %d, flags: 0x%x, stop: %d\n", > msg->addr, msg->len, msg->flags, stop); sniped > @@ -1165,14 +1204,25 @@ omap_i2c_isr_thread(int this_irq, void *dev_id) > } > } while (stat); > > - omap_i2c_complete_cmd(omap, err); > + return err; > +} > + > +static irqreturn_t > +omap_i2c_isr_thread(int this_irq, void *dev_id) > +{ > + int ret; > + struct omap_i2c_dev *omap = dev_id; > + > + ret = omap_i2c_xfer_data(omap); > + if (ret != -EAGAIN) > + omap_i2c_complete_cmd(omap, ret); > > -out: > return IRQ_HANDLED; > } > > static const struct i2c_algorithm omap_i2c_algo = { > - .master_xfer = omap_i2c_xfer, > + .master_xfer = omap_i2c_xfer_irq, > + .master_xfer_atomic = omap_i2c_xfer_polling, When consistency with other drivers is a goal, the functions should be named like: .master_xfe = omap_i2c_xfer, .master_xfer_atomic = omap_i2c_xfer_atomic, The first without a suffix and the second with the '_atomic' suffix. Kind regards, Stefan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel