From patchwork Tue Mar 28 09:36:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 9648621 X-Patchwork-Delegate: sameo@linux.intel.com 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 E1557601D7 for ; Tue, 28 Mar 2017 09:37:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8256205FB for ; Tue, 28 Mar 2017 09:37:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC76420499; Tue, 28 Mar 2017 09:37:35 +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 vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DC2321E5A for ; Tue, 28 Mar 2017 09:37:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754373AbdC1Jhe (ORCPT ); Tue, 28 Mar 2017 05:37:34 -0400 Received: from mga14.intel.com ([192.55.52.115]:39893 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754217AbdC1Jhd (ORCPT ); Tue, 28 Mar 2017 05:37:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490693853; x=1522229853; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=wWVBZFB/UpMspSUnTy+6xwjXT4W0bQSDxMzDuEQmlzU=; b=vULQMLIy0+r6qAEViRZyFYhVOSVQ67l3k3UDWAp+Pc1TLnpfraBsdgHh 4zcMBqa8baXD//1zhr9PzBo/BbOQ0w==; Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2017 02:36:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,236,1486454400"; d="scan'208";a="1112881797" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 28 Mar 2017 02:36:40 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 00BF43C9; Tue, 28 Mar 2017 12:36:39 +0300 (EEST) From: Andy Shevchenko To: Lauro Ramos Venancio , Aloisio Almeida Jr , Samuel Ortiz , linux-wireless@vger.kernel.org, Mika Westerberg Cc: Andy Shevchenko Subject: [PATCH v3 3/5] NFC: pn544: Convert to use devm_request_threaded_irq() Date: Tue, 28 Mar 2017 12:36:37 +0300 Message-Id: <20170328093639.53481-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170328093639.53481-1-andriy.shevchenko@linux.intel.com> References: <20170328093639.53481-1-andriy.shevchenko@linux.intel.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The error handling will be neat and short when using managed resources. Convert the driver to use devm_request_threaded_irq(). Signed-off-by: Andy Shevchenko --- v3: no change drivers/nfc/pn544/i2c.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c index b4001306aff8..5e780e7a28e5 100644 --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c @@ -963,9 +963,10 @@ static int pn544_hci_i2c_probe(struct i2c_client *client, pn544_hci_i2c_platform_init(phy); - r = request_threaded_irq(client->irq, NULL, pn544_hci_i2c_irq_thread_fn, - IRQF_TRIGGER_RISING | IRQF_ONESHOT, - PN544_HCI_I2C_DRIVER_NAME, phy); + r = devm_request_threaded_irq(&client->dev, client->irq, NULL, + pn544_hci_i2c_irq_thread_fn, + IRQF_TRIGGER_RISING | IRQF_ONESHOT, + PN544_HCI_I2C_DRIVER_NAME, phy); if (r < 0) { nfc_err(&client->dev, "Unable to register IRQ handler\n"); return r; @@ -976,14 +977,9 @@ static int pn544_hci_i2c_probe(struct i2c_client *client, PN544_HCI_I2C_LLC_MAX_PAYLOAD, pn544_hci_i2c_fw_download, &phy->hdev); if (r < 0) - goto err_hci; + return r; return 0; - -err_hci: - free_irq(client->irq, phy); - - return r; } static int pn544_hci_i2c_remove(struct i2c_client *client) @@ -1001,8 +997,6 @@ static int pn544_hci_i2c_remove(struct i2c_client *client) if (phy->powered) pn544_hci_i2c_disable(phy); - free_irq(client->irq, phy); - return 0; }