Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5755035imm; Tue, 26 Jun 2018 17:52:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcDD+YEcstXqBL7efVVRBSAb3yZDUeotO1gyjFiKgSdx46zGwcPivHMKYwp+mY4UVM4L2pr X-Received: by 2002:a62:4359:: with SMTP id q86-v6mr3700118pfa.140.1530060756769; Tue, 26 Jun 2018 17:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530060756; cv=none; d=google.com; s=arc-20160816; b=wzawXu7C6VGFJ/uOCxeBkaz3BtYcCBOGrCkm4BaDOo/R2qCvS6qqgGPi7q/w+ZVgul NZtZQyW88EpLrCnqGKWIZe5ogn2qsu69oZaThvMky+JT52gLflkHCkinkgo2uuX4fw1b Nd+N8AAXIkhZfUWDBlOw6dS3YlV/40Lt6R53Rg3YhQ+yrqG6pcGVy+T5TUhQOxGJwTEt eORAfGYoPyi1juz/LTAabrQ42nUvOOoOD9jOZAi7cObDWGQsnuy+SywsaDjGodMJPqKD 5CB2cvnVMeTdqLZsCoFGYRzHEw5D+9+AM1Y7fuGpl9nJAGxfVcDS4AUSJW3kwExJdk1X enlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=0HlvM25t7Nck72wrU+aqzz3MpJmfyiw1MIOYZ0J06tk=; b=bXGgl+y05FIKA+J+RIFaD90pGK8XEcY+shwdls5u4X1gQuf38wggtSxDth9wPuc899 4QC2gVS6vr7K4sUqPom+g8sWMEmvjOL+/2Av2nMb1aWrV37bfD6GWkrHVS+1nKmzlGHf M+BZlREa4AHJgoOPrl5+RPT+r6Iu93C4BIkNbjrrelQm42qPgdmQrTZDHJxcl376czlC OjmMV2OxKYnDPuWzLnwIeCz2WCQqHkKGSBBuTmgjn5YJlBcH/m0kg4OQl2lNfZiz+KOX tZyRBbEvkN7BNffJqcu36ZxWBgV7xxQlAAD/U9CdJJOYHfSnbZ4Gr5E0jP8bgV2KMeS/ jYoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w4-v6si2267669pgr.549.2018.06.26.17.51.49; Tue, 26 Jun 2018 17:52:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933194AbeFZT4y (ORCPT + 99 others); Tue, 26 Jun 2018 15:56:54 -0400 Received: from mail.bootlin.com ([62.4.15.54]:48061 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752109AbeFZT4v (ORCPT ); Tue, 26 Jun 2018 15:56:51 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 05DAD2079D; Tue, 26 Jun 2018 21:56:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 3E11D203B0; Tue, 26 Jun 2018 21:56:48 +0200 (CEST) Date: Tue, 26 Jun 2018 21:56:48 +0200 From: Boris Brezillon To: Andy Shevchenko Cc: Wolfram Sang , linux-i2c , Jonathan Corbet , Linux Documentation List , Greg Kroah-Hartman , Arnd Bergmann , Przemyslaw Sroka , Arkadiusz Golec , Alan Douglas , Bartosz Folta , Damian Kos , Alicja Jurasik-Urbaniak , Cyprian Wronka , Suresh Punnoose , Rafal Ciepiela , Thomas Petazzoni , Nishanth Menon , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , devicetree , Linux Kernel Mailing List , Vitor Soares , Geert Uytterhoeven , Linus Walleij , Xiang Lin , "open list:GPIO SUBSYSTEM" , Sekhar Nori , Przemyslaw Gaj Subject: Re: [PATCH v5 09/10] gpio: Add a driver for Cadence I3C GPIO expander Message-ID: <20180626215648.1472b96e@bbrezillon> In-Reply-To: References: <20180622104930.32050-1-boris.brezillon@bootlin.com> <20180622104930.32050-10-boris.brezillon@bootlin.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On Tue, 26 Jun 2018 22:07:03 +0300 Andy Shevchenko wrote: > On Fri, Jun 22, 2018 at 1:49 PM, Boris Brezillon > wrote: > > Add a driver for Cadence I3C GPIO expander. > > > > Signed-off-by: Boris Brezillon > > > + scratchbuf = kmalloc(sizeof(*scratchbuf) * 2, GFP_KERNEL); > > kmalloc_array() ? > > > + ret = i3c_device_do_priv_xfers(gpioc->i3cdev, xfers, > > + ARRAY_SIZE(xfers)); > > One line? > > > > +static void cdns_i3c_gpio_set_multiple(struct gpio_chip *g, > > + unsigned long *mask, > > + unsigned long *bits) > > +{ > > + struct cdns_i3c_gpio *gpioc = gpioc_to_cdns_gpioc(g); > > + u8 newovr; > > + int ret; > > + > > + newovr = (gpioc->ovr & ~(*mask)) | (*bits & *mask); > > + if (newovr == gpioc->ovr) > > + return; > > + > > + ret = cdns_i3c_gpio_write_reg(gpioc, OVR, newovr); > > + if (!ret) > > + gpioc->ovr = newovr; > > You don't change mask here, why do you need a pointer to it? What are you talking about??!!! This is part of the gpio_chip interface that drivers have to implement. You can't decide that mask should not be a pointer. And if you actually look at the code, you'll probably see that the reason we're passed a pointer here is that the GPIO chip might expose more GPIOs than can be represented by an unsigned long, hence the array of unsigned long. I'll say it here because this is not the first time I'm pissed off by one of your review. You seem to review everything that is posted on the LKML, and most of the time your reviews are superficial (focused on tiny details or coding style issues). Don't you have better things to do? I mean, I'm fine when I get such comments from people that also do useful comments, but yours are most of the time useless and sometime even wrong because you didn't time to look at the code in details. > > > +} > > > +static int cdns_i3c_gpio_get_multiple(struct gpio_chip *g, > > + unsigned long *mask, > > + unsigned long *bits) > > +{ > > + struct cdns_i3c_gpio *gpioc = gpioc_to_cdns_gpioc(g); > > + int ret; > > + u8 ivr; > > + > > + ret = cdns_i3c_gpio_read_reg(gpioc, IVR, &ivr); > > + if (ret) > > + return ret; > > + > > + *bits = ivr & *mask & gpioc->dir; > > + *bits |= gpioc->ovr & *mask & ~gpioc->dir; > > Ditto. > > > + > > + return 0; > > +} > > > +static void cdns_i3c_gpio_ibi_handler(struct i3c_device *i3cdev, > > + const struct i3c_ibi_payload *payload) > > +{ > > + struct cdns_i3c_gpio *gpioc = i3cdev_get_drvdata(i3cdev); > > > + u8 isr = 0; > > Perhaps you need to check the result of _read_reg() below instead of > dummy assignment? > > > + int i; > > + > > + cdns_i3c_gpio_read_reg(gpioc, ISR, &isr); > > > + for (i = 0; i < 8; i++) { > > + unsigned int irq; > > + > > + if (!(BIT(i) & isr & gpioc->imr)) > > + continue; > > for_each_set_bit() ? > > > + > > + irq = irq_find_mapping(gpioc->gpioc.irq.domain, i); > > + handle_nested_irq(irq); > > + } > > +} > > > +static const struct i3c_device_id cdns_i3c_gpio_ids[] = { > > + I3C_DEVICE(0x1c9, 0x0, NULL), > > > + { /* sentinel */ }, > > Slightly better without comma. > > > +}; > > +MODULE_DEVICE_TABLE(i3c, cdns_i3c_gpio_ids); >