From patchwork Thu Aug 17 05:59:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 802348 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="aj7MShs5"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xXwXd6Ncfz9t3B for ; Thu, 17 Aug 2017 15:59:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751666AbdHQF7p (ORCPT ); Thu, 17 Aug 2017 01:59:45 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:36159 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751642AbdHQF7o (ORCPT ); Thu, 17 Aug 2017 01:59:44 -0400 Received: by mail-wr0-f196.google.com with SMTP id y67so6487773wrb.3 for ; Wed, 16 Aug 2017 22:59:43 -0700 (PDT) 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=H/jR1/aR9BXlmB6N0d9hlqRhhJoYi0Bmc5VSiZiTy2s=; b=aj7MShs5fAIrcL4bMrfB85FT55/rFH999WO4kULRA2JJdOesZZCFLKzV6cfOBEFZGG JBqb+g57/2r38y63dILSFz1oeMHqP+YtqPNrTIC0kI+0QcdPGzVSSncdHTYMG+hEqGcx /PAyWapaB11NzJBvFXdnIkpMA+RMjAhCYghL+hgFtYG7Yz8AxWX3lg3p6v4lIn+CwYhX khMpt7+dtU/EaDhvbzYb19EMFk8DopOnFLguRToeq94z8LGHiANOoQl/DWu/+Dbq2qor zrZs0aFHvE8i8Y5MMWL2c62vmDUBQkn+sVrRSMxVc2l3+I3y0hTi8/3c8XqK6miFeWPi 1TMg== 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=H/jR1/aR9BXlmB6N0d9hlqRhhJoYi0Bmc5VSiZiTy2s=; b=UdWwHoGBjaeA0GA4bowo2+J2o47T9moLOX+q/HkIVZtl9TVHp8q9FJcbtFnoMEd1yc Af/9l6oobQVUGMR8s7YKGoAJU1WLtmn9+ejDC/UFDUMeaiI6fwCIDyGU7owzAyCmkLCS 4xrody/v7vsVs1ZbdGh/uFcQ8Na/0jHerLi7DgpulI9ROdPrw9vsSfwrrxUFb9311jTE QrNriThnPu8sep+8RJFvSxzMgqVCccuoNukwMQxxPqncfQZgJUMqw2FVZtNyoIJxszTE Ui42kW1ovuNitqgbIo7apkMLtujk6Gmwos4bSF3P6rCCkTbMPM4RqKud5OQfk1gePBML v88A== X-Gm-Message-State: AHYfb5g27G5SXwkNAgYz4G3Pwh4WnPhcAVnAX+HJhhp2Qadf0G0p5aN3 mkMhyWS4pT9hmPnn X-Received: by 10.28.125.74 with SMTP id y71mr463662wmc.46.1502949582818; Wed, 16 Aug 2017 22:59:42 -0700 (PDT) Received: from ?IPv6:2003:ea:8bc7:5e00:b1d4:11c8:15b6:16bf? (p200300EA8BC75E00B1D411C815B616BF.dip0.t-ipconnect.de. [2003:ea:8bc7:5e00:b1d4:11c8:15b6:16bf]) by smtp.googlemail.com with ESMTPSA id b33sm2884409wrg.65.2017.08.16.22.59.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Aug 2017 22:59:42 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH RFC 6/7] eeprom: at24: remove old read functions To: Wolfram Sang Cc: "linux-i2c@vger.kernel.org" References: <2e264f77-2316-b6b6-e66c-b162f77d81de@gmail.com> Message-ID: <65c0682b-73c0-6467-ffb8-f0ac0652debc@gmail.com> Date: Thu, 17 Aug 2017 07:59:22 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <2e264f77-2316-b6b6-e66c-b162f77d81de@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 read functions. Signed-off-by: Heiner Kallweit --- drivers/misc/eeprom/at24.c | 177 --------------------------------------------- 1 file changed, 177 deletions(-) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 55b35007..8f2106d3 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -61,9 +61,6 @@ struct at24_client { struct at24_data { struct at24_platform_data chip; - int use_smbus; - - ssize_t (*read_func)(struct at24_data *, char *, unsigned int, size_t); /* * Lock protects against activities from other Linux tasks, @@ -219,37 +216,6 @@ static struct at24_client *at24_translate_offset(struct at24_data *at24, return &at24->client[i]; } -static ssize_t at24_eeprom_read_smbus(struct at24_data *at24, char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, read_time; - struct i2c_client *client; - int status; - - client = at24_translate_offset(at24, &offset)->client; - - if (count > io_limit) - count = io_limit; - - /* Smaller eeproms can work given some SMBus extension calls */ - if (count > I2C_SMBUS_BLOCK_MAX) - count = I2C_SMBUS_BLOCK_MAX; - - loop_until_timeout(timeout, read_time) { - status = i2c_smbus_read_i2c_block_data_or_emulated(client, - offset, - count, buf); - - dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", - count, offset, status, jiffies); - - if (status == count) - return count; - } - - return -ETIMEDOUT; -} - static ssize_t at24_regmap_read(struct at24_data *at24, char *buf, unsigned int offset, size_t count) { @@ -303,139 +269,6 @@ static ssize_t at24_regmap_read_serial(struct at24_data *at24, char *buf, return -ETIMEDOUT; } -static ssize_t at24_eeprom_read_i2c(struct at24_data *at24, char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, read_time; - struct i2c_client *client; - struct i2c_msg msg[2]; - int status, i; - u8 msgbuf[2]; - - memset(msg, 0, sizeof(msg)); - client = at24_translate_offset(at24, &offset)->client; - - if (count > io_limit) - count = io_limit; - - /* - * When we have a better choice than SMBus calls, use a combined I2C - * message. Write address; then read up to io_limit data bytes. Note - * that read page rollover helps us here (unlike writes). msgbuf is - * u8 and will cast to our needs. - */ - i = 0; - if (at24->chip.flags & AT24_FLAG_ADDR16) - msgbuf[i++] = offset >> 8; - msgbuf[i++] = offset; - - msg[0].addr = client->addr; - msg[0].buf = msgbuf; - msg[0].len = i; - - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].buf = buf; - msg[1].len = count; - - loop_until_timeout(timeout, read_time) { - status = i2c_transfer(client->adapter, msg, 2); - if (status == 2) - status = count; - - dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", - count, offset, status, jiffies); - - if (status == count) - return count; - } - - return -ETIMEDOUT; -} - -static ssize_t at24_eeprom_read_serial(struct at24_data *at24, char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, read_time; - struct i2c_client *client; - struct i2c_msg msg[2]; - u8 addrbuf[2]; - int status; - - client = at24_translate_offset(at24, &offset)->client; - - memset(msg, 0, sizeof(msg)); - msg[0].addr = client->addr; - msg[0].buf = addrbuf; - - /* - * The address pointer of the device is shared between the regular - * EEPROM array and the serial number block. The dummy write (part of - * the sequential read protocol) ensures the address pointer is reset - * to the desired position. - */ - if (at24->chip.flags & AT24_FLAG_ADDR16) { - /* - * For 16 bit address pointers, the word address must contain - * a '10' sequence in bits 11 and 10 regardless of the - * intended position of the address pointer. - */ - addrbuf[0] = 0x08; - addrbuf[1] = offset; - msg[0].len = 2; - } else { - /* - * Otherwise the word address must begin with a '10' sequence, - * regardless of the intended address. - */ - addrbuf[0] = 0x80 + offset; - msg[0].len = 1; - } - - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].buf = buf; - msg[1].len = count; - - loop_until_timeout(timeout, read_time) { - status = i2c_transfer(client->adapter, msg, 2); - if (status == 2) - return count; - } - - return -ETIMEDOUT; -} - -static ssize_t at24_eeprom_read_mac(struct at24_data *at24, char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, read_time; - struct i2c_client *client; - struct i2c_msg msg[2]; - u8 addrbuf[2]; - int status; - - client = at24_translate_offset(at24, &offset)->client; - - memset(msg, 0, sizeof(msg)); - msg[0].addr = client->addr; - msg[0].buf = addrbuf; - addrbuf[0] = 0x90 + offset; - msg[0].len = 1; - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].buf = buf; - msg[1].len = count; - - loop_until_timeout(timeout, read_time) { - status = i2c_transfer(client->adapter, msg, 2); - if (status == 2) - return count; - } - - return -ETIMEDOUT; -} - /* * Note that if the hardware write-protect pin is pulled high, the whole * chip is normally write protected. But there are plenty of product @@ -670,7 +503,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) return -ENOMEM; mutex_init(&at24->lock); - at24->use_smbus = use_smbus; at24->chip = chip; at24->num_addresses = num_addresses; @@ -685,15 +517,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) return -EINVAL; } - if (chip.flags & AT24_FLAG_SERIAL) { - at24->read_func = at24_eeprom_read_serial; - } else if (chip.flags & AT24_FLAG_MAC) { - at24->read_func = at24_eeprom_read_mac; - } else { - at24->read_func = at24->use_smbus ? at24_eeprom_read_smbus - : at24_eeprom_read_i2c; - } - writable = !(chip.flags & AT24_FLAG_READONLY); if (writable) { if (!use_smbus || use_smbus_write) {