From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FB95C433EF for ; Mon, 1 Nov 2021 09:59:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BF7F60E54 for ; Mon, 1 Nov 2021 09:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231926AbhKAKCB (ORCPT ); Mon, 1 Nov 2021 06:02:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44467 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232557AbhKAKBc (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-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-zf57eYDcPwCbpf-PW6Halg-1; Mon, 01 Nov 2021 05:58:58 -0400 X-MC-Unique: zf57eYDcPwCbpf-PW6Halg-1 Received: by mail-ed1-f70.google.com with SMTP id r25-20020a05640216d900b003dca3501ab4so14991746edx.15 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=NJ/D1VmuHzro1MXvlt/S8eys5ftXJ4N2/B/cGHRpe4LVKBTN9xodD7TjEMgkv6zUjo O3NljxXfHzdIzoWw/ETL+ALuPVABlbhWrn6/7eJH5PasEUDPS9v8dsM0GDh6dFDEbR37 fjjcxfdxa2wewFJskahtZA146wDPHq9GMCZtHKW8TXm1l8Q+Z7FnSmAtldebOPNFbrUg IuNbfssl1IsW0bdzRc8j6XF1HilqOSBGCs2pRzGQX6IZ65ydi70XQBdiIwaXQWWa4uvq /G1cyVDMtPe9cojSAZqsrX4rpYxlgUlWWHT9cB/gcMj9si2qbMLq6Q27eKCKTAULjW4u qdZg== X-Gm-Message-State: AOAM533e/A6ucO+eu+JYotUV5+q6d9nELDIkozi00XKVTK+QQSODhm7d PjXBpt440I7+KWgei2SIHkTJRySwtMRhmmwEt6FZdk+3BdKGGCEUoYiZVF852HVjpDC5R9FxNtM NAiCl/CijCE5t9Ol3cqSxnnc= X-Received: by 2002:a05:6402:40c6:: with SMTP id z6mr8288081edb.304.1635760736987; Mon, 01 Nov 2021 02:58:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqPXJ6PYGCriCtuynpl/6EfcOsgDa+TrNrye+hvH/EBNEyhX4X2nt67BIJf0jZlCcKYYLEcQ== 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-input@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. >