[x86] Allow gzipping of squashfs images with padded jffs2 partition
[openwrt.git] / target / linux / generic / patches-3.2 / 864-gpiommc_configfs_locking.patch
1 The gpiommc configfs context structure needs locking, as configfs
2 does not lock access between files.
3
4 --- a/drivers/mmc/host/gpiommc.c
5 +++ b/drivers/mmc/host/gpiommc.c
6 @@ -144,6 +144,8 @@ struct gpiommc_configfs_device {
7 struct platform_device *pdev;
8 /* The configuration */
9 struct gpiommc_platform_data pdata;
10 + /* Mutex to protect this structure */
11 + struct mutex mutex;
12 };
13
14 #define GPIO_INVALID -1
15 @@ -234,6 +236,8 @@ static ssize_t gpiommc_config_attr_show(
16 unsigned int gpio;
17 int err = 0;
18
19 + mutex_lock(&dev->mutex);
20 +
21 if (attr == &gpiommc_attr_DI) {
22 gpio = dev->pdata.pins.gpio_di;
23 if (gpio == GPIO_INVALID)
24 @@ -294,6 +298,8 @@ static ssize_t gpiommc_config_attr_show(
25 WARN_ON(1);
26 err = -ENOSYS;
27 out:
28 + mutex_unlock(&dev->mutex);
29 +
30 return err ? err : count;
31 }
32
33 @@ -353,6 +359,8 @@ static ssize_t gpiommc_config_attr_store
34 int err = -EINVAL;
35 unsigned long data;
36
37 + mutex_lock(&dev->mutex);
38 +
39 if (attr == &gpiommc_attr_register) {
40 err = strict_strtoul(page, 10, &data);
41 if (err)
42 @@ -478,6 +486,8 @@ static ssize_t gpiommc_config_attr_store
43 WARN_ON(1);
44 err = -ENOSYS;
45 out:
46 + mutex_unlock(&dev->mutex);
47 +
48 return err ? err : count;
49 }
50
51 @@ -514,6 +524,7 @@ static struct config_item *gpiommc_make_
52 if (!dev)
53 return NULL;
54
55 + mutex_init(&dev->mutex);
56 config_item_init_type_name(&dev->item, name,
57 &gpiommc_dev_ci_type);
58
This page took 0.044443 seconds and 5 git commands to generate.