Add flashmap support for AMIT and Zyxel boards, thanks sn9
[openwrt.git] / target / linux / generic-2.6 / patches-2.6.25 / 923-gpiommc-configfs-locking.patch
1 The gpiommc configfs context structure needs locking, as configfs
2 does not lock access between files.
3
4 Index: linux-2.6.25.17/drivers/mmc/host/gpiommc.c
5 ===================================================================
6 --- linux-2.6.25.17.orig/drivers/mmc/host/gpiommc.c 2008-10-18 23:33:54.000000000 +0200
7 +++ linux-2.6.25.17/drivers/mmc/host/gpiommc.c 2008-10-18 23:34:33.000000000 +0200
8 @@ -140,6 +140,8 @@ struct gpiommc_configfs_device {
9 struct platform_device *pdev;
10 /* The configuration */
11 struct gpiommc_platform_data pdata;
12 + /* Mutex to protect this structure */
13 + struct mutex mutex;
14 };
15
16 #define GPIO_INVALID -1
17 @@ -230,6 +232,8 @@ static ssize_t gpiommc_config_attr_show(
18 unsigned int gpio;
19 int err = 0;
20
21 + mutex_lock(&dev->mutex);
22 +
23 if (attr == &gpiommc_attr_DI) {
24 gpio = dev->pdata.pins.gpio_di;
25 if (gpio == GPIO_INVALID)
26 @@ -290,6 +294,8 @@ static ssize_t gpiommc_config_attr_show(
27 WARN_ON(1);
28 err = -ENOSYS;
29 out:
30 + mutex_unlock(&dev->mutex);
31 +
32 return err ? err : count;
33 }
34
35 @@ -349,6 +355,8 @@ static ssize_t gpiommc_config_attr_store
36 int err = -EINVAL;
37 unsigned long data;
38
39 + mutex_lock(&dev->mutex);
40 +
41 if (attr == &gpiommc_attr_register) {
42 err = strict_strtoul(page, 10, &data);
43 if (err)
44 @@ -474,6 +482,8 @@ static ssize_t gpiommc_config_attr_store
45 WARN_ON(1);
46 err = -ENOSYS;
47 out:
48 + mutex_unlock(&dev->mutex);
49 +
50 return err ? err : count;
51 }
52
53 @@ -510,6 +520,7 @@ static struct config_item *gpiommc_make_
54 if (!dev)
55 return NULL;
56
57 + mutex_init(&dev->mutex);
58 config_item_init_type_name(&dev->item, name,
59 &gpiommc_dev_ci_type);
60
This page took 0.044756 seconds and 5 git commands to generate.