Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5501190imm; Tue, 26 Jun 2018 12:23:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfqxXQsUnZHvHDXPqXw8Vg78x50q5AmiHeg+zktFga2AmtJrbcIe8XA9zbJIsRSQtvyBzSr X-Received: by 2002:a62:1fd6:: with SMTP id l83-v6mr2835868pfj.182.1530041006082; Tue, 26 Jun 2018 12:23:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530041006; cv=none; d=google.com; s=arc-20160816; b=hsbveSE3HpbTITe6bIwMAQ4kFqb9A8N5jHqf3AJyL+ui95WkOYnY2mWj64sIaWu+e5 c2woPVoAOPYe5k4FIL91CqgNiP48dyhMuVTzRjRQxjq73wuTWkt0V4Ug7cJkTn8wzgGS lJE9Hghnpx/7vlUGCd8x/MdW7XmvC7Z90Iavetkm0VxMjDHtFH1sZogBKnSA9XXEDPPU vFOY0DHAIszoZ/+LHeSoU7avwWMoijVQ4/B8hbcAK2AJZe3W5u0HDJZWtpqjlmcdRS7y LjQV6P5IfxrktBgd71MBa6HWds5xXEAAo3y5xHnY/G4DPfjj2mQItjZFz2hQ5rZ1nI9x g0uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=VZKotvrwNPFphUqzlaTMRU8rEO/6NIZksU+asYw3/aM=; b=JA19ZX4b32aZLn8+lrvM3Z7xSFJdaadHhA2xV14k1vsdoQLvH6YbvTtc6cv76LpJtm ylcNW7u8YcBqrf9os7PNjgm6T2+w6W7L3WafOmMacCJqE87Vsfvo1yld1+xKDUVE3QSg OrIIAFeJDzQzVgEz2SFkQMqH2MFNfaqbAhonFTXPjwPG8RXfozM66DJZw3Vb3DLxFxIO i/EKRTWtkRcNolAKsleMqX0RBPJBBvVyuxXailo9W77PL9HQqd4bjczY5y/eTMgqhMDf XsXPze3jBBwYpLD2CgVAqdGEM1944KNcKdX7COy24nTg8QkMOzJRVvtI0PaDduafn69T MJmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oN8Y2FS8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24-v6si2173883pln.22.2018.06.26.12.23.11; Tue, 26 Jun 2018 12:23:26 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oN8Y2FS8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752096AbeFZTHI (ORCPT + 99 others); Tue, 26 Jun 2018 15:07:08 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:39749 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751604AbeFZTHF (ORCPT ); Tue, 26 Jun 2018 15:07:05 -0400 Received: by mail-vk0-f67.google.com with SMTP id n81-v6so4625547vke.6; Tue, 26 Jun 2018 12:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=VZKotvrwNPFphUqzlaTMRU8rEO/6NIZksU+asYw3/aM=; b=oN8Y2FS8Wk6z8Ys1Rzu3fG81vUnLiUkXucgm0jtwEgGR667KWWdsld1INYEnLgaIDb nY+DyBRfYxhC8zK8jU5AIbv05EBIVjLBCV9NAwEYu4yT1XsubP6wAmd1wpcZtK9IowuW 1G+U299tf1usarrH2LuV4/QEOIVmnfhUceOmPPjR7mktWyZJ/ACQEnncnV1/X6UKRtdt Bw49FlLXgkwzmXklmqZAK45GknuYBy34C21B6GnWYVDmqp8gOy/MmGcrYLrs5sLp5v8K GzxaoXQAIUoUseWDq2z6OTMaqOSY9Ks4v75stkLygJa1qY7IfsNY0QBGl5GUwbF0Pqps anRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=VZKotvrwNPFphUqzlaTMRU8rEO/6NIZksU+asYw3/aM=; b=NaBgicNHUqs77WELHyKeNuadqoWclLKeu8+k7iiQAwHv45JcWreyLHhs6TsvEQoLzg NMlYWRUPzNHto+0pMRiubs8Esn2xYBKeYZPNXkoMn6gpPV5fCyTrhb6O0zwNgG7OzDWo cB0yDUQYE3UVPpI5Ip/1OgC3KKT8mK8hYEAlxbTCvHo8WfFJ5Seux9gD2VteP+kskGLZ KV4yljDLpseZ2MUSPk8LbCIeyViqhTj66ufTIuHUorhyRETDWaXgvHRV1yysD4aHIvay O4NneLwvZY44ERlMEzkTEW6gKq6r3K9yRDWlfYfCNX2q2oM6N5Dn2f8DJuRyEvgdc+Jz 91Cw== X-Gm-Message-State: APt69E23yZcwpe5VjzvdNbFfp7Iu89URPNE3yVd/TtKC+nRUQJpdt73K Ei2v9VROwARt3AuHiTdcJjrzirYAvQD0rAEmTBU= X-Received: by 2002:a1f:50c:: with SMTP id 12-v6mr1770307vkf.26.1530040024410; Tue, 26 Jun 2018 12:07:04 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:8b02:0:0:0:0:0 with HTTP; Tue, 26 Jun 2018 12:07:03 -0700 (PDT) In-Reply-To: <20180622104930.32050-10-boris.brezillon@bootlin.com> References: <20180622104930.32050-1-boris.brezillon@bootlin.com> <20180622104930.32050-10-boris.brezillon@bootlin.com> From: Andy Shevchenko Date: Tue, 26 Jun 2018 22:07:03 +0300 Message-ID: Subject: Re: [PATCH v5 09/10] gpio: Add a driver for Cadence I3C GPIO expander To: Boris Brezillon 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > +} > +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); -- With Best Regards, Andy Shevchenko