/*
* Multi-line comments
* have this style
*/
+#include <linux/kernel.h>
kbuild bot complains for absence of
#include <linux/mod_devicetable.h>
here.
+static int gpio_apu_get_dir(struct gpio_chip *chip, unsigned int offset)
+{
+ u32 val;
+ struct apu_gpio_pdata *apu_gpio = gpiochip_get_data(chip);
+
+ spin_lock(&apu_gpio->lock);
+
+ val = ~ioread32(apu_gpio->addr[offset]);
There is no need to do ~ under spin lock.
+
+ spin_unlock(&apu_gpio->lock);
+
+ return !!(val & BIT(APU_GPIO_BIT_DIR));
+}
+ if (dmi_check_system(apu3_gpio_dmi_table)) {
(1)
+ apu_gpio->addr = devm_kzalloc(&pdev->dev,
+ sizeof(apu3_gpio_offset),
+ GFP_KERNEL);
+
No need to have this blank line. Same for the other cases.
+ if (!apu_gpio->addr)
+ return -ENOMEM;
+ } else if (dmi_check_system(apu2_gpio_dmi_table)) {
(2)
I think I have already told about (1) and (2). You may create two
callbacks and utilize .callback member in DMI table.
+ }
+static int __init apu_gpio_init(void)
+{
+ if (!(dmi_check_system(apu2_gpio_dmi_table)) &&
+ !(dmi_check_system(apu3_gpio_dmi_table))) {
+ pr_err("No PC Engines board detected\n");
+ return -ENODEV;
+ }
I don't think we need this.
+}
+
+module_init(apu_gpio_init);
+module_exit(apu_gpio_exit);
After removing unneeded checks why not to simple use
module_platform_driver()
?