From patchwork Tue Feb 9 09:27:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Ricard X-Patchwork-Id: 8259131 Return-Path: X-Original-To: patchwork-tpmdd-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4E3CABEEED for ; Tue, 9 Feb 2016 09:27:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6FBC520265 for ; Tue, 9 Feb 2016 09:27:38 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56B012022D for ; Tue, 9 Feb 2016 09:27:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aT4a8-0001iH-1L; Tue, 09 Feb 2016 09:27:36 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aT4a6-0001i8-Qg for tpmdd-devel@lists.sourceforge.net; Tue, 09 Feb 2016 09:27:34 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of gmail.com designates 74.125.82.67 as permitted sender) client-ip=74.125.82.67; envelope-from=christophe.ricard@gmail.com; helo=mail-wm0-f67.google.com; Received: from mail-wm0-f67.google.com ([74.125.82.67]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1aT4a5-0003Yg-VT for tpmdd-devel@lists.sourceforge.net; Tue, 09 Feb 2016 09:27:34 +0000 Received: by mail-wm0-f67.google.com with SMTP id g62so2239335wme.2 for ; Tue, 09 Feb 2016 01:27:33 -0800 (PST) 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=TfNkKOV7FOu0RqYxcOSTiKp7ObAAbKRRdei1Ftomty0=; b=FxPs44A/Krx6w1C2v8QKseY1pitQ7VzfxRK8AC2iflnoxDX9OKK3AMoRno5ruMA11P Wr20CcqCW37NM1FKIHx4ZpPj0VHG21Hpb/yAudAe4/xPWOQAF0xAozIBYmlHH4pzJDs6 XlPipYNZh89o2u4lxHulgBHqbYwk3fLeWoMLWUT/MYzpjN+2+vReL6DzdlgyaW9Y7+04 sHqTxvurmiqTERC3WAR8rGLCRpqG6nQKrpikRCECTOQDytVkUdHBVmxloq7DgLiyH1CT 3fA7i4G6O5B9vbQdD1REWlW6DoXH+MfeU5uZPseGng3hGSmyBVCV9mNaKTRrMdXuSnbk XvPA== X-Gm-Message-State: AG10YOQHojkYfF0LOrOpbOr2jDgiB1TN9Q/RKFmLYUu74+qs5K3c4GIGnMQ6qfGQpF5Wxg== X-Received: by 10.194.109.36 with SMTP id hp4mr38144530wjb.178.1455010048040; Tue, 09 Feb 2016 01:27:28 -0800 (PST) Received: from localhost.localdomain (ax113-6-78-236-204-66.fbx.proxad.net. [78.236.204.66]) by smtp.gmail.com with ESMTPSA id az10sm33793007wjc.28.2016.02.09.01.27.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Feb 2016 01:27:26 -0800 (PST) From: Christophe Ricard X-Google-Original-From: Christophe Ricard To: jarkko.sakkinen@linux.intel.com, peterhuewe@gmx.de Date: Tue, 9 Feb 2016 10:27:00 +0100 Message-Id: <1455010021-21927-12-git-send-email-christophe-h.ricard@st.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455010021-21927-1-git-send-email-christophe-h.ricard@st.com> References: <1455010021-21927-1-git-send-email-christophe-h.ricard@st.com> X-Spam-Score: -1.6 (-) X-Headers-End: 1aT4a5-0003Yg-VT Cc: jean-luc.blanc@st.com, ashley@ashleylai.com, christophe.ricard@gmail.com, tpmdd-devel@lists.sourceforge.net, christophe-h.ricard@st.com, benoit.houyere@st.com Subject: [tpmdd-devel] [PATCH 11/12] tpm/st33zp24/i2c: Change xxx_request_resources header X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: tpmdd-devel-bounces@lists.sourceforge.net X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,HK_RANDOM_ENVFROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify st33zp24_i2c_acpi_request_resources, st33zp24_i2c_of_request_resources and st33zp24_i2c_request_resources to have the same prototype and using i2c_get_clientdata. Signed-off-by: Christophe Ricard Reviewed-by: Jarkko Sakkinen --- drivers/char/tpm/st33zp24/i2c.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/char/tpm/st33zp24/i2c.c b/drivers/char/tpm/st33zp24/i2c.c index b20cc2b..f179aad 100644 --- a/drivers/char/tpm/st33zp24/i2c.c +++ b/drivers/char/tpm/st33zp24/i2c.c @@ -110,9 +110,9 @@ static const struct st33zp24_phy_ops i2c_phy_ops = { .recv = st33zp24_i2c_recv, }; -static int st33zp24_i2c_acpi_request_resources(struct st33zp24_i2c_phy *phy) +static int st33zp24_i2c_acpi_request_resources(struct i2c_client *client) { - struct i2c_client *client = phy->client; + struct st33zp24_i2c_phy *phy = i2c_get_clientdata(client); const struct acpi_device_id *id; struct gpio_desc *gpiod_lpcpd; struct device *dev; @@ -147,10 +147,10 @@ static int st33zp24_i2c_acpi_request_resources(struct st33zp24_i2c_phy *phy) return 0; } -static int st33zp24_i2c_of_request_resources(struct st33zp24_i2c_phy *phy) +static int st33zp24_i2c_of_request_resources(struct i2c_client *client) { + struct st33zp24_i2c_phy *phy = i2c_get_clientdata(client); struct device_node *pp; - struct i2c_client *client = phy->client; int gpio; int ret; @@ -185,10 +185,10 @@ static int st33zp24_i2c_of_request_resources(struct st33zp24_i2c_phy *phy) return 0; } -static int st33zp24_i2c_request_resources(struct i2c_client *client, - struct st33zp24_i2c_phy *phy) +static int st33zp24_i2c_request_resources(struct i2c_client *client) { struct st33zp24_platform_data *pdata; + struct st33zp24_i2c_phy *phy = i2c_get_clientdata(client); int ret; pdata = client->dev.platform_data; @@ -244,17 +244,20 @@ static int st33zp24_i2c_probe(struct i2c_client *client, return -ENOMEM; phy->client = client; + + i2c_set_clientdata(client, phy); + pdata = client->dev.platform_data; if (!pdata && client->dev.of_node) { - ret = st33zp24_i2c_of_request_resources(phy); + ret = st33zp24_i2c_of_request_resources(client); if (ret) return ret; } else if (pdata) { - ret = st33zp24_i2c_request_resources(client, phy); + ret = st33zp24_i2c_request_resources(client); if (ret) return ret; } else if (ACPI_HANDLE(&client->dev)) { - ret = st33zp24_i2c_acpi_request_resources(phy); + ret = st33zp24_i2c_acpi_request_resources(client); if (ret) return ret; }