Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4495141imu; Sat, 19 Jan 2019 10:41:38 -0800 (PST) X-Google-Smtp-Source: ALg8bN4d2HItE9SXfpRnlNh38ULu/NMUSI5cwIDQssSAi2N2+jVxnq6iNP9S6JgSjKg+J8DCyM5t X-Received: by 2002:a63:2263:: with SMTP id t35mr22277171pgm.69.1547923298102; Sat, 19 Jan 2019 10:41:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547923298; cv=none; d=google.com; s=arc-20160816; b=Wh+SSl1QwT/yI+ElPm0ndFi4D+Z9uv8wfJ8431BjdEP43tj7PUSyZA3avgQmyI0uTG 3MjoDlD6LjHFaNaGYrZWdeUsejTjz6vQjZBe/AyNdc6sY8rf2/aOKqp0K0ySVJVXvjTB JqTTKotDkqURvkAC/nllLk+vT7q3bG0uFc4eRLwDVZndnKqUlyrrufoGC/SN12Ebc5s5 1GKBelQ4ZQ4tc+1xdF/XxTrv8jjiTDGip6mb9Fr3dEkv7nHnZt9t02nRcuCG1khIlyqU Eo8Bm6UpPdRr8wJDNmzkj+CIWPXXNbxBg1tnxvngfG2QTIPiTSr2FD9VaIaiW7/7tyKs wQJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature; bh=sVOAklPk261L5+RTM1KzurR44bu8p9J8BGuUmJ4GCSg=; b=W4tfkg+wb1spoa0uh9wU4B28oh4TRvIMJ+0pLcs2VwGh88g8uKkZ4yz9G0WCdw/QI0 hIAlE3H5eZ/8ovgTk4lutmFYkHg16kL4JNR/EXVGKHlv5lQtepXoInyw31QiyaebZaEm Si7sDBHPMnY1raDH0euYG1xE299NDQbRX6Dno4IIreRxcYzh2eyKTvRQe3ugg44yozbc 2pxCUlzSlJoKwn9gmT6Ux8flpDtktMZwhI6892if5PKXh27vVRRt3w07PlPPXUTh7dNP jJdauEpoFIVwvofdcCoOTWEVgQcXVrsCNAGRNQg4sX+ax8GbYm/8lwezU2kTp2e9I+rj auyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nehJCdfo; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g98si7778174plb.99.2019.01.19.10.41.22; Sat, 19 Jan 2019 10:41:38 -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=@gmail.com header.s=20161025 header.b=nehJCdfo; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729087AbfASSjy (ORCPT + 99 others); Sat, 19 Jan 2019 13:39:54 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35014 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728590AbfASSjw (ORCPT ); Sat, 19 Jan 2019 13:39:52 -0500 Received: by mail-pf1-f196.google.com with SMTP id z9so8210789pfi.2; Sat, 19 Jan 2019 10:39:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=sVOAklPk261L5+RTM1KzurR44bu8p9J8BGuUmJ4GCSg=; b=nehJCdfosBLJWbp4TGUGU5Q2xMmcFXHpMIVpJJOz72gSaPStSwSrJDduvJ1TN4+xsS i5kGQR+BxN/U9mwOL+DXT+nV/88/UBHLkZ3CocTp0Hx6Dwa5nyfEHEsF5TOvKQByMp/o NwaRajsgTqrWojJ6tTOXwxOLzSri1JJ7u273LaZHZpnpG4B+Xqdy+u9PkJAgn72PkypQ FnLZXq33ED56aZGmUhMPMIY3DFOWIOiHq+srHWFYYN8wZMjGjxDERdZberCuHW91uDpe nvL0nQcCBZ6+cWuuygnQkQ5xX4bO3dfyyA+7XNpGGUKGshTJyKnvhPcZYeyekr3NBZ0E JVAg== 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:in-reply-to :references; bh=sVOAklPk261L5+RTM1KzurR44bu8p9J8BGuUmJ4GCSg=; b=JpFmzwlxm3Lz0T56Gizo5EjsykbAmiUM3yiQtcIyuRlz36gbBk5Rd/0Ssk8PUuoe3h OG1fj7+i9pZMjHhKHBpN+dX1CCVbmC0Rxw+e1q6oVd1yxgUOUeEyOOH2FQxZGnUS5r0h pVdFAVETzQ8WJONt3xkII0CxmEkGLvqy1W+Be3X9oz7F9bHEwrUnqsW9qKlmAYvy682L EeyQ2NDPmqILgWh9y3CYSt8mDdk/vRsUuI2Df85LvUhpPYiIo2pSi5VbDY6AqestwbaS 0xXB+f0YnsbUhUpC8BClY7WHRwmzxMTCm9iP8JdnV8IMz5Xn8EElR5eCMLgwIcUQMtpo Onmg== X-Gm-Message-State: AJcUukeRUlGZUEUF9FMoEg0WOiuBqqSaHqlWW1d7VllJO3smg+e1Ylcf X3J9FbwZfz7lBqMZ0RHngP4= X-Received: by 2002:a62:5d0c:: with SMTP id r12mr25055773pfb.0.1547923190835; Sat, 19 Jan 2019 10:39:50 -0800 (PST) Received: from localhost.localdomain ([49.33.214.52]) by smtp.gmail.com with ESMTPSA id m20sm10127471pgb.56.2019.01.19.10.39.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Jan 2019 10:39:50 -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, shreeya.patel23498@gmail.com Subject: [PATCH v2 2/3] Staging: iio: adt7316: Remove multi read and write functions Date: Sun, 20 Jan 2019 00:09:31 +0530 Message-Id: <20190119183932.14321-3-shreeya.patel23498@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190119183932.14321-1-shreeya.patel23498@gmail.com> References: <20190119183932.14321-1-shreeya.patel23498@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, adt7316 doesn't use multi read and multi write functions hence remove the redundant code and make the necessary changes in the code. Signed-off-by: Shreeya Patel --- drivers/staging/iio/addac/adt7316-i2c.c | 40 ------------------------- drivers/staging/iio/addac/adt7316-spi.c | 31 ++++--------------- drivers/staging/iio/addac/adt7316.h | 2 -- 3 files changed, 6 insertions(+), 67 deletions(-) diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c index 335c17731cf7..40aa9e2f1966 100644 --- a/drivers/staging/iio/addac/adt7316-i2c.c +++ b/drivers/staging/iio/addac/adt7316-i2c.c @@ -56,44 +56,6 @@ static int adt7316_i2c_write(void *client, u8 reg, u8 data) return ret; } -static int adt7316_i2c_multi_read(void *client, u8 reg, u8 count, u8 *data) -{ - struct i2c_client *cl = client; - int i, ret = 0; - - if (count > ADT7316_REG_MAX_ADDR) - count = ADT7316_REG_MAX_ADDR; - - for (i = 0; i < count; i++) { - ret = adt7316_i2c_read(cl, reg, &data[i]); - if (ret < 0) { - dev_err(&cl->dev, "I2C multi read error\n"); - return ret; - } - } - - return 0; -} - -static int adt7316_i2c_multi_write(void *client, u8 reg, u8 count, u8 *data) -{ - struct i2c_client *cl = client; - int i, ret = 0; - - if (count > ADT7316_REG_MAX_ADDR) - count = ADT7316_REG_MAX_ADDR; - - for (i = 0; i < count; i++) { - ret = adt7316_i2c_write(cl, reg, data[i]); - if (ret < 0) { - dev_err(&cl->dev, "I2C multi write error\n"); - return ret; - } - } - - return 0; -} - /* * device probe and remove */ @@ -105,8 +67,6 @@ static int adt7316_i2c_probe(struct i2c_client *client, .client = client, .read = adt7316_i2c_read, .write = adt7316_i2c_write, - .multi_read = adt7316_i2c_multi_read, - .multi_write = adt7316_i2c_multi_write, }; return adt7316_probe(&client->dev, &bus, id->name, client->irq); diff --git a/drivers/staging/iio/addac/adt7316-spi.c b/drivers/staging/iio/addac/adt7316-spi.c index adaaa3eecd04..1a78dc1e2840 100644 --- a/drivers/staging/iio/addac/adt7316-spi.c +++ b/drivers/staging/iio/addac/adt7316-spi.c @@ -23,15 +23,12 @@ * adt7316 register access by SPI */ -static int adt7316_spi_multi_read(void *client, u8 reg, u8 count, u8 *data) +static int adt7316_spi_read(void *client, u8 reg, u8 *data) { struct spi_device *spi_dev = client; u8 cmd[2]; int ret = 0; - if (count > ADT7316_REG_MAX_ADDR) - count = ADT7316_REG_MAX_ADDR; - cmd[0] = ADT7316_SPI_CMD_WRITE; cmd[1] = reg; @@ -43,7 +40,7 @@ static int adt7316_spi_multi_read(void *client, u8 reg, u8 count, u8 *data) cmd[0] = ADT7316_SPI_CMD_READ; - ret = spi_write_then_read(spi_dev, cmd, 1, data, count); + ret = spi_write_then_read(spi_dev, cmd, 1, data, 1); if (ret < 0) { dev_err(&spi_dev->dev, "SPI read data error\n"); return ret; @@ -52,21 +49,17 @@ static int adt7316_spi_multi_read(void *client, u8 reg, u8 count, u8 *data) return 0; } -static int adt7316_spi_multi_write(void *client, u8 reg, u8 count, u8 *data) +static int adt7316_spi_write(void *client, u8 reg, u8 val) { struct spi_device *spi_dev = client; u8 buf[ADT7316_REG_MAX_ADDR + 2]; - int i, ret = 0; - - if (count > ADT7316_REG_MAX_ADDR) - count = ADT7316_REG_MAX_ADDR; + int ret = 0; buf[0] = ADT7316_SPI_CMD_WRITE; buf[1] = reg; - for (i = 0; i < count; i++) - buf[i + 2] = data[i]; + buf[2] = val; - ret = spi_write(spi_dev, buf, count + 2); + ret = spi_write(spi_dev, buf, 3); if (ret < 0) { dev_err(&spi_dev->dev, "SPI write error\n"); return ret; @@ -75,16 +68,6 @@ static int adt7316_spi_multi_write(void *client, u8 reg, u8 count, u8 *data) return ret; } -static int adt7316_spi_read(void *client, u8 reg, u8 *data) -{ - return adt7316_spi_multi_read(client, reg, 1, data); -} - -static int adt7316_spi_write(void *client, u8 reg, u8 val) -{ - return adt7316_spi_multi_write(client, reg, 1, &val); -} - /* * device probe and remove */ @@ -95,8 +78,6 @@ static int adt7316_spi_probe(struct spi_device *spi_dev) .client = spi_dev, .read = adt7316_spi_read, .write = adt7316_spi_write, - .multi_read = adt7316_spi_multi_read, - .multi_write = adt7316_spi_multi_write, }; /* don't exceed max specified SPI CLK frequency */ diff --git a/drivers/staging/iio/addac/adt7316.h b/drivers/staging/iio/addac/adt7316.h index 03d5300a98cd..e9f288420234 100644 --- a/drivers/staging/iio/addac/adt7316.h +++ b/drivers/staging/iio/addac/adt7316.h @@ -18,8 +18,6 @@ struct adt7316_bus { void *client; 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); - int (*multi_write)(void *client, u8 first_reg, u8 count, u8 *data); }; #ifdef CONFIG_PM_SLEEP -- 2.17.1