Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp212908pxb; Fri, 29 Oct 2021 08:30:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyk4teuNaCR6bIG4o6KaM/5bGTtLyPkOuIS/Nf6NC1CdfxLx9ML/9mxOfkEarFsT2ioo3Rr X-Received: by 2002:a05:6e02:1402:: with SMTP id n2mr8324431ilo.208.1635521457747; Fri, 29 Oct 2021 08:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635521457; cv=none; d=google.com; s=arc-20160816; b=Yyu4oK1gdixijSUFgBLAGWGya2TPjlWTXKmxKQ8K+PlB/7jI4oI9N6VvknnGKjgoiH O1LUE3nGgg1tNaOvdg4z2lVVaxP4dooEH8+RktF8yGwWeOdjm3rAJdtuyV6TxogZKwGt eZ8+mHnIi9uZR9XynER66mFNftF9hSPGHlNQHlFKOR0/Ue3gcYw9y7+X92XcKeSSRXWe 3++pf05ybNy48Db72vhKjENQi9l84yZPgH16Wlle6ndG0/OURGBtnXPoAwG/elejezi5 Y0/B0mgtOoS1Wdyp3wkiGe2Lt8YSsBwkTE3MMUI01t9wQoYcsZqa9kXd7L5PW7CoF0MC oMmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :from; bh=NBkMCD7XDj/RsyAiq2ojrbqgmxofZ/NIsjMXPTJZoY8=; b=myvfBJkf/5r1gjrMAg4F2BYAOZgZFzM/70e49WKuMziEG3MZIA9KLMpTUgUeXiOotv tCioOlB+RYoTi+vOSChIykSG9883tHWdCtFE+s7AivNt7M4NZUUl11ixkVQGN+8pgvMW yDFSWjeloVsfLr2KZkFVaMvRz/96RUvBThhWdSEvTJa+qrNnAxgiNEPIUrr3PowU0mTD JQEu8N4HQlinhnrZ7QjXkpNo0R3goNBJSpKbg3X92cTBuFP3pFZXpfssrlVgDnOe/+uo QCmeFnQ+qFHS7Bqtvh8QdEUNY+oc9t+JOtR6hSGGJxRfLrkpdz4710NJUiNG9/tOKnkQ vsng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=dqjLxADx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si9373946ila.114.2021.10.29.08.30.45; Fri, 29 Oct 2021 08:30:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=dqjLxADx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230174AbhJ2Pbz (ORCPT + 99 others); Fri, 29 Oct 2021 11:31:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbhJ2Pbr (ORCPT ); Fri, 29 Oct 2021 11:31:47 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E1AFC061766; Fri, 29 Oct 2021 08:29:19 -0700 (PDT) From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1635521356; bh=47S71ww0oeAgpF1M5AvPvZs+YgAcY4mGa2+Jg6+IVus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dqjLxADx+7gG42MpSHV41hdPF7oE8VC2gn3Nd0mYq09l+Dj13qehsu/zATD1RkiQK 2Dp1ooRYK6APQr06sfhYosRfRoK2IamEmruabbCz2J0wW9SSVdqnHrFBhi1rWHKbCa rNenwe7bWPfHWgHFozSeXyTrMtYa91+Yt5F4UhqI= To: linux-input@vger.kernel.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Srinivas Pandruvada , Jiri Kosina , Benjamin Tissoires , Hans de Goede , Masahiro Yamada , Michal Marek , Nick Desaulniers Subject: [PATCH 1/6] HID: intel-ish-hid: add support for MODULE_DEVICE_TABLE() Date: Fri, 29 Oct 2021 17:28:56 +0200 Message-Id: <20211029152901.297939-2-linux@weissschuh.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211029152901.297939-1-linux@weissschuh.net> References: <20211029152901.297939-1-linux@weissschuh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This allows to selectively autoload drivers for ISH devices. Currently all ISH drivers are loaded for all systems having any ISH device. Signed-off-by: Thomas Weißschuh --- Cc: linux-kbuild@vger.kernel.org Cc: linux-input@vger.kernel.org Cc: Srinivas Pandruvada Cc: Jiri Kosina Cc: Benjamin Tissoires Cc: Hans de Goede Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers --- include/linux/mod_devicetable.h | 13 +++++++++++++ scripts/mod/devicetable-offsets.c | 3 +++ scripts/mod/file2alias.c | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index ae2e75d15b21..befbf53c4b7c 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -895,4 +895,17 @@ struct dfl_device_id { kernel_ulong_t driver_data; }; +/* ISHTP (Integrated Sensor Hub Transport Protocol) */ + +#define ISHTP_MODULE_PREFIX "ishtp:" + +/** + * struct ishtp_device_id - ISHTP device identifier + * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba + * @context: pointer to driver specific data + */ +struct ishtp_device_id { + guid_t guid; +}; + #endif /* LINUX_MOD_DEVICETABLE_H */ diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index cc3625617a0e..c0d3bcb99138 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -259,5 +259,8 @@ int main(void) DEVID_FIELD(dfl_device_id, type); DEVID_FIELD(dfl_device_id, feature_id); + DEVID(ishtp_device_id); + DEVID_FIELD(ishtp_device_id, guid); + return 0; } diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 49aba862073e..5258247d78ac 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -115,6 +115,17 @@ static inline void add_uuid(char *str, uuid_le uuid) uuid.b[12], uuid.b[13], uuid.b[14], uuid.b[15]); } +static inline void add_guid(char *str, guid_t guid) +{ + int len = strlen(str); + + sprintf(str + len, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", + guid.b[3], guid.b[2], guid.b[1], guid.b[0], + guid.b[5], guid.b[4], guid.b[7], guid.b[6], + guid.b[8], guid.b[9], guid.b[10], guid.b[11], + guid.b[12], guid.b[13], guid.b[14], guid.b[15]); +} + /** * Check that sizeof(device_id type) are consistent with size of section * in .o file. If in-consistent then userspace and kernel does not agree @@ -1380,6 +1391,18 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias) return 1; } +/* Looks like: ishtp:{guid} */ +static int do_ishtp_entry(const char *filename, void *symval, char *alias) +{ + DEF_FIELD(symval, ishtp_device_id, guid); + + strcpy(alias, ISHTP_MODULE_PREFIX "{"); + add_guid(alias, guid); + strcat(alias, "}"); + + return 1; +} + static int do_auxiliary_entry(const char *filename, void *symval, char *alias) { DEF_FIELD_ADDR(symval, auxiliary_device_id, name); @@ -1499,6 +1522,7 @@ static const struct devtable devtable[] = { {"auxiliary", SIZE_auxiliary_device_id, do_auxiliary_entry}, {"ssam", SIZE_ssam_device_id, do_ssam_entry}, {"dfl", SIZE_dfl_device_id, do_dfl_entry}, + {"ishtp", SIZE_ishtp_device_id, do_ishtp_entry}, }; /* Create MODULE_ALIAS() statements. -- 2.33.1