From patchwork Mon Nov 27 20:34:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 841869 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="nT4VJEpW"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ylz7L1hD6z9s1h for ; Tue, 28 Nov 2017 07:34:54 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752952AbdK0Uex (ORCPT ); Mon, 27 Nov 2017 15:34:53 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:43071 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752812AbdK0Uew (ORCPT ); Mon, 27 Nov 2017 15:34:52 -0500 Received: by mail-wr0-f195.google.com with SMTP id z34so4458798wrz.10 for ; Mon, 27 Nov 2017 12:34:52 -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=MrHGwN+FsZ7a8/+WcqXS4CARizuHB2qXgTwgugJPMqE=; b=nT4VJEpWc3Z0Ffome6/eBlNOubQ/ttYRL5swMh+ItrLeA+VgZc/Dc4XwoyZFqkOSSV xPLM4pww9fzh/FtyEKl6+Da7OPR2q/bpMqcQYUabnRJ8slQ04DUNyIo1EMXZrQ9RE1Ib jxlXCZeYtLFZmGFVVlSgAtgcK4X7I7GMUoNclf2b01/npcgG2maQmSHSHCk/T0cD+u3A RTCtCTXIqrBE8szKmekHtY//t0LEST7jIebN9NS677cZUFlIolRSBRPq1AJUZWDLRCtB VYzJwvhO/KhY6DKAn8mgAQoCzmuFFNS2kHmYEkodGh93/KjG2FF7eleWRai+3v29Yv9k v0Vw== 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=MrHGwN+FsZ7a8/+WcqXS4CARizuHB2qXgTwgugJPMqE=; b=LfZDvdektUINIlz54Vi6eczVu5lQXuwgnYff8nraxDSpmRQqAoc92lQ87xb1jHEkWs uAynAixeDcxiJP5yDpm1h3DKvLjH4Wqnm0BXHvCO7Z+ZFXmoHGPWdyegnr2tTcUQ5DmU kKVrtmntx3YEMchiY2pQgCYXf2vh65PMthlgUs/RM7QMNEnm2FOmI6V3w4Wxe7idiaQ0 kdssELE3kz3XiR+Q/Nn/kfmmJYKeQEqO323YyhzRtTDpbe7MxLiVj0BZbMBqlBax+iLm yK3M1g6sgXPbKoomMDSHnnB/e8sAbROkaUWL4GE5Vb7GdnjDFCVSyZlQ0FX7fcZjT/6Y zM7Q== X-Gm-Message-State: AJaThX5IxydTwxisfcVOEk06tPt8peLrOVCOa34HrORnfWbZ8Wj8V9n3 zhQBw+F+31I8+DydzUMKuGfFRg== X-Google-Smtp-Source: AGs4zMb/I6R79NMUvjQ5hmLocz2paHn7mgS47iO7B9muaaxosSQim5thdTzp7Tj7bkqhRS8SF6ROhg== X-Received: by 10.223.134.157 with SMTP id 29mr31958897wrx.72.1511814891388; Mon, 27 Nov 2017 12:34:51 -0800 (PST) Received: from ?IPv6:2003:ea:8bc0:e400:cdd0:4154:8262:d8bc? (p200300EA8BC0E400CDD041548262D8BC.dip0.t-ipconnect.de. [2003:ea:8bc0:e400:cdd0:4154:8262:d8bc]) by smtp.googlemail.com with ESMTPSA id x142sm13637717wme.34.2017.11.27.12.34.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Nov 2017 12:34:50 -0800 (PST) From: Heiner Kallweit Subject: [PATCH v5 7/7] eeprom: at24: remove now unneeded smbus-related code To: Bartosz Golaszewski Cc: "linux-i2c@vger.kernel.org" References: <2c379f45-d5e3-71af-eb20-ca51e09d9257@gmail.com> Message-ID: <0c8e9a5f-c066-5661-1b3b-316e3641bc61@gmail.com> Date: Mon, 27 Nov 2017 21:34:39 +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: <2c379f45-d5e3-71af-eb20-ca51e09d9257@gmail.com> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Remove remaining now unneeded code dealing with SMBUS details. Signed-off-by: Heiner Kallweit --- v2: - rebased v3: - rebased v4: - rebased v5: - rebased --- drivers/misc/eeprom/at24.c | 58 +++++++--------------------------------------- 1 file changed, 8 insertions(+), 50 deletions(-) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 9b3652ec9..5768d983e 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -520,8 +520,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) struct at24_platform_data chip; kernel_ulong_t magic = 0; bool writable; - int use_smbus = 0; - int use_smbus_write = 0; struct at24_data *at24; int err; unsigned i, num_addresses; @@ -573,33 +571,12 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) dev_warn(&client->dev, "page_size looks suspicious (no power of 2)!\n"); - /* Use I2C operations unless we're stuck with SMBus extensions. */ - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { - if (chip.flags & AT24_FLAG_ADDR16) - return -EPFNOSUPPORT; - - if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { - use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_WORD_DATA)) { - use_smbus = I2C_SMBUS_WORD_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_BYTE_DATA)) { - use_smbus = I2C_SMBUS_BYTE_DATA; - } else { - return -EPFNOSUPPORT; - } - - if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { - use_smbus_write = I2C_SMBUS_I2C_BLOCK_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { - use_smbus_write = I2C_SMBUS_BYTE_DATA; - chip.page_size = 1; - } - } + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C) && + !i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) && + i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) + chip.page_size = 1; if (chip.flags & AT24_FLAG_TAKE8ADDR) num_addresses = 8; @@ -634,21 +611,8 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) } writable = !(chip.flags & AT24_FLAG_READONLY); - if (writable) { - if (!use_smbus || use_smbus_write) { - - unsigned write_max = chip.page_size; - - if (write_max > io_limit) - write_max = io_limit; - if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) - write_max = I2C_SMBUS_BLOCK_MAX; - at24->write_max = write_max; - } else { - dev_warn(&client->dev, - "cannot write due to controller restrictions."); - } - } + if (writable) + at24->write_max = min_t(unsigned int, chip.page_size, io_limit); /* use dummy devices for multiple-address chips */ for (i = 1; i < num_addresses; i++) { @@ -709,12 +673,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) dev_info(&client->dev, "%u byte %s EEPROM, %s, %u bytes/write\n", chip.byte_len, client->name, writable ? "writable" : "read-only", at24->write_max); - if (use_smbus == I2C_SMBUS_WORD_DATA || - use_smbus == I2C_SMBUS_BYTE_DATA) { - dev_notice(&client->dev, "Falling back to %s reads, " - "performance will suffer\n", use_smbus == - I2C_SMBUS_WORD_DATA ? "word" : "byte"); - } /* export data to kernel code */ if (chip.setup)