Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp770005imu; Sat, 17 Nov 2018 09:09:20 -0800 (PST) X-Google-Smtp-Source: AJdET5fkU59voUXd3d8KZYe5MCwxV2Myy9pmsCh+tuuRzEkadDcJnfIE/31pacQbG1/nSRPwqZD/ X-Received: by 2002:a63:d40a:: with SMTP id a10mr13952240pgh.394.1542474559991; Sat, 17 Nov 2018 09:09:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542474559; cv=none; d=google.com; s=arc-20160816; b=wOiVi60Vo6s/axRZGQfTbxSHyQV8mWG59sszcHJmgjKncFnjIbK3VX5cPTomi/ZKbb 7nOGhdBv1YuqeZMuDyWT7sJtK5qDChG4FjSH9zFnfr7lXNosd5ZeuExzwvrGYs2xxH8J D6Y0OONVDlolZuh8P3IiBn4VL2Vd281VINhzALbt2sXSQ3l808R/jUZw/S3F9r+tQava aE0XKN00f2DRDmXOccDPu90/YK3PpYe37/bzLqMhf52Knh6qCUflD3Fxk2ic5EEsyUWe z9y3dig0eei98JHh2G4EfoiYlU0gvLUT2D0tEzUgcKfEPtEYMC8+zYG48RRfZMmeQsWB pJUg== 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 :dkim-signature; bh=qjdo2O8wlZLh/keRKqX+dxUUaB+Jy1EqC6Uc7SGt7j0=; b=yHsiwJut+KWoCjJs26l7d4evMB11hirRAAXEWZ6+TtR6KHsYimvb48Bzlvv8Ifqvoc 7iUY/v5BI+ulbTCCHBdYzqlm16qXSoJas7yDEpL/YeVDXC6QA+KaoSwR31Nq7O3PQhXB AVvz+lwoBzkMHmbLNh+6mDdI7dx0UcTOQqze+hkpi2t9aiR2WOczfZO/Os69Mmx66KGz yMjBlGjo+/4BiMnQkLXbP4gu4LiZ9J7RKMcSc0Fr+yhmduJLuEx3pNw028QNZhSqPhtT IEetl/ctmUk5hOVap+UY0HRuDqKL9N221LaC/YsrM9xH9AgSoKSo7NXfkyXPvA0fY6YN 9UJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I9Ru2ok1; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5-v6si35163544plp.132.2018.11.17.09.09.05; Sat, 17 Nov 2018 09:09:19 -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=@kernel.org header.s=default header.b=I9Ru2ok1; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726738AbeKRDY3 (ORCPT + 99 others); Sat, 17 Nov 2018 22:24:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:44994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726128AbeKRDY3 (ORCPT ); Sat, 17 Nov 2018 22:24:29 -0500 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 81D3D206BA; Sat, 17 Nov 2018 17:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542474430; bh=i6kBGB0hT5CdXg554iNDBaZNRHnQhHXVkYpYhdoTnb8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=I9Ru2ok1n2ZGTyY12B+LDD35ozaCfQ9p0CQejeJBWtwBqLupLCxEKO443v/uIW/Cm 9YId4l1GhSxmzD+OLi/GHFSkCMHzFb0h7pnzBAvbtx1dYDFV4jWnPtT1nc/ONfXeoT lF8wry8g0vN2c6f/l7Tr925BMaz/7qqVOEzDlMC0= Date: Sat, 17 Nov 2018 17:07:05 +0000 From: Jonathan Cameron To: Shreeya Patel Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/7] Staging: iio: adt7316: Use device tree data to set ldac_pin Message-ID: <20181117170705.2532ca74@archlinux> In-Reply-To: <20181116225732.24823-1-shreeya.patel23498@gmail.com> References: <20181116225732.24823-1-shreeya.patel23498@gmail.com> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; 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 On Sat, 17 Nov 2018 04:27:32 +0530 Shreeya Patel wrote: > Make the driver use device tree instead of the platform data. > Hence, use devm_gpiod_get_optional function to get the data from > device tree for ldac-pin and accordingly make the needed changes > in the driver. > > Signed-off-by: Shreeya Patel Looks good to me. I'll pick this up once patch 3 is sorted. Thanks, Jonathan > --- > drivers/staging/iio/addac/adt7316.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c > index 3f22d1088713..deb2f7b40f60 100644 > --- a/drivers/staging/iio/addac/adt7316.c > +++ b/drivers/staging/iio/addac/adt7316.c > @@ -177,7 +177,7 @@ > > struct adt7316_chip_info { > struct adt7316_bus bus; > - u16 ldac_pin; > + struct gpio_desc *ldac_pin; > u16 int_mask; /* 0x2f */ > u8 config1; > u8 config2; > @@ -950,8 +950,8 @@ static ssize_t adt7316_store_update_DAC(struct device *dev, > if (ret) > return -EIO; > } else { > - gpio_set_value(chip->ldac_pin, 0); > - gpio_set_value(chip->ldac_pin, 1); > + gpiod_set_value(chip->ldac_pin, 0); > + gpiod_set_value(chip->ldac_pin, 1); > } > > return len; > @@ -2120,7 +2120,13 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus, > else > return -ENODEV; > > - chip->ldac_pin = adt7316_platform_data[1]; > + chip->ldac_pin = devm_gpiod_get_optional(dev, "ldac", GPIOD_OUT_LOW); > + if (IS_ERR(chip->ldac_pin)) { > + ret = PTR_ERR(chip->ldac_pin); > + dev_err(dev, "Failed to request ldac GPIO: %d\n", ret); > + return ret; > + } > + > if (chip->ldac_pin) { > chip->config3 |= ADT7316_DA_EN_VIA_DAC_LDCA; > if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)