From patchwork Thu Sep 7 23:38:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 9942989 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 80F6D604D5 for ; Thu, 7 Sep 2017 23:38:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BA2A20855 for ; Thu, 7 Sep 2017 23:38:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7099027165; Thu, 7 Sep 2017 23:38:41 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 E829D20855 for ; Thu, 7 Sep 2017 23:38:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751091AbdIGXij (ORCPT ); Thu, 7 Sep 2017 19:38:39 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:42566 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750739AbdIGXij (ORCPT ); Thu, 7 Sep 2017 19:38:39 -0400 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23993950AbdIGXiiW5O7k (ORCPT ); Fri, 8 Sep 2017 01:38:38 +0200 Date: Fri, 8 Sep 2017 01:38:20 +0200 From: Ladislav Michl To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Sean Young , Andi Shyti Subject: [PATCH v2 07/10] media: rc: gpio-ir-recv: use devm_request_irq Message-ID: <20170907233820.nfve3zfuiu2bhwvu@lenoch> References: <20170907233355.bv3hsv3rfhcx52i3@lenoch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170907233355.bv3hsv3rfhcx52i3@lenoch> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use of devm_request_irq simplifies error unwinding and as free_irq was the last user of driver remove function, remove it too. Signed-off-by: Ladislav Michl --- Changes: -v2: rebased to current linux.git drivers/media/rc/gpio-ir-recv.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c index 110276d49495..1d115f8531ba 100644 --- a/drivers/media/rc/gpio-ir-recv.c +++ b/drivers/media/rc/gpio-ir-recv.c @@ -161,25 +161,10 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gpio_dev); - rc = request_irq(gpio_to_irq(pdata->gpio_nr), + return devm_request_irq(dev, gpio_to_irq(pdata->gpio_nr), gpio_ir_recv_irq, - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, - "gpio-ir-recv-irq", gpio_dev); - if (rc < 0) - goto err_request_irq; - - return 0; - -err_request_irq: - return rc; -} - -static int gpio_ir_recv_remove(struct platform_device *pdev) -{ - struct gpio_rc_dev *gpio_dev = platform_get_drvdata(pdev); - - free_irq(gpio_to_irq(gpio_dev->gpio_nr), gpio_dev); - return 0; + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, + "gpio-ir-recv-irq", gpio_dev); } #ifdef CONFIG_PM @@ -217,7 +202,6 @@ static const struct dev_pm_ops gpio_ir_recv_pm_ops = { static struct platform_driver gpio_ir_recv_driver = { .probe = gpio_ir_recv_probe, - .remove = gpio_ir_recv_remove, .driver = { .name = GPIO_IR_DRIVER_NAME, .of_match_table = of_match_ptr(gpio_ir_recv_of_match),