From patchwork Thu Mar 24 14:46:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 64389 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp699872lbc; Thu, 24 Mar 2016 07:52:26 -0700 (PDT) X-Received: by 10.66.102.37 with SMTP id fl5mr13463239pab.32.1458831144942; Thu, 24 Mar 2016 07:52:24 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3si12713921pfj.107.2016.03.24.07.52.24; Thu, 24 Mar 2016 07:52:24 -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 S1752306AbcCXOwT (ORCPT + 1 other); Thu, 24 Mar 2016 10:52:19 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:34601 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752489AbcCXOqV (ORCPT ); Thu, 24 Mar 2016 10:46:21 -0400 Received: by mail-wm0-f49.google.com with SMTP id p65so277606055wmp.1 for ; Thu, 24 Mar 2016 07:46:21 -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=sDOq8meaaaahjkh/UPGSq9GnLHWgFOYcbAToN+UJGus=; b=hZnmmg/uKSGZ79dYJ3CdVIIzd26MRYQWiRD4zGtyaX52ff6k67oT46HqAv6NWz6NZK vQ9N1vc/EWjTaE3Zze9MygL1HYV7mzcl9c/Jsjyf1cjmMuoFsdK2hC8NAMk4n+fzC2bP Q4zufETgUnZ2mmeNEBKwfKf7rIAtq+dxIX5uE4tgAlC/cetQx60N+ew6SNSTY8YoGIIO a2RssupfrU1Qr2+PNk/B05ffOQlYrw+BXEnp6mxVlR2e7sfLhT3yRInnjJPdO6X4TBda T8vwanNFNcXIJC2pb/OyWMPcgU/FG7aXyNHRiNsGZdGnO0vJPIJN0wXU9fRCe9HkjPXN wvFQ== 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=sDOq8meaaaahjkh/UPGSq9GnLHWgFOYcbAToN+UJGus=; b=k2Ws2QL8rTDc1xkIYj7j0ib8IC1ShcXB+K6cyhHHgReFFHMg6wTiFvGr607Soilp6X LPprSTkRDxAxwYNzL5saJ9ZN51KwWtf+bkbOr/SZzyNaHupL9iyVkyy4/+R7HDR21+iv J3KTNhlho5RkxwKLPI96+Jm5mX0ku0oElWeEk65mqPtseHphw3pnckKfxJaUvgno70Re LXbqjYKIKyd2alMpzr/phvJaBHPwRPrEnRuos7l3b91NkYUXpZlOAQjJlgig37uVkgtk a6DPP3r/Sr8OrqWmAbmZ2TwhSNt5jsu2UMlkcasUV+NZff2rlkgi/96ueaJpE7j4cvW9 G/bQ== X-Gm-Message-State: AD7BkJKVt6rvysX/2r99mr9YVkRyGrZZd5DuF+L+cy1TBgnE0Kd0L3VVyA1O5UL4r8ZN1O0N X-Received: by 10.194.61.19 with SMTP id l19mr10277699wjr.148.1458830779569; Thu, 24 Mar 2016 07:46:19 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id k125sm27255752wmb.14.2016.03.24.07.46.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 24 Mar 2016 07:46:19 -0700 (PDT) From: Bartosz Golaszewski To: Wolfram Sang , linux-i2c , LKML Cc: Andrew Lunn , Bartosz Golaszewski Subject: [PATCH 09/13] eeprom: at24: use at24cs_serial_read() Date: Thu, 24 Mar 2016 15:46:03 +0100 Message-Id: <1458830767-23816-10-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458830767-23816-1-git-send-email-bgolaszewski@baylibre.com> References: <1458830767-23816-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 5b484bc..9515001 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -162,9 +162,8 @@ static struct i2c_client *at24_translate_offset(struct at24_data *at24, return at24->client[i]; } -static int __attribute__((unused)) -at24cs_serial_read(struct at24_data *at24, - char *buf, loff_t off, size_t count) +static int at24cs_serial_read(struct at24_data *at24, + char *buf, loff_t off, size_t count) { unsigned long timeout, read_time; struct i2c_client *client; @@ -614,8 +613,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) {