Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1291580ybg; Fri, 18 Oct 2019 15:19:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyS5G5cCFVfrqCLKImhasl3wbt11Uz5zxwH46mLy+LTtD0J902E20/GSyV0VfQB5fOrs3iv X-Received: by 2002:a17:906:6d89:: with SMTP id h9mr10765548ejt.169.1571437163319; Fri, 18 Oct 2019 15:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571437163; cv=none; d=google.com; s=arc-20160816; b=l4kbc+a824Cfa5YxS7zOI4aGGgo/H3hpwk8NzR3OQ3QiX2cRqdy1yxL/7Jfg7rYgSo 9zDDaJ3sjCigKWHj3SJbTqFWd+IAVURk6Igq4bzGAp4I2vZetaOt+pLEjxoSFVfwFQv9 t4UneY5GcViMbHVYa+7Ei3RuTBM0wt61+3/lmdxbXxTtEnqHMe7+J5NqO3PBmlh34DdP jNXOk62i3oeLWdCR/V1AvcYrc85Rn9kiJ6bbiK0NpFaE0Z9pEOMSaxHPc54i4ktP3HV5 GVKbwKiU+lMaOKbDVOAHyU8k8WNvqvRMPyZ/+a1080HXW5CsBE3c9DQOottaFrcVGjKs dVJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rw40Y7pRi4fTQvKbY/v46MITEUGL/XAU6ul7eCZwlVo=; b=JJgZwFHjTEwN5811L5XM9TSKnCTZ1waGqnY4hjQGNuxb+8KxdswmcbXZsYx/6jFjBB 9Ptw69TAhyfDrAIbeD1GVx6RXBX1MU4PnMgVdkIdc19HYCglGwCKLpPEWigYU+0ICD9h QzU6DQJwWjlNIRSGijl+PUeWZvPi0evqy3EY9PgpAPn+eGelc57aZgqAtENp89Ag20T3 A2J+YKsfUyedbobiiC5mlZTYCAmU3LsFUvUxLLugKX+TBBGmcn/4pPU+KG+/pdIEeLJS lSH1ReudI5LqlTWrPV3Bt2l8+adsBpVz9SI1nlLZz41VS6IXxoKtnZiJBOtuF0BZUEN0 RZsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sosHBIU0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si4395168ejd.78.2019.10.18.15.19.00; Fri, 18 Oct 2019 15:19:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sosHBIU0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503581AbfJQUnq (ORCPT + 99 others); Thu, 17 Oct 2019 16:43:46 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:42160 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502552AbfJQUmo (ORCPT ); Thu, 17 Oct 2019 16:42:44 -0400 Received: by mail-pg1-f195.google.com with SMTP id f14so2007056pgi.9; Thu, 17 Oct 2019 13:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rw40Y7pRi4fTQvKbY/v46MITEUGL/XAU6ul7eCZwlVo=; b=sosHBIU0RsMqX17uO+wNzNK+kTy+a2nIFoJViL+RO0PmnZeS5wLogNIhsI6ZFet+U0 C8T94GZQOS4cgMpAQ/aUOb3LZ60rTrnwBD5ubj9FE0ZndFOgELM3lw+FnioxXNUR4AQ+ 488KaZljXNL/XiQS5gYiEm0PU0eHrYUhAKlOqzRwv3okyPruZVB2DZ+Lir3uMZzQZsVS wHKseAUYgWvgZMZGpkz1L8lJaO7EacPEQpJalDbuLKRQ1PChklT8VmBA/0FBQJBHuiXV /WOB/wtEw95TcmXnjM8ZZxYeYLPJpp7cN+1amGmo8MihmpH8MaHIkQ64lfha4BkRt9Ma 6Bfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rw40Y7pRi4fTQvKbY/v46MITEUGL/XAU6ul7eCZwlVo=; b=gKtPbzLnFBXMPzfTBPSen+5VeDpXWrB9ycfAvVb7GTGKYXfpUvcXrtvcD/NgF3pSSs czKg8q92SglH3bspWfmuk+qnEWXPF/BGRlO1CIAYda1kVjloG09ddOZLDJH4r7U06No7 4KAqgdRDvvfOX8spefkQ4F9i4vrdd3VvWdteqRNaa6UDtSSOuBxjlBASwpl1Tk+pYf1H jKLO8oOl2IZAfmgLRhnFsv9BbzOwKvT5AvBFIKsWs0NKS4/RywB9ugQcT3vQ4KdQbxco 2dRxmuzUR1CTK4jmteqDMndb16iU+nEU07oRrbLFCSQHxH+uNYqBbiqhVpXxslKTpJi5 DUog== X-Gm-Message-State: APjAAAX0QA9cq7+MTPJPiVLC0Hr1eYxY6RjPzQA0Mej/bkGk50rwueTh o7dB18gO8EFcRKfiBcHWtJZLMeWm X-Received: by 2002:a17:90a:a407:: with SMTP id y7mr6561565pjp.124.1571344961518; Thu, 17 Oct 2019 13:42:41 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id b3sm4626365pfd.125.2019.10.17.13.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 13:42:40 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 15/22] Input: rb532_button - switch to using managed resources Date: Thu, 17 Oct 2019 13:42:09 -0700 Message-Id: <20191017204217.106453-16-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog In-Reply-To: <20191017204217.106453-1-dmitry.torokhov@gmail.com> References: <20191017204217.106453-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using devm API allows us to clean up error handling paths and drop the remove() method. Signed-off-by: Dmitry Torokhov --- drivers/input/misc/rb532_button.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/drivers/input/misc/rb532_button.c b/drivers/input/misc/rb532_button.c index 4412055f8761..3c43024f4527 100644 --- a/drivers/input/misc/rb532_button.c +++ b/drivers/input/misc/rb532_button.c @@ -58,7 +58,7 @@ static int rb532_button_probe(struct platform_device *pdev) struct input_polled_dev *poll_dev; int error; - poll_dev = input_allocate_polled_device(); + poll_dev = devm_input_allocate_polled_device(&pdev->dev); if (!poll_dev) return -ENOMEM; @@ -68,34 +68,18 @@ static int rb532_button_probe(struct platform_device *pdev) poll_dev->input->name = "rb532 button"; poll_dev->input->phys = "rb532/button0"; poll_dev->input->id.bustype = BUS_HOST; - poll_dev->input->dev.parent = &pdev->dev; - - dev_set_drvdata(&pdev->dev, poll_dev); input_set_capability(poll_dev->input, EV_KEY, RB532_BTN_KSYM); error = input_register_polled_device(poll_dev); - if (error) { - input_free_polled_device(poll_dev); + if (error) return error; - } - - return 0; -} - -static int rb532_button_remove(struct platform_device *pdev) -{ - struct input_polled_dev *poll_dev = dev_get_drvdata(&pdev->dev); - - input_unregister_polled_device(poll_dev); - input_free_polled_device(poll_dev); return 0; } static struct platform_driver rb532_button_driver = { .probe = rb532_button_probe, - .remove = rb532_button_remove, .driver = { .name = DRV_NAME, }, -- 2.23.0.866.gb869b98d4c-goog