From patchwork Thu Apr 21 20:11:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 8903671 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 AA0D3BF29F for ; Thu, 21 Apr 2016 20:12:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D8F0E2026D for ; Thu, 21 Apr 2016 20:12:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 07D622025A for ; Thu, 21 Apr 2016 20:12:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751840AbcDUUMY (ORCPT ); Thu, 21 Apr 2016 16:12:24 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:58485 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751658AbcDUUMX (ORCPT ); Thu, 21 Apr 2016 16:12:23 -0400 Received: from localhost.localdomain ([95.91.39.67]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0Lxwsm-1bpn6s2rwa-015KwD; Thu, 21 Apr 2016 22:11:30 +0200 From: Stefan Wahren To: Jonathan Cameron , Dmitry Torokhov , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Marek Vasut Cc: Fabio Estevam , Juergen Borleis , linux-iio@vger.kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren Subject: [PATCH RFT V2 1/3] iio: mxs-lradc: simplify TS registration Date: Thu, 21 Apr 2016 20:11:16 +0000 Message-Id: <1461269478-449-2-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1461269478-449-1-git-send-email-stefan.wahren@i2se.com> References: <1461269478-449-1-git-send-email-stefan.wahren@i2se.com> X-Provags-ID: V03:K0:YVfx5xrtCx0nzOFJBOG7aTutMpi+0WnOgmtWU0ziem8RdTZuCF9 LnS+oHcnPHNrZzuI614Nt8N5L9QemYXsVJfqN+i5x98Hec/uHnxA2hhsnhZ6Dkk7vZMBykc Cttc7hVdce35w5abEHNeTZVV2CSyXS26DaAgjdIPZdp7Tp5vw2NkKxS5mL92R3ze9xf9CvK JHghQDi9NK0Bf3MX+NxZg== X-UI-Out-Filterresults: notjunk:1; V01:K0:OjVJoOh6oKs=:qBOj4A1rsyMkN8D2lyy9Ul RPgo4AIgwzsqxSOWll4KO+VKfRjVUUhj5UHmc6jk7COOdFkOSv3qy+g+UfUZjFHUDIKF9jj7/ gTUMJuyYwIlc1A9r++07kwkdMKxK2iXY2uQgHkHeHL51R/eBzna26NkPngBUillyLy7k6f7LB qwJi9c+zJGDKUINosadKOY7UlqkEcUtqGvhN+RfGzYjlqUw0eRgIB2jkY/T8DIeyNEHWakvbb 2TRc4RD9biLVP7rGD3WPPik+vSL6o0QI50DYjaureCIyUOaaswMYY0L7hGqYMdTAWbPIy0rI3 bwIRKLpKTqflwi1ZgpCwKmMmPEX2yTubPdVa7j+8Cv95qDIxdHBuPuoxqQs4qmq6uOTwoiwAN OItKyn8RhPWdBIspbdLRJSfKGfqx1jJ8oFxnueERKnTBaAODnMuI4c6DhTwBCZosAeLRzu3jt 82eNvPDMMkxZTc6iXKYiP/6B+iHLwvYxO8NzVx0l7EBqF9+/YfCBIAdc5XJgGW0GSttCwxvk9 EstCcNpQcjLDwnSF2xxFGPxb/nhOf/7c4FHLwk0ORRqpF1kyfL8cdjiC6DXvW0HLup2afTKXp tFtANrShD6h3SDAA5F4ARg6Eij+S3vbNyfjq674nTYgj3d76DmvT/J5uFjGsGOeiIOAgYU2c3 /Fi+XRZbwTLy+/KAI6wmaiOmq2l6bVaeVW+fKjmmMUstWeVY6hmmEkaKa1iPMeOnQzVc= 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 --- drivers/iio/adc/mxs-lradc.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c index ad26da1..223650b 100644 --- a/drivers/iio/adc/mxs-lradc.c +++ b/drivers/iio/adc/mxs-lradc.c @@ -1120,12 +1120,11 @@ 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; @@ -1146,11 +1145,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 +1155,6 @@ static void mxs_lradc_ts_unregister(struct mxs_lradc *lradc) return; mxs_lradc_disable_ts(lradc); - input_unregister_device(lradc->ts_input); } /*