From patchwork Fri Aug 8 07:16:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kiran.padwal@smartplayin.com X-Patchwork-Id: 4694511 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E657F9F4D4 for ; Fri, 8 Aug 2014 07:26:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 25E262016C for ; Fri, 8 Aug 2014 07:26:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B7592017D for ; Fri, 8 Aug 2014 07:26:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755929AbaHHH0o (ORCPT ); Fri, 8 Aug 2014 03:26:44 -0400 Received: from smtp88.ord1c.emailsrvr.com ([108.166.43.88]:48778 "EHLO smtp88.ord1c.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751464AbaHHH0l (ORCPT ); Fri, 8 Aug 2014 03:26:41 -0400 X-Greylist: delayed 525 seconds by postgrey-1.27 at vger.kernel.org; Fri, 08 Aug 2014 03:26:40 EDT Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp12.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id EC8CD8026C; Fri, 8 Aug 2014 03:19:46 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp12.relay.ord1c.emailsrvr.com (Authenticated sender: kiran.padwal-AT-smartplayin.com) with ESMTPSA id 888F5806FF; Fri, 8 Aug 2014 03:19:44 -0400 (EDT) X-Sender-Id: kiran.padwal@smartplayin.com Received: from SPINITDTDL00291.smartplayin.local ([UNAVAILABLE]. [220.227.185.53]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA) by 0.0.0.0:587 (trex/5.2.10); Fri, 08 Aug 2014 07:19:46 GMT From: Kiran Padwal To: support.opensource@diasemi.com, dmitry.torokhov@gmail.com Cc: anthony.olech.opensource@diasemi.com, david.chen@diasemi.com, kiran.padwal21@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Kiran Padwal Subject: [PATCH 2/2] Input: da9055_onkey: convert to use devm_* Date: Fri, 8 Aug 2014 12:46:52 +0530 Message-Id: <1407482212-17669-1-git-send-email-kiran.padwal@smartplayin.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Converting to devm functions can make the code smaller and cleaner. Signed-off-by: Kiran Padwal --- drivers/input/misc/da9055_onkey.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/input/misc/da9055_onkey.c b/drivers/input/misc/da9055_onkey.c index ed6eaa9..1a1e760 100644 --- a/drivers/input/misc/da9055_onkey.c +++ b/drivers/input/misc/da9055_onkey.c @@ -90,9 +90,9 @@ static int da9055_onkey_probe(struct platform_device *pdev) if (!onkey) return -ENOMEM; - input_dev = input_allocate_device(); + input_dev = devm_input_allocate_device(&pdev->dev); if (!input_dev) { - dev_err(&pdev->dev, "Failed to allocate memory\n"); + dev_err(&pdev->dev, "Failed to allocate input device\n"); return -ENOMEM; } @@ -107,43 +107,33 @@ static int da9055_onkey_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&onkey->work, da9055_onkey_work); - err = request_threaded_irq(irq, NULL, da9055_onkey_irq, + err = devm_request_threaded_irq(&pdev->dev, irq, NULL, da9055_onkey_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "ONKEY", onkey); if (err < 0) { dev_err(&pdev->dev, "Failed to register ONKEY IRQ %d, error = %d\n", irq, err); - goto err_free_input; + return err; } err = input_register_device(input_dev); if (err) { dev_err(&pdev->dev, "Unable to register input device, %d\n", err); - goto err_free_irq; + cancel_delayed_work_sync(&onkey->work); + return err; } platform_set_drvdata(pdev, onkey); return 0; - -err_free_irq: - free_irq(irq, onkey); - cancel_delayed_work_sync(&onkey->work); -err_free_input: - input_free_device(input_dev); - - return err; } static int da9055_onkey_remove(struct platform_device *pdev) { struct da9055_onkey *onkey = platform_get_drvdata(pdev); - int irq = platform_get_irq_byname(pdev, "ONKEY"); - irq = regmap_irq_get_virq(onkey->da9055->irq_data, irq); - free_irq(irq, onkey); cancel_delayed_work_sync(&onkey->work); input_unregister_device(onkey->input);