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 X-Spam-Level: X-Spam-Status: No, score=-15.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5BA3C432BE for ; Fri, 6 Aug 2021 13:55:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7CE160F70 for ; Fri, 6 Aug 2021 13:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234487AbhHFNzd (ORCPT ); Fri, 6 Aug 2021 09:55:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47564 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233639AbhHFNzd (ORCPT ); Fri, 6 Aug 2021 09:55:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628258117; 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=yDGccq4EL4HUZuGNfYSKAvuqv2aWcZeIxltDgtSD4p0=; b=DYCMyTfzRUHgmIXLWtKFcp2hgMnTtjFLQHns5FgKjvJb4MBqMcgubefCA2JS7H1FDgWLkg HIheyTSN4mjehg6nhn5mdhBG61UzpD2YZqeHH22ec+VCn9755X3TPV/iomKeBGAZVjelNg 2GXN7Y3zdJwO/5hymuu3m5CpcPO3U8I= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-226-uXh4p3gOMIye-g1nfkMaEQ-1; Fri, 06 Aug 2021 09:55:16 -0400 X-MC-Unique: uXh4p3gOMIye-g1nfkMaEQ-1 Received: by mail-ed1-f69.google.com with SMTP id d6-20020a50f6860000b02903bc068b7717so4977166edn.11 for ; Fri, 06 Aug 2021 06:55:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=yDGccq4EL4HUZuGNfYSKAvuqv2aWcZeIxltDgtSD4p0=; b=DbnLqPQkiXtkCxBcAXVQFdARj8JVArypmtvUWKLlsMKRIaEj6DjDy7xAilMw8Tsr2w 1acFiOPwlHEdOYC7Qs2kYhU1WO+mb5NEop4Al1E2tYClL9XECaUl1lxw7CXRUf4eDMv3 h9Jg2TyPnUk7AQL4i/BOuSmSfGqnuebtxhHetGZSMHJeq6siLAMKVHjJ+1rLtRtuPfmA lcdwKIznZiumuv+cqcyEF1QYkTmv0LwCNCnYvW8Had5cGQBYA/FJfJy9fUiBtS//N2YW 4226zKKzeAoz4065x9M4XzisGSx4x/Vj7HTyMRQtZeSlD+JPZqMLW7dABDuxi6dk1GVV XQ7Q== X-Gm-Message-State: AOAM531/J5PST9I2GkG5Wgfx0ehe0Q/ojeTL4/7yXcPkTSf0usI8KBxG phyU+xap44u1Chi+/xZRpyiwiYS2p5J0p5dCPyBOvqFYOy8zzvwFou9ACdRyHGh+6zTOnycRuaq t6WSudsizm2rxDH7ObHk3lP85xCmdenQs6w== X-Received: by 2002:a17:906:cc57:: with SMTP id mm23mr9536510ejb.12.1628258115035; Fri, 06 Aug 2021 06:55:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEX6beW+Ymvpc82lCPC99uTGdZqKJGEd3vGreAUTQPHD73ncgvfzuuOvPqFMX/eXQ7xNCf4w== X-Received: by 2002:a17:906:cc57:: with SMTP id mm23mr9536499ejb.12.1628258114894; Fri, 06 Aug 2021 06:55:14 -0700 (PDT) Received: from x1.localdomain (2001-1c00-0c1e-bf00-1054-9d19-e0f0-8214.cable.dynamic.v6.ziggo.nl. [2001:1c00:c1e:bf00:1054:9d19:e0f0:8214]) by smtp.gmail.com with ESMTPSA id b15sm2900165ejv.15.2021.08.06.06.55.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Aug 2021 06:55:14 -0700 (PDT) Subject: Re: [PATCH v2] platform/x86: add meraki-mx100 platform driver To: Andy Shevchenko , Chris Blake Cc: Platform Driver , "open list:GPIO SUBSYSTEM" , Christian Lamparter References: <20210806005755.2295193-1-chrisrblake93@gmail.com> From: Hans de Goede Message-ID: Date: Fri, 6 Aug 2021 15:55:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Hi, On 8/6/21 9:52 AM, Andy Shevchenko wrote: > On Fri, Aug 6, 2021 at 5:47 AM Chris Blake wrote: >> >> This adds platform support for the Cisco Meraki MX100 (Tinkerbell) >> network appliance. This sets up the network LEDs and Reset >> button. Note that this patch requires > >> mfd: lpc_ich: Enable GPIO driver for DH89xxCC > > Use standard format for the commits, and you may find its SHA in the > repository of respective maintainer I suppose. > >> which has been accepted >> and is currently targeted for 5.15. >> >> Signed-off-by: Chris Blake > >> Co-developed-by: Christian Lamparter > > Missed SoB of co-developer. > > ... > >> +#include > > This is wrong. Mustn't be included in the new code. Right I don't think you need this at all since I don't think the code directly uses the GPIOs, but if removing it gives issues then you will want to use: #include >> +#include > >> +#include > > Does this provide a GPIO controller driver? I don't think so. Actually GPIO controller drivers use for board files / glue code which e.g. needs to add lookup-tables, which this code does, so including this header is correct. >> +#include >> +#include >> +#include >> +#include >> +#include > > ... > >> +static struct platform_device * __init tink_create_dev( >> + const char *name, >> + const void *pdata, >> + size_t sz) > > Use less LOCs for this... > > ... > >> + pdev = platform_device_register_data(NULL, >> + name, >> + PLATFORM_DEVID_NONE, >> + pdata, >> + sz); > > ...and for this (put name and sz to the respective previous lines). > >> + > > Unneeded blank line. > >> + if (IS_ERR(pdev)) >> + pr_err("failed registering %s: %ld\n", name, PTR_ERR(pdev)); >> + > > ... > >> + /* We need to make sure that GPIO60 isn't set to native mode as is default since it's our >> + * Reset Button. To do this, write to GPIO_USE_SEL2 to have GPIO60 set to GPIO mode. >> + * This is documented on page 1609 of the PCH datasheet, order number 327879-005US >> + */ > > /* > * Multi-line comment style is not > * for this subsystem. > */ > > ... > >> + tink_leds_pdev = tink_create_dev( >> + "leds-gpio", >> + &tink_leds_pdata, >> + sizeof(tink_leds_pdata)); >> + >> + tink_keys_pdev = tink_create_dev( >> + "gpio-keys-polled", >> + &tink_buttons_pdata, >> + sizeof(tink_buttons_pdata)); > > Again, use less LOCs. > > ... > >> + > > Unneeded blank line, attach the below to the respective functions > >> +module_init(tink_board_init); >> +module_exit(tink_board_exit); > > ... > >> +MODULE_DEVICE_TABLE(dmi, tink_systems); > Put this closer to the structure. To clarify please put this immediately after the "};" line terminating the id array declaration, like this: static const struct dmi_system_id tink_systems[] __initconst = { { .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Cisco"), DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MX100-HW"), }, }, {} /* Terminating entry */ }; MODULE_DEVICE_TABLE(dmi, tink_systems); Regards, Hans