From patchwork Thu Dec 13 15:14:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10728891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0BB2714DE for ; Thu, 13 Dec 2018 15:15:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF1B328742 for ; Thu, 13 Dec 2018 15:15:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E23DE2C4BA; Thu, 13 Dec 2018 15:15:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61DFB28742 for ; Thu, 13 Dec 2018 15:15:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729453AbeLMPPS (ORCPT ); Thu, 13 Dec 2018 10:15:18 -0500 Received: from mail-out.m-online.net ([212.18.0.10]:55170 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728591AbeLMPPS (ORCPT ); Thu, 13 Dec 2018 10:15:18 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 43Fy0h5Sg7z1qyCC; Thu, 13 Dec 2018 16:15:16 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 43Fy0h56Wkz1qtfL; Thu, 13 Dec 2018 16:15:16 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id fc1ZRPfUjFE1; Thu, 13 Dec 2018 16:15:10 +0100 (CET) X-Auth-Info: UBfcqNgPZdFawlbO6Cj0cI59+NzG99tlbEImuwQoPNo= Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz [86.49.110.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 13 Dec 2018 16:15:10 +0100 (CET) From: Marek Vasut To: linux-input@vger.kernel.org Cc: Marek Vasut , Dmitry Torokhov , Henrik Rydberg , Olivier Sobrie Subject: [PATCH 6/8] input: touchscreen: ili210x: Reorder probe Date: Thu, 13 Dec 2018 16:14:40 +0100 Message-Id: <20181213151442.27854-7-marex@denx.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181213151442.27854-1-marex@denx.de> References: <20181213151442.27854-1-marex@denx.de> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Perform the register access only after the I2C client data are set, this is only done in preparation for the subsequent patch which uses the I2C client data in the register IO function. Signed-off-by: Marek Vasut Cc: Dmitry Torokhov Cc: Henrik Rydberg Cc: Olivier Sobrie To: linux-input@vger.kernel.org --- drivers/input/touchscreen/ili210x.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c index 2354e487c796a..4d11e6cd9a1b6 100644 --- a/drivers/input/touchscreen/ili210x.c +++ b/drivers/input/touchscreen/ili210x.c @@ -191,6 +191,17 @@ static int ili210x_i2c_probe(struct i2c_client *client, mdelay(100); } + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + input = devm_input_allocate_device(dev); + if (!priv || !input) + return -ENOMEM; + + priv->client = client; + priv->input = input; + priv->reset_gpio = reset_gpio; + + i2c_set_clientdata(client, priv); + /* Get firmware version */ error = ili210x_read_reg(client, REG_FIRMWARE_VERSION, &firmware, sizeof(firmware)); @@ -211,15 +222,6 @@ static int ili210x_i2c_probe(struct i2c_client *client, xmax = panel.x_low | (panel.x_high << 8); ymax = panel.y_low | (panel.y_high << 8); - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - input = devm_input_allocate_device(dev); - if (!priv || !input) - return -ENOMEM; - - priv->client = client; - priv->input = input; - priv->reset_gpio = reset_gpio; - /* Setup input device */ input->name = "ILI210x Touchscreen"; input->id.bustype = BUS_I2C; @@ -239,8 +241,6 @@ static int ili210x_i2c_probe(struct i2c_client *client, input_set_abs_params(input, ABS_MT_POSITION_X, 0, xmax, 0, 0); input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ymax, 0, 0); - i2c_set_clientdata(client, priv); - error = devm_request_threaded_irq(dev, client->irq, NULL, ili210x_irq, IRQF_ONESHOT, client->name, priv); if (error) {