From patchwork Sat Apr 23 19:57:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 8918891 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A3C8BBF29F for ; Sat, 23 Apr 2016 19:59:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C7E6E20121 for ; Sat, 23 Apr 2016 19:59:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE97820125 for ; Sat, 23 Apr 2016 19:59:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751829AbcDWT70 (ORCPT ); Sat, 23 Apr 2016 15:59:26 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:50776 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752038AbcDWT7Y (ORCPT ); Sat, 23 Apr 2016 15:59:24 -0400 Received: from localhost.localdomain ([95.91.39.67]) by mrelayeu.kundenserver.de (mreue002) with ESMTPSA (Nemesis) id 0MSmRQ-1bLWhI1H4m-00RcUR; Sat, 23 Apr 2016 21:58:24 +0200 From: Stefan Wahren To: Jonathan Cameron , Dmitry Torokhov , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Marek Vasut Cc: Ksenija Stanojevic , Fabio Estevam , Juergen Borleis , linux-iio@vger.kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren Subject: [PATCH V3 1/3] iio: mxs-lradc: simplify TS registration Date: Sat, 23 Apr 2016 19:57:57 +0000 Message-Id: <1461441479-23218-2-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1461441479-23218-1-git-send-email-stefan.wahren@i2se.com> References: <1461441479-23218-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K0:4C6ZIR7xGzjt2L0SUD0cPs9CDhMIVlJA6l/1fsfEG02t2W4U+vy 3rz9RPhesTXNn1WB+vvFE64phXIoNsQBr3kdDE3dFthxpOBgoB/qw09SURB9fd/ZSHNUyLC zwLwK4BA2xvaUiTWxWLOhTG+z6DmdtG0mLZc4Nx87QOIxPrFOuPkznOxyR3u2h3cEGuieDN zXCAvnaICFT6otFuIhuJg== X-UI-Out-Filterresults: notjunk:1; V01:K0:dWzoqA6JmrY=:NOBXj/LF0jRf4P1VhO+dg9 +Q4M+EnhJa723qwTFtEtOi68RvOCu4mHvnFc3p7YzgIpNGZBK2VwD3wIHNgGaZ0Fi8FPevmQt aNw7g7slEjv/X3LKO9ULpv5Dz1QsLdtvMRF4J3e8KmytR8bMgVoJ0Bn3k1UAuEmh3qXRoZML6 l3uJDgDWOnPzhQFXhezsJxt/n5i+tk6ywYIaL2EaMLwp6aJOdVrOgWo3b/jFlFup3LHEFd03x taoq6mcK7YbKxYRhM3QnRzTWlQtx1C182y/00u1f/xPCobjklj3Vg1up41kQN2lkMQmge0X6X yBof5zqzJ/GEOK5IK+b1RHSupET+CYO0fQ8q4b+HG/sgQ3kJ3gKLo7YOuk4wwD4Pd9pUqCbyV XR5gDXg4MlEgj+iQnzp8n61P2p2frIAhkJq2D4BkhQ6zHScF0w4lW/rCQpGh8agzrPJo4Y90g ZCoQ1aepiAcmuTNK5kLY4J7X4ts8H+GlfiDzG1QR20n3rZtCSG+pgzvXQdj/e4UQJWe2peWce j0NIGsguJPJdYKq8hySOuZOvFWgKt/wBM2gf+Py/DSRNmbVvvzVWNwvgor/+dndJbObuf6o8+ a1dMQPHkXSAQ8av70ODRgoS9E/hXCtr6AQFJtAEuFNJAjsUUm8K9T/4BV+0DyaiaMGyUM1kCs uzchPeIhWjX94N551vKD4K++F/XtLeZocWlI8K1/UfUzTk1p3tkQ4Z2TTrygSdX6Wr9o= 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 This patch simplifies the TS registration of mxs-lradc by using devm_input_allocate_device. Signed-off-by: Stefan Wahren Reviewed-by: Marek Vasut Acked-by: Dmitry Torokhov --- drivers/iio/adc/mxs-lradc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c index ad26da1..3d1d370 100644 --- a/drivers/iio/adc/mxs-lradc.c +++ b/drivers/iio/adc/mxs-lradc.c @@ -1120,18 +1120,16 @@ static int mxs_lradc_ts_register(struct mxs_lradc *lradc) { struct input_dev *input; struct device *dev = lradc->dev; - int ret; if (!lradc->use_touchscreen) return 0; - input = input_allocate_device(); + input = devm_input_allocate_device(dev); if (!input) return -ENOMEM; input->name = DRIVER_NAME; input->id.bustype = BUS_HOST; - input->dev.parent = dev; input->open = mxs_lradc_ts_open; input->close = mxs_lradc_ts_close; @@ -1146,11 +1144,8 @@ static int mxs_lradc_ts_register(struct mxs_lradc *lradc) lradc->ts_input = input; input_set_drvdata(input, lradc); - ret = input_register_device(input); - if (ret) - input_free_device(lradc->ts_input); - return ret; + return input_register_device(input); } static void mxs_lradc_ts_unregister(struct mxs_lradc *lradc) @@ -1159,7 +1154,6 @@ static void mxs_lradc_ts_unregister(struct mxs_lradc *lradc) return; mxs_lradc_disable_ts(lradc); - input_unregister_device(lradc->ts_input); } /*