Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2330152imj; Mon, 11 Feb 2019 00:35:05 -0800 (PST) X-Google-Smtp-Source: AHgI3IbBNpEGS0q9+uAyfY8rRIuZmju353x9Krpk2cwcakeMJYrkazbc+hJFCYcDf8xjbeGGRviM X-Received: by 2002:a63:200e:: with SMTP id g14mr32731581pgg.235.1549874105462; Mon, 11 Feb 2019 00:35:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549874105; cv=none; d=google.com; s=arc-20160816; b=vykw+jlc7/vx5958JdsRBpocQIPnvGX1SpMgGIYiUPiPZ+q2QNE8iDItlmrSmQ0oJw TgWvxDVGQEZrbRorq7mNVV2E0aCLih1FRokLq1pzUu1q0TK1h8B4VUfeIgzC+SIdAS/J Mte7A9a5mS54q4RTpOcP5TsbKeX0q6sbyhF9OAN3+WHvcXRgPcwWbDl1oQPtYC2kmPCW jy1eS6YaUtf0MdXOUPWsxE5Dn6kBpkkPqoauqChqaFYXGD01jXNn9CbX7IG45TBfRm3q To5Qc4erqVxcgh32cFKDtQ2W/GKkiMpkiKwWOimwMkBnC1NVxLQm0QmkQ9/rgICPUv+S THIg== 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 :in-reply-to:references:mime-version:dkim-signature; bh=CBwVq/2kgXI0NZVvileKPaowPKcOhcpTEl/viUnmBok=; b=dybbbBlY+7/XD6rUzhLEmghSEM1sJq9h/jj5i5l9FKGJ2Td+Pmz9OIGIHz/siYfzxB QYmDN6kPcCRS90MvTdh6eezIFNcpFWbg1136d5Whd8A4FMHHDL14gTk2tcXS9OrVoCxz bFHzMRGD6BuVy1EnuHyJmRvY0rlLu92ttkiiShifMGy7omwJ8KMIeiwEMygBU5hY8Qtz R3VcFiRpCDuITNH5FFv82IK1lIKx5gkP3an0zWI5jHvp4UmnuUjJJLTfSPkl4danZOTx z7LrS/nFt5PcYBEJG/A6cHayIA8Jnas04d3d15IAxKTgC6eSntqkWoCPf+mIUCUH2N95 F2Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RKBkluOu; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si8979372pgc.448.2019.02.11.00.34.45; Mon, 11 Feb 2019 00:35:05 -0800 (PST) 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=@linaro.org header.s=google header.b=RKBkluOu; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727083AbfBKIe1 (ORCPT + 99 others); Mon, 11 Feb 2019 03:34:27 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:40947 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727024AbfBKIe1 (ORCPT ); Mon, 11 Feb 2019 03:34:27 -0500 Received: by mail-lj1-f194.google.com with SMTP id z25-v6so7972085ljk.7 for ; Mon, 11 Feb 2019 00:34:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CBwVq/2kgXI0NZVvileKPaowPKcOhcpTEl/viUnmBok=; b=RKBkluOuqeaBUAF+gCsFl+EjlRYuEFLJa/fomibjDDJtNgZTYRyUuKo/DVfidWuY1f pPWhJxIvOVwxfatVFkq7fMgWdTWmURBnss9ymYCMQDUjTuEWP4BrTW6Cv34nDIaxEdPG W7rtZI6+S4DSpnniXH9sNpeEnyt0UZ+BLLXmlGJahTErPRKmzS/8yBc+mNjOcPG+vdn2 BOYJ0p9pCG4XabxLpYx2dFhq5FeDBDBFR++T/EGt2uapZFSgr6Fzd19o7WI4t9FqOr/9 9ULLQXPkR+OCWg+QUyd54qVRLr1FySA5rlk7tnGgwmLXmD8b1tAaFJw9WNWi9R3kTRIe qiDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CBwVq/2kgXI0NZVvileKPaowPKcOhcpTEl/viUnmBok=; b=N/5YwPRbO7u28qRI6E9FANTqEVo88b7qeQaooM6MNC2d143WlZJwu2jDGr6az1ckeZ zAwRgqMk0pQOBtHEh1BXpaVP9U9DHW2MdQQ/Fnr45gl6n9tovsfazchkwhBW9MtnEBq2 1RozB81lDfJiuBdWtpOeY+C9fIsqI/0RcbDJmYLSvceCtrmdzHE0056YTje3FeZebpJ1 p5W+qFS9ovpIjtmdFJ45zVsI51JyLiPbMMLIFZWEg4zXWjptQxv5B3DOC6PI4gkeBuqs lktVnJc628/OTya8bppB+NRu5wvAp0Q9MJqXxEJS5xEePeb8D32A4H98yMyP3a2TDuwo B3Aw== X-Gm-Message-State: AHQUAua/XT/F1WPr3n7jVu/n5T4g95sW9TSkAPcb2ZrrB4FAsOfBdGMM /1l+7VrNGWmQt0TW8bFbcACkcgbHU0dBviERcjIpzA== X-Received: by 2002:a2e:96c9:: with SMTP id d9-v6mr6106310ljj.105.1549874064899; Mon, 11 Feb 2019 00:34:24 -0800 (PST) MIME-Version: 1.0 References: <1549653856-47409-1-git-send-email-justinpopo6@gmail.com> In-Reply-To: <1549653856-47409-1-git-send-email-justinpopo6@gmail.com> From: Linus Walleij Date: Mon, 11 Feb 2019 09:34:13 +0100 Message-ID: Subject: Re: [PATCH] iio: adc: ti-ads7950: add GPIO support To: Justin Chen Cc: linux-iio@vger.kernel.org, "open list:GPIO SUBSYSTEM" , bcm-kernel-feedback-list , Florian Fainelli , Bartosz Golaszewski , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald , David Lechner , "linux-kernel@vger.kernel.org" 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 Hi Justin, thanks for your patch! On Fri, Feb 8, 2019 at 8:25 PM wrote: > From: Justin Chen > > The ADS79XX has GPIO pins that can be used. Add support for the GPIO > pins using the GPIO chip framework. > > Signed-off-by: Justin Chen (...) > @@ -56,11 +61,17 @@ struct ti_ads7950_state { > struct spi_message ring_msg; > struct spi_message scan_single_msg; > > + struct iio_dev *indio_dev; > + struct gpio_chip *chip; Why use a pointer here? Correct me if wrong by a struct ti_ads7950_state is always allocated for each instance of the hardware right? So just struct gpio_chip chip; should be fine, then just fill in that struct. > + /* Add GPIO chip */ > + st->chip->label = dev_name(&st->spi->dev); So it would be st->chip.label = ... etc. > + chip = devm_kzalloc(&spi->dev, sizeof(*chip), GFP_KERNEL); > + if (!chip) > + return -ENOMEM; And no need to do this. Apart from that it looks OK to me, but there are some locking comments I see. Yours, Linus Walleij