From patchwork Sat Aug 24 05:50:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822297 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAD353B182; Sat, 24 Aug 2024 05:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478660; cv=none; b=KxB2rxQL9uZOFyjPvkk947uXGcZA60+eABCb7wZnKc4cUPmchZ3emZRU/Ytgiq/i3W/rK9S56xZxlJPJqXMLF/0mNhnQSC4FqpDGvAYc0ijM250G+uVlT138DbSgw9VpB5RRYGsGPejuDc0kOCjmLJA0pCN5KOW4SVW4T7hRo6g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478660; c=relaxed/simple; bh=LrtWWKEh4GKx8Bxbh2O2jSGkgXnoUQ3ZTvu5p7QkV8o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BB8bilE5poH4Abxraut5NPRjr7hMwBuQCISiY6rZwzWqpPP0K/kgcKVEzHt4DqbLCMUfDeppElVVji1jTP2YFDmWg75/qKIxVwtYVapbDbcsXov1z7qmJaOMfF4fppeLMZwI4dosaioDaeaPZWb+vCZI0DzMOV8qpIi1ldcFF+s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WrQNY+JO; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WrQNY+JO" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-20230059241so23086395ad.3; Fri, 23 Aug 2024 22:50:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478658; x=1725083458; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wSAgrcjoZD7AJdof5h2n0SqHB3C3G8j8Ni3BDUX078E=; b=WrQNY+JOs+Kd3/QonyOush2b5V5RSBAwubwV/JenQkgNdZtZhfWXYQkyXC85fo4Vpt 6Mw03s6j8ujVROdFg/JvU9pKRTzmkhhgx84WLTa3cI0wWvcNkbiUkjAWMJ50KtgWkxqI 0iM146XF6XmGnVY6+jhjnmEk48s+VC6qsRYkv5+qy7GISb5emzPoWHK/0vvvdIOjHDTH Ild89B/+m3rSh7KNQvLjlO8VuvJAhaL+yJMOLXn7BpD/Y8uVK0S8Cu4Ux8GWqL8aUxtM jNMvnG8+EZA60TapcX0FHW8shJ0M4Y2nNnWhXoTCCtGupC6csng3q9Fuo7cGZLLg5e4v x7Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478658; x=1725083458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wSAgrcjoZD7AJdof5h2n0SqHB3C3G8j8Ni3BDUX078E=; b=P30AZ6bfauu+NkxYFBJYzg2SRhDIVWN016iYjTUoF8zVuuR8uv6IwMLMUzC2M0sXDZ db4lIJEvMTGUr7u3DlWcpQJ8+krI4JnHt66mwiANEqQUTmADQDRUxPGIhieTd31WItph 4bXH1VvRZUw0S7ruMW0Fyh26dtPoG8P4wnNlqg3nPPQuNgS2/zU9qgD9DBxNPvUmRBm6 P2WRATyYqwf2s5m3WSwb9O481nGc4ZA1SswMjBlh1wH2ZAeDEf93m5E2TUHBfFL6jAf3 aqLC+iFUU/CS6lOxJAJ1tNs4+fcm5sEt+ChUt0g3jFFYCAMaoXkmxML9OF51UTaKMzO2 Z7WA== X-Forwarded-Encrypted: i=1; AJvYcCUBhwadXGFV2BuCWy6bz7oqxAd3+xjSG3FY5NSdwjTrTRly9PTGgTTvwu3ILEP9qz+GROsJ5QMe1qlI0Q==@vger.kernel.org, AJvYcCVnarG+5KfPEDGXVWsjyGkhtco//x0d11STaEZELYoNhAkZLgAoXiRUmckH5Pp2oNFWFMq77FJFaZ69H56M@vger.kernel.org X-Gm-Message-State: AOJu0YyWzPjaXEmvVOgQIHeNHvNbXGYS0ge78NM4RPZtSZmRh/1GEkmF /tO0V63lhHxezgM8jLrWqi4IbLsHo5qm+3nfcClRBPU83quZFAaV X-Google-Smtp-Source: AGHT+IHqqBlshmRtWi1clh1LkUbUw3h3QKiaChjsx4ZdjfZfI7bB5NtLgY5mG2lv2M4V1wk7Xjni2Q== X-Received: by 2002:a17:902:e842:b0:1fb:90e1:c8c5 with SMTP id d9443c01a7336-2039e4b5193mr36024105ad.33.1724478657754; Fri, 23 Aug 2024 22:50:57 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.50.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:50:57 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Sudip Mukherjee , Andreas Kemnade , linux-kernel@vger.kernel.org, Sudip Mukherjee Subject: [PATCH 01/18] Input: zforce_ts - use devm_add_action_or_reset() Date: Fri, 23 Aug 2024 22:50:25 -0700 Message-ID: <20240824055047.1706392-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sudip Mukherjee If devm_add_action() fails we are explicitly calling the cleanup to free the resources allocated. Lets use the helper devm_add_action_or_reset() and return directly in case of error, as we know that the cleanup function has been already called by the helper if there was any error. Signed-off-by: Sudip Mukherjee Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index fdf2d1e770c8..ffbd55c6e1d4 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -803,15 +803,12 @@ static int zforce_probe(struct i2c_client *client) udelay(100); } - ret = devm_add_action(&client->dev, zforce_reset, ts); + ret = devm_add_action_or_reset(&client->dev, zforce_reset, ts); if (ret) { dev_err(&client->dev, "failed to register reset action, %d\n", ret); /* hereafter the regulator will be disabled by the action */ - if (!IS_ERR(ts->reg_vdd)) - regulator_disable(ts->reg_vdd); - return ret; } From patchwork Sat Aug 24 05:50:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822897 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 740907E575; Sat, 24 Aug 2024 05:50:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478660; cv=none; b=N//YvwvnX9kLJpOElTmsOQ/2a0Liq802jNU5vyJ96/9UTLI6sIhe5OvVhjpVBCU2VzwNgdCUeoemg6k8UR5zJhefl6FK0uAwftm/tItoOnH7LJRQfhKWhuZ2NJQz+bGHq43+PFZSC+fMpgPEWAk517dFyPqCts8Y7c9tsYjuN1k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478660; c=relaxed/simple; bh=qrTTEVet9DVf+P8WZVnNHtg3K773zFUw5LoxWudGN60=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oHmisSqAgrZP9ADd1Rd4ktnakj2424ONumlKYLFy1OhNuGF1nciHY852zbf06uZAmpjK7cmqbqvXdpKGofkviO57+lCqAEJB4kxNWJLHfIIa49rLULMIwlQmJ9w9aulH9Id0+ub50WnqiuEFXt3FhhEN3XuqZFMx65Eo6kyQdYM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Dhoya9XO; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Dhoya9XO" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-714302e7285so2292248b3a.2; Fri, 23 Aug 2024 22:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478659; x=1725083459; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b6sQ34F+nnm4L9xEfmuQS9U4eeZQJzK8r1tJDoiW5xw=; b=Dhoya9XOlivE+PXBBUbFXJFB5/clopstq8Kd4rUv2PnxVWn0tZ3Not+0ysg0l9Kb1F buFVuPWjSfJ41qz+BoHpkkHYU8c41q40Vdy6VKP+dTSQ3JnYth80T8EjKfKy7wZp22cb 7HAdF9cKocCCUmCljeXPmJm0/eaZrmG5YmuBqyXyA7ebuKj9QXObtZp+rJu1cyPH03b9 XklWBPuDrmSE9LuSn2hZdjWRONl5Rmk2C9891vaVYWDffIeetTtsqntMS921eYjR+wGx EQLxN1vP+VtXjExkJRzFPtPTXt7R/hLM9Nlp1YQOvgPVx/0rwtTKVrrPnnpuJKG/H4ov 6T6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478659; x=1725083459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b6sQ34F+nnm4L9xEfmuQS9U4eeZQJzK8r1tJDoiW5xw=; b=IAfJb9UJJ7rO5PYLNRzBhVlPP8K3yie0tsyqNamihohgh2YJ2uGkmq8ET9FtNwdHGK dHRJ++RTX1j4hOq8OWKOoEweta6q0hwCA32g2qcUcC6L2Lgn0wJW6YiFWp1QLwfP6L+f 2b83R47GPPQMHbhIzk+4EKbpoPK6wway66zFcUqJVDWdWjisuBsSNp1U5oTDxnzv0skb zm2g499PayhNt7KPK7k7rfe+V9J2kQP6JthoEfVVGN6P8A/6vsiX03egDBs5Wf/ee6WV usNYN+q9sQOaOHT3T9pw5P84Rfoh93F71GULc6VWxUAaCn02pgx8W8tyVDs8QmRCAjPt AVVw== X-Forwarded-Encrypted: i=1; AJvYcCXAiaFb0S36vf1joC0lDc72xcJcE5S6m+eAY7QL4OQL8FnTGCpXMggWbjb+WjmDRu0aKLM7HHJcE1cGmA==@vger.kernel.org, AJvYcCXvfK0u8qUC7RS1kSALf5cuv4+T20zBL0c9eQHUetHPRowP4YMyM0yH/WBprdT11GCHFM6YiyVfk5QYtEpW@vger.kernel.org X-Gm-Message-State: AOJu0YySfKLWMPZC8MEysWz13P9ZhST9jEDa0C3a3gPKMmOj8DUnqWdU //sBSeXIlTN5pD8jLaDlJy7+LThOmTQETjQZXaQyCDEr6mCkA0PH X-Google-Smtp-Source: AGHT+IEuageBihitbZVQb5egC8OVLS4HRZZx1QLZ91t+LxMSexOw/6w8CRcQ7tCS+Vs8xmG2LiICIw== X-Received: by 2002:a05:6a20:c793:b0:1be:c929:e269 with SMTP id adf61e73a8af0-1cc89ee5437mr5747576637.34.1724478658526; Fri, 23 Aug 2024 22:50:58 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:50:58 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 02/18] Input: zforce_ts - simplify reporting of slot state Date: Fri, 23 Aug 2024 22:50:26 -0700 Message-ID: <20240824055047.1706392-3-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 input_mt_report_slot_state() returns true if slot is active, so we can combine checks for point.state != STATE_UP. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index ffbd55c6e1d4..350cec8508a3 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -386,10 +386,8 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) /* the zforce id starts with "1", so needs to be decreased */ input_mt_slot(ts->input, point.id - 1); - input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, - point.state != STATE_UP); - - if (point.state != STATE_UP) { + if (input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, + point.state != STATE_UP)) { touchscreen_report_pos(ts->input, &ts->prop, point.coord_x, point.coord_y, true); From patchwork Sat Aug 24 05:50:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822296 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58D4314EC73; Sat, 24 Aug 2024 05:51:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478661; cv=none; b=mFxKTY8qOyqkmh3AVmCRv7E2vG0GvMlpWBkCvDNMGd5TcQfVHdZJYSY1tBEc/eMcrj9rhyaHn6l7wNBpqe9SLREtVVv+uMVQbWBPYLf/elXXWMLZTeVibMFXPm5zYUH8IZ5YWZ4ewvxGFm2CAd34nJzImMw/6fYmDlYyT4kE5a0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478661; c=relaxed/simple; bh=d8/cwb9Pxb7IHUK4X6fnXxfxirqKTGGnG0GqI7TveIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vEtS8NVVFLzqeZL2c+IGZ0p+iyjPz+pIgKRBoe+YVFyvIUPhwDRNf/SM+kc7rGd4k7w43Qubn5jFJmWtHFKc2ksiJTjRbWLWQiOIs67IMDrBpvwuXIELrB0WURpb+0y+ukXdyfxm/rtLhuFGzoHXFVWGzoljkDiaN189ZSZoFgU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MygKJ7W/; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MygKJ7W/" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-713edc53429so2151505b3a.2; Fri, 23 Aug 2024 22:51:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478659; x=1725083459; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ezKHKr+4RbEaJ839QztElord5F93gI6kBwoAwsgFbkA=; b=MygKJ7W/pX5AhFDyh5WOdxXWEuk9EDeOrpURW5TOPGA0HEhmk61VZhQXXaMOOiUBgj ESuy4iAL3IHFFEYohrvKJeqVM/viz91nn+0OHLKWRuxsE+FFjBx5dps285YXw4sn6rnT UlgKFvA1G3zwAc1T+LCVPPTatqOVcqOZ/KWiEguKeoHR/nQBf8xX4HRt01IfdINHU60P G+8NGVl/4kKebSamqoSY6XfKEUK+winp2l4evb4oaPf3zDz3My+oJVCg7cpCPwNkd+SO stpH5121s+viReKM/dc5NXfJVvjsfYqqvSkGx6ych6j67u958m++gkLnNNNE+5KZ2ydN GslA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478659; x=1725083459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ezKHKr+4RbEaJ839QztElord5F93gI6kBwoAwsgFbkA=; b=WhDXj/XwhpOKWJekY3129iNqC21/15uNEigvX0efAlY205aRTfglGo5xHaX8NuAD8D u5QQC9Pk1s2YxCxyuqtuAX0Ly2lz9RETPQe72cgAWStfWNzD7MQyhUjpqkhWQdY5lvHR 5qQb9jPjmDgUt0JngdUY3DRgrTyMw+20PpqM+VeCr2g14PwRnBUO5XbmBfMYGs/PWGMI TC3Il7nfek29iSGFbsZJrXbg4cs/RJ2elFT2FhUz2re+mIUmfL1HPyy/QL76CvhI36p8 fJvY4yPQtg+2ENoHvxQE7VTFyxoWny/HUqhRuEY1yaPQP/B+BZF/zlVyvAd2ZHDyDFtb XV9g== X-Forwarded-Encrypted: i=1; AJvYcCUMLG6ynX84OGqZcwLgJvWxWoSvXNXiZ0oQBHPHsF0m74fv9ehQApZMA2TSYHQQZSJ4uo13z6HUykwNC/Zp@vger.kernel.org, AJvYcCXgOor+jPeCF7h7fbF/xaixkEc1FDFF8QyzI4TZovGUT9UArQlw/P2rEDSZeILFYcO8Pxyj7e9dQ0NGiw==@vger.kernel.org X-Gm-Message-State: AOJu0YyCDqn/p+kcA0rmvKKu2s2w5duHkfzJoKC5xhp0MhtK9HsJhADY /PMWbFUcAzWLXHCqY67C+eJ0UyK55zxJjCln+0xodOm8kmfzyks2 X-Google-Smtp-Source: AGHT+IHee2poCvIqv8q30/gbA7K9/auSgR1h2+m/fDfSDibHM8ef10E/0QFTp/qy3a+4yYl5mEJDpw== X-Received: by 2002:a05:6a20:cf90:b0:1c4:23f1:114 with SMTP id adf61e73a8af0-1cc89d65b39mr4922763637.20.1724478659280; Fri, 23 Aug 2024 22:50:59 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:50:59 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 03/18] Input: zforce_ts - remove support for platfrom data Date: Fri, 23 Aug 2024 22:50:27 -0700 Message-ID: <20240824055047.1706392-4-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are no in-tree users of platform data and any new ones should either use device tree or static device properties, so let's remove platform data support. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 56 +++++++------------------ include/linux/platform_data/zforce_ts.h | 15 ------- 2 files changed, 16 insertions(+), 55 deletions(-) delete mode 100644 include/linux/platform_data/zforce_ts.h diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 350cec8508a3..5a8f79b800e6 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -9,21 +9,19 @@ * Author: Pieter Truter */ -#include -#include -#include -#include -#include -#include #include -#include #include -#include +#include +#include +#include #include #include -#include -#include +#include +#include #include +#include +#include +#include #define WAIT_TIMEOUT msecs_to_jiffies(1000) @@ -108,7 +106,6 @@ struct zforce_ts { struct i2c_client *client; struct input_dev *input; struct touchscreen_properties prop; - const struct zforce_ts_platdata *pdata; char phys[32]; struct regulator *reg_vdd; @@ -702,39 +699,24 @@ static void zforce_reset(void *data) regulator_disable(ts->reg_vdd); } -static struct zforce_ts_platdata *zforce_parse_dt(struct device *dev) +static void zforce_ts_parse_legacy_properties(struct zforce_ts *ts) { - struct zforce_ts_platdata *pdata; - struct device_node *np = dev->of_node; - - if (!np) - return ERR_PTR(-ENOENT); + u32 x_max = 0; + u32 y_max = 0; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { - dev_err(dev, "failed to allocate platform data\n"); - return ERR_PTR(-ENOMEM); - } - - of_property_read_u32(np, "x-size", &pdata->x_max); - of_property_read_u32(np, "y-size", &pdata->y_max); + device_property_read_u32(&ts->client->dev, "x-size", &x_max); + input_set_abs_params(ts->input, ABS_MT_POSITION_X, 0, x_max, 0, 0); - return pdata; + device_property_read_u32(&ts->client->dev, "y-size", &y_max); + input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, y_max, 0, 0); } static int zforce_probe(struct i2c_client *client) { - const struct zforce_ts_platdata *pdata = dev_get_platdata(&client->dev); struct zforce_ts *ts; struct input_dev *input_dev; int ret; - if (!pdata) { - pdata = zforce_parse_dt(&client->dev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - } - ts = devm_kzalloc(&client->dev, sizeof(struct zforce_ts), GFP_KERNEL); if (!ts) return -ENOMEM; @@ -822,7 +804,6 @@ static int zforce_probe(struct i2c_client *client) mutex_init(&ts->access_mutex); mutex_init(&ts->command_mutex); - ts->pdata = pdata; ts->client = client; ts->input = input_dev; @@ -837,12 +818,7 @@ static int zforce_probe(struct i2c_client *client) __set_bit(EV_SYN, input_dev->evbit); __set_bit(EV_ABS, input_dev->evbit); - /* For multi touch */ - input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, - pdata->x_max, 0, 0); - input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, - pdata->y_max, 0, 0); - + zforce_ts_parse_legacy_properties(ts); touchscreen_parse_properties(input_dev, true, &ts->prop); if (ts->prop.max_x == 0 || ts->prop.max_y == 0) { dev_err(&client->dev, "no size specified\n"); diff --git a/include/linux/platform_data/zforce_ts.h b/include/linux/platform_data/zforce_ts.h deleted file mode 100644 index 2463a4a856a6..000000000000 --- a/include/linux/platform_data/zforce_ts.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* drivers/input/touchscreen/zforce.c - * - * Copyright (C) 2012-2013 MundoReader S.L. - */ - -#ifndef _LINUX_INPUT_ZFORCE_TS_H -#define _LINUX_INPUT_ZFORCE_TS_H - -struct zforce_ts_platdata { - unsigned int x_max; - unsigned int y_max; -}; - -#endif /* _LINUX_INPUT_ZFORCE_TS_H */ From patchwork Sat Aug 24 05:50:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822896 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 276461514EF; Sat, 24 Aug 2024 05:51:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478662; cv=none; b=kpRtCg1uYvlatMWb4JBuFaNQvHhXWm1uOVnMH4OPdwFRHzy1iKZQVp0HtcQceDqyhbcfciOVhBliD2bTOsv10+ABE5Fsy9bAGISamC/XPR63w/a7NPtrseq6TJY+L4VZ8LxBryE9pxJrwV9c3fievx0Pvx4+w7FXvbRH31TnJkc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478662; c=relaxed/simple; bh=LOjd101Xy/X/zP6hxJ0OIH+TJD3G+l/KW1/diVKMQII=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ADV1Nh0hrrGKSSJghY5T9rlvRpW1D/yt7v0Jo+OnEoZzJsYbj394pzF+eVzV7+EgfoO3aE7uZGgiU1ODcAlYKpQAaw1adywEvDzdQ36B+xMhIyQj4jlfMUp3byxHkxInrE/a6XqrMFNUvfdhOzoOaJSleVxdtUcQKW6F/PkkKZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=b8iqDV6a; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b8iqDV6a" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-201df0b2df4so20890085ad.0; Fri, 23 Aug 2024 22:51:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478660; x=1725083460; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qiwPVBWS9hQXQBSqTAgjSYAnOWrQbyMBgnrH83inBt8=; b=b8iqDV6afX42GNG4MH2f3yvr5i5rxp1oYwzVdlRYyCDiclkcHofPLQgC+XXba1XkNF sg3z8Fa8ahELNUzUYlzdkj1dagl96q1qIK1jbb6ykOnw3hNS8SeTjflkaufVo2AqpQrQ cyimM9yh7/OJP8iKCh/X1DOJzwHyHCsJ5HPoJOJBNd+3TWl4N1kkds5UvjmEnG3YnStr +jIBAXGxWBwfJsFCBkDlFYnTPHUJFCEgKT8DzkkA280wJalNQK1ufoDzmzPi5n/fxDzr +WowCYMBoawJLhs2HAlRnmT0U7HqS5eJRLLM6l/x07Biq5RS9+UlPVZRvMBvB16YIWg7 GNGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478660; x=1725083460; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qiwPVBWS9hQXQBSqTAgjSYAnOWrQbyMBgnrH83inBt8=; b=DfNdAbS06nIker/IcHlYRLlth4vXCBTRkhNoKaId0AXM/JhGmKYykCirZp5wmehJMT 19G21N+hm//NO/X3MLOmHBRTyL9ZZcJxJxZcay7s97eG/SEXu2oWhmFc4Ux0x8TySijX XhFgDqTk9jf9l8moWbx1dNX1x0jO9gzlP08WpfF66T05m5DRFwLSuk3bbdUM7cHwm7ps rIaW4onkV0KjKe8vuVXyqj+rIUVFmNGExjxEXkOcOcV8cULjL3eqt9NS5TCI2QsiGNaz T1HOG3R5DYUZESdmu8ctzFARgp/xGpSfdB5cq4SEckvH2dD4swMAe8w0/vwBp3KbFek8 lvWg== X-Forwarded-Encrypted: i=1; AJvYcCVICxVIYhbCJTftE9gBy1mffj8QvsMw3imI3NhzISrPM/USEWkwuRhw2R/RPz41pkPkNE/I7l0yk0gArQ==@vger.kernel.org, AJvYcCWaYngq1AStHNOIs4QFU0ouikWuviqcZmzFBlXV9ELJ/vi7e1oRyshu64XOOW5kGbJl+DQa7v5yTKy6lvAG@vger.kernel.org X-Gm-Message-State: AOJu0YwFQbR2nXrTDhPCYEbjPtuMR6wrsH48Ds7kG5rvyTLmvmjNpMES R39y9kZVhCFXBETxBgUX3C7VMMLWu8OQMGXcLclTAnr0PhS1Ls0Q X-Google-Smtp-Source: AGHT+IGushiJY78lKaJuM8cDmw+yw0Me0YLR+sRvnCRsA53D6RqunKu/mX3NIrcsLzRDAdg6MWaF1A== X-Received: by 2002:a17:902:da8d:b0:1ff:393d:5e56 with SMTP id d9443c01a7336-2039e4cab1emr52244185ad.36.1724478660123; Fri, 23 Aug 2024 22:51:00 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:50:59 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 04/18] Input: zforce_ts - do not explicitly set EV_SYN, etc bits Date: Fri, 23 Aug 2024 22:50:28 -0700 Message-ID: <20240824055047.1706392-5-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Input core and various helpers already do that for us, so drop the code setting these bits explicitly. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 5a8f79b800e6..a6f6cc5d8a3f 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -814,10 +814,6 @@ static int zforce_probe(struct i2c_client *client) input_dev->open = zforce_input_open; input_dev->close = zforce_input_close; - __set_bit(EV_KEY, input_dev->evbit); - __set_bit(EV_SYN, input_dev->evbit); - __set_bit(EV_ABS, input_dev->evbit); - zforce_ts_parse_legacy_properties(ts); touchscreen_parse_properties(input_dev, true, &ts->prop); if (ts->prop.max_x == 0 || ts->prop.max_y == 0) { From patchwork Sat Aug 24 05:50:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822295 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0EB0153BD7; Sat, 24 Aug 2024 05:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478663; cv=none; b=u8NncynDpia0KJzvQCZcY5hl35kBnZp/6VB57vSDHK1ISmsMU6KZe2S0C8oGkspsm3vGowEqZiHcaFGqetObu43gIDTFpeTlmWh2wcTNcQviRnho+DTK58FJkH+jfY/fbfyKoTQ0q2ETQ+KU8C6T4OAaEELwnSogdK9LceXHmEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478663; c=relaxed/simple; bh=XpESOWzC6fCu4/oArcc42Qp3xJuY/+ezjsEMmGagwYw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NWKQ9NudfPT5XP85f2eTefjpAN31ZKASS8aqT7AXTICZYsUzHAmFtkgi9oYDRDperGTpbeAs9t0CjQVVQf0vz0I30Zr36PIMwbd4w3EUKeVqGN+z2/BkxehHyQsOoK7ySTiBdD7Ew35tFAXAo/W120UajdXQECmLZkKYpqf/4sY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DAVt/xQZ; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DAVt/xQZ" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-202089e57d8so17384835ad.0; Fri, 23 Aug 2024 22:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478661; x=1725083461; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kvY60QkB50ssU4IYdBdAE3/BwfGIyIBrZW4hREQwiPE=; b=DAVt/xQZxLBHJa+riychGFLxxwNnuqlfZ9HPOCBctmAlZw3mKQD+XGdu4H0VNJoDlP 7yVCwcgucSO9SBMkx2nau76d1wK2jAMCfJbcehx55ZnpJl5mSQV44EqLu3Ov4yalBeGG UgjX5u35DxEv4qWXioGJgKAtJuAUk5KUnJGMAtueFQONcqxq+rs01G2h/VkoTHwq42O1 +CiEVKieSOkSoLxVF+7fhHOF9K1MM2tKFMahsnvC/Zpaqh305Tx4CzxcPveqx4mFnbi+ XNMQ19mFxCyFMrLpa9s0urjo35/wj4YzdeT/2P6/lN4P38u/c+/8FKq9csRAlfjsNeEY 8/AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478661; x=1725083461; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kvY60QkB50ssU4IYdBdAE3/BwfGIyIBrZW4hREQwiPE=; b=Wv0a6A8ql1OaGfCTsGRVIYbsY3JjxlMMsM8UXNLKgCjH6Q5WYX3nLUtFYYBpVyMV74 GH1cA2Iqc51PD+nm+bJ0xTgocZFZ9sM02y/8Yqqtx5LQqvLfH0gosHeMbl/8pMfwxbYW 81gtIlLFyALrKQ7Ab04cJQ2aQL6rbUxf5Y7R1TEpRzWk1ug6RMXWY1NPZbu93WtzexYb qoocwoQDzRWClqfiHAH6rDnT7z5bimqpARiSRotcdia3EnzMyN6XboD3/ZXuKtbvP5Ck Km8v4FEPqVYSmGJ1w0xNTBgVlIU/5mSsPXTL0bqlCIwHRKaVuWD53ejshHLANQL1wDBU Ph3w== X-Forwarded-Encrypted: i=1; AJvYcCVJrHhmSv2XnO0qVCV6EtuNODTVRIM8Ksix4zdry9LqB/2hd1iroUtfLdkV3sTBoaLjBHbFmiBvPvOboQ==@vger.kernel.org, AJvYcCVzmsVuJG4aTZYBJK7yL76q+rUxflE+ftEt5Jtk9WGqCtNAFYvifqzk3KZPxdhK7mN8Rsc4umVsmKee8lu9@vger.kernel.org X-Gm-Message-State: AOJu0YxoOYD0IuH+0omcVm1Sw1H3f63CM6ciWKXJ39ew6dOKme/ARe4r rYSzaZ7cyKN1l6EBrZHIRYdTEl+kaTLetEjdYbt4XVJyS9di6zv9cvR0iA== X-Google-Smtp-Source: AGHT+IHP0C8cjSmWUCaFdzPkid0uOjIAE3LGGbSbJ9M2x5/ZjSYT6z+u7PtETZEpIMF/dZS9jwJ/UQ== X-Received: by 2002:a17:902:c412:b0:1ff:5135:131f with SMTP id d9443c01a7336-2039c509ec7mr81719975ad.25.1724478660961; Fri, 23 Aug 2024 22:51:00 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:00 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 05/18] Input: zforce_ts - handle errors from input_mt_init_sots() Date: Fri, 23 Aug 2024 22:50:29 -0700 Message-ID: <20240824055047.1706392-6-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 input_mt_init_slots() can potentially return error which needs to be handled. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index a6f6cc5d8a3f..a4956f1eebb2 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -826,7 +826,11 @@ static int zforce_probe(struct i2c_client *client) input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, ZFORCE_MAX_AREA, 0, 0); input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); - input_mt_init_slots(input_dev, ZFORCE_REPORT_POINTS, INPUT_MT_DIRECT); + + ret = input_mt_init_slots(input_dev, ZFORCE_REPORT_POINTS, + INPUT_MT_DIRECT); + if (ret) + return ret; input_set_drvdata(ts->input, ts); From patchwork Sat Aug 24 05:50:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822895 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAF011547EE; Sat, 24 Aug 2024 05:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478664; cv=none; b=hZQoZZ0wnI4wQ0/3lCpC7RlrsM06nQPgf1b3uRlCYtnAub2keknjxALoWHG1PJzkULkJPwhuK9o3kSUFMxU2syPW2DvmNI+K0kZvXgIWlLi6ycDqTr02+QX/mJN8n5DTTfW3e5UCH0IOMZT51Ph5o3KafY56dJS40m+PJf+E+5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478664; c=relaxed/simple; bh=DO2POWR+L4mpoJESl3OGhJJvqVw8fpyfFYUIvsIfyV4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mpWbniVRte1zd1ygXdFy2O1MgcfiFKmCCJ5D73CQeKRnBrbNfU4exesFyytyjK0SaQiJusovOpmWxjuzjV3JcQ6fEjCXCPHUwMLc1S1GaqfqHFkKoR6d/I531+vb2p7Rz82iiJbN8UgnAH5ZDfl72oKVxtzr3wa2uBqPZSjKgPY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QR5yoyBS; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QR5yoyBS" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-201d5af11a4so23871295ad.3; Fri, 23 Aug 2024 22:51:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478662; x=1725083462; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ehLi53HnV4EpA+uVYR2JtIJT0ACD//Baaeue9KBcNcI=; b=QR5yoyBS3bwXMJvovrQwPFfhSq/iTzlkPvazaoN7C9Y55Amadew31WA+bNFyLb7j1o hMxoXr6p1sNyWsYVSd1a/C7MF+rl+atk55zs58NoGS3oifqh59YOkFRmww1SYyJRKklb /YfvVvNC9qTP0Nwetx92IuaMV+uR6RHk1puhUsh7Bl9qejquC5MncSOkmOOZM+EvRcKG I01IfRPVt3fmR4erjDIAwkHE+68t1DgfQA9xdATisiE1Ow895q76nUOhfQPh5KEcCTgo +2n6tZqnL+QmzsqC3fdWkPFBHrEBjE8c2ycVfqiP7wYHlGaTKbzidxeAc/UlvUg4wJ/8 NM9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478662; x=1725083462; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ehLi53HnV4EpA+uVYR2JtIJT0ACD//Baaeue9KBcNcI=; b=mPQJNCEcMmVmf8ElZWh7ewQ8f6cBKGSaSZbKz3YYaPX1ipMYS2HdHO5gri2CREGJsS sN948XKoCjwDyP0+iMl05V8nH6eXx/lOlo3TBZvhKMUCfYyodHkx8lXtwrKmcNk2YCF3 uwhYVawj8mkaG82HokBr9/lG6pZdja+sGCZVmQCnuodbxTlTD826nwumQCKsL/Sq1/YL Aco2noscHQCu8NGqg8Gy2Efj3jmHbWoObizqjKjfortp9toKvlPu8D03mC3M4rWyIOU9 zRvfnIluM5VvkH3ouOcJVoAHOam0RmVpdYlS5KEB4nE6q40Dx4T2iAjj6HhM03vGoEfT 8dLw== X-Forwarded-Encrypted: i=1; AJvYcCVO8grpormtsCaK4k2Xr1QztwlIvNKT3OuZAYX/N01r0c34VoSP9//EsKm8jkWsTidCv1i91NHGDA30iw==@vger.kernel.org, AJvYcCXcxJwo0gjJt8qsRYTBsf1gB35d21NTjdtbcEYL5KPwoC7W/zxSk63LU3IfYtxzDyBYHKt5m3YiNJYcnSJu@vger.kernel.org X-Gm-Message-State: AOJu0Yw892FLjv/wukTd9eUV1zQrDIrXLdoP9gTCUsRybNFjvWowJmkd jSJjan1ltmQB2m9hjPlELi2bgBJvrQjGzyJVAkxnYgYPMJtzr/OD X-Google-Smtp-Source: AGHT+IEgSszwWvTWjjBYNM43ijA8tNPk16mglLTjE9eznV7DUm/LrglTUm9Hikoo4gKdLsskpuQXbQ== X-Received: by 2002:a17:902:e889:b0:202:1db8:d9aa with SMTP id d9443c01a7336-2039e4cefb4mr47257555ad.30.1724478661767; Fri, 23 Aug 2024 22:51:01 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:01 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 06/18] Input: zforce_ts - remove unneeded locking Date: Fri, 23 Aug 2024 22:50:30 -0700 Message-ID: <20240824055047.1706392-7-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There is no need to have a lock around calls to i2c_master_send() and i2c_master_recv() as they are not issued concurrently and they are not sharing any buffers. Also there is no need for command_mutex as all commands are issued sequentially. Remove both. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 47 +++++---------------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index a4956f1eebb2..afeafa589928 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -95,9 +95,7 @@ struct zforce_point { * @suspending in the process of going to suspend (don't emit wakeup * events for commands executed to suspend the device) * @suspended device suspended - * @access_mutex serialize i2c-access, to keep multipart reads together * @command_done completion to wait for the command result - * @command_mutex serialize commands sent to the ic * @command_waiting the id of the command that is currently waiting * for a result * @command_result returned result of the command @@ -123,10 +121,7 @@ struct zforce_ts { u16 version_build; u16 version_rev; - struct mutex access_mutex; - struct completion command_done; - struct mutex command_mutex; int command_waiting; int command_result; }; @@ -143,9 +138,7 @@ static int zforce_command(struct zforce_ts *ts, u8 cmd) buf[1] = 1; /* data size, command only */ buf[2] = cmd; - mutex_lock(&ts->access_mutex); ret = i2c_master_send(client, &buf[0], ARRAY_SIZE(buf)); - mutex_unlock(&ts->access_mutex); if (ret < 0) { dev_err(&client->dev, "i2c send data request error: %d\n", ret); return ret; @@ -169,37 +162,24 @@ static int zforce_send_wait(struct zforce_ts *ts, const char *buf, int len) struct i2c_client *client = ts->client; int ret; - ret = mutex_trylock(&ts->command_mutex); - if (!ret) { - dev_err(&client->dev, "already waiting for a command\n"); - return -EBUSY; - } - dev_dbg(&client->dev, "sending %d bytes for command 0x%x\n", buf[1], buf[2]); ts->command_waiting = buf[2]; - mutex_lock(&ts->access_mutex); ret = i2c_master_send(client, buf, len); - mutex_unlock(&ts->access_mutex); if (ret < 0) { dev_err(&client->dev, "i2c send data request error: %d\n", ret); - goto unlock; + return ret;; } dev_dbg(&client->dev, "waiting for result for command 0x%x\n", buf[2]); - if (wait_for_completion_timeout(&ts->command_done, WAIT_TIMEOUT) == 0) { - ret = -ETIME; - goto unlock; - } + if (wait_for_completion_timeout(&ts->command_done, WAIT_TIMEOUT) == 0) + return -ETIME; ret = ts->command_result; - -unlock: - mutex_unlock(&ts->command_mutex); - return ret; + return 0; } static int zforce_command_wait(struct zforce_ts *ts, u8 cmd) @@ -412,41 +392,35 @@ static int zforce_read_packet(struct zforce_ts *ts, u8 *buf) struct i2c_client *client = ts->client; int ret; - mutex_lock(&ts->access_mutex); - /* read 2 byte message header */ ret = i2c_master_recv(client, buf, 2); if (ret < 0) { dev_err(&client->dev, "error reading header: %d\n", ret); - goto unlock; + return ret; } if (buf[PAYLOAD_HEADER] != FRAME_START) { dev_err(&client->dev, "invalid frame start: %d\n", buf[0]); - ret = -EIO; - goto unlock; + return -EIO; } if (buf[PAYLOAD_LENGTH] == 0) { dev_err(&client->dev, "invalid payload length: %d\n", buf[PAYLOAD_LENGTH]); - ret = -EIO; - goto unlock; + return -EIO; } /* read the message */ ret = i2c_master_recv(client, &buf[PAYLOAD_BODY], buf[PAYLOAD_LENGTH]); if (ret < 0) { dev_err(&client->dev, "error reading payload: %d\n", ret); - goto unlock; + return ret; } dev_dbg(&client->dev, "read %d bytes for response command 0x%x\n", buf[PAYLOAD_LENGTH], buf[PAYLOAD_BODY]); -unlock: - mutex_unlock(&ts->access_mutex); - return ret; + return 0; } static void zforce_complete(struct zforce_ts *ts, int cmd, int result) @@ -801,9 +775,6 @@ static int zforce_probe(struct i2c_client *client) return -ENOMEM; } - mutex_init(&ts->access_mutex); - mutex_init(&ts->command_mutex); - ts->client = client; ts->input = input_dev; From patchwork Sat Aug 24 05:50:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822294 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AF031552E3; Sat, 24 Aug 2024 05:51:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478664; cv=none; b=OWbzZY+DkGtCWuRWC3hWcNERKokY+TOZplsRnrg8YlDwFN+wrQxBsJgHN736pqcwERmc6Zxd/CCrXYeBkfx/569BxgjT8PjbD1kIY8s0hkR+42syRZ+MKZwHyocLCF3E+opAK5wulQZ02hteOdzg8V3wwk4HRmSp+gIko+cFW7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478664; c=relaxed/simple; bh=jZc/ru8ieOguS6XNd3fDyKoJzxvdq03+pTPuWqE0FRQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bkg1HzmjFbpv6P33VFGRtNFKoE8DAyagSthkEZCqpkKzUqYYHjNAbiILaZdDQmjzl3MKzH7A8/8e2msTBzgO+5wKac0hYAHo/xpjJMu4XgUgWrqPwuTArErT+wbhwrlugYV3FPWdp+GGTVmDp/GJHnKpY+bqWF9tFvzdbEyn/nI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fd9ErRlh; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fd9ErRlh" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2025031eb60so23383225ad.3; Fri, 23 Aug 2024 22:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478663; x=1725083463; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ztZiHh+Ss+9GgllgOmhrzPgnRJ98j/KfpwosGaKcSPw=; b=fd9ErRlh/xQErQTBhJOU5UIq6eR8WGedIubVtjzYJ9DIi/CXfHYNTtUOkVi3sZcYT6 3i4/u7bTSUF+hE0iSGuCWtRzdPk6wZXvg5OliEDt3/5dsNHk2cTEmwA52ZsZaRgfyclw NOzFDNRqBcF8qDyzBa9PbGY4fuC1bZItFed7LxXcyO6jDypbfYO95u1uQL/K9b95uf63 SktIEtJ+V9C840iu0FWYfY1otYC5FNFN6km3TbC8MF8s+mYUrUMKO5qsyCkyGxwvfJUq MbUVNhpckFmLkcBI7Za2CgFu8wgqsIRgCgJHtD23q5Mr5eczHR9lbx0tYyHl92HoIWuR /TiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478663; x=1725083463; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ztZiHh+Ss+9GgllgOmhrzPgnRJ98j/KfpwosGaKcSPw=; b=SG2DDM+geo9w9T/3y+RQWdDJZlx8Nw3IZqkjVlo8diSNtdtxGSFRnf/sg5AvBr/ExB 0JyWnrinAZl2lv5QzKQK8Vn1d2WIuajBcnJEkPYW2f7V2boPW4/xOQXbDPd94rLw+1C7 lgsfe8ONca0FHjGNuQvScxTY/p2bSx3jbGcQN4CnhWw0kIWOl4ieE4nVoDLkcjV7b/Wk 9mAlZE+3CKfd5pUOAU0JB7JmJ91DMWA1v120RrEtj/YOT1A6lrIuN8SZ4uA2HKpUr+Zi DyK52qIHK7iplWSOznpzwTxCJGvccgkEXHk1MIGHKdbjMmFdCfZ87nYBkfW/+P+5xL01 Dgxg== X-Forwarded-Encrypted: i=1; AJvYcCWV2snsMaJCOpu2LGyAidlXaT5ZOPxpEbzcTCM4khYVI5cSfGSWJSfY0g7PYryasWhtYfO9tww7uFoLHk6G@vger.kernel.org, AJvYcCXB43w1n4AZcrL3T54cVG/39/q7HmdNZGjBAcvRQvE05CFY36pwSDAz28fsO0o1imxCifaozrj4KKVF7Q==@vger.kernel.org X-Gm-Message-State: AOJu0YwIlg0Ta5ZjmVdIs4RBtEXWecd6r6YrhOKjcgSo1Pg86BkbnJ77 h0X4b1WMX88m7oj/LduY4tBkgFswYMAii9asviHLhlc1mJA+kQ0B X-Google-Smtp-Source: AGHT+IGot0lQRgzGokFPzNf71FPRlrLtsMrbJ1ij7h8spkWMrpcdahIR65WkFEWR2vsBXXI5LaaCFw== X-Received: by 2002:a17:903:188:b0:1fc:86cc:4254 with SMTP id d9443c01a7336-2039e4b37c1mr44644235ad.33.1724478662530; Fri, 23 Aug 2024 22:51:02 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:02 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 07/18] Input: zforce_ts - ensure that pm_stay_awake() and pm_relax() are balanced Date: Fri, 23 Aug 2024 22:50:31 -0700 Message-ID: <20240824055047.1706392-8-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There is a small chance that ts->suspending flag may change while the interrupt handler is running. To make sure call to pm_relax() is not skipped on accident use a temporary to hold the original value at the beginning of interrupt. Use READ_ONCE() so that the value is actually fetched at the right time. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index afeafa589928..004ef728fb90 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -454,6 +454,7 @@ static irqreturn_t zforce_irq_thread(int irq, void *dev_id) int ret; u8 payload_buffer[FRAME_MAXSIZE]; u8 *payload; + bool suspending; /* * When still suspended, return. @@ -467,7 +468,8 @@ static irqreturn_t zforce_irq_thread(int irq, void *dev_id) dev_dbg(&client->dev, "handling interrupt\n"); /* Don't emit wakeup events from commands run by zforce_suspend */ - if (!ts->suspending && device_may_wakeup(&client->dev)) + suspending = READ_ONCE(ts->suspending); + if (!suspending && device_may_wakeup(&client->dev)) pm_stay_awake(&client->dev); /* @@ -495,7 +497,7 @@ static irqreturn_t zforce_irq_thread(int irq, void *dev_id) * Always report touch-events received while * suspending, when being a wakeup source */ - if (ts->suspending && device_may_wakeup(&client->dev)) + if (suspending && device_may_wakeup(&client->dev)) pm_wakeup_event(&client->dev, 500); zforce_touch_event(ts, &payload[RESPONSE_DATA]); break; @@ -548,7 +550,7 @@ static irqreturn_t zforce_irq_thread(int irq, void *dev_id) } } while (gpiod_get_value_cansleep(ts->gpio_int)); - if (!ts->suspending && device_may_wakeup(&client->dev)) + if (!suspending && device_may_wakeup(&client->dev)) pm_relax(&client->dev); dev_dbg(&client->dev, "finished interrupt\n"); @@ -584,7 +586,9 @@ static int zforce_suspend(struct device *dev) int ret = 0; mutex_lock(&input->mutex); - ts->suspending = true; + + WRITE_ONCE(ts->suspending, true); + smp_mb(); /* * When configured as a wakeup source device should always wake @@ -615,7 +619,9 @@ static int zforce_suspend(struct device *dev) ts->suspended = true; unlock: - ts->suspending = false; + smp_mb(); + WRITE_ONCE(ts->suspending, false); + mutex_unlock(&input->mutex); return ret; From patchwork Sat Aug 24 05:50:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822894 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6456B155747; Sat, 24 Aug 2024 05:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478665; cv=none; b=Afs8eeK2c+u0oBHL9w46GuyLAPYHNIbVHEgcFr4ZWI+xXy16JNyhmgGRAgLA0Ps9Ue2xb0y1pxmxDN9wFsRniNhniKdTf/wsDSYt28MZl6xV3l+tHKi1SbbOoQiX0xrV2bNrpS1coyxi6EUtDZDOiURXZC8MdvSas/jp9PE3490= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478665; c=relaxed/simple; bh=eTmMw6sy5a3FwLOkXsn0i8esUShU9HaG4PdhLj5Aigo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X+iRWos92j2lyeNRlgCKPaNOFzn7n2S2wnQdx1+suZPx8cyLjmCSCg0RfzUIA0LHx60tCfPNdLqBrulZGhaqeMGaK5KbOsue0ei3Dd2wIDRwyNQwFxB3VFaAltqRuPhJ/oD3uj2FOuIzxq4xc4GIHXpcffmw8wydOwaMKIiPK1w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CapdDkz4; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CapdDkz4" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2021537a8e6so23741545ad.2; Fri, 23 Aug 2024 22:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478664; x=1725083464; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0DoNrVX1zw5AZFrBvhUTXomIhhIXtmiB4re9ahxacuw=; b=CapdDkz4+RSeGeMaKEIOb03c4pYHuCRvVjYPer9rHy8oLV6duOsU8T0OozIYSY2ydh n3I7PP2tupk8Ljytt5PNW4hEb5TkbU6+uJZh+eArJANFN/om1hyV2Gg8Y1iyRlUpnCV1 31QPROq7ZcZnrhg0r5W/EDXFjhw9mapLNukJznvslEhcYE9uCs/KwtFMuQWwvaHoSUTA +R2i1r6g+j3oLMpVyfoIX7Ocf/z7ZzbUeYHdB4PTkEKeAfVX5GlR0c786x7U7F5Vpw3N BrSP+lnW7892d5bDSDF5q5O83HHhRyiPzevO5f1TAJO3APSP7BY0x8efS8XNy/OWLgVA qPPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478664; x=1725083464; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0DoNrVX1zw5AZFrBvhUTXomIhhIXtmiB4re9ahxacuw=; b=N98/a9VDC1TtNvWt6qfRdkABDWoZ+inSpvCDt+BZPFKreQNUy/cijufr46vsyPyLcu knFKRhASMsUqjaszD7LOZaUBj3Z7HQseyU1dyLRPQAVVNGAyhTfqs/tDR6lxMTx2BQdU Z5KmpY6AyNr3qxJZpen6f3EDOy4fC6N03lBbJiwWxQVAXuvSSEqDiHDGCGWRuIsey/rA UTXR5kd7y3zC+WWde6YcsV/6z3WkdRanv/60bKzaaYd8ooYhF0df7a7xyejgbqYD0q2T zEcWxux2irn0p0NoN0nF/7c8swSIb5FaoQ+A9hI0+ug2LdAlAGfrae3FVSSGU+J0aIpc 1bcQ== X-Forwarded-Encrypted: i=1; AJvYcCU68UUNNr6ihhEqsn37ZhmG7TNb2a7M/rzxHYFsky8XUkEqzoAcw9SPiaHRsnSCVHOUgSHBB1VJSTqwIQ==@vger.kernel.org, AJvYcCW9a3vKgGYhLpTA6Bjy/Vu6H5FUnqqk6ISAooJyUWoHe3iJCx1hn1GSPb31oZ5shrSeJlNwrCjPP20bjQdD@vger.kernel.org X-Gm-Message-State: AOJu0YygwF5/Wba+RrnvERiulwbysIZF9dWsPQBDAWYbt0ELoA04Zlcp UZurdMOh6K2AFnfJ1FDX4g3UFfxMH65Q500ADdWaXfnpUo3c5e2f X-Google-Smtp-Source: AGHT+IGFL3X8GJP4kWNn6gyGFuylxySYdAuiNwhJZ8hD2/YigZDRmmFNebN96CyuXf6sjxnNFGHIiw== X-Received: by 2002:a17:903:2292:b0:1fb:9b91:d7c9 with SMTP id d9443c01a7336-2039e44f6d1mr52227285ad.4.1724478663380; Fri, 23 Aug 2024 22:51:03 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:03 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 08/18] Input: zforce_ts - use guard notation when acquiring mutexes Date: Fri, 23 Aug 2024 22:50:32 -0700 Message-ID: <20240824055047.1706392-9-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Guard notation allows for simpler code and ensures that mutexes are automatically released in all code paths. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 45 ++++++++++++++------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 004ef728fb90..0dea389594bd 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -578,17 +578,13 @@ static void zforce_input_close(struct input_dev *dev) return; } -static int zforce_suspend(struct device *dev) +static int __zforce_suspend(struct zforce_ts *ts) { - struct i2c_client *client = to_i2c_client(dev); - struct zforce_ts *ts = i2c_get_clientdata(client); + struct i2c_client *client = ts->client; struct input_dev *input = ts->input; - int ret = 0; - - mutex_lock(&input->mutex); + int ret; - WRITE_ONCE(ts->suspending, true); - smp_mb(); + guard(mutex)(&input->mutex); /* * When configured as a wakeup source device should always wake @@ -601,7 +597,7 @@ static int zforce_suspend(struct device *dev) if (!input_device_enabled(input)) { ret = zforce_start(ts); if (ret) - goto unlock; + return ret; } enable_irq_wake(client->irq); @@ -611,18 +607,28 @@ static int zforce_suspend(struct device *dev) ret = zforce_stop(ts); if (ret) - goto unlock; + return ret; disable_irq(client->irq); } ts->suspended = true; + return 0; +} -unlock: +static int zforce_suspend(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct zforce_ts *ts = i2c_get_clientdata(client); + int ret; + + WRITE_ONCE(ts->suspending, true); smp_mb(); - WRITE_ONCE(ts->suspending, false); - mutex_unlock(&input->mutex); + ret = __zforce_suspend(ts); + + smp_mb(); + WRITE_ONCE(ts->suspending, false); return ret; } @@ -632,9 +638,9 @@ static int zforce_resume(struct device *dev) struct i2c_client *client = to_i2c_client(dev); struct zforce_ts *ts = i2c_get_clientdata(client); struct input_dev *input = ts->input; - int ret = 0; + int ret; - mutex_lock(&input->mutex); + guard(mutex)(&input->mutex); ts->suspended = false; @@ -647,7 +653,7 @@ static int zforce_resume(struct device *dev) if (!input_device_enabled(input)) { ret = zforce_stop(ts); if (ret) - goto unlock; + return ret; } } else if (input_device_enabled(input)) { dev_dbg(&client->dev, "resume without being a wakeup source\n"); @@ -656,13 +662,10 @@ static int zforce_resume(struct device *dev) ret = zforce_start(ts); if (ret < 0) - goto unlock; + return ret; } -unlock: - mutex_unlock(&input->mutex); - - return ret; + return 0; } static DEFINE_SIMPLE_DEV_PM_OPS(zforce_pm_ops, zforce_suspend, zforce_resume); From patchwork Sat Aug 24 05:50:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822293 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 207B015666C; Sat, 24 Aug 2024 05:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478666; cv=none; b=jHuFx89+dclQ2cBxIwhNsi6yR80h1E5dpHPNk3ONPvLiKKcUN3yjxUZspyM79qX6PsVwm3THp3hbGyLPYb4oPxsFj1ddMJ3pvXuugT6P5YHvg8PBfs+8fBBmoUBNhlaOZ38CIRGoqmQ6g1HOT4/EUYeDqpPVBPrXLO+1JS+U/Jo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478666; c=relaxed/simple; bh=wEFODl4yeDg3eyT9jMQUENszOYCv0kVPep+SFxJdH0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qEAeVasaIJV0dm561WXyEOJiRjCwTLHTw1a9Q61Hx7MXvwaj0UeUa7F0O64BxPsM3yMfb1kVUkghW4DmTn3cTrSuSm7ntRCGnnZ5rJxq5Exmrv1wWVdif4qVDme/g4deztXK6ha+lTkYmIWQ5HdckwCKHA7dyLCHjiVdT75Vn7Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AYprlK0a; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AYprlK0a" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-20230059241so23086655ad.3; Fri, 23 Aug 2024 22:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478664; x=1725083464; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=A6Sg2wDuV70PjHjfBL6ApHgYUIE/Vxr5uqqwJxQtROc=; b=AYprlK0agQUqQqqn03D77XGeH6iyfY/P6EJN8Val94af8b775Y07SATSkhzKj8IUNE Hf8fYL+iJ9olDom1h+in4uLbFqnCQ7463bRoFE1ze6ht2+zAbIpaa7JykhsLwepTE6ZW B/e0DWUHcWdmOqXcrR5xo//lXwSaSxDlAJQL5tm5Ou8SuZwNKxA9lVB6tbSbq4ZlEFq8 5rdhVKfvcDNDKyx5wtI6VkjOVz1+FeileaDuk4YgT5ykcDQdTMs4E4ZAPA3nmByxtn5f woyYP3xjlSQwQgHg+qLzNWkXkZZ199jhqwm/acyGwcIiFYXm2xFbVX5xe0Nxqev23BCD BmZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478664; x=1725083464; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A6Sg2wDuV70PjHjfBL6ApHgYUIE/Vxr5uqqwJxQtROc=; b=egUnGLHorHTXztYsAMLTI2pbvBXUjkVxu2ZhweXvY4WgrYJdIAk+f/Xqk7DBXdp7Dx 54c4djN+/U4Reva8bCY+3hogetZG52B1fQwcd1cnOlZVVgYMd4Kqj+x6L2PWCMLYM+ck ufn635ljHwTlRD2SsmuvmAlHa8X19UVqe+ddY8OHfVT2y+QZv88Vqu9cw7JlsMxvvexg mZVQcPECsMEOlh2t64hPv7/BfZWPa66WsR96lWww4fK2JuGiVpuiknWuQ5+3ToIFeDpV /7CqGPxFP/V5dSGKzGHgH2Laui1vGNlRRdWbCidfK4RTem6T4avkZMtlrq2beJG42pw5 7aMg== X-Forwarded-Encrypted: i=1; AJvYcCWxJVxke2xrIMWymceEgEq0tc6j8NLKcsgr36ebPKNlNniyKIiA8R97TK6sgD8EZeiJuto6KGKlmHo7xQ==@vger.kernel.org, AJvYcCXUFjbd1WaY7SSSTclBddYZimki1eUjKf/uG8wk2dmzFUuWb7VFMRtiy/tlKz4eUbEqNV9AVJYVnIjY4VnD@vger.kernel.org X-Gm-Message-State: AOJu0Yy/GKqYasfx75dKZOXo9zBn94iDABGiNdtfOJe56rysDt+bFvnv 8XQMRxEU6BoL6lrMxJRjyZa+d45BTEXVG2w4K6t6kelPDsSwtXBW X-Google-Smtp-Source: AGHT+IFDkbfV3uN3rli45qhKMMnb/dSuaj8Bs5wgbk4xEv2M2AC0KO4uleN1CMVQTA3sbxb45Wkkjg== X-Received: by 2002:a17:902:d511:b0:1fb:82f5:6641 with SMTP id d9443c01a7336-2039e47b214mr51258395ad.23.1724478664137; Fri, 23 Aug 2024 22:51:04 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:03 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 09/18] Input: zforce_ts - switch to using get_unaligned_le16 Date: Fri, 23 Aug 2024 22:50:33 -0700 Message-ID: <20240824055047.1706392-10-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead of doing conversion from little-endian data to CPU endianness by hand use existing helpers. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 0dea389594bd..32f3d74bd339 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -22,6 +22,7 @@ #include #include #include +#include #define WAIT_TIMEOUT msecs_to_jiffies(1000) @@ -327,10 +328,8 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) } for (i = 0; i < count; i++) { - point.coord_x = - payload[9 * i + 2] << 8 | payload[9 * i + 1]; - point.coord_y = - payload[9 * i + 4] << 8 | payload[9 * i + 3]; + point.coord_x = get_unaligned_le16(&payload[9 * i + 1]); + point.coord_y = get_unaligned_le16(&payload[9 * i + 3]); if (point.coord_x > ts->prop.max_x || point.coord_y > ts->prop.max_y) { @@ -521,14 +520,15 @@ static irqreturn_t zforce_irq_thread(int irq, void *dev_id) * Version Payload Results * [2:major] [2:minor] [2:build] [2:rev] */ - ts->version_major = (payload[RESPONSE_DATA + 1] << 8) | - payload[RESPONSE_DATA]; - ts->version_minor = (payload[RESPONSE_DATA + 3] << 8) | - payload[RESPONSE_DATA + 2]; - ts->version_build = (payload[RESPONSE_DATA + 5] << 8) | - payload[RESPONSE_DATA + 4]; - ts->version_rev = (payload[RESPONSE_DATA + 7] << 8) | - payload[RESPONSE_DATA + 6]; + ts->version_major = + get_unaligned_le16(&payload[RESPONSE_DATA]); + ts->version_minor = + get_unaligned_le16(&payload[RESPONSE_DATA + 2]); + ts->version_build = + get_unaligned_le16(&payload[RESPONSE_DATA + 4]); + ts->version_rev = + get_unaligned_le16(&payload[RESPONSE_DATA + 6]); + dev_dbg(&ts->client->dev, "Firmware Version %04x:%04x %04x:%04x\n", ts->version_major, ts->version_minor, From patchwork Sat Aug 24 05:50:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822893 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E059815B155; Sat, 24 Aug 2024 05:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478667; cv=none; b=IRIm6H43MQk3cdYWG+IKl2hUtkUiBDuaSf5fARrZ10hZOB6fMoV3I4sx0i//37Z1ckAADwGT8KMbeggV+xHcj/l8XribEfb9Xk1sDdW7vekPlgl8WIsjHiYfPfFTtPHctk7DMv3nNJYhX0C5h+mOcL5u+UabxCUh7Ufk6a7FXKk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478667; c=relaxed/simple; bh=Xp4qfeTlxk2eTt/LR4WhGao5XwYHTSzWfxlA1JG37LY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZczM7SV20/CD6FjkaggSQ2QrPAv7RdnmFTYuz6WjNjeWQ2EDQgIk1U4Uh76m2NBLTsut/zqDJxlF5czpiM/LZtGoj/CY5XGxUStmIybfHIS/dc0XSxagWLBPhPawUMXr0skA65WirCz6g0vxv3XWWcxrptL+cDoikhcJg3gW1mc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XJYODFVo; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XJYODFVo" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-6c5bcb8e8edso1989520a12.2; Fri, 23 Aug 2024 22:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478665; x=1725083465; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iWx4S/yyQ8tATVGsDpSEMMNoZAbZjpUFwOWTe/DcQKs=; b=XJYODFVoYHN7AnNozDGb0tsxsoT8TVHZoiD1qF0nJ0mDY5NZ3ZLFTkcGPVMVRra9ek ov4jnRMwxaNhC1Vc9uTeS/kCs4c1GPMl+qfC8l4S/Mvfe0C7mTNBId4rmFTCfxWm6MeL yLh8o0ZhkXTxPwlsSrR3UDg0VJHI4ILB/ISziCK6vtx4C69WIHDzVkAmcR8hIeahxva2 qoEJhFT03NDOXF3GxYX7zllZQ1bTeHO+ugxMXmKuKYEMkRpxy2oQvi2EbtBIP1bsS8oz qplmXceD/oo7kvF0YktdMbh++K4fD4J75bkKnOi5TF2TVfMSJEIpWWQN1M+6UsBZt/kb OvXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478665; x=1725083465; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iWx4S/yyQ8tATVGsDpSEMMNoZAbZjpUFwOWTe/DcQKs=; b=u0DVETLE/3ojFPAWnmP1GvsTRDbeO6r+BG43F/A8lwr/nhA7zANSOxzvoYReXtAO4h N2aCBWmubrGIxsIoWf1oSYksaSsNrZ+yHm8Ovj6vZ6kYRBqWtN++3XYxtc9YrJHAWWyO e+eZLuSEODSopZ+zK8ZN6+NsqTxZ0NAh8gN00YvWrIoUIvvvjl6x4pPFPEWnCZY5eLlE 7YyvBMU7vz1G8FAgoty4UXq+0O2DuExc6ta+wx9kMnVtl3EPeRWnoWJFZEUASVt2v6ka yapZwKLfVAZQ+Az1cuEF8dxYKwru2g+5WNY4cDox4GWgrEVLR7g4h7T2d3RB4P73BBg5 uDBg== X-Forwarded-Encrypted: i=1; AJvYcCUwXohGpFAFSEYnrm2zWMOkrlDWkWAzZapZ8VQMb5/QT8SHHclTNFpkylHjOPFM5T3jps9zic6WALvOA1gm@vger.kernel.org, AJvYcCX/Vboxy/1XlOG8jZHqZqgvbvCT5Bs8p+pVDBHM4EwkgppomKfyQBANmzwA9cACB+k77PNyvIaJP3KDcw==@vger.kernel.org X-Gm-Message-State: AOJu0YxCcSI9WjR/xjK+cMA6QdRAlg7AvmFq5QbvHyo0KWdoOcyjLj0D PRaUSBgnJ7LeB+W42DUOBLuh04l0c5s69HYp17MLgMh+E8/UJpoNe7F+jQ== X-Google-Smtp-Source: AGHT+IGXN3AOZT9KuNHhR9PsauJTI+NYuBD8Ia2mqI/h9yGRicbDAD6T5EJ2fs6qURarH2FaOecdQw== X-Received: by 2002:a05:6a20:ac43:b0:1c0:f1cb:c4b2 with SMTP id adf61e73a8af0-1cc8b4290d5mr4610745637.4.1724478664907; Fri, 23 Aug 2024 22:51:04 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:04 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 10/18] Input: zforce_ts - make parsing of contacts less confusing Date: Fri, 23 Aug 2024 22:50:34 -0700 Message-ID: <20240824055047.1706392-11-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Zforce touch data packet consists of a byte representing number of contacts followed by several chunks with length of 9 bytes representing each contact. Instead of accounting for the leading byte by increasing offset of each field in contacts by one introduce a pointer to contact data and point it appropriately. This avoids awkward constructs like: point.prblty = payload[9 * i + 9]; which makes it seem like there is off-by-one error, in favor of more straightforward: point.prblty = p[8]; Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 32f3d74bd339..c5b4c85359b4 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -318,6 +318,7 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) struct i2c_client *client = ts->client; struct zforce_point point; int count, i, num = 0; + u8 *p; count = payload[0]; if (count > ZFORCE_REPORT_POINTS) { @@ -328,8 +329,10 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) } for (i = 0; i < count; i++) { - point.coord_x = get_unaligned_le16(&payload[9 * i + 1]); - point.coord_y = get_unaligned_le16(&payload[9 * i + 3]); + p = &payload[i * 9 + 1]; + + point.coord_x = get_unaligned_le16(&p[0]); + point.coord_y = get_unaligned_le16(&p[2]); if (point.coord_x > ts->prop.max_x || point.coord_y > ts->prop.max_y) { @@ -338,18 +341,16 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) point.coord_x = point.coord_y = 0; } - point.state = payload[9 * i + 5] & 0x0f; - point.id = (payload[9 * i + 5] & 0xf0) >> 4; + point.state = p[4] & 0x0f; + point.id = (p[4] & 0xf0) >> 4; /* determine touch major, minor and orientation */ - point.area_major = max(payload[9 * i + 6], - payload[9 * i + 7]); - point.area_minor = min(payload[9 * i + 6], - payload[9 * i + 7]); - point.orientation = payload[9 * i + 6] > payload[9 * i + 7]; - - point.pressure = payload[9 * i + 8]; - point.prblty = payload[9 * i + 9]; + point.area_major = max(p[5], p[6]); + point.area_minor = min(p[5], p[6]); + point.orientation = p[5] > p[6]; + + point.pressure = p[7]; + point.prblty = p[8]; dev_dbg(&client->dev, "point %d/%d: state %d, id %d, pressure %d, prblty %d, x %d, y %d, amajor %d, aminor %d, ori %d\n", From patchwork Sat Aug 24 05:50:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822292 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F55D1684AC; Sat, 24 Aug 2024 05:51:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478668; cv=none; b=i7nfmHKgySM4VZNJJ3iynIS8+Zt4YmNIvHnYfcsM/i811S48nFT3p8uLSraehu20mAIW6ROaCsiXpGBen76uTgzm/OG+n3WZ0YNX+POLv3ZmjyR0P6mzP4UP08c8vaN24xugywt1Kd30Iqj22Akvmc+7K06imgM0XcmLjrCbhL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478668; c=relaxed/simple; bh=LH7J6vBS32ha3ew9nxayD5gynd3RoOLPuosE9anBCXk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O1EMbkAMib8g5B3/s2F29jY2smZWdV3ImYOXAMkR00TPKH5JEL1/WBdiZAVDYwXehe57kkv7b36k93Hp9YhIjyofPI/9gCNdXXP8BHWP7/CyWbVXsPhAia2OrgSyt/Z3FnF/oihPBIRbzFDsxjSGOiX2P7gmEfEojMhxZJbKlks= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=b3utMy3i; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b3utMy3i" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2020e83eca1so26741175ad.2; Fri, 23 Aug 2024 22:51:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478666; x=1725083466; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CKtUQ3HzVmiQ6+VbR9hd5Nt80Xys/tTNaSD1W/KzOkI=; b=b3utMy3ikEQ9ciY1Z0eGPivjSowZzkiZ1CMulxrxnNNgDsrFlzKlvTA7wYU1u0Z2fd pgxj9kMDBBFwnjxDjySx6aXvaCrf/Gb0qxaxbYnUxg0UWROWR/IBaeh6mDvwbzC1EPou Tw2ltXtzpxp4KjPvFtuNZQAGvgkcdyEmZHT7T2wjQHTL+Bb3lK5KBuvCDompL9BOlfKt Whz3PleZxCm6DAZJE0Cgf9EQ4lK0EThYqFgJSU0EHAuDP4UX3n7SwYuOU0bnULrTeL1L raUPXgP4gODPoTNZ8exaBovlBjOyEhZMTckf1QvK6vUiuCOUVUMV66PoRy4oTTUGJ2WY EVNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478666; x=1725083466; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CKtUQ3HzVmiQ6+VbR9hd5Nt80Xys/tTNaSD1W/KzOkI=; b=JqA2VWH6FvyP8YW5ilxSmhoc22ziYkPTO5ReNp5zMt+Ty7iOfvQtBdIh7IwGqsGzly rMzSosyrcD2oLJIBx7dE9gSpqdQV1Q4h9Yhipekk82skTSfy7MEAXxpp6aJspba04Q46 +0qLGlKHT1I2p5xRogMTWtKcBGgYJZb3xNRpDZC/nE/e26D8s0+hr1CEW08ZzfMQfDKI 3Hy9HmlwGmMuF0Hbxk1aMEYSkYa8rWqpnyFvAyZJBysHUCDQEP3CHtCA4V7WxZ5XEM5c vXa24EILFenBXA5bn8NR5/4NjbmXCgeTTqL6GOg+36NUnjysyu4RxMi22nni6tgWhpZp KVaQ== X-Forwarded-Encrypted: i=1; AJvYcCUTM5ZvAyuewLyOL6a18au+zMs++bPPILpcIaFY/jV6IJQvw5tgWQkMC6kFZoAUj6MqQ38eqcsIq1GXfg==@vger.kernel.org, AJvYcCUrBcu/Kh14S8dhP/wDcut325vnLcA8KFC2U2yksyS42rbqFR5at4n8mzKwYv4gQWyqPkrne99VAxE2tUYl@vger.kernel.org X-Gm-Message-State: AOJu0Yz0LzfmPiwMZBtoreTIMoLwyg5wyWlNa1dx4pdYgtawGkqW/yAV lPvTEzZhYj7Dr3J7u26mIMtElXbfUpjeyUFxiP7ll/H3M0IWXqii X-Google-Smtp-Source: AGHT+IF5KCoB6pj3hiWa4LcaH5wpgJV4z2oTS4dorpkOJV5VFkOVNEE3VQh2jR3TO0zipICA/ol0Cg== X-Received: by 2002:a17:902:c404:b0:203:a0f1:3400 with SMTP id d9443c01a7336-203a0f134f2mr48429025ad.0.1724478665796; Fri, 23 Aug 2024 22:51:05 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:05 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 11/18] Input: zforce_ts - do not ignore errors when acquiring regulator Date: Fri, 23 Aug 2024 22:50:35 -0700 Message-ID: <20240824055047.1706392-12-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We should abort probe on any error besides -ENOENT which signifies that the regulator is not defined in device tree or elsewhere, not only when we see -EPROBE_DEFER. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index c5b4c85359b4..0d06dda311d4 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -753,7 +753,7 @@ static int zforce_probe(struct i2c_client *client) ts->reg_vdd = devm_regulator_get_optional(&client->dev, "vdd"); if (IS_ERR(ts->reg_vdd)) { ret = PTR_ERR(ts->reg_vdd); - if (ret == -EPROBE_DEFER) + if (ret != -ENOENT) return ret; } else { ret = regulator_enable(ts->reg_vdd); From patchwork Sat Aug 24 05:50:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822892 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A18931714B8; Sat, 24 Aug 2024 05:51:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478669; cv=none; b=Bmn5eeyZlcZQyGQXppGbAvFlJn8XFNfQ/33CMAIMTb9w0eQWi7p/T0LzJafG2QDZ/apFehzT3yXeTLleov4T2sqtmAatJuQtVK0xNlt9WRh52hzdO4MVv+yCbf/XP3vJXjq1EsIRWEvmFraAawAiQZm63aoxPglSP3rk+TAa6ww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478669; c=relaxed/simple; bh=kAin8AmcWz03gVn0Hk/ibmc/ZZ18NkBhN8ORD+wN100=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LuEmY1rR2Rulb7uzyu1M7kIQCLE0Tr/uvLFYUuyz85RBUICFZhNQ0x6fRGsFjDfGyKyoR/n4gznGWWR6hd9ljqwB6LKjBbVdFeH2UJB+6582J9lOBCldzUQBPti7apEe9lt8rhoetoXPKrAa5kExeNK5WrPRBEZ8JYNZRS8Z0ac= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lr6opexQ; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lr6opexQ" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-202089e57d8so17384955ad.0; Fri, 23 Aug 2024 22:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478667; x=1725083467; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qbiWBzDjwLyTeI3RfiJIlPq9VBW7gMqHkiL4ai+n1sY=; b=lr6opexQpNO6pWcYXVkyMc2YILt3LS2iKRKPP77PJAApM/6YBvSg47W75oiJYxR7eU ni9yK3Yy1es6VX+P4GilR0iRSC6buJXkXBaCVJDLeeqcIf1rEKtp0jYyPmeEerFU2gV2 DzrQvitexrCDzv2ENXOx9nfxQKRCUX4iChReL7b3n3IWR1n0jHPA8Wvdd4n+b2MqNuOS Kt6CKNBScsOTezesdXuXh6NNxb2AMyBSSex0IcyLUlAHjrSR7ZIA6vyIsUBYFODm3glU 68D7v5W55kwGK7aMkPvvU8pcwcGwLTjmOE6CwCr0QjJJmiwELTa+76e50mmE5J2TmdHN bJLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478667; x=1725083467; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qbiWBzDjwLyTeI3RfiJIlPq9VBW7gMqHkiL4ai+n1sY=; b=TbMS19swWHFROSRNFYmJAx7oZkmE393u/9EPZAvyimq03ARCOJuRLuKgHt0oFQzWel B2klUD4AG+AvJvNDjaJt5Lf7v7Zea6MnaG25C751/J3T8cqyYvebYh9OFccYcBavWT06 ZpdcYoR7t12QK5JMijSNGpMG8el5wzZjMAG4KRr+VV1aNYYAkSiP0igdXVfnDJtnYUNy nA4wNYgyadRatpXpTbVAoeKzgl3HsuW7BndjwxXBEsOUHmyscgbJ1sgOjQ6ebtPLSgIm 8uPu1ag3hrwBcouXc8ONjPOrmVjuq71AvWXOjqf1g1FU+b7/3Z1aQcCbjaikcjag1arU kkfQ== X-Forwarded-Encrypted: i=1; AJvYcCUa0S5mKvjInxHyf8GTKWs0a//r0ERzf2oJqABHxt7FHiPIVh90qxqzXGU1G1ehuLJHdTad0geAQoYqDQ==@vger.kernel.org, AJvYcCUsKw+m3/0ggDM5ZYwe1XhrpBSC2X3k/rnd+rFZpkcOilVjmj8glBeDef5j9ILVksp+HE8Wqdji9KrjGrZ1@vger.kernel.org X-Gm-Message-State: AOJu0Yw6kQmSA6udfAojRivRDfplbBuUG8QDXBHYXqBdR8LJ7Uu6+KmY d9Gx93L+lX0q/0oOdjRFuoKsPo6CvHyED6qEFJw63FQeL+CPRDV0caKzPA== X-Google-Smtp-Source: AGHT+IGk13vtLLreaqEgGc+/X6hs4tT+DqRzFLThl8NQ7dFX1PtiLM18q7pWCL21H43CjxfXkO37tw== X-Received: by 2002:a17:902:cec8:b0:202:2f22:2fac with SMTP id d9443c01a7336-2037ee1f8bemr133205485ad.8.1724478666584; Fri, 23 Aug 2024 22:51:06 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:06 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 12/18] Input: zforce_ts - use dev_err_probe() where appropriate Date: Fri, 23 Aug 2024 22:50:36 -0700 Message-ID: <20240824055047.1706392-13-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use dev_err_probe() helper to log deferrals in the devices_deferred debugfs file and avoid extra messages in the logs. Also rename "ret" variables holding error codes only to "error". Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 245 ++++++++++++-------------- 1 file changed, 113 insertions(+), 132 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 0d06dda311d4..78f561510f8d 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -171,7 +171,7 @@ static int zforce_send_wait(struct zforce_ts *ts, const char *buf, int len) ret = i2c_master_send(client, buf, len); if (ret < 0) { dev_err(&client->dev, "i2c send data request error: %d\n", ret); - return ret;; + return ret; } dev_dbg(&client->dev, "waiting for result for command 0x%x\n", buf[2]); @@ -187,7 +187,7 @@ static int zforce_command_wait(struct zforce_ts *ts, u8 cmd) { struct i2c_client *client = ts->client; char buf[3]; - int ret; + int error; dev_dbg(&client->dev, "%s: 0x%x\n", __func__, cmd); @@ -195,10 +195,11 @@ static int zforce_command_wait(struct zforce_ts *ts, u8 cmd) buf[1] = 1; /* data size, command only */ buf[2] = cmd; - ret = zforce_send_wait(ts, &buf[0], ARRAY_SIZE(buf)); - if (ret < 0) { - dev_err(&client->dev, "i2c send data request error: %d\n", ret); - return ret; + error = zforce_send_wait(ts, &buf[0], ARRAY_SIZE(buf)); + if (error) { + dev_err(&client->dev, "i2c send data request error: %d\n", + error); + return error; } return 0; @@ -246,40 +247,40 @@ static int zforce_setconfig(struct zforce_ts *ts, char b1) static int zforce_start(struct zforce_ts *ts) { struct i2c_client *client = ts->client; - int ret; + int error; dev_dbg(&client->dev, "starting device\n"); - ret = zforce_command_wait(ts, COMMAND_INITIALIZE); - if (ret) { - dev_err(&client->dev, "Unable to initialize, %d\n", ret); - return ret; + error = zforce_command_wait(ts, COMMAND_INITIALIZE); + if (error) { + dev_err(&client->dev, "Unable to initialize, %d\n", error); + return error; } - ret = zforce_resolution(ts, ts->prop.max_x, ts->prop.max_y); - if (ret) { - dev_err(&client->dev, "Unable to set resolution, %d\n", ret); - goto error; + error = zforce_resolution(ts, ts->prop.max_x, ts->prop.max_y); + if (error) { + dev_err(&client->dev, "Unable to set resolution, %d\n", error); + goto err_deactivate; } - ret = zforce_scan_frequency(ts, 10, 50, 50); - if (ret) { + error = zforce_scan_frequency(ts, 10, 50, 50); + if (error) { dev_err(&client->dev, "Unable to set scan frequency, %d\n", - ret); - goto error; + error); + goto err_deactivate; } - ret = zforce_setconfig(ts, SETCONFIG_DUALTOUCH); - if (ret) { + error = zforce_setconfig(ts, SETCONFIG_DUALTOUCH); + if (error) { dev_err(&client->dev, "Unable to set config\n"); - goto error; + goto err_deactivate; } /* start sending touch events */ - ret = zforce_command(ts, COMMAND_DATAREQUEST); - if (ret) { + error = zforce_command(ts, COMMAND_DATAREQUEST); + if (error) { dev_err(&client->dev, "Unable to request data\n"); - goto error; + goto err_deactivate; } /* @@ -290,24 +291,24 @@ static int zforce_start(struct zforce_ts *ts) return 0; -error: +err_deactivate: zforce_command_wait(ts, COMMAND_DEACTIVATE); - return ret; + return error; } static int zforce_stop(struct zforce_ts *ts) { struct i2c_client *client = ts->client; - int ret; + int error; dev_dbg(&client->dev, "stopping device\n"); /* Deactivates touch sensing and puts the device into sleep. */ - ret = zforce_command_wait(ts, COMMAND_DEACTIVATE); - if (ret != 0) { + error = zforce_command_wait(ts, COMMAND_DEACTIVATE); + if (error) { dev_err(&client->dev, "could not deactivate device, %d\n", - ret); - return ret; + error); + return error; } return 0; @@ -451,7 +452,7 @@ static irqreturn_t zforce_irq_thread(int irq, void *dev_id) { struct zforce_ts *ts = dev_id; struct i2c_client *client = ts->client; - int ret; + int error; u8 payload_buffer[FRAME_MAXSIZE]; u8 *payload; bool suspending; @@ -482,10 +483,10 @@ static irqreturn_t zforce_irq_thread(int irq, void *dev_id) * no IRQ any more) */ do { - ret = zforce_read_packet(ts, payload_buffer); - if (ret < 0) { + error = zforce_read_packet(ts, payload_buffer); + if (error) { dev_err(&client->dev, - "could not read packet, ret: %d\n", ret); + "could not read packet, ret: %d\n", error); break; } @@ -570,20 +571,18 @@ static void zforce_input_close(struct input_dev *dev) { struct zforce_ts *ts = input_get_drvdata(dev); struct i2c_client *client = ts->client; - int ret; + int error; - ret = zforce_stop(ts); - if (ret) + error = zforce_stop(ts); + if (error) dev_warn(&client->dev, "stopping zforce failed\n"); - - return; } static int __zforce_suspend(struct zforce_ts *ts) { struct i2c_client *client = ts->client; struct input_dev *input = ts->input; - int ret; + int error; guard(mutex)(&input->mutex); @@ -596,9 +595,9 @@ static int __zforce_suspend(struct zforce_ts *ts) /* Need to start device, if not open, to be a wakeup source. */ if (!input_device_enabled(input)) { - ret = zforce_start(ts); - if (ret) - return ret; + error = zforce_start(ts); + if (error) + return error; } enable_irq_wake(client->irq); @@ -606,9 +605,9 @@ static int __zforce_suspend(struct zforce_ts *ts) dev_dbg(&client->dev, "suspend without being a wakeup source\n"); - ret = zforce_stop(ts); - if (ret) - return ret; + error = zforce_stop(ts); + if (error) + return error; disable_irq(client->irq); } @@ -639,7 +638,7 @@ static int zforce_resume(struct device *dev) struct i2c_client *client = to_i2c_client(dev); struct zforce_ts *ts = i2c_get_clientdata(client); struct input_dev *input = ts->input; - int ret; + int error; guard(mutex)(&input->mutex); @@ -652,18 +651,18 @@ static int zforce_resume(struct device *dev) /* need to stop device if it was not open on suspend */ if (!input_device_enabled(input)) { - ret = zforce_stop(ts); - if (ret) - return ret; + error = zforce_stop(ts); + if (error) + return error; } } else if (input_device_enabled(input)) { dev_dbg(&client->dev, "resume without being a wakeup source\n"); enable_irq(client->irq); - ret = zforce_start(ts); - if (ret < 0) - return ret; + error = zforce_start(ts); + if (error) + return error; } return 0; @@ -699,7 +698,7 @@ static int zforce_probe(struct i2c_client *client) { struct zforce_ts *ts; struct input_dev *input_dev; - int ret; + int error; ts = devm_kzalloc(&client->dev, sizeof(struct zforce_ts), GFP_KERNEL); if (!ts) @@ -707,22 +706,18 @@ static int zforce_probe(struct i2c_client *client) ts->gpio_rst = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); - if (IS_ERR(ts->gpio_rst)) { - ret = PTR_ERR(ts->gpio_rst); - dev_err(&client->dev, - "failed to request reset GPIO: %d\n", ret); - return ret; - } + error = PTR_ERR_OR_ZERO(ts->gpio_rst); + if (error) + return dev_err_probe(&client->dev, error, + "failed to request reset GPIO\n"); if (ts->gpio_rst) { ts->gpio_int = devm_gpiod_get_optional(&client->dev, "irq", GPIOD_IN); - if (IS_ERR(ts->gpio_int)) { - ret = PTR_ERR(ts->gpio_int); - dev_err(&client->dev, - "failed to request interrupt GPIO: %d\n", ret); - return ret; - } + error = PTR_ERR_OR_ZERO(ts->gpio_int); + if (error) + return dev_err_probe(&client->dev, error, + "failed to request interrupt GPIO\n"); } else { /* * Deprecated GPIO handling for compatibility @@ -732,33 +727,31 @@ static int zforce_probe(struct i2c_client *client) /* INT GPIO */ ts->gpio_int = devm_gpiod_get_index(&client->dev, NULL, 0, GPIOD_IN); - if (IS_ERR(ts->gpio_int)) { - ret = PTR_ERR(ts->gpio_int); - dev_err(&client->dev, - "failed to request interrupt GPIO: %d\n", ret); - return ret; - } + + error = PTR_ERR_OR_ZERO(ts->gpio_int); + if (error) + return dev_err_probe(&client->dev, error, + "failed to request interrupt GPIO\n"); /* RST GPIO */ ts->gpio_rst = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_OUT_HIGH); - if (IS_ERR(ts->gpio_rst)) { - ret = PTR_ERR(ts->gpio_rst); - dev_err(&client->dev, - "failed to request reset GPIO: %d\n", ret); - return ret; - } + error = PTR_ERR_OR_ZERO(ts->gpio_rst); + if (error) + return dev_err_probe(&client->dev, error, + "failed to request reset GPIO\n"); } ts->reg_vdd = devm_regulator_get_optional(&client->dev, "vdd"); - if (IS_ERR(ts->reg_vdd)) { - ret = PTR_ERR(ts->reg_vdd); - if (ret != -ENOENT) - return ret; + error = PTR_ERR_OR_ZERO(ts->gpio_rst); + if (error) { + if (error != -ENOENT) + return dev_err_probe(&client->dev, error, + "failed to request vdd supply\n"); } else { - ret = regulator_enable(ts->reg_vdd); - if (ret) - return ret; + error = regulator_enable(ts->reg_vdd); + if (error) + return error; /* * according to datasheet add 100us grace time after regular @@ -767,23 +760,18 @@ static int zforce_probe(struct i2c_client *client) udelay(100); } - ret = devm_add_action_or_reset(&client->dev, zforce_reset, ts); - if (ret) { - dev_err(&client->dev, "failed to register reset action, %d\n", - ret); - - /* hereafter the regulator will be disabled by the action */ - return ret; - } + error = devm_add_action_or_reset(&client->dev, zforce_reset, ts); + if (error) + return dev_err_probe(&client->dev, error, + "failed to register reset action\n"); snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&client->dev)); input_dev = devm_input_allocate_device(&client->dev); - if (!input_dev) { - dev_err(&client->dev, "could not allocate input device\n"); - return -ENOMEM; - } + if (!input_dev) + return dev_err_probe(&client->dev, -ENOMEM, + "could not allocate input device\n"); ts->client = client; ts->input = input_dev; @@ -797,10 +785,8 @@ static int zforce_probe(struct i2c_client *client) zforce_ts_parse_legacy_properties(ts); touchscreen_parse_properties(input_dev, true, &ts->prop); - if (ts->prop.max_x == 0 || ts->prop.max_y == 0) { - dev_err(&client->dev, "no size specified\n"); - return -EINVAL; - } + if (ts->prop.max_x == 0 || ts->prop.max_y == 0) + return dev_err_probe(&client->dev, -EINVAL, "no size specified"); input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, ZFORCE_MAX_AREA, 0, 0); @@ -808,10 +794,10 @@ static int zforce_probe(struct i2c_client *client) ZFORCE_MAX_AREA, 0, 0); input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); - ret = input_mt_init_slots(input_dev, ZFORCE_REPORT_POINTS, + error = input_mt_init_slots(input_dev, ZFORCE_REPORT_POINTS, INPUT_MT_DIRECT); - if (ret) - return ret; + if (error) + return error; input_set_drvdata(ts->input, ts); @@ -824,14 +810,13 @@ static int zforce_probe(struct i2c_client *client) * Therefore we can trigger the interrupt anytime it is low and do * not need to limit it to the interrupt edge. */ - ret = devm_request_threaded_irq(&client->dev, client->irq, - zforce_irq, zforce_irq_thread, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, - input_dev->name, ts); - if (ret) { - dev_err(&client->dev, "irq %d request failed\n", client->irq); - return ret; - } + error = devm_request_threaded_irq(&client->dev, client->irq, + zforce_irq, zforce_irq_thread, + IRQF_TRIGGER_LOW | IRQF_ONESHOT, + input_dev->name, ts); + if (error) + return dev_err_probe(&client->dev, error, + "irq %d request failed\n", client->irq); i2c_set_clientdata(client, ts); @@ -843,33 +828,29 @@ static int zforce_probe(struct i2c_client *client) dev_warn(&client->dev, "bootcomplete timed out\n"); /* need to start device to get version information */ - ret = zforce_command_wait(ts, COMMAND_INITIALIZE); - if (ret) { - dev_err(&client->dev, "unable to initialize, %d\n", ret); - return ret; - } + error = zforce_command_wait(ts, COMMAND_INITIALIZE); + if (error) + return dev_err_probe(&client->dev, error, "unable to initialize\n"); /* this gets the firmware version among other information */ - ret = zforce_command_wait(ts, COMMAND_STATUS); - if (ret < 0) { - dev_err(&client->dev, "couldn't get status, %d\n", ret); + error = zforce_command_wait(ts, COMMAND_STATUS); + if (error) { + dev_err_probe(&client->dev, error, "couldn't get status\n"); zforce_stop(ts); - return ret; + return error; } /* stop device and put it into sleep until it is opened */ - ret = zforce_stop(ts); - if (ret < 0) - return ret; + error = zforce_stop(ts); + if (error) + return error; device_set_wakeup_capable(&client->dev, true); - ret = input_register_device(input_dev); - if (ret) { - dev_err(&client->dev, "could not register input device, %d\n", - ret); - return ret; - } + error = input_register_device(input_dev); + if (error) + return dev_err_probe(&client->dev, error, + "could not register input device\n"); return 0; } From patchwork Sat Aug 24 05:50:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822291 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C84117625A; Sat, 24 Aug 2024 05:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478669; cv=none; b=OC/vAdxsyxxDTSehjIT+m4+WANIBaxF/N89DxhtdcB8RFGyN7CRnyU8ZYYKtiLDaV6DGu3eXH8NjqWGgvMWMFr42KQEJQcz0s6r5kjfmpHuNRTRck16ERGFDOI6GgOxd4n6Nnf9SLkYFE5ZnJP7vxzadBWBzPa0HMmM+KpoJwxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478669; c=relaxed/simple; bh=sXJokwmwypVXYkriPam/tpr+/sHFGQ1h4EjwJIMaEcw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qlqD43nvzrJMjJQPq04uTKd8Tl45p94FDifabekm+hYDgb5O+j30BrDoYQoctUA29wzF/YUupG+MmWd4kES3UXt2LCZrzaVjuL3Ufz/WRyikEQ8GetHOi4wv0ubFjaAQpzbldeJ/cwjbeFaVdJyCfgZAPJm3HtKFd9oWAAb42/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AAqTNgps; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AAqTNgps" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-20230059241so23086855ad.3; Fri, 23 Aug 2024 22:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478667; x=1725083467; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9CWMnsLFQR74RvzlYOC3kpIV2wtjWs90jpX0t8PRdXg=; b=AAqTNgpsD8O69hgsRWwJ0KfQXpgOkutWjTMBU2RhG5uELS10DFcvzLlZ3BexJMPNtp I5mFG36ZDDs/0joBISeZgVMQsKm5hn7BHD/LqPRzGu7fspLRO8mV5l1pNXVcvB/FB3n2 TVhOBkJZ6Zqvez8X/PFGSidy72lFybu0Aulsflx0z8ehr/uvwVPjCbwuR2h4HjijVVwh X7p/OBvM5+OAshWtFk2PWOq/TRl4ZSEpd5Swm9RTUBzNRbmCYSM2fTTasR+lmWQnW/M9 GGLvol/oWQbEdFkg4anwFuTR1VNk4wS5X2f2IqmAagGaISfNfiTCSFJrMff65Zy2Rw+x kmjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478667; x=1725083467; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9CWMnsLFQR74RvzlYOC3kpIV2wtjWs90jpX0t8PRdXg=; b=GEIia+mycZ0i6txOUOn8tf36f70mvM4S5AWuvo33/h0oI8sfO6IcAzEMKn7U8r0ZR2 QJ4ebToIaf+Y+imGn7MfjzuxoZ2xZwOLQbmbLE9ms/AEtceB+HtzERZqEjvbTadzjUwT BcOM0euQ9oRRrPqaOe6YQ0f0GfDAEXN6kl84SSVyh64a3PMp3ERvG8q8BbvsIiMrCDP/ 7FPIJRGsmPDm6yTbCWAt/IV+PJ55mnaqHglhz1Xq/N2YtROKfNc0nLM9FOdlYw8U+7bS iaAYk3rpxa1Gvfg5dxIP4pdJ6/CTwdO1tLN0sJM3u+Rwnnj8rj/jxiAmlD35G2ZLhwKt Xv7w== X-Forwarded-Encrypted: i=1; AJvYcCW7aZImOEgcdfnnmCNdmuI5Ir8k0jr1xFSLn08weOyU40bRvnwEaU0ORP1rMMfnAZpv+sZKP+OLCfOx2g==@vger.kernel.org, AJvYcCWf+eTag9wTO+LBj63GXT2SfChYWPAQfxIKBTxCrayw0ynKtK/YScfgGOl2ed9gdFWYl9/UKUorF7FWAofO@vger.kernel.org X-Gm-Message-State: AOJu0YwaYCK+f3WY/WK9TB1PTCEOFNVLtQ9bRg59ySfS5xsFu2rqr9Q9 Yc3i3l734siQ4GWY2JOBQlFq7baEyeAyjEmxWF/ahM4Uyyo4wKZl X-Google-Smtp-Source: AGHT+IH6axTfumE8irq09ckupeuyyfaUTjSdf0aW5ZKXalnBzWKFxW7G+PxKpAVVIGgXozFsEWghAw== X-Received: by 2002:a17:902:ced0:b0:202:e83:eb11 with SMTP id d9443c01a7336-2039e49513emr50276245ad.29.1724478667341; Fri, 23 Aug 2024 22:51:07 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:07 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 13/18] Input: zforce_ts - make zforce_idtable constant Date: Fri, 23 Aug 2024 22:50:37 -0700 Message-ID: <20240824055047.1706392-14-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The I2C ID table is not supposed to change; mark it as const. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 78f561510f8d..2ae079db8884 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -855,7 +855,7 @@ static int zforce_probe(struct i2c_client *client) return 0; } -static struct i2c_device_id zforce_idtable[] = { +static const struct i2c_device_id zforce_idtable[] = { { "zforce-ts" }, { } }; From patchwork Sat Aug 24 05:50:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822891 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83C74178CCA; Sat, 24 Aug 2024 05:51:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478670; cv=none; b=PiqGB3wkP4vPNss3ANmLGiuDP2rT8bJ5hLUemZpwl4XcmYvZem2EpQZGOOGwB8uh/hTUdGVrp0UI+Yalr+7gaJPJGwPN2WeNRTpvZbL2DwiuJJY69E/Jf+QBTy7PHq63GvpvxV+RAngHFELruZwp34J05msu2TxfWBhRR57497Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478670; c=relaxed/simple; bh=Rx6QObzW2tAkW8bZrjVRp7zSZg/oSBN82GNXbmEw5Fk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F9n6o3gMwnV9LCYMuAVHT9sqspfnwgWP8oIGvYE4c75VnKGDPlrJCdA32jSA53cLGIx1hCEt7lUcNUY13Febj/YsD9FgdoCwZXhzhSnnXf5QbCuYo1207hNgFElaU2aPdwSq+4KxJmYWYL/PfH9zZCQNdZxYFkJHT5lzLCQPF2I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Iwz02THN; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Iwz02THN" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-202376301e6so20829055ad.0; Fri, 23 Aug 2024 22:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478669; x=1725083469; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QsVMpTzQ0nHDzO6GBbmNnexPMjHwrZ6KxVxvGiXfL88=; b=Iwz02THNeP+n+sPs98481jD/IX0LkOucMfZyTr2/hXPlyHY9/7hgcHHhYmahXgCmTS bKBOmrI1QtYOertF7TDpJtRFY8HdciTkrDihIZNHsx+qL186Rn5OGJx6vci7+2gXh1gV hzqq1mnYtuZKVWnuQErONAWXY/D0CtGW+Q/+TmNKB9xY5P8HKWvOuTCYL5UGnWa5EZXO dAgZ7DovSbW78KvOrPhvf+Ew6tCSe9BFZk/YFvpUmb8XaIEJMpvoNIwOpUJfc1C8CdsF JwUZNSFdfX3ZFaknvjqusZ8o2IPUMatyfPJgaCbfNYlvYd+lRY0gziiicGnTOO/uXWjE 5Sgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478669; x=1725083469; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QsVMpTzQ0nHDzO6GBbmNnexPMjHwrZ6KxVxvGiXfL88=; b=aGtnO5Nv8MDAFT9Yd8Yefq8xtZfvITNTuh/SXg9gfLanfGwJRBzSV9wsTwWTk91kHS 7o/LLdfvwXJ9oZ1FUHALVX/37hDVf7RO+dKRs2emkKEXPdilzs5L+cPMQdx4e0VYYaAI zzxvqM8mU7nUDm9l+yRVm1Im0w7unOAfCHkz0dNWRHK2nFuZbdDyLqEv23qvr6yR0sH/ OTjxqStihwTO7STOEaY17vGZsZUA+ruEvHPm7BAoxfrZ6WyTmVxDV2ia6SMT/fgL4ggs h/YQ9Gh6ckIYfWDlrAfZCWGfwFn4JpwLwrrsRsnP6e+lxnUYRKaOhktPCRp+eu5CAtrX WGIw== X-Forwarded-Encrypted: i=1; AJvYcCXV8URWni3jj8uXlSPDf0cxc6oatvVzYR8RodowQ3KSPFJgxCqbJB/WVPRpwygINF/TYlcSsVADsEnM8w==@vger.kernel.org, AJvYcCXnY0pWafJitM1CHItK/8QUyXoZ8Z04VD95q+04MYawuBGV3Fd2unlm6xuFKjWkrWUijJpGDJSG4OnJC5da@vger.kernel.org X-Gm-Message-State: AOJu0YwKhVamYjdp5x+VwKjCKtTmQjeZvNvQIJ2TZBXAvEzwLx2EzRVn lMF8UVjycS9IH1CoKgce26CcgPyjz/+Yik/cJJK+x5iQxntQT3h+uIGVIg== X-Google-Smtp-Source: AGHT+IFXBzMNq+Ocava/aFz53RhCxsfyIjsAXiFbUNUr+xPisSPAxbfWAS6HCUgLP0BnmBblqtFgdw== X-Received: by 2002:a17:903:2444:b0:202:38ea:f60c with SMTP id d9443c01a7336-2039e44f0b7mr58067975ad.5.1724478668533; Fri, 23 Aug 2024 22:51:08 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:07 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 14/18] Input: zforce_ts - stop treating VDD regulator as optional Date: Fri, 23 Aug 2024 22:50:38 -0700 Message-ID: <20240824055047.1706392-15-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This regulator is not optional from the controller point of view, so stop treating it as such. For hard-wired designs that omit the regulator from their device trees regulator subsystem will create a dummy instance. This may introduce unnecessary delay of 100us in case of dummy regulator, but if it is important the driver should be marked as using asynchronous probing to avoid even longer delays waiting for the command completions. Also use usleep_range() instead of udelay() to avoid spinning. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 2ae079db8884..c6b506a01b2a 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -742,23 +742,21 @@ static int zforce_probe(struct i2c_client *client) "failed to request reset GPIO\n"); } - ts->reg_vdd = devm_regulator_get_optional(&client->dev, "vdd"); + ts->reg_vdd = devm_regulator_get(&client->dev, "vdd"); error = PTR_ERR_OR_ZERO(ts->gpio_rst); - if (error) { - if (error != -ENOENT) - return dev_err_probe(&client->dev, error, - "failed to request vdd supply\n"); - } else { - error = regulator_enable(ts->reg_vdd); - if (error) - return error; + if (error) + return dev_err_probe(&client->dev, error, + "failed to request vdd supply\n"); - /* - * according to datasheet add 100us grace time after regular - * regulator enable delay. - */ - udelay(100); - } + error = regulator_enable(ts->reg_vdd); + if (error) + return error; + + /* + * According to datasheet add 100us grace time after regular + * regulator enable delay. + */ + usleep_range(100, 200); error = devm_add_action_or_reset(&client->dev, zforce_reset, ts); if (error) From patchwork Sat Aug 24 05:50:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822290 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C34917ADE7; Sat, 24 Aug 2024 05:51:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478671; cv=none; b=Y96t3wzYPFw83TPUmMXiCcbioJoN/+abedROLSs2G8HY9vnIvTR5b4ltsWsWcKTOId+w6Jea+8bQK5PM4c0S5SkSuXCqE40o4ugQQlwgyNc3B9Hsz9lIsVGDbHIS4m/jHI6s0ejhc9RJIgkTEPYB3KEdxqytvAw00KXTjgmCmuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478671; c=relaxed/simple; bh=aQGY6xAtKC5ai++QfYurQDsQP1cuvTCiWT35ho4XmaU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t/2SXqublejezpIDaswD25siahVUBUNsg0OkNOmLputiZkyDeQLAeJ2i1Hen+jPFoJhOtUjG+ikgwdjaNJ+MsbbiCXFxFfJz0Fk2RiikRkPII9vQeY9+0J9T4c7p6/2LP8SlLAruzkeaPtUBnzA1fAJpfe5eEZtUMT/uSOYbVc4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UmD1UIKk; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UmD1UIKk" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-201f7fb09f6so23565945ad.2; Fri, 23 Aug 2024 22:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478670; x=1725083470; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wJU3qXpzKeb4nsoK17LBCwJKBBq5lMc52NwCSFijnLQ=; b=UmD1UIKkEt8CU4J5rT1cluWsy9Ox6pFeyN6ja18WexwOR4+uScyO+gUrraT1neoF7u v8a5ucIp7mctNoDQ+OSqHxDkJ7gWywJRR4I8JOS6loZoycrNmHDTjgzagkiMKryxoxVI E9y5TQWeA+7csn0s80r2UNReRCJ68EBp7Mu3sJI4FNEutvS0Pl3WPGp8vcnOwAbpIQdw tGNeJMoFTmhs+KsH3yS4sJwdMk8hsvEpO/NAEKLwibMQpw9Fho3ywIdymxYjtbMRHJwZ In9nUApQjw3VVaedWB5q5qAgsaq1gC036gnP4swbpeTkiolt7M9QzhM2tgx/ndQovHuO lxMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478670; x=1725083470; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wJU3qXpzKeb4nsoK17LBCwJKBBq5lMc52NwCSFijnLQ=; b=r8nlN5ktY+WvVVZ9io19HAvDSxM5kNDeGZ4Gn9NSwJQr8MLXzAjsdhN/A94nTS1NWL KaCsnvlKIVNYv8hjPWmYaa/crinD2IFWxtLyEs+SKZ0NpyJtO+/5TD0El7seSyBH0R1c xQexOhVQot+CFotQjzRzyskHQG1pQGSIuTd9frKn74G9BDAV/EgYDFdtzaCtf1b7FKuW y6aG3HdoCTmFm9zxR4HqrVI9dE41XYTAXuk5Puz7hgTKTmDRj1OBCHJEs6pVbsDV5LHQ 1aeqjJ1zTFcjVS57Vuuzd6YKLSq3ZVahGyeJ+ahmYVqL2Kk/0s+tVlki3Kq68uJEufAl 7fDg== X-Forwarded-Encrypted: i=1; AJvYcCVS8yKySrr6R4YL7e5iJhoNr6kgE2ljPp/Ttsgq/sy2rD0TtvXG6iSrfQnEIhybaAXvjb7Ly1wdQGP15CMK@vger.kernel.org, AJvYcCXWDAZ7DG/2evCQ8MQavKaiScYAQ9X6Gf3B1O3kaEAUsOWH1pTGgpT5kqx6tNiMvtck1yE9u6WYEmE2QA==@vger.kernel.org X-Gm-Message-State: AOJu0YwuG7xZA0NgcxjoDxwFwf3zxNAEEUTRGxMIzuejRMUoAbAG+CPo mg/0EeYhJbSaJJxx+Be2Ay4jy9cM8w5cSVHaw52QWi6U8OuA9S1AVPvPvg== X-Google-Smtp-Source: AGHT+IGq9kREupQXaSZ9urzIaEkaT9A5FfRpU8spntREOHyQrXh1KlsQwu6RzG2INF03PIS9k0U3Wg== X-Received: by 2002:a17:902:e546:b0:202:4640:cc68 with SMTP id d9443c01a7336-2039e545b61mr49283775ad.59.1724478669429; Fri, 23 Aug 2024 22:51:09 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:09 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 15/18] Input: zforce_ts - switch to using devm_regulator_get_enable() Date: Fri, 23 Aug 2024 22:50:39 -0700 Message-ID: <20240824055047.1706392-16-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The driver does not actively manage regulator state past probe() time, so we can use devm_regulator_get_enable() to simplify the code. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index c6b506a01b2a..316901c751c0 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -107,8 +107,6 @@ struct zforce_ts { struct touchscreen_properties prop; char phys[32]; - struct regulator *reg_vdd; - struct gpio_desc *gpio_int; struct gpio_desc *gpio_rst; @@ -675,11 +673,7 @@ static void zforce_reset(void *data) struct zforce_ts *ts = data; zforce_reset_assert(ts); - udelay(10); - - if (!IS_ERR(ts->reg_vdd)) - regulator_disable(ts->reg_vdd); } static void zforce_ts_parse_legacy_properties(struct zforce_ts *ts) @@ -742,16 +736,11 @@ static int zforce_probe(struct i2c_client *client) "failed to request reset GPIO\n"); } - ts->reg_vdd = devm_regulator_get(&client->dev, "vdd"); - error = PTR_ERR_OR_ZERO(ts->gpio_rst); + error = devm_regulator_get_enable(&client->dev, "vdd"); if (error) return dev_err_probe(&client->dev, error, "failed to request vdd supply\n"); - error = regulator_enable(ts->reg_vdd); - if (error) - return error; - /* * According to datasheet add 100us grace time after regular * regulator enable delay. From patchwork Sat Aug 24 05:50:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822890 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24E5017BEA4; Sat, 24 Aug 2024 05:51:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478672; cv=none; b=NPlqLVVHqtHEE+zzagxuXinEJctE30qLXv9QCYEfEKn/9PKOa4nCecSM4vBptPoqjYXE6hXxfaMS6gpT/EMhvQ1ZjwZCvngF4/AWLAf+zFl2hmk7w0yqc6CUUx4c01d8BixtEcp+PYLkPg0bKgtvMQT4tSBAww6MkZzUGLwOtnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478672; c=relaxed/simple; bh=biuMi/gbrrCwuR4GWg0PW/N/pUp23XaffWaY9uhrlwY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E4ijSJwUdfWexxx4Fo/yA2XuBu7zpbwSRxUVtGwAmLkLjh1ZbsuqZyAjJpaq3mZydNORWlI5/nus0ljchtSJ4CMwzftwzFG+3pqywguKYN7gMDE2RKvlpQ/MlMCrToaWugc7JXs0YbExMLP/zDPRpkOSatsyBi1hE1NA16fLXA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RCPQ6wGy; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RCPQ6wGy" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-201d5af11a4so23871895ad.3; Fri, 23 Aug 2024 22:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478670; x=1725083470; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hFBECxeMkNVzyITrHm0p33ljFGf8aAYIteFTrI/Vc5k=; b=RCPQ6wGy8pqkkpc2Wd5honK0fImY2pSuPb2g++iP6xzALSOKUfmGqGLm5soajDGMnH 5IhEVijDR5408xllfjfq6n58AqurCyi3PFrbkdF+j6cmQX0+79MiBXYS3YOSiLlM1jbj rofbFCuE4uIrByLrSDGXiwLAMCdo6ngU1VyvLg8nj1M8/NhiOpM4rfz00ITwEOOkQm8S RGXiF/q/Hbzz7RxFd3oLRK3YZ+YucA/7Tq/nrDA036CdHWyAOME7fmIbP/HJzoWbnmg1 25ixN7IMYKjBenFjAigRnsH7uukxT8nVDdnld1xhINzTDLT1uvIwUVrJ1Y29Sa8Blgnm WDgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478670; x=1725083470; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hFBECxeMkNVzyITrHm0p33ljFGf8aAYIteFTrI/Vc5k=; b=kKO+iU90fKx7upLTc4vZW0nNczPSeXjUt56ObJuSSdQ5HPwLOZ/ONqP7F8RLYy9xc+ RSMVgu7XmMatH/niXFoyMYM6M+WHKpCBRIplazxM1lq/zSGf1I7Nht5UYzTyfF1/6V7V Tdes64YojSioAPSlrF3q326NEuz8ZYQTqkALsDU/7rjX/xMqPXumcIJPqrKRji2awQ9k oUkFATKjcvAE0LBHyNDoGFUrpLtjZYXu+PgUa7zOebz2vOGc7w4ba6vfmvXPVxG5RRXI i7dhU7dbph44qAuexM/0w2++nnJDQbp7gUIgsCmnmv24SX3GAvpun+gLsWlieAToDKhA vDog== X-Forwarded-Encrypted: i=1; AJvYcCUwAn/GpVUUqHaQjyEXF21I23mZo+MENiqBmm1B2ncqdncUeRnB8k6X4oGOooNz869UvgwW7iNBKgCkKB/A@vger.kernel.org, AJvYcCWigDpNasVJj5SAhJ+eERgX/2erxEwIKomOOmnegAJcOC+R9dVGgJcLvvnAJXN+l09sbnXGWO2OLovwJw==@vger.kernel.org X-Gm-Message-State: AOJu0Yx3txyi5miVw9nRWXHxk+yhRBRQbbjzml2Pg3xhiHdc7OLNeBLP lBb/X6684h1UL0AKDnAsYskgvdDR+Xd+DGaMWRm4hyjwo5y/R/JY X-Google-Smtp-Source: AGHT+IHaF2YPGMKn/yJGBL8uSFY3B2qExObhXX4JSXda6BY3M3uKLk9gHAyN2YDi1zITSZaLqpwofg== X-Received: by 2002:a17:902:e889:b0:202:1db8:d9aa with SMTP id d9443c01a7336-2039e4cefb4mr47259765ad.30.1724478670176; Fri, 23 Aug 2024 22:51:10 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:09 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 16/18] Input: zforce_ts - do not hardcode interrupt level Date: Fri, 23 Aug 2024 22:50:40 -0700 Message-ID: <20240824055047.1706392-17-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Stop forcing interrupt to be low level triggered and instead rely on the platform to define proper trigger to allow flexibility in board designs. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 316901c751c0..116f3aa6350c 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -799,8 +799,7 @@ static int zforce_probe(struct i2c_client *client) */ error = devm_request_threaded_irq(&client->dev, client->irq, zforce_irq, zforce_irq_thread, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, - input_dev->name, ts); + IRQF_ONESHOT, input_dev->name, ts); if (error) return dev_err_probe(&client->dev, error, "irq %d request failed\n", client->irq); From patchwork Sat Aug 24 05:50:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822289 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0ACF717BECE; Sat, 24 Aug 2024 05:51:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478673; cv=none; b=FnXlNFHhTkgByup8fOzdyOYcpeaRNptk1BsbVJB+NLqQ5bjpqNa57uZE/Ixxc1biWr9WZmQH+9JPc8P3ygvKeIzsyYSgFMhvIMTe9fWTRE9UxsnGLj4UGyCfe8g4ADRGd+DD13XooFkCRWBXylfuICkzw0dRGZb7HYARtMbBNtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478673; c=relaxed/simple; bh=pKUHKSHsiWT/Krt0Ih5WrZx+zlIygzOxXTii+DWPROo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q+LygsBxkkqMMHjECFnswItQWeMhGeu7h83GWnn1G97WMU3PO2tK46tUEEq+XJSS0dwqg2zumFEa1dadfP31gWx5aoCQ6/oDvMfeMqc27dZ5huNHo7OcrY187Sonlx+y+pB9QHfwDyJf7r2yx1QtuH1NlDZGBkwQL+ayqChXhNc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d6boee5+; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d6boee5+" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1fec34f94abso26160325ad.2; Fri, 23 Aug 2024 22:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478671; x=1725083471; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c3aQhk/CNuOCmAWy8KuscMnFEZUSU7TNPDgoCpOzq2M=; b=d6boee5+EmGwXGI2+LYKnfSv8ube2kZFv4ar8J3ozDT1IogGWJCqMRvsm0OY3if57a 5VlLIJprnJqZWKFYf1sBSuMG58PIjY/sl/eN+U+uHgt1KCW/Gj9rsbzd48Av2k18HW4p qs+QV7RZRdBoAx7xme2mWuOIGASt2KPAJ2xEKsh9NHQkI/0EWMGTpGiFY1gPCfNkl0bw HRpfcJibU8fDRPEaxhrtrKvQFhKYOQpX1LB8h167oQZH4xquXh4h9h6OveRirEaAdDSn K8UC5sTLA04aZvgBfLHPuQOYACvGC4vGMle0DHUdRv6yiu0EAkUBktyLYI8JQ+HpHtLF aQbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478671; x=1725083471; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c3aQhk/CNuOCmAWy8KuscMnFEZUSU7TNPDgoCpOzq2M=; b=nZi/xQNuVMCPgXien6pnkMyfH79kGgxcFGzZqpLGbJj+DKfUr9KRIPiDk8ATYffLgY PnHzV5gbaRX9M5vr6QjyArl/T3yPb6N6c9aOwUFyqCjhav2Rw0cefqmYOrBUjmknRN/N Oak2wr8MJcC8v2gCWOC3C+hgfzlA0kU+0/URdYYA4wviLd8xPJbOBHlUSxDkj2v1gUue M9bjworDoPfECkxcsiHgT1pTRocIQfHLoPbjpxgNW2Jy9tYlHPIH1buT4ULj6iW7x5C5 C5o/QbLSNeerrJWdiyvzUnOaRlZR5BX/+8X3UjgUFXdaYaJBlWncfvqnieUrYR5EnVGI bOxw== X-Forwarded-Encrypted: i=1; AJvYcCVhcy/910GEcvkLASmcxLpaN8VcgiFmLR0giZV/JngpLNovbgVFNRqQeDxUPqaqoDiF6arkZnPhugPt5GLT@vger.kernel.org, AJvYcCXpS33WmsdvXXactMus42HaO6VYHqoXag4vtKtGd54AWG7lpNORQW5KFq44UkWsj2AJyP2gIP09l9JHwQ==@vger.kernel.org X-Gm-Message-State: AOJu0YwKBpXn9N8GCanuUlrkTr+Xdn9AwEloAMpzoz7f7t3UBvKWnha0 gmLQgXf+jCE196tpP5ExOsi9294dqeix8Grahcl+BKCwM8Or9htS X-Google-Smtp-Source: AGHT+IEz/YMP6ziVNvymOtS/B0DVnJwn2iKo2DX15n+4D7DvWYJja/XnL4bII0NSaTz7eEUH+o2YSw== X-Received: by 2002:a17:902:d2c4:b0:202:348d:4e85 with SMTP id d9443c01a7336-2039e4cef90mr46586285ad.39.1724478670935; Fri, 23 Aug 2024 22:51:10 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:10 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 17/18] Input: zforce_ts - remove assert/deassert wrappers Date: Fri, 23 Aug 2024 22:50:41 -0700 Message-ID: <20240824055047.1706392-18-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The wrappers are extremely simple, used once, and do not bring much value. Remove them. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 116f3aa6350c..5df4f9e8fb2e 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -146,16 +146,6 @@ static int zforce_command(struct zforce_ts *ts, u8 cmd) return 0; } -static void zforce_reset_assert(struct zforce_ts *ts) -{ - gpiod_set_value_cansleep(ts->gpio_rst, 1); -} - -static void zforce_reset_deassert(struct zforce_ts *ts) -{ - gpiod_set_value_cansleep(ts->gpio_rst, 0); -} - static int zforce_send_wait(struct zforce_ts *ts, const char *buf, int len) { struct i2c_client *client = ts->client; @@ -672,7 +662,7 @@ static void zforce_reset(void *data) { struct zforce_ts *ts = data; - zforce_reset_assert(ts); + gpiod_set_value_cansleep(ts->gpio_rst, 1); udelay(10); } @@ -807,7 +797,7 @@ static int zforce_probe(struct i2c_client *client) i2c_set_clientdata(client, ts); /* let the controller boot */ - zforce_reset_deassert(ts); + gpiod_set_value_cansleep(ts->gpio_rst, 0); ts->command_waiting = NOTIFICATION_BOOTCOMPLETE; if (wait_for_completion_timeout(&ts->command_done, WAIT_TIMEOUT) == 0) From patchwork Sat Aug 24 05:50:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 822889 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B36A917B51D; Sat, 24 Aug 2024 05:51:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478674; cv=none; b=YUhQtgEUlH5YqeeGmFBFDJbDeJsa+OcooXOzaQtToBGdmbyxdALuZZ2j17B2ZvptYQV68qY8Eo/ZjWyhRiBvUutRSt0xb8CqSjM+1GYawcNEENHZgcBwjFYgKwlvhBJaRTxhYDlsGf8UbZioflSLOaijCyy4jQMHOsP8WrQoa/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724478674; c=relaxed/simple; bh=rRtkFYuVY9i9DtMdTHLPYCWG2ssElqwmzvgesJlrxkw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QHZGCi2u9oE6V6lj0SjU2z5fzkbr4298m58BZt7g6c5yxaPnM5pY9sO9qe8z68QNhl9MgL6YiuYnbzLE5eyeUlPlhhjpEmT218JC+iC6F9tF5tWbdIJMAZ7AilUT7SdLrL61NSRHOHk45ArrgPxexPWupEBCsjX+TqYl/v/n/BM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ByBIcNRK; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ByBIcNRK" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-201f2b7fe0dso25808355ad.1; Fri, 23 Aug 2024 22:51:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724478672; x=1725083472; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Az8mzLSvgpvxTnIRjRc4nRA5yr1Q3pk0TUweK6xj7q0=; b=ByBIcNRKhNr6Xfylx/dkVamicltFLf0Bbl6DkgfwQpCIU8poasSAvXF2vcYTAbX3He vxfqXdJeE9Tsl+WS6zYmI4BQRj7ZxTA9fVVsK+0Cy+Q3F/hdUIAvYwCGg/+xEKosVMVz 6nU6IdAv0JZos/2bWKaKcs+ES44FGBPzr262ZbSkmc8dYedgxrduGXweuU9yYS/InTBB QYJGBoIcx2uRIsV3jgaGuJetUE+vLUup0KeQ6bfnMhtKrzLrY/bqWlxedDiBl4Li4aH3 TEcd1vpIFTtRVSDGGTbSvyvHS7Mz3eUceKgXRMracL3WxwEjgAfyMGoso6HQTAgXsH54 voxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724478672; x=1725083472; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Az8mzLSvgpvxTnIRjRc4nRA5yr1Q3pk0TUweK6xj7q0=; b=Pe9Kr/+0omRrNVaLrvVdHfeoBxd3aGk0PLS5BaRfTOroLgA591avYe0FdL+7DSXGSe uifS1PyelFH7FUQSm8Y3l6hj5d8/DqEIjnyH1XBcwPpkhPgt6U3sUbQHw5QeMEbuQG29 ZbIpuOp8N68fGUJJFMjN0dzZoCRYfsK2vH5UmpgeHMhixffGvNNPkyjxguadjH/EAQqI DwoSmfDiNb4kKcRLQr11BwJekrnFtq5ACvGxuJAXlQIOMIYieKDmh2BB47PeWfW/vgnD 6omE1AMqfx3AItafFYQMlYUcMLHFyEJh4vhTswwKPOhkyPXuqiTr7f9Pg6RvCVZNaTBn aEiA== X-Forwarded-Encrypted: i=1; AJvYcCVwyKm5Bjlymj/HbHhSOiMxKJcRAA7qqLL/7t4BLkWVwc5OdqE03plg3EOViHKSx70c77F4VsGwOs1F8Q==@vger.kernel.org, AJvYcCWtHwvtYLDwcOEZTImXV4H9U+uteiigz7x7+0A3WHPbkZLarq0W1au5F8Yl+q1plV/H5HvX423UOyS6H4Em@vger.kernel.org X-Gm-Message-State: AOJu0Yw6+D2QSnFxQURdO/9pDKERi8uXvsF/8jcmGGFHlKg3SBkOZPX9 MAln6XaJ5fnJqVApVUEnnHAzTfk97oeAcdSoqBdiPlquoKC4Nt4X X-Google-Smtp-Source: AGHT+IHGuMlO1L1aYaMH5Lp/IpwQcR0p5c5VDWGk5IHdjMfD57mIFjYRu7HHLx2T2bcAjODyi8+r5w== X-Received: by 2002:a17:902:d4cf:b0:202:23f1:ebfa with SMTP id d9443c01a7336-2039e4f3ae3mr51042145ad.52.1724478671799; Fri, 23 Aug 2024 22:51:11 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:75c:5a5a:d7dc:18f6]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20395ef904dsm23398615ad.31.2024.08.23.22.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 22:51:11 -0700 (PDT) From: Dmitry Torokhov To: =?utf-8?q?Heiko_St=C3=BCbner?= , linux-input@vger.kernel.org Cc: Andreas Kemnade , linux-kernel@vger.kernel.org Subject: [PATCH 18/18] Input: zforce_ts - switch to using asynchronous probing Date: Fri, 23 Aug 2024 22:50:42 -0700 Message-ID: <20240824055047.1706392-19-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> References: <20240824055047.1706392-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The driver waits for the device to boot, which can be a lengthy process. Switch it to asynchronous probing to allow more devices to be probed simultaneously. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/zforce_ts.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 5df4f9e8fb2e..4b8c4ebfff96 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -850,6 +850,7 @@ static struct i2c_driver zforce_driver = { .name = "zforce-ts", .pm = pm_sleep_ptr(&zforce_pm_ops), .of_match_table = of_match_ptr(zforce_dt_idtable), + .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .probe = zforce_probe, .id_table = zforce_idtable,