Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp771429imu; Sat, 17 Nov 2018 09:10:34 -0800 (PST) X-Google-Smtp-Source: AJdET5fnnLoPgtfy+5kf/NXc4zBmJ9fXz/yswyvnBQioMwI18/uWyshMbZXiKU2Z+Ct7FaDU5gsE X-Received: by 2002:aa7:8354:: with SMTP id z20mr15880545pfm.81.1542474634724; Sat, 17 Nov 2018 09:10:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542474634; cv=none; d=google.com; s=arc-20160816; b=TZqX3lU5Xbe9Ul49cP4C+0Kz4DDvumWJ95KTrKeyJIjJQ/G81/ia+++mjvqJLK+8+A V9yskPFPGSg+8Bp7K676btdDFUnVej9TLQZHBbv5NzVL2xccd/IuU0VVDekQ7w4Dcy8E yHJMS5GnPP4tmMx6QnI9OZdiAxOYNQT257mT0Z1Ui/eTQtRBPieckeSaRE9LUMqUShyk OSN4M67zmwbFaLjBSLbZhoa36ZDQFbNM1VXpQ6Tv37i6LJcZtvtTSZyDNL+W3TFWfS3J L8o0NUsYRq7DahfX6AAxHq5pxHqGfX3lhfEy1aidGgFWb+Tq+wpjV2xUmG0vQey1ywrf v6DQ== 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=En4APwHKnUzHWAx8MHXienoLDKjSkwoMxNdjvnFe9V0=; b=0BHffmfF/qHgnyYcpk+KygRKGIXu0UhpJuJD2lsDWBbwv8TLebTERAlW3cv3TIsSRv 466Z73Y+w8H+M5Bhvk006+zc6g0BQ6EJiBI4DsijUTA8qCdRzs4CqOcDffoqvrfJaFls sUFju+mJFMFqKI40yV9BM5hPp4CswxLJMYBF92AMHX8hf9pzNTxVAsIshDnAPZD34yK5 GrWmQc7rhUSfY873zqPp8KjLigGACrnhGktT76cLSP5lUw/DDSvwAlCrZxtb1v8+MPSx 5yUNu+w3DnxdrVAZUjmxXAE2Ui9QrIuy6IBU0rZiO3lrP7blzLDl+Q4Jml38vminylqt kxsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l8cDSNk2; 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.10.19; Sat, 17 Nov 2018 09:10:34 -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=l8cDSNk2; 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 S1726941AbeKRD0U (ORCPT + 99 others); Sat, 17 Nov 2018 22:26:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:45376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726128AbeKRD0U (ORCPT ); Sat, 17 Nov 2018 22:26:20 -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 150C8206BA; Sat, 17 Nov 2018 17:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542474541; bh=dKg6ALVXaFQE47SjX1hqptgdEl6lCD5QORh07rss5fU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=l8cDSNk2g9NQw+6FqDPi2qBxCRiTJZEjaoXp3L9FMqhyy8oCBwN4d12HRLbPj1mOi dVMU4iO/ooTkz0foO5M57Oe8JFuF0St9alU0S1/c2q4GeCXS5EpbcqG7hn4gFjmDZZ qyZvIFBZgkbI+3hVM7oy6+480us3+iyztd/9qcPc= Date: Sat, 17 Nov 2018 17:08:56 +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 7/7] Staging: iio: adt7316: Use device tree data to assign irq_type Message-ID: <20181117170856.5637f708@archlinux> In-Reply-To: <20181116230455.25073-1-shreeya.patel23498@gmail.com> References: <20181116230455.25073-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:34:55 +0530 Shreeya Patel wrote: > ADT7316 driver no more uses platform data and hence use device tree > data instead of platform data for assigning irq_type field. > Switch case figures out the type of irq and if it's the default case > then assign the default value to the irq_type i.e. > irq_type = IRQF_TRIGGER_LOW > > Signed-off-by: Shreeya Patel I think this set of 3 patches around irq type are fine. If no one else finds any issues, I'll pick up in v2. Thanks, Jonathan > --- > drivers/staging/iio/addac/adt7316.c | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c > index 9c72538baf9e..c647875a64f5 100644 > --- a/drivers/staging/iio/addac/adt7316.c > +++ b/drivers/staging/iio/addac/adt7316.c > @@ -2101,8 +2101,7 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus, > { > struct adt7316_chip_info *chip; > struct iio_dev *indio_dev; > - unsigned short *adt7316_platform_data = dev->platform_data; > - int irq_type = IRQF_TRIGGER_LOW; > + int irq_type; > int ret = 0; > > indio_dev = devm_iio_device_alloc(dev, sizeof(*chip)); > @@ -2146,8 +2145,22 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus, > indio_dev->modes = INDIO_DIRECT_MODE; > > if (chip->bus.irq > 0) { > - if (adt7316_platform_data[0]) > - irq_type = adt7316_platform_data[0]; > + irq_type = > + irqd_get_trigger_type(irq_get_irq_data(chip->bus.irq)); > + > + switch (irq_type) { > + case IRQF_TRIGGER_HIGH: > + case IRQF_TRIGGER_RISING: > + break; > + case IRQF_TRIGGER_LOW: > + case IRQF_TRIGGER_FALLING: > + break; > + default: > + dev_info(dev, "mode %d unsupported, using IRQF_TRIGGER_LOW\n", > + irq_type); > + irq_type = IRQF_TRIGGER_LOW; > + break; > + } > > ret = devm_request_threaded_irq(dev, chip->bus.irq, > NULL,