From patchwork Mon Apr 11 18:57:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 65564 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1519255qge; Mon, 11 Apr 2016 11:59:35 -0700 (PDT) X-Received: by 10.66.162.101 with SMTP id xz5mr16487513pab.157.1460401174903; Mon, 11 Apr 2016 11:59:34 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si5093211pat.152.2016.04.11.11.59.34; Mon, 11 Apr 2016 11:59:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755440AbcDKS7d (ORCPT + 29 others); Mon, 11 Apr 2016 14:59:33 -0400 Received: from mail-pf0-f173.google.com ([209.85.192.173]:34491 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755241AbcDKS6A (ORCPT ); Mon, 11 Apr 2016 14:58:00 -0400 Received: by mail-pf0-f173.google.com with SMTP id c20so129109235pfc.1 for ; Mon, 11 Apr 2016 11:58:00 -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=korAxay9z8Du2GMWQRUHfPWNPk6ovc//OYNSQQEvNJYQ0AO7hTP4910Ll7tG44Q7vf 8UiHUcii66tSG4Nk752Wdi0SAxmSwrG9TF6IBWSX2GjlpeDtuLYRZcCVNA7F4I5kjkHZ OrBPOW9AGMZmgN2o7FuwJKMJ8Bmida10IbI1WLSDm+IUZeRj1WBluFL9oJrm7czxc4YH KZ1NFSqgCFvc6s1RZwODs1ecGiOeEWWFeJ/5TZYrnKWLn3Z4/4DSDyeBLP8obfWGKxY9 vr2SnJFzRqEpeWfQLcl+dn91uRSDu25O1xe2h12sPAgoDMEKGMhV8Hf7rVFUaWwMow3+ gGww== 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=FOpF/WyXKt4UTQBuN0fYTw3FJ84QqIqZQ3afhUtU0f+OH/F9dLecERSm6NMRhIGRlJ QDaCNm/HCqVuis/vyB6wJw+dCaSHf6QKeuy9Yi86x57K5YxaqPy2qsyl7KzNxLHch4x8 sb6du/kqjMC8/XxlsVS0qRo9xy+a+HqXEsquPHiyaBPIcJrPne9t5zhM1LySMoc3JBcl NNnEWAEwVH0CS2XVbHFpcGAA3J4UvuEi9/pcJ2YGCzItCZe+YWvtecSVkM0Jl6Fb9hwm +x8Q12H1/0lgOAXDNmC2wR3CCnZEm1zBWOBrsAessXdrBZIPejxBOOAG7ZaWz8UfydWO 2KlA== X-Gm-Message-State: AD7BkJLWIbFNEtz7BMKbMt3ut6fN/2ePc1WegMl4UV9G8aWl9nNx4bEC7x+AmHCRQZp7xsLn X-Received: by 10.98.71.149 with SMTP id p21mr34931043pfi.133.1460401079540; Mon, 11 Apr 2016 11:57:59 -0700 (PDT) Received: from localhost.localdomain (cpe-172-248-200-249.socal.res.rr.com. [172.248.200.249]) by smtp.gmail.com with ESMTPSA id ke7sm22322404pad.44.2016.04.11.11.57.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Apr 2016 11:57:59 -0700 (PDT) From: Bartosz Golaszewski To: Wolfram Sang , linux-i2c , LKML , srinivas.kandagatla@linaro.org, maxime.ripard@free-electrons.com Cc: Andrew Lunn , Bartosz Golaszewski Subject: [RESEND PATCH v2 09/13] eeprom: at24: use at24cs_serial_read() Date: Mon, 11 Apr 2016 11:57:25 -0700 Message-Id: <1460401049-25459-10-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1460401049-25459-1-git-send-email-bgolaszewski@baylibre.com> References: <1460401049-25459-1-git-send-email-bgolaszewski@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 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) {