From patchwork Fri Aug 19 16:30:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9290579 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 19A7F607FF for ; Fri, 19 Aug 2016 16:33:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C9D02939A for ; Fri, 19 Aug 2016 16:33:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 018A4294D2; Fri, 19 Aug 2016 16:33:31 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D05B02939A for ; Fri, 19 Aug 2016 16:33:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bami6-0002M8-Er; Fri, 19 Aug 2016 16:31:58 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bamha-0001gs-88 for linux-arm-kernel@lists.infradead.org; Fri, 19 Aug 2016 16:31:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From; bh=qWaO5XgjkYnFGjoDsF8b+CswFUlAhUwpr3VX0mQhXKE=; b=hinLspz82RJd53UEM64DZzfmcDttxYZryN529x9w/ecHxmojZaY5ySj0nJo10droXBjiifqgxfP8M17m4QvvAaOfSvLeRhTZRRrlxuYcklv/DEG4dvhlKsZYgGeuEql/UR/nz464ujsRj3CX8I6KKL6BR6zJT1uHmcA8JsXhMlY=; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:54744 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1bamh9-0003Jh-QY; Fri, 19 Aug 2016 17:30:59 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1bamh9-0004Vi-0I; Fri, 19 Aug 2016 17:30:59 +0100 From: Russell King To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/2] Input: jornada720_kbd - switch to devm_* APIs MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 19 Aug 2016 17:30:59 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160819_093126_909113_7A35C21B X-CRM114-Status: GOOD ( 14.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Torokhov , linux-input@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Switch the jornada720_kbd driver to use the devm_* APIs. This is in preparation to removing the mach/irqs.h include from this driver. Signed-off-by: Russell King --- drivers/input/keyboard/jornada720_kbd.c | 38 ++++++++------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/drivers/input/keyboard/jornada720_kbd.c b/drivers/input/keyboard/jornada720_kbd.c index 421d9c55b0e8..4b2e9ff18ba1 100644 --- a/drivers/input/keyboard/jornada720_kbd.c +++ b/drivers/input/keyboard/jornada720_kbd.c @@ -53,6 +53,7 @@ static unsigned short jornada_std_keymap[128] = { /* ROW */ struct jornadakbd { unsigned short keymap[ARRAY_SIZE(jornada_std_keymap)]; struct input_dev *input; + int irq; }; static irqreturn_t jornada720_kbd_interrupt(int irq, void *dev_id) @@ -99,12 +100,10 @@ static int jornada720_kbd_probe(struct platform_device *pdev) struct input_dev *input_dev; int i, err; - jornadakbd = kzalloc(sizeof(struct jornadakbd), GFP_KERNEL); - input_dev = input_allocate_device(); - if (!jornadakbd || !input_dev) { - err = -ENOMEM; - goto fail1; - } + jornadakbd = devm_kzalloc(&pdev->dev, sizeof(*jornadakbd), GFP_KERNEL); + input_dev = devm_input_allocate_device(&pdev->dev); + if (!jornadakbd || !input_dev) + return -ENOMEM; platform_set_drvdata(pdev, jornadakbd); @@ -127,37 +126,18 @@ static int jornada720_kbd_probe(struct platform_device *pdev) input_set_capability(input_dev, EV_MSC, MSC_SCAN); - err = request_irq(IRQ_GPIO0, - jornada720_kbd_interrupt, - IRQF_TRIGGER_FALLING, - "jornadakbd", pdev); + err = devm_request_irq(&pdev->dev, IRQ_GPIO0, jornada720_kbd_interrupt, + IRQF_TRIGGER_FALLING, "jornadakbd", pdev); if (err) { printk(KERN_INFO "jornadakbd720_kbd: Unable to grab IRQ\n"); - goto fail1; + return err; } - err = input_register_device(jornadakbd->input); - if (err) - goto fail2; - - return 0; - - fail2: /* IRQ, DEVICE, MEMORY */ - free_irq(IRQ_GPIO0, pdev); - fail1: /* DEVICE, MEMORY */ - input_free_device(input_dev); - kfree(jornadakbd); - return err; + return input_register_device(jornadakbd->input); }; static int jornada720_kbd_remove(struct platform_device *pdev) { - struct jornadakbd *jornadakbd = platform_get_drvdata(pdev); - - free_irq(IRQ_GPIO0, pdev); - input_unregister_device(jornadakbd->input); - kfree(jornadakbd); - return 0; }