From patchwork Tue Feb 23 21:25:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Ricard X-Patchwork-Id: 587099 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 5DD01140297 for ; Wed, 24 Feb 2016 08:26:28 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aYKTS-0002pq-PI; Tue, 23 Feb 2016 21:26:26 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aYKTR-0002pW-1E for tpmdd-devel@lists.sourceforge.net; Tue, 23 Feb 2016 21:26:25 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of gmail.com designates 74.125.82.47 as permitted sender) client-ip=74.125.82.47; envelope-from=christophe.ricard@gmail.com; helo=mail-wm0-f47.google.com; Received: from mail-wm0-f47.google.com ([74.125.82.47]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1aYKTQ-00052S-62 for tpmdd-devel@lists.sourceforge.net; Tue, 23 Feb 2016 21:26:25 +0000 Received: by mail-wm0-f47.google.com with SMTP id c200so241321375wme.0 for ; Tue, 23 Feb 2016 13:26:24 -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=p3jmVeFsH/4QfMwy00Ex4GOnUuKwvEtz2S5eT/4bXgs=; b=Hp0zNBTv5ENCClfbos7N+Lq9bndWN+Ch7MhKwo7KXmR6iIeModoaEgfZ/I1jZy7pzw 7CE/65F6zvfXTOhgVHo9AfExCpouXconX2gOn7viFLC5kv2eMnaGMq1WhrEKC3RGBpl6 j6qkevH7fHG1vJF29qWdhvwKADmFG34jKiGFTbMer1KtrwJ0PgCCH57XZhlCybBQX7M/ K+o6f4Lnr6vY7zmq70tRbTFuFytpISaBtoApTDt8JZ4mB/tW94JDm0/kLqq7jhTdli4s /TL8zsWod6yJttwm+WLbbuvVGlNk7me/bac9tr45jcSvHAa0XR674os5RMx3NnCL7Fss Zziw== X-Gm-Message-State: AG10YOS5b0sGWdcsE3kmMrZkPG/cDTiFQetv/NLREluyxC+A7hGMwluHSMQURbMtcQRqXQ== X-Received: by 10.194.94.40 with SMTP id cz8mr35681741wjb.17.1456262778217; Tue, 23 Feb 2016 13:26:18 -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 v1sm31448264wjf.49.2016.02.23.13.26.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Feb 2016 13:26:16 -0800 (PST) From: Christophe Ricard X-Google-Original-From: Christophe Ricard To: jarkko.sakkinen@linux.intel.com, peterhuewe@gmx.de Date: Tue, 23 Feb 2016 22:25:50 +0100 Message-Id: <1456262751-12096-12-git-send-email-christophe-h.ricard@st.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456262751-12096-1-git-send-email-christophe-h.ricard@st.com> References: <1456262751-12096-1-git-send-email-christophe-h.ricard@st.com> X-Spam-Score: -1.6 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (christophe.ricard[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1aYKTQ-00052S-62 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 v3 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 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. Reviewed-by: Jarkko Sakkinen Signed-off-by: Christophe Ricard --- 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; }