Re: [PATCH v7 5/8] gpio: sim: new testing module
From: Bartosz Golaszewski <hidden>
Date: 2021-10-19 14:18:37
Also in:
linux-gpio, lkml
On Mon, Oct 18, 2021 at 12:40 PM Andy Shevchenko [off-list ref] wrote:
On Fri, Oct 08, 2021 at 10:17:36AM +0200, Bartosz Golaszewski wrote:quoted
Implement a new, modern GPIO testing module controlled by configfs attributes instead of module parameters. The goal of this driver is to provide a replacement for gpio-mockup that will be easily extensible with new features and doesn't require reloading the module to change the setup. Signed-off-by: Bartosz Golaszewski <redacted> [Andy: Initialize attribute allocated on the heap] Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> [Colin: Fix dereference of free'd pointer config] Signed-off-by: Colin Ian King <redacted> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Linus Walleij <redacted>Some nit-picks below, up to you to address. ...quoted
+ ret = gpio_sim_setup_sysfs(chip); + if (ret) + return ret; + + return 0;return gpio_sim_...(chip); ?
Sure, can do.
...quoted
+Redundant empty line.quoted
+CONFIGFS_ATTR_RO(gpio_sim_config_, dev_name);...quoted
+Ditto.quoted
+CONFIGFS_ATTR_RO(gpio_sim_config_, chip_name);...quoted
+Ditto.quoted
+CONFIGFS_ATTR(gpio_sim_config_, label);...quoted
+Ditto.quoted
+CONFIGFS_ATTR(gpio_sim_config_, num_lines);...quoted
+Ditto.quoted
+CONFIGFS_ATTR(gpio_sim_config_, line_names);
These are on purpose - there's the store and show function and putting it next to only one is misleading IMO.
...quoted
+ fwnode = fwnode_create_software_node(properties, NULL); + if (IS_ERR(fwnode)) + return PTR_ERR(fwnode);quoted
+ fwnode = dev_fwnode(&config->pdev->dev); + platform_device_unregister(config->pdev); + fwnode_remove_software_node(fwnode);This seems correct, thank you for modifying the code. ...quoted
+ config->pdev = NULL; + mutex_unlock(&config->lock);mutex_destroy() ? Or is it done in the upper level?
It's done in the release callback. Bart
-- With Best Regards, Andy Shevchenko