From patchwork Fri Nov 16 22:57:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 10687111 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 D39BA13B5 for ; Fri, 16 Nov 2018 22:57:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA4842CEF6 for ; Fri, 16 Nov 2018 22:57:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD1D92CEF8; Fri, 16 Nov 2018 22:57:44 +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 27A572CEF6 for ; Fri, 16 Nov 2018 22:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728043AbeKQJLy (ORCPT ); Sat, 17 Nov 2018 04:11:54 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:38674 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbeKQJLy (ORCPT ); Sat, 17 Nov 2018 04:11:54 -0500 Received: by mail-pl1-f196.google.com with SMTP id e5so1772638plb.5; Fri, 16 Nov 2018 14:57:38 -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=zNs2xBlZTXJMas/ITpZ31ZhslFUYpV/Egqz6U1dNoRs=; b=AiF+uM5iSK+i5Ybez9CbgCfedUkPQxXfIHeWLPZPDZbNRg46tFoX5p11nW4xN9rm68 fMisNWkqd6ZfFhbWuzEEKmoUo1t6BsTkWbJYL8QMhIq+Z4BO+YrMwOI3WspseyvIy2Nn MAPQ02oNvvdjD6pluaMsmsKv6b3pCtbyPFiREw7mHMiar4qUGJKx1b8eKNmvOd7rFxve 4rc49Fj5lDjwy/yVkF+v5zEvYSseh30nvZ4A9vrzke7nhMi7WIbsPLgk3I4NBSBYwf/L lV39wGVbg+yPYvAmsH1B6s9A+h3vaPfdvLmYupVhaMU9NdnQDTF+P4R32WuaboULmIEs s01A== 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=zNs2xBlZTXJMas/ITpZ31ZhslFUYpV/Egqz6U1dNoRs=; b=RzC+vR3La307UUOWJu8kCHhC8SG+OACYRRIuwE/RFZwkI1OcwUc+GVa/5AWVCHiy+v Abn8k5baUCBhnRF7YF1VDhKRU2+m27RVXYrDxrK8BgByxV3ud+0X1PNCp8kfzlh8PZCg ugPGUodBvz28T0erAAppx+lmz8zFs6sgsPSMS3ZzGubOXEnOQgdVaprRHEzPT7pBgqGQ 0hVBGKg0XXoAMfIG3d/pbf9aLFBwkS0OwU4bAHHKVK5PG08bu7X4xcWPuIbDQq/EGUHg dappic9QadFAspxc9HG1ztsIWF5Th9jhchAxwANYKiy2JkR7/QsTbo9xmWTAudxvK4Bg yYGw== X-Gm-Message-State: AA+aEWZRN48w2ZwHRGjc1eAzGilzuD06E6Mpb2T8YTda1J9lx1d7cjyx eP9Oy5ym7QFzJFXGCwMdsMU= X-Google-Smtp-Source: AFSGD/UDjI9jweK8d1XWCdKp0ehNYdtxmWaSQH/YO1r8y2He1fUV2uUwdtkkwfSWwokmF+ocin6VQA== X-Received: by 2002:a17:902:8ec9:: with SMTP id x9mr839145plo.27.1542409057583; Fri, 16 Nov 2018 14:57:37 -0800 (PST) Received: from localhost.localdomain ([103.212.140.154]) by smtp.gmail.com with ESMTPSA id 137-v6sm35425004pfz.103.2018.11.16.14.57.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 14:57:37 -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 4/7] Staging: iio: adt7316: Use device tree data to set ldac_pin Date: Sat, 17 Nov 2018 04:27:32 +0530 Message-Id: <20181116225732.24823-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 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 --- 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) From patchwork Fri Nov 16 22:59:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 10687115 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 702FD14DB for ; Fri, 16 Nov 2018 23:00:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B3812CF29 for ; Fri, 16 Nov 2018 23:00:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48E232CF21; Fri, 16 Nov 2018 23:00:02 +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 D1C6C2CF21 for ; Fri, 16 Nov 2018 23:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729765AbeKQJOM (ORCPT ); Sat, 17 Nov 2018 04:14:12 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:35656 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbeKQJOM (ORCPT ); Sat, 17 Nov 2018 04:14:12 -0500 Received: by mail-pg1-f196.google.com with SMTP id 32-v6so11219687pgu.2; Fri, 16 Nov 2018 14:59:55 -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=wcOr0IyKfNnQzLgC+t07yZkvswNA9tMU8FyJkchOris=; b=D3rqOmR27SbqitfqRcX4mV50QGNxqp1dASTsjtRThO5T0O1W69lg2F+rOMMEdw2QPp 8bSIXObng/7C+Iw3OIZiCNXt9cmD860vf95OHDIT2UAxV3eFC1N9yptzF/c6MmDxZNg1 IVdH/y1lLVcQNjl+N4KGoxuYANnOr1nzrtMqCKhp6ziynQAPkwScp7NrLH8eR4iRRj8W mf7Xr3UkY+J+w7m2BUmbLEKLwkspxYFefo09I2M6RZMrykJL/IffkuDckP8SXO7ENmp3 AKjzl6PtzlPbu2n4vJg8r7tLNrLdRSJbZ84TaRqxM0/KfhNTEkaTt0G0eDv5RW5Z4+ra fztg== 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=wcOr0IyKfNnQzLgC+t07yZkvswNA9tMU8FyJkchOris=; b=fSCW8Qelvt2O/EiV5nEqezKd3cQlLxaeiUQIq/rmG/OIlwJANsxwtDoDPQDXz1NayS /0MAGI2/EGGhjPPSm0Z99LyUlEAOwzu4fyV5nF1avQsNF8QiCDH2P4hHo06Z2vDgs5fc v5ig0/A90Iv7/JvJCxczi4kyqspwrFRyiNxsCSM+vdLjEEeuJU+qusyxWiIGesrAMI6Q ingX0fXafUutqDwqTrCa5c3h2JdKjDyRHqTWexVTvYVCu1vaNoJVxDcGDgpvt0bGdspA YEIWWs96adR2IirnuutNSOL8HaEFlFRU9O1FrIUkNhJl8EXKM8bIec0qqdhSE7o/eEWW IfHw== X-Gm-Message-State: AGRZ1gJIlDz15Q2heUmSGbAHQFlOoCBHy5K4czjrRMC5+JdV8d6TLNJn GAz7Q6goEexnqH/XyyFVAH4= X-Google-Smtp-Source: AJdET5d8t5MH/dIeL+10DWve5kO2nZJ4mq+gL1DFmwEEZKNCVrT+EliGYcH6i+xgw4F5CaMoBoIneQ== X-Received: by 2002:a63:5c41:: with SMTP id n1mr10265692pgm.1.1542409195175; Fri, 16 Nov 2018 14:59:55 -0800 (PST) Received: from localhost.localdomain ([103.212.140.154]) by smtp.gmail.com with ESMTPSA id w80-v6sm55317406pfk.11.2018.11.16.14.59.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 14:59:54 -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 5/7] Staging: iio: adt7316: Switch irq_flags to a local variable Date: Sat, 17 Nov 2018 04:29:49 +0530 Message-Id: <20181116225949.24913-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 There is no need to store irq_flags into the structure as it is always set to the same thing. Hence switch irq_flags to a local variable. Signed-off-by: Shreeya Patel --- drivers/staging/iio/addac/adt7316-i2c.c | 1 - drivers/staging/iio/addac/adt7316-spi.c | 1 - drivers/staging/iio/addac/adt7316.c | 8 ++++---- drivers/staging/iio/addac/adt7316.h | 1 - 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c index d4b5060c18ee..91d6cdcb747e 100644 --- a/drivers/staging/iio/addac/adt7316-i2c.c +++ b/drivers/staging/iio/addac/adt7316-i2c.c @@ -104,7 +104,6 @@ static int adt7316_i2c_probe(struct i2c_client *client, struct adt7316_bus bus = { .client = client, .irq = client->irq, - .irq_flags = IRQF_TRIGGER_LOW, .read = adt7316_i2c_read, .write = adt7316_i2c_write, .multi_read = adt7316_i2c_multi_read, diff --git a/drivers/staging/iio/addac/adt7316-spi.c b/drivers/staging/iio/addac/adt7316-spi.c index 5cd22743e140..e75827e326a6 100644 --- a/drivers/staging/iio/addac/adt7316-spi.c +++ b/drivers/staging/iio/addac/adt7316-spi.c @@ -94,7 +94,6 @@ static int adt7316_spi_probe(struct spi_device *spi_dev) struct adt7316_bus bus = { .client = spi_dev, .irq = spi_dev->irq, - .irq_flags = IRQF_TRIGGER_LOW, .read = adt7316_spi_read, .write = adt7316_spi_write, .multi_read = adt7316_spi_multi_read, diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c index deb2f7b40f60..dfae22619287 100644 --- a/drivers/staging/iio/addac/adt7316.c +++ b/drivers/staging/iio/addac/adt7316.c @@ -2102,6 +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 ret = 0; indio_dev = devm_iio_device_alloc(dev, sizeof(*chip)); @@ -2146,19 +2147,18 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus, if (chip->bus.irq > 0) { if (adt7316_platform_data[0]) - chip->bus.irq_flags = adt7316_platform_data[0]; + irq_flags = adt7316_platform_data[0]; ret = devm_request_threaded_irq(dev, chip->bus.irq, NULL, adt7316_event_handler, - chip->bus.irq_flags | - IRQF_ONESHOT, + irq_flags | IRQF_ONESHOT, indio_dev->name, indio_dev); if (ret) return ret; - if (chip->bus.irq_flags & IRQF_TRIGGER_HIGH) + if (irq_flags & IRQF_TRIGGER_HIGH) chip->config1 |= ADT7316_INT_POLARITY; } diff --git a/drivers/staging/iio/addac/adt7316.h b/drivers/staging/iio/addac/adt7316.h index ec40fbb698a6..fd7c5c92b599 100644 --- a/drivers/staging/iio/addac/adt7316.h +++ b/drivers/staging/iio/addac/adt7316.h @@ -17,7 +17,6 @@ struct adt7316_bus { void *client; int irq; - int irq_flags; int (*read)(void *client, u8 reg, u8 *data); int (*write)(void *client, u8 reg, u8 val); int (*multi_read)(void *client, u8 first_reg, u8 count, u8 *data); From patchwork Fri Nov 16 23:02:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 10687117 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 7848513B5 for ; Fri, 16 Nov 2018 23:02:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FB622CFAF for ; Fri, 16 Nov 2018 23:02:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 545E02CFE0; Fri, 16 Nov 2018 23:02:50 +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 CCC4D2CFAF for ; Fri, 16 Nov 2018 23:02:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725995AbeKQJRG (ORCPT ); Sat, 17 Nov 2018 04:17:06 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38796 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbeKQJRF (ORCPT ); Sat, 17 Nov 2018 04:17:05 -0500 Received: by mail-pf1-f194.google.com with SMTP id q1so4070770pfi.5; Fri, 16 Nov 2018 15:02:48 -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=eTX7PtUr6Q7zkF+X5PRrXV48Zpfxuf4qKpn1IOAx0xC1C6lSMlL/wxSFvWXFmg3SrX ZveZ8ZKvxZzh1R8CRjOATCinMdkIwaNQqmnVA1+pUGoTaE0NvIk8ps9mNcCy+JZx+Sof X5TWS4qO7IMNjLQ09Fp227CNz6Twrmgsp8iq3Uo57+U52sjwxHEdZsZM0QJh9AHUXT8g 6APhMAehtDiywKqd53cYkx/rBx20SKsU2T93vWtP/yFQp7fPhaXPOhuFTYTBAfUblRSV Oe4NYD5YUjn8sixq5tLbM7A4OdxqebL9itoUikgpa5nGZgsQPfyxrvO7vPMwW0qbQM0Y u6kg== 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=YEImEWD5yVSwph33i5QaYtkRQkVHZ14xvQG7CSubL0muwf037/2o/+g+RCOFb6Q9ae 6/zZeBvRkjxYGWJuPtI/EqlMnaRcNBMNjs/wwOcI9LyQn1K+nQ+tBz7hF0xtfsP8fih2 O2oK0mkYFV5YFpzZlAAKgQclw6NPsP2+w6s5iYIGO0Su9Y/enL4LKbWGouRysLDJ2v/U FlOoSRaqiCDpm4RMIogNhhyLzxDlgo51Z0cEkJQ3cIPIBAuZxSlBh/aSNvdxtr2gF13J rdhAPF9anEZ92mtNijuXLt8eGdyBuIofAUBOggoDHaxSVRQ7O38D8ACi5OQuJrVaebEU qWqg== X-Gm-Message-State: AGRZ1gLYXbjTpXQr9ayYtK7i/9RnGRuVcB2PHSjPqeZd6+8y6k+cIK3u jBk9DKBHUTfw7e/SsvZcqYs= X-Google-Smtp-Source: AJdET5dI7UQJil4xr1fsCJyQTAMYEi7rUK5gXJEOsWOyg+EhmaWfXpuPjVnhmis0z1bPHxVvWCaJTg== X-Received: by 2002:a63:f34b:: with SMTP id t11mr11740169pgj.341.1542409368558; Fri, 16 Nov 2018 15:02:48 -0800 (PST) Received: from localhost.localdomain ([103.212.140.154]) by smtp.gmail.com with ESMTPSA id 18sm31043413pgl.50.2018.11.16.15.02.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 15:02:48 -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 6/7] Staging: iio: adt7316: Change the name from irq_flags to irq_type Date: Sat, 17 Nov 2018 04:32:43 +0530 Message-Id: <20181116230243.24985-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 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,