From patchwork Mon Jun 12 15:44:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 9781809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 31BC460352 for ; Mon, 12 Jun 2017 15:45:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 233FE271CB for ; Mon, 12 Jun 2017 15:45:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1822C285A5; Mon, 12 Jun 2017 15:45:42 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id B147B27CF9 for ; Mon, 12 Jun 2017 15:45:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1dKRX8-0001S1-Sc; Mon, 12 Jun 2017 15:45:38 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1dKRX3-0001Ru-Rs for tpmdd-devel@lists.sourceforge.net; Mon, 12 Jun 2017 15:45:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From; bh=Nv4DGKb4A3iXp+R61sDlCfNuJujgE8vHlimd0VXQ+sk=; b=TaEnSv3P9yAtDjbr2AChWkwiJE2Knbi6xf/7LPSMqPNmZ3QqkaLT/xMLS8yAHSN5tu4Dw9v+lmPK/C5yx8fFrknHll9z04Pq9IPL/FKTbuRENMJrGfa+SMKyTmUFP/6tf9+L/gOfeGOnYVADeDBeeZ2zug2Tvs9HDBcbjg9wmNI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x; h=Message-Id:Date:Subject:Cc:To:From; bh=Nv4DGKb4A3iXp+R61sDlCfNuJujgE8vHlimd0VXQ+sk=; b=Ic8wklp2X/ybWGreTD3TB2py4WRsMynDx8xnNPmgEeBo5kyOKg2ZyYmF0cR929kwGxV5sPt/F0JlPnk9ns9V/JkhdJqTWd8Nesf8DOkvgv4XHJ8TIjp92Qk5GFN7ZKdO44is2j4A5rwVUVMaFkiQ1hbhJlC/S1Lk/32QRjrLblU=; X-ACL-Warn: Received: from mga01.intel.com ([192.55.52.88]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1dKRX0-0000rz-3H for tpmdd-devel@lists.sourceforge.net; Mon, 12 Jun 2017 15:45:33 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2017 08:45:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,334,1493708400"; d="scan'208";a="98497610" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 12 Jun 2017 08:45:17 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id E0CE7DC; Mon, 12 Jun 2017 18:44:16 +0300 (EEST) From: Andy Shevchenko To: Jarkko Sakkinen , tpmdd-devel@lists.sourceforge.net, Peter Huewe , Marcel Selhorst Date: Mon, 12 Jun 2017 18:44:16 +0300 Message-Id: <20170612154416.82847-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.11.0 X-Headers-End: 1dKRX0-0000rz-3H Subject: [tpmdd-devel] [PATCH v1] tpm/st33zp24: Switch to devm_acpi_dev_add_driver_gpios() X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andy Shevchenko MIME-Version: 1.0 Errors-To: tpmdd-devel-bounces@lists.sourceforge.net X-Virus-Scanned: ClamAV using ClamSMTP Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify error path and fix potentially wrong assignment if ->probe() fails. Signed-off-by: Andy Shevchenko Reviewed-by: Jarkko Sakkinen Tested-by: Jarkko Sakkinen --- drivers/char/tpm/st33zp24/i2c.c | 3 +-- drivers/char/tpm/st33zp24/spi.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/char/tpm/st33zp24/i2c.c b/drivers/char/tpm/st33zp24/i2c.c index 1b10e38f214e..be5d1abd3e8e 100644 --- a/drivers/char/tpm/st33zp24/i2c.c +++ b/drivers/char/tpm/st33zp24/i2c.c @@ -127,7 +127,7 @@ static int st33zp24_i2c_acpi_request_resources(struct i2c_client *client) struct device *dev = &client->dev; int ret; - ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), acpi_st33zp24_gpios); + ret = devm_acpi_dev_add_driver_gpios(dev, acpi_st33zp24_gpios); if (ret) return ret; @@ -285,7 +285,6 @@ static int st33zp24_i2c_remove(struct i2c_client *client) if (ret) return ret; - acpi_dev_remove_driver_gpios(ACPI_COMPANION(&client->dev)); return 0; } diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c index c69d15198f84..0fc4f20b5f83 100644 --- a/drivers/char/tpm/st33zp24/spi.c +++ b/drivers/char/tpm/st33zp24/spi.c @@ -246,7 +246,7 @@ static int st33zp24_spi_acpi_request_resources(struct spi_device *spi_dev) struct device *dev = &spi_dev->dev; int ret; - ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), acpi_st33zp24_gpios); + ret = devm_acpi_dev_add_driver_gpios(dev, acpi_st33zp24_gpios); if (ret) return ret; @@ -402,7 +402,6 @@ static int st33zp24_spi_remove(struct spi_device *dev) if (ret) return ret; - acpi_dev_remove_driver_gpios(ACPI_COMPANION(&dev->dev)); return 0; }