Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2842419pxb; Mon, 1 Nov 2021 03:01:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhe/V48WKTD0bQ9K+cxvnzC3jughz19vWFpJEm2hQpSNiCtsmRPEOyY/JBNKE/5jEIr60P X-Received: by 2002:a17:906:314e:: with SMTP id e14mr35222702eje.165.1635760910731; Mon, 01 Nov 2021 03:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635760910; cv=none; d=google.com; s=arc-20160816; b=Hcz7gsLUXTgcmDqivGG1kQ4cTFId9dvMOjjqv56ylntbALTI8AlMZW1+NCRopAkHfz SA4izPu33gZXthOlvCG4Xm2CgUPGDV6IKXMmE2kzdf8J0SkDSQ0q+RMK65s18iSTJ50f pM/5UlLktVXVqPRJDF8M4pdLkdaijcqk4qrIhrv6BzJS/BDvktVTyJHGJ6bahoxgxG4j rBEOkWgsz6sflSdX9pgiAizfAcxtde2cwy0lNIze29fbcJCzn7v+UGBrxGeAJFpkPa7q /dNWbYekKwWuBQFIA4mWhjZxgqqlvYFb4YVN/ELy98/nNBaPQOaobetRQsJmotc+yBcN pl8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6caRVk8CMsSD+h3ZfXjPmUciaKaQW9ki6VuNt64p3I4=; b=CO3rQyL/j8+eStdv9BESt+PjSKL/G2GLcQBG6pOvtwHvyo0jk6p/wGbirSmUhpLOIv t0wCSgRd3MQAtppc4nHKd5TY+zpxdErg7SoWQK+rYATF3UWDr/oMz4kzWlf7lmYpUeKn LmcyQjKnCCPYYTtzdTwx4Hqvpk4byo3F+88h0S1W4DEBQotCcOW7qRAUK2elPA6drXfj k56zRo0/7MR/I+QjR0tezTkOqgJuOrT2V4NFPLWGGJUABrSJ5ZYTS02YdxzNOhYn4ZNq hSz+J9jKlWbjpsDnI81gCnbaiZ3zLiCTZH+BH0bp5HZeIhvR1qjDBc/E3LAS1PMwTqcF BoIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dJCjkXxV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr9si25256103ejc.530.2021.11.01.03.01.26; Mon, 01 Nov 2021 03:01:50 -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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dJCjkXxV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233000AbhKAKCC (ORCPT + 99 others); Mon, 1 Nov 2021 06:02:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20141 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232583AbhKAKBc (ORCPT ); Mon, 1 Nov 2021 06:01:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635760739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6caRVk8CMsSD+h3ZfXjPmUciaKaQW9ki6VuNt64p3I4=; b=dJCjkXxVcYWbStpUL5tUN2S2OfSFktAEboh9QrHBVckVcvtZiUPQXimO5YdpEuztqJwTcz s8iM9yB3Qj9bf1GYD8SZDEwO++TJNs4D+PnCCsbIrDZ/IdawLkAyY0eO/3uJs78NJ8vW7N uu/4W0RbHz7RCVdMl3Px2POuU0X9I/8= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-158-kkiRjZO6M46dztR5Fhs0Tw-1; Mon, 01 Nov 2021 05:58:58 -0400 X-MC-Unique: kkiRjZO6M46dztR5Fhs0Tw-1 Received: by mail-ed1-f72.google.com with SMTP id d11-20020a50cd4b000000b003da63711a8aso14990613edj.20 for ; Mon, 01 Nov 2021 02:58:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=6caRVk8CMsSD+h3ZfXjPmUciaKaQW9ki6VuNt64p3I4=; b=qsK+B+vMcNYZ2mM1Fee8PD9wZdcwYDVrgAnsmE9pZxhw6EQCG+znok5Pd7qS9tdVOv BLjN/NF6koC/RHh/OomjK3JrYHPqCi5Iy5fxQGf5ic+IIZy8xj4DqVbJBEQ22C4uLTX5 8XOScnGn6xdXJp9n1gU5Eibv29LT/uZDuvMXelLF0+PWmYrsdGPkz7kKjF5x6aAV3/To zVm9/Ww9mJvzvfSQGcOtrW8yhXvGlc3RYoinqq2/2RcCLQgEmCYa5ZiTM5yV2WV6riyn La5+1xa3hFFk3SeDJuWVSQ/9aKwY8stAkBrkohZSHuIBRiG64tEXtgrcs8mULFG+UGN/ fqkA== X-Gm-Message-State: AOAM532IPJtE3enfHbuk7zJqAfdjdBuoGw0cC1MsNLVAEbh8mgvE67Xt JeoC+9ZxV3aRgnOeWg7uft2aVpyY1BbM67E/Euu9pEQpupSR+2mbS8SLzkXCmu+7NFtTHOCtYvG aNtRz/r51hfIfQT3+/Px+N8Ys X-Received: by 2002:a05:6402:40c6:: with SMTP id z6mr8288084edb.304.1635760736988; Mon, 01 Nov 2021 02:58:56 -0700 (PDT) X-Received: by 2002:a05:6402:40c6:: with SMTP id z6mr8288065edb.304.1635760736808; Mon, 01 Nov 2021 02:58:56 -0700 (PDT) Received: from [10.40.1.223] ([81.30.35.201]) by smtp.gmail.com with ESMTPSA id x22sm8510583edv.14.2021.11.01.02.58.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Nov 2021 02:58:56 -0700 (PDT) Message-ID: Date: Mon, 1 Nov 2021 10:58:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH 1/6] HID: intel-ish-hid: add support for MODULE_DEVICE_TABLE() Content-Language: en-US To: =?UTF-8?Q?Thomas_Wei=c3=9fschuh?= , linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Srinivas Pandruvada , Jiri Kosina , Benjamin Tissoires , Masahiro Yamada , Michal Marek , Nick Desaulniers References: <20211029152901.297939-1-linux@weissschuh.net> <20211029152901.297939-2-linux@weissschuh.net> From: Hans de Goede In-Reply-To: <20211029152901.297939-2-linux@weissschuh.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 10/29/21 17:28, Thomas Weißschuh wrote: > 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; The kdoc comment documents a context pointer, but this is missing from the actual struct. Having some sort of driver_data (1) field here would be good IMHO. Regards, Hans 1) "context" is fine, but AFAIK almost all other foo_device_id structs call this driver_data, so that would be more consistent IMHO. > +}; > + > #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. >