Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1291702ybg; Fri, 18 Oct 2019 15:19:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3KIzIcFiEIVF94wDdr04SihU/aNDB6jIESjWD9cucPZcmTKbFb4RvwF7mNWuzpH1QTrwj X-Received: by 2002:aa7:d8c7:: with SMTP id k7mr12195487eds.138.1571437170738; Fri, 18 Oct 2019 15:19:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571437170; cv=none; d=google.com; s=arc-20160816; b=qdE4ucqR+leKCEQ2JUvZkKBlNJQKMKa8oNbpmQvRgP8hQFzvQetSzdikaRyJimlttY 4f1QDjh8+gInc4x/vIxGLCIczo7zLN/6YGT01wQqy72rz/OfgfVN4kv3u+5wKrUdpeSr TPWHsL4mh1lc8rFcup4aNmXv7xvn+AMaLj0V7PqkDtLiVVJ1ep51PDs+rVEYCd2Y0hTc PxVy4jPvPsdBVsnTXhARNlaYfz0zsUA7+4HGbr+c3xUTolvSlwDG+1ut0h3OH+ZRILwW enZ0EFH52Qbb7EcOrVgJoJ27cNL9T5JBylvrye2QkkxmJ5bGXdAIZ8pWbwwxxL2H1ZDo lOAA== 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=sSHq9wsAzsKM4AZ9LGW0ongN+PTn6qrVrduasflfRcM=; b=zpwCf3+C2YPIMUc3BicSukGsDdZZUTtuRBmmX9G+R6/Y8Y7ugdKNfNuqyLde8FnYyx Gp0U4LXodKvLg1ooY7e5/vKCcygA53W9u4PUhmPt3JguIGANzRgXRx5xk9yidcpMRhtK ISfGYsTcONEmhZU0XYi3U5Olq1ruGqloQ8PvE7/kma5TLCuLxHObjeVcoqZmYszemCSA MXsWGDifgUCyRjVACDHb0lhZF7QoLHHi9bgTWrTj1p3CbAa6zz+shR3pGuVUOoGD1qSH cyBY2GivmepwPBalE21hmUXSBzRIRlu56F+bADbvZD3MIJIGoSSp6EvGAtai13gfwWSF ze3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=goASVb+k; 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 va7si4286486ejb.4.2019.10.18.15.19.07; Fri, 18 Oct 2019 15:19:30 -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=goASVb+k; 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 S2437294AbfJQUoG (ORCPT + 99 others); Thu, 17 Oct 2019 16:44:06 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42736 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440795AbfJQUm3 (ORCPT ); Thu, 17 Oct 2019 16:42:29 -0400 Received: by mail-pf1-f193.google.com with SMTP id q12so2366456pff.9; Thu, 17 Oct 2019 13:42:29 -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=sSHq9wsAzsKM4AZ9LGW0ongN+PTn6qrVrduasflfRcM=; b=goASVb+k6liB5swYO63ZxWWekRVhGn3GuMsbPw2TeHuX0v/VFzTJCpHLCRpFv0Ngnb LDGiCtYWcJ5zxIOqmhrr8IRDjleOtxitzOhSew4NHmeu8aeP9liDUrHqYjVvAnqwV4zH N5L7jKq6ZDhb3VLiEOTOI33zZuv1Lkfz+qSzqCaS9uscoIxmpqq+I5004S23Amu2lZtA 0LNv4aB5iMDEzF5XBMiWsmGiolIBLswcBn0H8sP70z0tcnbaiNP1bEtvVB5Ax6yN/NoC Vcrf+XdBoZiwnuh+rw/j2N5m6MBuI1x0wXLofqExCv8gVjBRLj+wdnnJqcuOK43KkonH Sg2g== 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=sSHq9wsAzsKM4AZ9LGW0ongN+PTn6qrVrduasflfRcM=; b=rOoO7vJdwabAco+NHVuuiWz1sAWZ9hEmaRz9qHVkZhg1cBSA2gUq582FtL7brLvy3q e6S0x3DrI2KZZjGlscccTn1W10dUrmEwIA0HmFhPYF5q1e0V1+USZLtwlRBF3aVJW7ph KbXfYyrGy7+N1tdZ3OpwbZ1Q1tWLuaAlBTJb2guTMQ9eLi3O735dKupSvxSP7b3lSosh iBL2T0b4l91VKtFiN94nWMt25hmI8deRbcFngjWEmfwM5XvZiMot4zPlYj1/w5X3eCj7 R/gn8aXjBsZgQqysX8LKYsB39OrK24AHHA7syk8Rs1F2YYbuEhPF83JVrb7uXJ14TphF JKlg== X-Gm-Message-State: APjAAAU+qOoEdo3CzK+9QebMtIyGCzofVR7Rs69Tj1RA2MaImJCdhvYg xkba92K1NQzCc9cFPNbMn0jpO6o7 X-Received: by 2002:a63:fe44:: with SMTP id x4mr6257421pgj.118.1571344948576; Thu, 17 Oct 2019 13:42:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 13:42:28 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Allison Randal , Anson Huang , Dong Aisheng , Jacky Bai , Marco Felsch , =?UTF-8?q?Ronald=20Tschal=C3=A4r?= , Stefan Agner , linux-kernel@vger.kernel.org Subject: [PATCH 05/22] Input: adc-keys - switch to using polled mode of input devices Date: Thu, 17 Oct 2019 13:41:59 -0700 Message-Id: <20191017204217.106453-6-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 We have added polled mode to the normal input devices with the intent of retiring input_polled_dev. This converts adc-keys driver to use the polling mode of standard input devices and removes dependency on INPUT_POLLDEV. Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/Kconfig | 1 - drivers/input/keyboard/adc-keys.c | 36 ++++++++++++++++--------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index a716a90de683..c6bf99d23b1a 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -16,7 +16,6 @@ if INPUT_KEYBOARD config KEYBOARD_ADC tristate "ADC Ladder Buttons" depends on IIO - select INPUT_POLLDEV help This driver implements support for buttons connected to an ADC using a resistor ladder. diff --git a/drivers/input/keyboard/adc-keys.c b/drivers/input/keyboard/adc-keys.c index 9885fd56f5f9..6d5be48d1b3d 100644 --- a/drivers/input/keyboard/adc-keys.c +++ b/drivers/input/keyboard/adc-keys.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -30,9 +29,9 @@ struct adc_keys_state { const struct adc_keys_button *map; }; -static void adc_keys_poll(struct input_polled_dev *dev) +static void adc_keys_poll(struct input_dev *input) { - struct adc_keys_state *st = dev->private; + struct adc_keys_state *st = input_get_drvdata(input); int i, value, ret; u32 diff, closest = 0xffffffff; int keycode = 0; @@ -55,12 +54,12 @@ static void adc_keys_poll(struct input_polled_dev *dev) keycode = 0; if (st->last_key && st->last_key != keycode) - input_report_key(dev->input, st->last_key, 0); + input_report_key(input, st->last_key, 0); if (keycode) - input_report_key(dev->input, keycode, 1); + input_report_key(input, keycode, 1); - input_sync(dev->input); + input_sync(input); st->last_key = keycode; } @@ -108,7 +107,6 @@ static int adc_keys_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct adc_keys_state *st; - struct input_polled_dev *poll_dev; struct input_dev *input; enum iio_chan_type type; int i, value; @@ -145,19 +143,13 @@ static int adc_keys_probe(struct platform_device *pdev) if (error) return error; - poll_dev = devm_input_allocate_polled_device(dev); - if (!poll_dev) { + input = devm_input_allocate_device(dev); + if (!input) { dev_err(dev, "failed to allocate input device\n"); return -ENOMEM; } - if (!device_property_read_u32(dev, "poll-interval", &value)) - poll_dev->poll_interval = value; - - poll_dev->poll = adc_keys_poll; - poll_dev->private = st; - - input = poll_dev->input; + input_set_drvdata(input, st); input->name = pdev->name; input->phys = "adc-keys/input0"; @@ -174,7 +166,17 @@ static int adc_keys_probe(struct platform_device *pdev) if (device_property_read_bool(dev, "autorepeat")) __set_bit(EV_REP, input->evbit); - error = input_register_polled_device(poll_dev); + + error = input_setup_polling(input, adc_keys_poll); + if (error) { + dev_err(dev, "Unable to set up polling: %d\n", error); + return error; + } + + if (!device_property_read_u32(dev, "poll-interval", &value)) + input_set_poll_interval(input, value); + + error = input_register_device(input); if (error) { dev_err(dev, "Unable to register input device: %d\n", error); return error; -- 2.23.0.866.gb869b98d4c-goog