@@ -517,6 +517,7 @@ struct gpio_mockup_device {
};
static LIST_HEAD(gpio_mockup_devices);
+static DEFINE_MUTEX(gpio_mockup_devices_lock);
static void gpio_mockup_unregister_one_device(struct gpio_mockup_device *dev)
{
@@ -534,10 +535,14 @@ static void gpio_mockup_unregister_devices(void)
struct gpio_mockup_device *mockup_dev;
struct list_head *curr, *next;
+ mutex_lock(&gpio_mockup_devices_lock);
+
list_for_each_safe(curr, next, &gpio_mockup_devices) {
mockup_dev = list_entry(curr, struct gpio_mockup_device, list);
gpio_mockup_unregister_one_device(mockup_dev);
}
+
+ mutex_unlock(&gpio_mockup_devices_lock);
}
static __init char **gpio_mockup_make_line_names(const char *label,
@@ -588,7 +593,9 @@ static int __init gpio_mockup_register_device(struct property_entry *properties)
return PTR_ERR(mockup_dev->pdev);
}
+ mutex_lock(&gpio_mockup_devices_lock);
list_add(&mockup_dev->list, &gpio_mockup_devices);
+ mutex_unlock(&gpio_mockup_devices_lock);
return 0;
}