From patchwork Fri Nov 16 22:49:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 10687105 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 7AC7C1747 for ; Fri, 16 Nov 2018 22:49:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6131D2CB7B for ; Fri, 16 Nov 2018 22:49:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54BE92CBC8; Fri, 16 Nov 2018 22:49:15 +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 EC17C2CB7B for ; Fri, 16 Nov 2018 22:49:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726035AbeKQJD3 (ORCPT ); Sat, 17 Nov 2018 04:03:29 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41644 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbeKQJD2 (ORCPT ); Sat, 17 Nov 2018 04:03:28 -0500 Received: by mail-pl1-f194.google.com with SMTP id u6so908219plm.8; Fri, 16 Nov 2018 14:49:13 -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=xa7mMwilfARzNlzgBshZrLuLhTmZAU6FLzH06agvJF0=; b=pWhO7j8lshrUTTsoIXqfiRcfWRcVjYemY6CB23DWYNUKul6JwjHPxhhzYxOFZHWvDq UWBKEC+EW5Bo8gtX7UCzxrhJz5G2TUaslN1GcXjJ1XlxQK6NcdZvtJoJ6uNpb+bA1yFq M1QgnN6QV35bz8unapINX//xRiq8w2KytXjlpaxG7/fjt64yNuDtMXqlPdOBja5naxGA j3Dt+0rty+GRUgb/x4k6AQosJTAuyLTW98G2XIOdpq7Dk8DhYdr+fdo9oDUCceWjkqLJ KUg+hHdyjlTcjKJwHCMXMrL1mX7rIvkCWENNrZ03foY1oxztbMbPu9Ki25D+7ho3wN90 366g== 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=xa7mMwilfARzNlzgBshZrLuLhTmZAU6FLzH06agvJF0=; b=NQYtpSoYcVL+5KLezL56qGu/3NkGmifBcuIbaeaTpXNeO0cRz/pXfZNflNVOVX//pZ l4J3Ve7yZY9WODEFpOAyhM3lRIdnUpZ8lJHAiLseNDt9aOXKnsyiKVmwWIeGwIkxuCfl Qb3cg9pxDlKD94E8VvPA7+oYe8gJOs3kG6LZiBcoBdrFNuc2nX8qoqMPBorHcIpJQgfQ XwzRWY/UkZ0cEXvLerO25kPuQGbVufU/j5uSWtBPh0NqPDHFyDo51ZBounD8/CHqhi4+ Dib776OKwF1Opb+q9Fs97pMwrB/R+yxH0AxhmmCmGKselwcj2V8ONZ1Pqgiuj8QaD/+8 iDXg== X-Gm-Message-State: AGRZ1gK0bU7dWqzmsNvkaS+jKC/yxOdhZhBz3di86/vNf1GHiNW+pRE5 pVn8DFUK6TdWXlmkl7BQAhY= X-Google-Smtp-Source: AJdET5eRT/xt0lA0riteQjBPIZFI9UpvfR1OOE3qpm4zOVqrJ9rSAgI/j+HihLKsaybwpIahHc/dsw== X-Received: by 2002:a17:902:aa8d:: with SMTP id d13-v6mr12936705plr.74.1542408553213; Fri, 16 Nov 2018 14:49:13 -0800 (PST) Received: from localhost.localdomain ([103.212.140.154]) by smtp.gmail.com with ESMTPSA id 27-v6sm45417607pfm.36.2018.11.16.14.49.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 14:49:12 -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 1/7] Staging: iio: adt7316: Set the data field Date: Sat, 17 Nov 2018 04:19:07 +0530 Message-Id: <20181116224907.24376-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_i2c_read function nowhere sets the data field. It is necessary to have an appropriate value for it. Hence, assign the value stored in 'ret' variable to data field. Signed-off-by: Shreeya Patel --- drivers/staging/iio/addac/adt7316-i2c.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c index f66dd3ebbab1..856bcfa60c6c 100644 --- a/drivers/staging/iio/addac/adt7316-i2c.c +++ b/drivers/staging/iio/addac/adt7316-i2c.c @@ -35,6 +35,8 @@ static int adt7316_i2c_read(void *client, u8 reg, u8 *data) return ret; } + *data = ret; + return 0; } From patchwork Fri Nov 16 22:51: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: 10687107 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 7E1E213B5 for ; Fri, 16 Nov 2018 22:51:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BF322CBEA for ; Fri, 16 Nov 2018 22:51:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C3D42CC1A; Fri, 16 Nov 2018 22:51:40 +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 010642CBEA for ; Fri, 16 Nov 2018 22:51:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726607AbeKQJFy (ORCPT ); Sat, 17 Nov 2018 04:05:54 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39882 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbeKQJFy (ORCPT ); Sat, 17 Nov 2018 04:05:54 -0500 Received: by mail-pf1-f193.google.com with SMTP id c72so7373819pfc.6; Fri, 16 Nov 2018 14:51: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=OwHcst+enILOIrmgfby8FDaIChOrcGZVIxgWGuwQJZI=; b=fhTFvyiamH4EGxbnSXyG3JpZ/JBP3STklHfIMitnqr5oTszVyRaxmHSQcCykJvOBqh dQGqM7vWiapOwwMcqg993RUvn4gvR4FEP2EupK5fgA9pUWYilizKgPHdyuEFjOnaPSwD KdL6Zd6pLKQwYk0eSMZ2wERA5wzf5BA55nEV+Td3vfFrlubPw7tMb+sgoET6SuUCvklB iC9ADUjIyA6Y2fn4UQLEixH37m40KQvEKMb5+d1zni2cdr6JCbZUfMw6bvxFHjGg6ca+ 8oJZqhle5ylkC13k3P091wmWQ50c7d55KStG9gSh2d/ZFSFd39TlhwWaEniLHKo1HNkK YbQQ== 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=OwHcst+enILOIrmgfby8FDaIChOrcGZVIxgWGuwQJZI=; b=PJ8O9o3K+qpkWs4zeheXNPnFAUMEAPC3lqRwyzsgxWBL31T8r4Q1X1PuIs7zaqDaVR wA9hT5now5uI1sTwPWp17JIsdKjOCYRegPQxxnXVfHuXAp5FdovnSK/ClLhWde087l+1 88BV+KN1lcWhEoB/cUVt0jqLYpBEvlHsIuT5t5yLZJJnqwoH1QwMpqpT+cUbE2NOUMWj DncEzAiY+onWaKIilJpmrsE77tzIkpREUuOBe2MGnWQczGjtwAst7n3AbsiIbzaKFMAc Qw/876rTldr/HHZ6Ghw0q+Vvkp8XQAnMTuW9ewhilLsVKrV0OMCBO3lRaF7MXiEpT8+/ cEdA== X-Gm-Message-State: AGRZ1gKMHEXzrp9nzde+UW/TqdWOPPjQRItQiiE2DzgUBEYbmoizI07c rNgPGJomXVQ8K9FJleMjo/M= X-Google-Smtp-Source: AJdET5eXpe8zD0VAjobO2dAI69cHXfF4WKLOS1vSatOQXdxpU9T4phi3NMZbDgn80/NuWN4zSjXAKg== X-Received: by 2002:a63:4e41:: with SMTP id o1mr11889942pgl.282.1542408698201; Fri, 16 Nov 2018 14:51:38 -0800 (PST) Received: from localhost.localdomain ([103.212.140.154]) by smtp.gmail.com with ESMTPSA id 34sm47407359pgp.90.2018.11.16.14.51.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 14:51: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 2/7] Staging: iio: adt7316: Add an extra check for 'ret' equals to 0 Date: Sat, 17 Nov 2018 04:21:32 +0530 Message-Id: <20181116225132.24459-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 ret = 0 indicates a case of no error but no data read from the bus which is an invalid case. This case doesn't ever happen in reality. It should perhaps be handled for correctness though. Signed-off-by: Shreeya Patel --- drivers/staging/iio/addac/adt7316-i2c.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c index 856bcfa60c6c..473e5e34ec00 100644 --- a/drivers/staging/iio/addac/adt7316-i2c.c +++ b/drivers/staging/iio/addac/adt7316-i2c.c @@ -30,6 +30,10 @@ static int adt7316_i2c_read(void *client, u8 reg, u8 *data) } ret = i2c_smbus_read_byte(client); + + if (!ret) + return -EIO; + if (ret < 0) { dev_err(&cl->dev, "I2C read error\n"); return ret; From patchwork Fri Nov 16 22:55:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 10687109 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 BA2F514DB for ; Fri, 16 Nov 2018 22:55:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA3442CEF5 for ; Fri, 16 Nov 2018 22:55:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E5792CEF8; Fri, 16 Nov 2018 22:55: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 5268F2CEF5 for ; Fri, 16 Nov 2018 22:55:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729954AbeKQJKA (ORCPT ); Sat, 17 Nov 2018 04:10:00 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:32779 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbeKQJJ7 (ORCPT ); Sat, 17 Nov 2018 04:09:59 -0500 Received: by mail-pf1-f195.google.com with SMTP id v68-v6so12073332pfk.0; Fri, 16 Nov 2018 14:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ScFtGBrlajRSaqOZKDSi+ZNN1qxF/nK+tAQqaxfHfNw=; b=Wwm/jcIphCQaNwfGsoFjT9lOWd8mFqBLZm5Aai14EP89GfRdmJn1BXs1lC7Z/Hisc1 tUEPr9inAp3cM77mriqGB1Dn1CyPuwAiY2Rm63Ce62gzGsoJRbhvncg7hgAtysfwBmIy OzMvRTqz55CLXrY/aHvqGn0tXDZxFBXTjjS8/wYNkd1ZOqhg5gCFlZppimf61y3VbSss nnDPwsp07ntCu7I9sgx2loUgWe/b8CX/ErYjZlyk2rPwz3nF0f6MvVdv8GpNKoRknVeT X8Ke+b0P2AdCCtkyrDstQXTVS2aWYw8GjMGSdp/+Tj7U2bytZF25GF3ThFpS0tOBDTkd OgOQ== 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:mime-version :content-transfer-encoding; bh=ScFtGBrlajRSaqOZKDSi+ZNN1qxF/nK+tAQqaxfHfNw=; b=P8QEdP9FTq3XcdKHcpxlHYNENH5D7swBYDUvFcx085K1ftLw+/n72QodeO14zypO4m UbGf4XSdpr91bfwLIw+6XGqT7K34kcNCSJrqzbLZUV2lBPJUaFLDpNUlDihzShu1ataT cVx6socU+xqtnefuSQgx7FZKxa4JzdlCGNCQrbJ3eg2LPSKdc4Pn4sMxIw3bR7HI/G3l z8MFvRz1/nKn9bEizQqSRXa0HZhUd+MrXBWleb5rh6NBVbBgXi3eAnUofcfkqYIECWa8 prTgQgLZQ7VZnLcVrDJjcVkAXvY+6ympCDYzvNRSlmDhFA4ZOfDSHBw5jGfjD7O2EsGj /JiA== X-Gm-Message-State: AGRZ1gJxdZ3pED0MSbyjS6Q/kMSEq2bw9/NZAUp46PRAdLF6aJx9HYQG gRbd16C/0uDr+jICOD0xjZ4= X-Google-Smtp-Source: AJdET5cOgpOTr3kIxCvdlgh0MIwUlv3dxdxNTcthdlCOfD2CKVjqaGU+rZGQHVF81Cyn/QZWErchTQ== X-Received: by 2002:a62:7504:: with SMTP id q4mr12828805pfc.180.1542408943102; Fri, 16 Nov 2018 14:55:43 -0800 (PST) Received: from localhost.localdomain ([103.212.140.154]) by smtp.gmail.com with ESMTPSA id u19-v6sm35754093pfh.153.2018.11.16.14.55.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 14:55:42 -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 3/7] Staging: iio: adt7316: Add of_device_id table Date: Sat, 17 Nov 2018 04:25:37 +0530 Message-Id: <20181116225537.24723-1-shreeya.patel23498@gmail.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 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 When the kernel starts up, it kicks off compiled-in drivers that match “compatible” entries it finds in the device tree. At a later stage (when /lib/modules is available), all kernel modules that match “compatible” entries in the device tree are loaded. Hence to be able to use device tree for ADT7316, add of_device_id table which specifies the supported devices through compatible property. Note that there is a fall back path in i2c that will result in i2c_device_id table being used if there is no of_devcie_id table. Signed-off-by: Shreeya Patel --- drivers/staging/iio/addac/adt7316-i2c.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c index 473e5e34ec00..d4b5060c18ee 100644 --- a/drivers/staging/iio/addac/adt7316-i2c.c +++ b/drivers/staging/iio/addac/adt7316-i2c.c @@ -126,6 +126,18 @@ static const struct i2c_device_id adt7316_i2c_id[] = { MODULE_DEVICE_TABLE(i2c, adt7316_i2c_id); +static const struct of_device_id adt7316_of_match[] = { + { .compatible = "adi,adt7316" }, + { .compatible = "adi,adt7317" }, + { .compatible = "adi,adt7318" }, + { .compatible = "adi,adt7516" }, + { .compatible = "adi,adt7517" }, + { .compatible = "adi,adt7519" }, + { }, +}; + +MODULE_DEVICE_TABLE(of, adt7316_of_match); + static struct i2c_driver adt7316_driver = { .driver = { .name = "adt7316",