From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 AD82A434E55 for ; Mon, 3 Aug 2026 18:46:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785782800; cv=none; b=oakqURo+2/fU4zpE1M7lZqZENolqqmvyv1xmFUxAonSerLh1dQ5gH0PccuPfvZrdMQp7ga5QvNeTzINSg1GTHrfl1Kc2ub1oCQyoCk0a5mpPwTKMKkXIhCe9g7FykucSO41QT4q92cLazeDgTWUOLsLuL6lftxviU4a8+DHE5kQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785782800; c=relaxed/simple; bh=zTvGTNkJ/wqnyMbPR7YJxhbtHyE5HaI2GyeFefAOijU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V1QMVTt2C7virc3/fLmh8o4ahg9muXYUXV+nSa+B3W6z4oij8qZ3C+OfpsGAIdvUgM4ifHghV6gBOqapN39YA1Gwd08/AigZouYlZo6qQaxIVUNUip5NCrrWkSfPm0rzVmU3pgWdDBTsDdontXY0xM5Ah4DGp30nfIwpYH39hzk= 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=aeHBCcSV; arc=none smtp.client-ip=209.85.216.53 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="aeHBCcSV" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-383cb94f742so3755686a91.3 for ; Mon, 03 Aug 2026 11:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785782795; x=1786387595; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fDX03Rc6Co4fp263PbZY9y3DOwf1pY8yl2EntzRzQTY=; b=aeHBCcSVl8t3n8TKdHm7kuAHzkasUis4mHZl0wezNnlQ5w0kjis1D0fjUKjcNnSF4i ZfefXAmM/4qqqFkxUQ/po4R9Evh9RawpGWQYTisgsTcQYJ7ZnQ/mGeItv/GZPMmeWb5n g0xey8asHyNrsahRlwFBwi9FE62JIR3f6q6Djin0ZUPKa/zyjuncnfhV1Rdf51MW3Q8U PU0eARE2hgHLvUbQPRN/iiCIol1CA0EfkwcJAXQa5k6XJCGOMrCxMRfYBrbA9MXN652m 8MGOwODxSbWFoye0EyWHCaj/YywuL1WMcFmZVI8AoD42fXRDxxQLUDAX+bOisAbD5+AN py9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785782796; x=1786387596; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=fDX03Rc6Co4fp263PbZY9y3DOwf1pY8yl2EntzRzQTY=; b=d9fuGhJXS8QcBx2zO0NOi7bMykFAGj0dTdk2+He8/2rY5KKSu5FFRW6xJR6Uj9NYxJ hUOJxmEGTV83tGCUkfl4iXC9BsSa3LzF9v1Py6n7hAwwJ5O85AU3/VUL/WqxIQKcZK0d iJOaY7OnIir6Y8CCrFkNFG3YPBKnMZ7frySapv9/E5xqu3CTwlqSkPNf9QZKKG94/xz/ ZVV0xlS7dqgd92N7J2P90JaHiH2M7b2XIoXIxqk2hXJh6nl+Ge69+EiTbTA6Pw5I3VH6 2OqqwZpEeG/BPdaEP/JMetVd2+HREys15GoVrVCMMs+1ZelTR0xOTU7DYPoHAWOgN8tb R6BQ== X-Forwarded-Encrypted: i=1; AHgh+RraXYG9SeQZrM9RB2ZB9n7kISfDk1Ft5p5HoANRDtNcM0Bfi0LoFVDzNWGlQESh8oIiqY3tuX/SU8onnNQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw7laYVtZGkxHEFBIYg9cvhAgtR23ZO97X2hod2SC5cd9RUFXph R25mHo6r/plUFFkaJDd+abfkhKFG2TJs1viPoFbop3WtlquN1R84ELxL X-Gm-Gg: AR+sD13D9Fp9f64vtMiO/kIi9chC/5jxddSObsn4HFiHrnBXZLmrwpujgQXl4SmkBzV /Nc9Q/DIvGgmBYATVTMnPCZXGeoyJ/k4N7IpTmTvLjkiJcYMq+QzamwTIN+TraDptO0FI/xg/V7 mnIDHwG3CJZ42ziK5g3MxdtA4nQFrVXCdTuIKJcUglHL89DblYlulaHMLDjzL4NmUqN6js38Bk+ unLxaBLbbbhOWZOMlpwIjvA0XbmKhBIYi0jXQG7J/3h3Mr42WgOljDufvlpl74m7v8Zz2u+2Arr n/E4yJ0aqZvQ8S5U2u4TcC5zX2jYgu1hDZz7B+9PsF7w5g9s4kUqMX3dCPkZb+RwqHv4XlDkHJP F3hLp1fYlpx273PI+ZP9FMwvgM/AVsuROwEYGhW6EjsRdDDVb5LTVYM6mj51zfEN2Q5EPgnmurL SQ2hnl4wE7nW6n7K12FxN75Mkbyou4Z+n2fV3KAgUA9PJ5NVeSPV3+zddmGultl6VwXqLK/sXnl P1vPGx1dHk1NdwQq8O74EkGhFRxygzl9uaJ2i1xAJrdgfcVLB5J X-Received: by 2002:a17:90b:540b:b0:38e:e9b:ffa7 with SMTP id 98e67ed59e1d1-38fbc51f1e4mr10231317a91.28.1785782795558; Mon, 03 Aug 2026 11:46:35 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:d109:cdba:8a20:74ad]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fab24ec10sm33935472c88.6.2026.08.03.11.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 11:46:35 -0700 (PDT) From: Dmitry Torokhov Date: Mon, 03 Aug 2026 11:46:26 -0700 Subject: [PATCH 01/21] HID: core: automatically initialize generic FF if no other FF is present Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260803-hid-ff-input-configured-v1-1-1dc9bbacd88c@gmail.com> References: <20260803-hid-ff-input-configured-v1-0-1dc9bbacd88c@gmail.com> In-Reply-To: <20260803-hid-ff-input-configured-v1-0-1dc9bbacd88c@gmail.com> To: Jiri Kosina , Benjamin Tissoires , Jonathan Corbet , Shuah Khan , Julia Lawall , Nicolas Palix , =?utf-8?q?Filipe_La=C3=ADns?= , Bastien Nocera Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, cocci@inria.fr X-Mailer: b4 0.16-dev-b242f Some HID drivers initialize their own force-feedback support within their .input_configured() callback. In such cases, we should skip the generic PID force-feedback initialization to avoid conflicts and redundant setup. Add hid_has_ff_input() helper and use it to check for existing FF capabilities before calling hdev->ff_init(). Since we now have a dynamic way to detect if force-feedback is needed, the HID_CONNECT_FF flag is redundant for conflict resolution and can be ignored in the core initialization logic. Generic PID support will now be attempted by default for any claimed input device that doesn't already have FF capabilities. Assisted-by: Gemini:gemini-3.1-pro Signed-off-by: Dmitry Torokhov --- drivers/hid/hid-core.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index f107f5103b35..2767a171eae9 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -2287,6 +2287,18 @@ static const BIN_ATTR_RO(report_descriptor, HID_MAX_DESCRIPTOR_SIZE); static const DEVICE_ATTR_RO(country); +static bool hid_has_ff_input(struct hid_device *hdev) +{ + struct hid_input *hidinput; + + list_for_each_entry(hidinput, &hdev->inputs, list) { + if (test_bit(EV_FF, hidinput->input->evbit)) + return true; + } + + return false; +} + int hid_connect(struct hid_device *hdev, unsigned int connect_mask) { static const char *types[] = { "Device", "Pointer", "Mouse", "Device", @@ -2336,7 +2348,8 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) hid_process_ordering(hdev); if ((hdev->claimed & HID_CLAIMED_INPUT) && - (connect_mask & HID_CONNECT_FF) && hdev->ff_init) + (connect_mask & HID_CONNECT_FF) && hdev->ff_init && + !hid_has_ff_input(hdev)) hdev->ff_init(hdev); len = 0; -- 2.55.0.629.g250fe7f194-goog