From patchwork Fri Nov 16 23:04:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 10687119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 87C0414DB for ; Fri, 16 Nov 2018 23:05:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75E9B2CBC8 for ; Fri, 16 Nov 2018 23:05:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 656E72D271; Fri, 16 Nov 2018 23:05:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EE482CBC8 for ; Fri, 16 Nov 2018 23:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725911AbeKQJTT (ORCPT ); Sat, 17 Nov 2018 04:19:19 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:42899 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbeKQJTT (ORCPT ); Sat, 17 Nov 2018 04:19:19 -0500 Received: by mail-pl1-f196.google.com with SMTP id x21-v6so9081032pln.9; Fri, 16 Nov 2018 15:05:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=+/WUkaayRJ8LV3dIb3j9FE2qSHbPHPjvZWttEtLlGIc=; b=XdXxrj994D7OXruPigzaHdUJ8WfDYHtQE7mmV5nWT+DXuLGaVTEk5IQ0qGYx7/DPjD toVzSqEyPcpxxODrqe3IOfiWhr6pYUgOcfh1bLbo3io5PqPQf9MZR69cU2luxg5lytg0 9BVY0xx7vJqIVNdVPL66Y1PpHFnlhgjopfIGOvrW9xV2wQCpBbW7RYeqmtESsq9eFUzt OX0G2xTysTPa9nVfShIcJkHJ1HSbR1HOjXmnzt2oOFleqGeF8ErYkjiceax8APGTuGP4 D/HuR/Y1cHqzg1CRBFzYEpAuqEjmBS/42kMOmq+Ohh+BcNy4SDeXJf/ANsvMAsc8HZup b1Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=+/WUkaayRJ8LV3dIb3j9FE2qSHbPHPjvZWttEtLlGIc=; b=OBsr3tO49PUmQWjyEAcBnx8yph7TycpE9yHO/aTfhip42AWwLpf3mDDbqeE4Pf84ET trbMegE1Go5W66o+XDzU06PneSJhhkamlEtx73misycJpNYk/LZ3BEPm6yoFru7L7F2I vjQrHgbqxijPbXwb0C8iF+PPyIsZYxgTsj25TkcLDAPpY2MU9YtiH8TB8mungTekSGKq +PRAPJXD9a7LtCkNF0GxRNrkLeCuaqVq4zV11figSgYnlf+4qUIY+tHpUaHOh3xoO0a1 KwYqxebdrA2P44BhnR6XfoiOJ/OlPIBe50DhheKrC8aRCZWvERikRJ4h7EKmSPTfTKcl SeaA== X-Gm-Message-State: AGRZ1gJfOxROMaW1qKSM1aV8n/6J6XHUyGqXNCsD9K6llY2HicGjOwsS 57tvyd+trRQYFZrKMmzDc92us1yk X-Google-Smtp-Source: AJdET5e2SCRXbpBRhjzsuLc7kXwBj/2KUHTbHUIbPuWkEcQzPAa6gHrOxsDcPgdmYgGj7T4dro/xiw== X-Received: by 2002:a17:902:d890:: with SMTP id b16-v6mr12522921plz.207.1542409501394; Fri, 16 Nov 2018 15:05:01 -0800 (PST) Received: from localhost.localdomain ([103.212.140.154]) by smtp.gmail.com with ESMTPSA id w80-v6sm55326522pfk.11.2018.11.16.15.04.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 15:05:00 -0800 (PST) From: Shreeya Patel To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, 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: [PATCH 7/7] Staging: iio: adt7316: Use device tree data to assign irq_type Date: Sat, 17 Nov 2018 04:34:55 +0530 Message-Id: <20181116230455.25073-1-shreeya.patel23498@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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,