From patchwork Wed Nov 22 21:12:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 840525 X-Patchwork-Delegate: bartekgola@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kIb5lzXg"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yhwD15wkgz9rxm for ; Thu, 23 Nov 2017 08:13:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752140AbdKVVNP (ORCPT ); Wed, 22 Nov 2017 16:13:15 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:33817 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751681AbdKVVNM (ORCPT ); Wed, 22 Nov 2017 16:13:12 -0500 Received: by mail-wr0-f196.google.com with SMTP id k18so10846683wre.1 for ; Wed, 22 Nov 2017 13:13:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=4EIJvyAx5ZsLpZPQ9Tm/Nb3Btaax3qUsWkYKYKgmIiU=; b=kIb5lzXgWFrsvHhiY94Z6JMwjwHBtXYXhr+YuK8Ryjo91X1kSUYtpRS8ggrmF/gI05 YPiLPhFaAby50NUlmYqGQFCrk1rV+CKaejIKkf//4GfbeWWoSDO0muXHdDgAuNu6D8b3 DOAQGi6Y+Nhh6FZlEPrsjnZ6oK1WJpzOmmP2x/+VXkitXCrlZbpqeXXP4JAzcNEQNYDp U5WrvZfOsv2GX+nZzQyEe3WQpx1Xyo6gcLT1ckqJ3AweymxH/518xqcXdVZ3TH0UjpKP /ymBIdFa19Bf5ECElNlZe/XNVm56zIM1Vhmz1C6btwbIsqzvxTaxw6nwp7AwpY5fH7n2 ai8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=4EIJvyAx5ZsLpZPQ9Tm/Nb3Btaax3qUsWkYKYKgmIiU=; b=ZKfWouyWwTAoGxVoPEv0qnA7xV3+PrsQNxNS3wmsLPm8TQcAvrKFq8Y5x7YOSMRidI pi8p927VzlfSDk2xzZGnql6L7eZFgOsYML636chtEY0gO1hGhNSCNXMYP+AGAY1qAMLX dgcv+0vrAchePPOvGpBiSloXiZ0xdC0WhW2+55p7zc87JHgSd+a4Nv7/rmN9KUbMuw+p w9IeqV5ghzjg9LX64UQRQP93LLD0RLLJj2Lem3t02jJK5XBTI7/rW298ajlwtGWm554q bJp29sQXnEZRCHPA1FmHzX7uDw5RdH5fxhClLzyjoG5ALJxDofw3WVDzjl6UsVTi/AEu tpqQ== X-Gm-Message-State: AJaThX5VtuP/OvIo7KtgEGktL7ayCSkKkfttRksunfrE4xGVOkyJyb14 iWUMAkS3f3fumqwoOekNLzJgVw== X-Google-Smtp-Source: AGs4zMaZGW4Vv6bdVtxSS/DZ6YG91tSjJdSanj7Ipfyy88o4c3jRWZKXVGoJY2CtevwDDfMW5OsGQg== X-Received: by 10.223.170.143 with SMTP id h15mr20839970wrc.49.1511385190819; Wed, 22 Nov 2017 13:13:10 -0800 (PST) Received: from ?IPv6:2003:ea:8bc0:e400:58ac:8788:9665:db13? (p200300EA8BC0E40058AC87889665DB13.dip0.t-ipconnect.de. [2003:ea:8bc0:e400:58ac:8788:9665:db13]) by smtp.googlemail.com with ESMTPSA id q89sm10925667wrb.95.2017.11.22.13.13.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 13:13:10 -0800 (PST) From: Heiner Kallweit Subject: [PATCH v4 4/7] eeprom: at24: remove old write functions To: Bartosz Golaszewski Cc: "linux-i2c@vger.kernel.org" References: <0448eec2-7dfb-ca79-d03a-d5b7fcb5d76c@gmail.com> Message-ID: <366a5e66-46b1-dfaa-cdc3-a59cdb495a2f@gmail.com> Date: Wed, 22 Nov 2017 22:12:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <0448eec2-7dfb-ca79-d03a-d5b7fcb5d76c@gmail.com> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Remove the old and now unused write functions. Signed-off-by: Heiner Kallweit --- v2: - rebased v3: - rebased v4: - no changes --- drivers/misc/eeprom/at24.c | 117 --------------------------------------------- 1 file changed, 117 deletions(-) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 86a36482a..493e2b646 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -64,11 +64,8 @@ struct at24_client { struct at24_data { struct at24_platform_data chip; int use_smbus; - int use_smbus_write; ssize_t (*read_func)(struct at24_data *, char *, unsigned int, size_t); - ssize_t (*write_func)(struct at24_data *, - const char *, unsigned int, size_t); /* * Lock protects against activities from other Linux tasks, @@ -76,7 +73,6 @@ struct at24_data { */ struct mutex lock; - u8 *writebuf; unsigned write_max; unsigned num_addresses; @@ -481,62 +477,6 @@ static size_t at24_adjust_write_count(struct at24_data *at24, return count; } -static ssize_t at24_eeprom_write_smbus_block(struct at24_data *at24, - const char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, write_time; - struct at24_client *at24_client; - struct i2c_client *client; - ssize_t status = 0; - - at24_client = at24_translate_offset(at24, &offset); - client = at24_client->client; - count = at24_adjust_write_count(at24, offset, count); - - loop_until_timeout(timeout, write_time) { - status = i2c_smbus_write_i2c_block_data(client, - offset, count, buf); - if (status == 0) - status = count; - - dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", - count, offset, status, jiffies); - - if (status == count) - return count; - } - - return -ETIMEDOUT; -} - -static ssize_t at24_eeprom_write_smbus_byte(struct at24_data *at24, - const char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, write_time; - struct at24_client *at24_client; - struct i2c_client *client; - ssize_t status = 0; - - at24_client = at24_translate_offset(at24, &offset); - client = at24_client->client; - - loop_until_timeout(timeout, write_time) { - status = i2c_smbus_write_byte_data(client, offset, buf[0]); - if (status == 0) - status = count; - - dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", - count, offset, status, jiffies); - - if (status == count) - return count; - } - - return -ETIMEDOUT; -} - static ssize_t at24_regmap_write(struct at24_data *at24, const char *buf, unsigned int offset, size_t count) { @@ -562,47 +502,6 @@ static ssize_t at24_regmap_write(struct at24_data *at24, const char *buf, return -ETIMEDOUT; } -static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, write_time; - struct at24_client *at24_client; - struct i2c_client *client; - struct i2c_msg msg; - ssize_t status = 0; - int i = 0; - - at24_client = at24_translate_offset(at24, &offset); - client = at24_client->client; - count = at24_adjust_write_count(at24, offset, count); - - msg.addr = client->addr; - msg.flags = 0; - - /* msg.buf is u8 and casts will mask the values */ - msg.buf = at24->writebuf; - if (at24->chip.flags & AT24_FLAG_ADDR16) - msg.buf[i++] = offset >> 8; - - msg.buf[i++] = offset; - memcpy(&msg.buf[i], buf, count); - msg.len = i + count; - - loop_until_timeout(timeout, write_time) { - status = i2c_transfer(client->adapter, &msg, 1); - if (status == 1) - status = count; - - dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", - count, offset, status, jiffies); - - if (status == count) - return count; - } - - return -ETIMEDOUT; -} - static int at24_read(void *priv, unsigned int off, void *val, size_t count) { struct at24_data *at24 = priv; @@ -836,7 +735,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) mutex_init(&at24->lock); at24->use_smbus = use_smbus; - at24->use_smbus_write = use_smbus_write; at24->chip = chip; at24->num_addresses = num_addresses; @@ -860,15 +758,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) : at24_eeprom_read_i2c; } - if (at24->use_smbus) { - if (at24->use_smbus_write == I2C_SMBUS_I2C_BLOCK_DATA) - at24->write_func = at24_eeprom_write_smbus_block; - else - at24->write_func = at24_eeprom_write_smbus_byte; - } else { - at24->write_func = at24_eeprom_write_i2c; - } - writable = !(chip.flags & AT24_FLAG_READONLY); if (writable) { if (!use_smbus || use_smbus_write) { @@ -880,12 +769,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) write_max = I2C_SMBUS_BLOCK_MAX; at24->write_max = write_max; - - /* buffer (data + address at the beginning) */ - at24->writebuf = devm_kzalloc(&client->dev, - write_max + 2, GFP_KERNEL); - if (!at24->writebuf) - return -ENOMEM; } else { dev_warn(&client->dev, "cannot write due to controller restrictions.");