From patchwork Thu Mar 24 16:19:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 64404 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp756866lbc; Thu, 24 Mar 2016 09:21:06 -0700 (PDT) X-Received: by 10.98.86.157 with SMTP id h29mr14084329pfj.105.1458836465834; Thu, 24 Mar 2016 09:21:05 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s28si13089334pfi.238.2016.03.24.09.21.05; Thu, 24 Mar 2016 09:21:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756849AbcCXQUw (ORCPT + 1 other); Thu, 24 Mar 2016 12:20:52 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:32969 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756845AbcCXQT6 (ORCPT ); Thu, 24 Mar 2016 12:19:58 -0400 Received: by mail-wm0-f41.google.com with SMTP id l68so282414494wml.0 for ; Thu, 24 Mar 2016 09:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yKTut7Kp+XiF9nnBXqAjLIigwP7Y+Lgzh3gZMPWruEY=; b=Jxlqz5luvtzZWJ8oGASfxGE6UO4YK4d94B246L3ptWoUfCBJyI01T8EPf8tDo73P81 60Yxs+PfMOAX+cyDNwEbgodd+nZhUZhSYtMrQnrQOGR2dcH1JFiFeAZCndz2+DKlhxFF M/5ISQtn1AOg+jNhkSHPDx+s06E/YW+yxygpAETrnJOTEpzJp6yzgURMXNs7WdwzLc4m glfkd2IeJcq0WWn4BDQ8I0Gxr/QvAGwFJkdTzEAjSv7n2Ik3NC1uZAPNW9u1k30YN5N/ kCvAZSzkgHGXYEpQeASDAYlUf0scO5Ftyg6aADUR3LvbCgts6303+Kb9zUTqVOxkztw3 OT2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yKTut7Kp+XiF9nnBXqAjLIigwP7Y+Lgzh3gZMPWruEY=; b=leHykGiSf6WfhANZ70mcW4jM+w/1hUyi4AhL07dmncLazKxplAyF58TXqcsYPM8POb zyvTqgYheNXjfSbJ7RdPgJSmKuOeTfeE9ea/ryFp+fukEEj2CJwGqQSJeKfcoH55MlUW o62jqux/4EyJZ8uuwYwK3drJY2R8JXbLzOZe1+bWzac156rU9yu09ir0aWRyCpiVHUOe Yze5hbHKJjwB+el6zaNoxZ6n/HkcQEc73im8DRcQ3NMf5XrM4s4csLOINjIVjofncwbI zK/Y+sjchAVMp35u8TJYpcY/vLIDJOp/uneWLEgJgIs5Q/CQtFvVm3yDfLRPF7FeUQkT Qzjg== X-Gm-Message-State: AD7BkJIEETKtJpxjAyghJotfadkdORDeWJpgLiD1y9zjJgW+R0nNEUSdqzw1QSePALtKsEh4 X-Received: by 10.28.96.197 with SMTP id u188mr11948821wmb.26.1458836395208; Thu, 24 Mar 2016 09:19:55 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id k124sm8370718wmb.11.2016.03.24.09.19.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 24 Mar 2016 09:19:54 -0700 (PDT) From: Bartosz Golaszewski To: Wolfram Sang , linux-i2c , LKML Cc: Andrew Lunn , Bartosz Golaszewski Subject: [PATCH v2 09/13] eeprom: at24: use at24cs_serial_read() Date: Thu, 24 Mar 2016 17:19:39 +0100 Message-Id: <1458836383-6668-10-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458836383-6668-1-git-send-email-bgolaszewski@baylibre.com> References: <1458836383-6668-1-git-send-email-bgolaszewski@baylibre.com> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Assign at24cs_serial_read() to at24->read_func if the chip allows serial number read operation. Signed-off-by: Bartosz Golaszewski --- drivers/misc/eeprom/at24.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 4c868a2..d3e4d66 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -163,9 +163,8 @@ static struct i2c_client *at24_translate_offset(struct at24_data *at24, return at24->client[i]; } -static ssize_t __attribute__((unused)) -at24cs_serial_read(struct at24_data *at24, - char *buf, loff_t off, size_t count) +static ssize_t at24cs_serial_read(struct at24_data *at24, + char *buf, loff_t off, size_t count) { unsigned long timeout, read_time; struct i2c_client *client; @@ -615,8 +614,12 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) at24->chip = chip; at24->num_addresses = num_addresses; - at24->read_func = at24_read; - at24->write_func = at24_write; + if (chip.flags & AT24_FLAG_SERIAL) { + at24->read_func = at24cs_serial_read; + } else { + at24->read_func = at24_read; + at24->write_func = at24_write; + } writable = !(chip.flags & AT24_FLAG_READONLY); if (writable) {