From patchwork Tue Nov 20 16:58:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 10690861 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 2EDF715A7 for ; Tue, 20 Nov 2018 16:58:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CACF2A153 for ; Tue, 20 Nov 2018 16:58:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1046C2A187; Tue, 20 Nov 2018 16:58:46 +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 AA02E2A153 for ; Tue, 20 Nov 2018 16:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727354AbeKUD2v (ORCPT ); Tue, 20 Nov 2018 22:28:51 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42309 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726911AbeKUD2v (ORCPT ); Tue, 20 Nov 2018 22:28:51 -0500 Received: by mail-pf1-f193.google.com with SMTP id 64so1266338pfr.9; Tue, 20 Nov 2018 08:58:44 -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=+6XVtq4oJHjTw6cvWsMsqPWuyqZ5zrnnSTv1YyHvuZo=; b=E23GK7WjxA+pnZjRt0Mu1Zw1AjfZ64PXf4DCFk74gRs0dk5LaJa0opg1MuK1RNvLya c10Xcqo6uKEtGwBrW9ipKUl2itneyJCu4kkaXTDrHZSlKctoU5AnqHOpiTbmdRVjJ4Dy jmyNBD6UotKEVtzjOVUmf00PNsykTZwF/GjCwwBYAln6QhbLRGHymexkpQ1EwGpPzwzE edzv9Yg7PXmiDJXWZOKAyUacIJ9r8Ga9zUFnAZivyPVJKhWXUWAYjD/WGMkEBDyVBn+x o61mhUjnMvMRZrKHvohlCKFZMN5TtAQmXuTVORhTe/i6QUMQRJplCG21qjBGLn2z4KoG lbIQ== 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=+6XVtq4oJHjTw6cvWsMsqPWuyqZ5zrnnSTv1YyHvuZo=; b=MPcQqEi/eHHrJPXrcjPKnI0B45S51psZvgzRec8H5Zi/Fk0QnPnPsAC/fNWVoJKKaI B/uFyPe1CLvWD6LG4P5zuLby4Y02e5xWqzaSHltVRk60Q7LQLjzUJKTdVhjELts9zLYR +7Cm5bAjiIFkFStyut33nf9Y8mgkx5toGXthSI4hTQJc85E2hv6lLz2T0g2v0Q1hDCqm s6P8VRb10vg903nWKycRdLIJjiJg3q/Bm3L4HGiFVbi/2EPtWkzEY3MPLcxRJgcpNUK6 jDwTfrgfuSoeMNlf61QMbhR4xQPIz6cMDQrA4Mqbsoy1evfHhmuqUASeY9656jZLRXiS ljWQ== X-Gm-Message-State: AA+aEWbpjwN7okJmLuj08xLMl+KkF7hEybnEDUxHTExomq5G8sO74nua n3VvftrvhwAuoBVuSoP9e2k= X-Google-Smtp-Source: AFSGD/XXerMvLxHix+qRf8A8fOHK2uibp0UNAHyqv7CV5Qk3KT4DPmOklYb+9vgIxoR0FpLWo5BOvQ== X-Received: by 2002:a63:6045:: with SMTP id u66mr2628089pgb.204.1542733123867; Tue, 20 Nov 2018 08:58:43 -0800 (PST) Received: from localhost.localdomain ([103.212.140.152]) by smtp.gmail.com with ESMTPSA id h8sm19044899pfo.162.2018.11.20.08.58.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Nov 2018 08:58:43 -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 v2 4/5] Staging: iio: adt7316: Change the name from irq_flags to irq_type Date: Tue, 20 Nov 2018 22:28:36 +0530 Message-Id: <20181120165836.7335-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 Most of the drivers in IIO uses irq_type as the name for storing the interrupt type and hence change the name from irq_flags to irq_type for maintaining the consistency. Signed-off-by: Shreeya Patel --- drivers/staging/iio/addac/adt7316.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c index dfae22619287..9c72538baf9e 100644 --- a/drivers/staging/iio/addac/adt7316.c +++ b/drivers/staging/iio/addac/adt7316.c @@ -2102,7 +2102,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_flags = IRQF_TRIGGER_LOW; + int irq_type = IRQF_TRIGGER_LOW; int ret = 0; indio_dev = devm_iio_device_alloc(dev, sizeof(*chip)); @@ -2147,18 +2147,18 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus, if (chip->bus.irq > 0) { if (adt7316_platform_data[0]) - irq_flags = adt7316_platform_data[0]; + irq_type = adt7316_platform_data[0]; ret = devm_request_threaded_irq(dev, chip->bus.irq, NULL, adt7316_event_handler, - irq_flags | IRQF_ONESHOT, + irq_type | IRQF_ONESHOT, indio_dev->name, indio_dev); if (ret) return ret; - if (irq_flags & IRQF_TRIGGER_HIGH) + if (irq_type & IRQF_TRIGGER_HIGH) chip->config1 |= ADT7316_INT_POLARITY; } From patchwork Tue Nov 20 17:00:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 10690869 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 B2A5915A7 for ; Tue, 20 Nov 2018 17:00:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E38B2AC55 for ; Tue, 20 Nov 2018 17:00:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9240F2AC65; Tue, 20 Nov 2018 17:00:46 +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 403042AC55 for ; Tue, 20 Nov 2018 17:00:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727313AbeKUDax (ORCPT ); Tue, 20 Nov 2018 22:30:53 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:33665 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725925AbeKUDax (ORCPT ); Tue, 20 Nov 2018 22:30:53 -0500 Received: by mail-pf1-f194.google.com with SMTP id c123so580913pfb.0; Tue, 20 Nov 2018 09:00:44 -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=e6qSkPh76WCZuT5r4MdbxYMntXDli74QGRdhKJlOmJO34s7XfNqz9PyiMk2s0XMzTb 85Bqxc8csqVuaYRdAO3nhVGWrFiym+uwzvn1L5jZcGZVHwclL/QFuErlw/KCtB/+311x zL7s97Y5TMO2mOWGFk/O00AhV34VXsGXYxU2k/bj7BqH0ZAY7aU2JIAIThdkNUfzi66d eKKyPLCF8RmCJPDeVwHPdOTQNg4sL5CXH37KBzMBHPi/Xf0yPqCiGU/KYNzdHx7wqy2H uMGyhlOaZToKHNkWuQeRQl6GIaF4GvmQWVyu/AocYMTEWAnYQSiqnOs6ofq9vHb9i1me igaQ== 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=VQPMdILEa3ZCegY1+8nvjK7IRdrVHNKN9TVEvPAeD2SlLu5SjjV/VubRV6QeCs4HQJ 3RioGyii/m13IqiyoGpUuBPHdJtDvStCs5x8WwualbsIGANj642Sci+N4qUCalyO/wIo IhIuHqB+KejfVkBKm72Egrp8t7kC03YKGZ4x4iSKu67MAqUf9yrIKE4D13S1RD9Qn7F1 vHWy4old3VW8etjcKlu9/QAzQhZRT1sFXzyAj5j4FimiNhfpotQDakdw676IjDdpuyqb O81p5E9k4orOJWXZufBTvLlcGFGnL/WNy6CD3FYB8+YU20pnKXym+X6Xo5a1SiKQEs7N xr7g== X-Gm-Message-State: AA+aEWbSoymtN2qlj55RBXRz9uwMqEUHNthCNXnFgtLw6hEWmyvm3zPq f2qP7EMBlEJzm0P4wMV9tPWdXHGA X-Google-Smtp-Source: AFSGD/XAUqlAWhA1uF37fQ7ZObzJqs6si/12Xn7RsIJvL4yni4mERbI0LXmjsk0FQMMdkpe15B9mmQ== X-Received: by 2002:a63:4342:: with SMTP id q63mr2618852pga.63.1542733244461; Tue, 20 Nov 2018 09:00:44 -0800 (PST) Received: from localhost.localdomain ([103.212.140.152]) by smtp.gmail.com with ESMTPSA id 7sm31843166pfm.8.2018.11.20.09.00.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Nov 2018 09:00:43 -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 v2 5/5] Staging: iio: adt7316: Use device tree data to assign irq_type Date: Tue, 20 Nov 2018 22:30:36 +0530 Message-Id: <20181120170036.7403-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,