From: Hans de Goede <hdegoede@redhat.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
Chris Blake <chrisrblake93@gmail.com>
Cc: Platform Driver <platform-driver-x86@vger.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
Christian Lamparter <chunkeey@gmail.com>
Subject: Re: [PATCH v2] platform/x86: add meraki-mx100 platform driver
Date: Fri, 6 Aug 2021 15:55:14 +0200 [thread overview]
Message-ID: <b5430038-c18c-6037-44d1-a3c0089645a1@redhat.com> (raw)
In-Reply-To: <CAHp75VenSw9BanwH58VSCNpw4cNFf7h3uSWTXLb5n0+OPtnDTQ@mail.gmail.com>
Hi,
On 8/6/21 9:52 AM, Andy Shevchenko wrote:
> On Fri, Aug 6, 2021 at 5:47 AM Chris Blake <chrisrblake93@gmail.com> 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 <chrisrblake93@gmail.com>
>
>> Co-developed-by: Christian Lamparter <chunkeey@gmail.com>
>
> Missed SoB of co-developer.
>
> ...
>
>> +#include <linux/gpio.h>
>
> 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 <linux/gpio/consumer.h>
>> +#include <linux/gpio_keys.h>
>
>> +#include <linux/gpio/machine.h>
>
> Does this provide a GPIO controller driver? I don't think so.
Actually GPIO controller drivers use <linux/gpio/driver.h>
<linux/gpio/machine.h> for board files / glue code which
e.g. needs to add lookup-tables, which this code does,
so including this header is correct.
>> +#include <linux/input.h>
>> +#include <linux/kernel.h>
>> +#include <linux/leds.h>
>> +#include <linux/module.h>
>> +#include <linux/platform_device.h>
>
> ...
>
>> +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
next prev parent reply other threads:[~2021-08-06 13:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 0:57 [PATCH v2] platform/x86: add meraki-mx100 platform driver Chris Blake
2021-08-06 7:52 ` Andy Shevchenko
2021-08-06 13:55 ` Hans de Goede [this message]
2021-08-06 13:58 ` Andy Shevchenko
2021-08-06 15:37 ` Chris
2021-08-06 15:44 ` Andy Shevchenko
2021-08-09 9:05 ` Lee Jones
2021-08-06 13:51 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b5430038-c18c-6037-44d1-a3c0089645a1@redhat.com \
--to=hdegoede@redhat.com \
--cc=andy.shevchenko@gmail.com \
--cc=chrisrblake93@gmail.com \
--cc=chunkeey@gmail.com \
--cc=linux-gpio@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).