From patchwork Thu Nov 16 20:26:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 838783 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="YhD4TbJQ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ydCTk7156z9s71 for ; Fri, 17 Nov 2017 07:27:22 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759036AbdKPU1V (ORCPT ); Thu, 16 Nov 2017 15:27:21 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:44241 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759003AbdKPU1U (ORCPT ); Thu, 16 Nov 2017 15:27:20 -0500 Received: by mail-wr0-f196.google.com with SMTP id l22so228715wrc.11 for ; Thu, 16 Nov 2017 12:27:19 -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=g3Jr37gHypCsZQfPwNowOu+yJD/ujHcxumyaActrvgg=; b=YhD4TbJQlPltmEbTVhGvtJxf2UUAA6odIkDD/3zGSSbnZdRixS5QbUSab62XRmj+a8 ZhPfGjWqM1zfl7kdu/JSAVRUfgo2xGjY/tL2cGnZsYtcHo2Quz1J2OAQNaqfYT3trMcF Xa41WEPJXxvpv186pbM4zrCUFbmArMFpoCtIEctaEbgxPRzW1GzYqCGtDkO350nP+E6p saHRMEND0+qUpYFe2/iptpp0jFHo/walIbzopbZ8OU03K4M3Io3D6NYNU2v5u6kTZxLE TYKsNJpUjvEtTraFJW5S6NJ6NrqX5zw0cezrs2Br6S/ZeV9wN4fp4VvoHReHKLMtNMtM KUCw== 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=g3Jr37gHypCsZQfPwNowOu+yJD/ujHcxumyaActrvgg=; b=goCerC3Ufy4qQJttbekI0NsEPyO70S29CmnT6yL3NndNDBjOOej64v24ReHe3/XKyN iMOCyYMRveqZkoVu+Ek228yUpu1wNahYbyKUucb1uIMadMQFzYqQ4Qzy9veEajD2NIxg A4YWPJc9jQPiVqq42qOm8sf3D3IY/7Dn4Z2HjS+izFdG8XmxPzcpec8Qj4BezL/NMMgF QacnBvSLxl0jIcw6Hy9TH4LNP41AN/N0JRfXNrXSV41X7kaAP6b3hZDJiyXQ2jY38GQZ djgnOz+qf1xRxAm0Sz3DAA7RSFKpd8DmbKrFJzpxI7WdUlTlsXYT9MOm2akZOLqXyJ4i 2hWA== X-Gm-Message-State: AJaThX6zqPY9nv8yLLl6rpROdKW9uB3pycETzzOI00QoqNpBD2Qpm9Vt 5EnmPndKiRegROlpOh8mpa9/ow== X-Google-Smtp-Source: AGs4zMYKGTtLKwWl5JbtfePzLUaDNIYXO77ZjOleRg44/1yGj2dlYzyYYDEZ2t06ZN3+LO4dmMUk5w== X-Received: by 10.223.182.73 with SMTP id i9mr2636308wre.113.1510864038737; Thu, 16 Nov 2017 12:27:18 -0800 (PST) Received: from ?IPv6:2003:ea:8bc0:e400:5d3b:3d3e:54b7:39d0? (p200300EA8BC0E4005D3B3D3E54B739D0.dip0.t-ipconnect.de. [2003:ea:8bc0:e400:5d3b:3d3e:54b7:39d0]) by smtp.googlemail.com with ESMTPSA id 16sm1627797wrt.81.2017.11.16.12.27.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Nov 2017 12:27:18 -0800 (PST) From: Heiner Kallweit Subject: [PATCH v2 2/7] eeprom: at24: change at24_translate_offset return type To: Bartosz Golaszewski Cc: "linux-i2c@vger.kernel.org" References: Message-ID: <9b0019a9-f272-e345-d814-fcb05f978554@gmail.com> Date: Thu, 16 Nov 2017 21:26:06 +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: Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Change return type of at24_translate_offset to *at24_client to make member regmap accessible for subsequent patches of this series. Signed-off-by: Heiner Kallweit --- v2: - rebased --- drivers/misc/eeprom/at24.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 911cce8ec..1411fa029 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -267,8 +267,8 @@ MODULE_DEVICE_TABLE(acpi, at24_acpi_ids); * one "eeprom" file not four, but larger reads would fail when * they crossed certain pages. */ -static struct i2c_client *at24_translate_offset(struct at24_data *at24, - unsigned int *offset) +static struct at24_client *at24_translate_offset(struct at24_data *at24, + unsigned int *offset) { unsigned i; @@ -280,7 +280,7 @@ static struct i2c_client *at24_translate_offset(struct at24_data *at24, *offset &= 0xff; } - return at24->client[i].client; + return &at24->client[i]; } static ssize_t at24_eeprom_read_smbus(struct at24_data *at24, char *buf, @@ -290,7 +290,7 @@ static ssize_t at24_eeprom_read_smbus(struct at24_data *at24, char *buf, struct i2c_client *client; int status; - client = at24_translate_offset(at24, &offset); + client = at24_translate_offset(at24, &offset)->client; if (count > io_limit) count = io_limit; @@ -324,7 +324,7 @@ static ssize_t at24_eeprom_read_i2c(struct at24_data *at24, char *buf, u8 msgbuf[2]; memset(msg, 0, sizeof(msg)); - client = at24_translate_offset(at24, &offset); + client = at24_translate_offset(at24, &offset)->client; if (count > io_limit) count = io_limit; @@ -373,7 +373,7 @@ static ssize_t at24_eeprom_read_serial(struct at24_data *at24, char *buf, u8 addrbuf[2]; int status; - client = at24_translate_offset(at24, &offset); + client = at24_translate_offset(at24, &offset)->client; memset(msg, 0, sizeof(msg)); msg[0].addr = client->addr; @@ -426,7 +426,7 @@ static ssize_t at24_eeprom_read_mac(struct at24_data *at24, char *buf, u8 addrbuf[2]; int status; - client = at24_translate_offset(at24, &offset); + client = at24_translate_offset(at24, &offset)->client; memset(msg, 0, sizeof(msg)); msg[0].addr = client->addr; @@ -481,7 +481,7 @@ static ssize_t at24_eeprom_write_smbus_block(struct at24_data *at24, struct i2c_client *client; ssize_t status = 0; - client = at24_translate_offset(at24, &offset); + client = at24_translate_offset(at24, &offset)->client; count = at24_adjust_write_count(at24, offset, count); loop_until_timeout(timeout, write_time) { @@ -508,7 +508,7 @@ static ssize_t at24_eeprom_write_smbus_byte(struct at24_data *at24, struct i2c_client *client; ssize_t status = 0; - client = at24_translate_offset(at24, &offset); + client = at24_translate_offset(at24, &offset)->client; loop_until_timeout(timeout, write_time) { status = i2c_smbus_write_byte_data(client, offset, buf[0]); @@ -534,7 +534,7 @@ static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf, ssize_t status = 0; int i = 0; - client = at24_translate_offset(at24, &offset); + client = at24_translate_offset(at24, &offset)->client; count = at24_adjust_write_count(at24, offset, count); msg.addr = client->addr; @@ -574,7 +574,7 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count) if (unlikely(!count)) return count; - client = at24_translate_offset(at24, &off); + client = at24_translate_offset(at24, &off)->client; ret = pm_runtime_get_sync(&client->dev); if (ret < 0) { @@ -619,7 +619,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count) if (unlikely(!count)) return -EINVAL; - client = at24_translate_offset(at24, &off); + client = at24_translate_offset(at24, &off)->client; ret = pm_runtime_get_sync(&client->dev); if (ret < 0) {