From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 566D8224240; Mon, 31 Mar 2025 14:53:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743432782; cv=none; b=rnuUgQDOQgUV3mDHGuqHT8k85+CnY0vVZSXt72ASTrAvRzHhNEXd722r2yWeh3FW0TOMS3VL6bJXhxzt/5+sv0p6HUqJEadWUImXck5vZ8ulVwOZk/b7+UAy7rUAyS/cfs6W7pSlQ2Jv11HGVLkfhTKVg8IKwMtC8Llx1XMSyPo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743432782; c=relaxed/simple; bh=bR9loiAosq18/UmjopG2hMorkY4VpSBlgHvbcZ/wMOY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=NK41cl52BF1Bo/zUPtbVK5XPIqrp1Hi0iINckPa9uJkjOJPJpWJ6aKGNNuyb5cZnnTUZo1lNM8WGI0i5osygI6OEwJE9ssOwm8CVg2MucrDDLaEf1Ktifr36co/wgqqXzkhK2iSQGikD/9k7RdMLhhjvefmaVQ23Ed+Yp6qT+kw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RoHvUMVP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RoHvUMVP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B899C4CEE4; Mon, 31 Mar 2025 14:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743432781; bh=bR9loiAosq18/UmjopG2hMorkY4VpSBlgHvbcZ/wMOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RoHvUMVPCJnx7us232Ui6Zup+kYX/yQ5nKCwC28z+Wl9AIrhw25/dhRxIaAehbZyZ JhHDd3TRNxB2pfDOyuSSlGzZL1O0tRQlGQRgtt1c6iwgY4+RzQtTIlQWJwBTP1wCCj HRBQNykBc8VYAUXJwMnjLRV6PCN+nSQyIFpa473kYmSfLkTvwNYottqKVv+3vzX1HF dNZJiek4ohDKLx8CbVOfoNjr8xPR4ADdYIryJmsUgduQ+ljQornd/VmeznPT1AeA4Z UuHjmYEBYPQrcMoM627ITRHYILTP9M0gDDRDylzoPfhfy8xBWBN5wHxq23cAWQXulu jNFAUCU/C35hA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Tomasz=20Paku=C5=82a?= , =?UTF-8?q?Micha=C5=82=20Kope=C4=87?= , Paul Dino Jones , =?UTF-8?q?Crist=C3=B3ferson=20Bueno?= , Pablo Cisneros , Jiri Kosina , Sasha Levin , jikos@kernel.org, bentiss@kernel.org, linux-usb@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH AUTOSEL 6.14 08/27] HID: pidff: Add hid_pidff_init_with_quirks and export as GPL symbol Date: Mon, 31 Mar 2025 10:52:26 -0400 Message-Id: <20250331145245.1704714-8-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250331145245.1704714-1-sashal@kernel.org> References: <20250331145245.1704714-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.14 Content-Transfer-Encoding: 8bit From: Tomasz Pakuła [ Upstream commit 36de0164bbaff1484288e84ac5df5cff00580263 ] This lays out a way to provide an initial set of quirks to enable before device initialization takes place. GPL symbol export needed for the possibility of building HID drivers which use this function as modules. Adding a wrapper function to ensure compatibility with the old behavior of hid_pidff_init. Signed-off-by: Tomasz Pakuła Reviewed-by: Michał Kopeć Reviewed-by: Paul Dino Jones Tested-by: Paul Dino Jones Tested-by: Cristóferson Bueno Tested-by: Pablo Cisneros Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/usbhid/hid-pidff.c | 15 ++++++++++++++- include/linux/hid.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index 5a57ba0d7026a..b8c2ba0a930c2 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c @@ -1268,8 +1268,9 @@ static int pidff_check_autocenter(struct pidff_device *pidff, /* * Check if the device is PID and initialize it + * Set initial quirks */ -int hid_pidff_init(struct hid_device *hid) +int hid_pidff_init_with_quirks(struct hid_device *hid, __u32 initial_quirks) { struct pidff_device *pidff; struct hid_input *hidinput = list_entry(hid->inputs.next, @@ -1291,6 +1292,7 @@ int hid_pidff_init(struct hid_device *hid) return -ENOMEM; pidff->hid = hid; + pidff->quirks = initial_quirks; hid_device_io_start(hid); @@ -1369,3 +1371,14 @@ int hid_pidff_init(struct hid_device *hid) kfree(pidff); return error; } +EXPORT_SYMBOL_GPL(hid_pidff_init_with_quirks); + +/* + * Check if the device is PID and initialize it + * Wrapper made to keep the compatibility with old + * init function + */ +int hid_pidff_init(struct hid_device *hid) +{ + return hid_pidff_init_with_quirks(hid, 0); +} diff --git a/include/linux/hid.h b/include/linux/hid.h index 89a4dee377292..31dfe9ed5394b 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -1224,8 +1224,10 @@ void hid_quirks_exit(__u16 bus); #ifdef CONFIG_HID_PID int hid_pidff_init(struct hid_device *hid); +int hid_pidff_init_with_quirks(struct hid_device *hid, __u32 initial_quirks); #else #define hid_pidff_init NULL +#define hid_pidff_init_with_quirks NULL #endif /* HID PIDFF quirks */ -- 2.39.5