Re: [PATCH v2] platform/x86: add meraki-mx100 platform driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 8/6/21 9:52 AM, Andy Shevchenko wrote:
> On Fri, Aug 6, 2021 at 5:47 AM Chris Blake <chrisrblake93@xxxxxxxxx> 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@xxxxxxxxx>
> 
>> Co-developed-by: Christian Lamparter <chunkeey@xxxxxxxxx>
> 
> 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




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux