aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/vmt.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-07-22 08:25:02 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-10-14 06:10:20 -0400
commit8bc22961966b845aa5f965be30771902146c2fcc (patch)
treebfa7236da8184560f85fdeb2ad4d565995e237ac /drivers/mtd/ubi/vmt.c
parentdcec4c3bdc4d5f4bd2d858ee1ce11e3424cbaed7 (diff)
UBI: fix sparse warnings
Fix "symbol shadows an earlier one" warnings. Although they are harmless but it does not hurt to fix them and make sparse happy. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/vmt.c')
-rw-r--r--drivers/mtd/ubi/vmt.c70
1 files changed, 37 insertions, 33 deletions
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index ea0d5c825ab4..88629a320c2b 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -37,21 +37,21 @@ static ssize_t vol_attribute_show(struct device *dev,
37 struct device_attribute *attr, char *buf); 37 struct device_attribute *attr, char *buf);
38 38
39/* Device attributes corresponding to files in '/<sysfs>/class/ubi/ubiX_Y' */ 39/* Device attributes corresponding to files in '/<sysfs>/class/ubi/ubiX_Y' */
40static struct device_attribute vol_reserved_ebs = 40static struct device_attribute attr_vol_reserved_ebs =
41 __ATTR(reserved_ebs, S_IRUGO, vol_attribute_show, NULL); 41 __ATTR(reserved_ebs, S_IRUGO, vol_attribute_show, NULL);
42static struct device_attribute vol_type = 42static struct device_attribute attr_vol_type =
43 __ATTR(type, S_IRUGO, vol_attribute_show, NULL); 43 __ATTR(type, S_IRUGO, vol_attribute_show, NULL);
44static struct device_attribute vol_name = 44static struct device_attribute attr_vol_name =
45 __ATTR(name, S_IRUGO, vol_attribute_show, NULL); 45 __ATTR(name, S_IRUGO, vol_attribute_show, NULL);
46static struct device_attribute vol_corrupted = 46static struct device_attribute attr_vol_corrupted =
47 __ATTR(corrupted, S_IRUGO, vol_attribute_show, NULL); 47 __ATTR(corrupted, S_IRUGO, vol_attribute_show, NULL);
48static struct device_attribute vol_alignment = 48static struct device_attribute attr_vol_alignment =
49 __ATTR(alignment, S_IRUGO, vol_attribute_show, NULL); 49 __ATTR(alignment, S_IRUGO, vol_attribute_show, NULL);
50static struct device_attribute vol_usable_eb_size = 50static struct device_attribute attr_vol_usable_eb_size =
51 __ATTR(usable_eb_size, S_IRUGO, vol_attribute_show, NULL); 51 __ATTR(usable_eb_size, S_IRUGO, vol_attribute_show, NULL);
52static struct device_attribute vol_data_bytes = 52static struct device_attribute attr_vol_data_bytes =
53 __ATTR(data_bytes, S_IRUGO, vol_attribute_show, NULL); 53 __ATTR(data_bytes, S_IRUGO, vol_attribute_show, NULL);
54static struct device_attribute vol_upd_marker = 54static struct device_attribute attr_vol_upd_marker =
55 __ATTR(upd_marker, S_IRUGO, vol_attribute_show, NULL); 55 __ATTR(upd_marker, S_IRUGO, vol_attribute_show, NULL);
56 56
57/* 57/*
@@ -78,23 +78,27 @@ static ssize_t vol_attribute_show(struct device *dev,
78 spin_unlock(&vol->ubi->volumes_lock); 78 spin_unlock(&vol->ubi->volumes_lock);
79 return -ENODEV; 79 return -ENODEV;
80 } 80 }
81 if (attr == &vol_reserved_ebs) 81 if (attr == &attr_vol_reserved_ebs)
82 ret = sprintf(buf, "%d\n", vol->reserved_pebs); 82 ret = sprintf(buf, "%d\n", vol->reserved_pebs);
83 else if (attr == &vol_type) { 83 else if (attr == &attr_vol_type) {
84 const char *tp; 84 const char *tp;
85 tp = vol->vol_type == UBI_DYNAMIC_VOLUME ? "dynamic" : "static"; 85
86 if (vol->vol_type == UBI_DYNAMIC_VOLUME)
87 tp = "dynamic";
88 else
89 tp = "static";
86 ret = sprintf(buf, "%s\n", tp); 90 ret = sprintf(buf, "%s\n", tp);
87 } else if (attr == &vol_name) 91 } else if (attr == &attr_vol_name)
88 ret = sprintf(buf, "%s\n", vol->name); 92 ret = sprintf(buf, "%s\n", vol->name);
89 else if (attr == &vol_corrupted) 93 else if (attr == &attr_vol_corrupted)
90 ret = sprintf(buf, "%d\n", vol->corrupted); 94 ret = sprintf(buf, "%d\n", vol->corrupted);
91 else if (attr == &vol_alignment) 95 else if (attr == &attr_vol_alignment)
92 ret = sprintf(buf, "%d\n", vol->alignment); 96 ret = sprintf(buf, "%d\n", vol->alignment);
93 else if (attr == &vol_usable_eb_size) { 97 else if (attr == &attr_vol_usable_eb_size) {
94 ret = sprintf(buf, "%d\n", vol->usable_leb_size); 98 ret = sprintf(buf, "%d\n", vol->usable_leb_size);
95 } else if (attr == &vol_data_bytes) 99 } else if (attr == &attr_vol_data_bytes)
96 ret = sprintf(buf, "%lld\n", vol->used_bytes); 100 ret = sprintf(buf, "%lld\n", vol->used_bytes);
97 else if (attr == &vol_upd_marker) 101 else if (attr == &attr_vol_upd_marker)
98 ret = sprintf(buf, "%d\n", vol->upd_marker); 102 ret = sprintf(buf, "%d\n", vol->upd_marker);
99 else 103 else
100 BUG(); 104 BUG();
@@ -126,28 +130,28 @@ static int volume_sysfs_init(struct ubi_device *ubi, struct ubi_volume *vol)
126{ 130{
127 int err; 131 int err;
128 132
129 err = device_create_file(&vol->dev, &vol_reserved_ebs); 133 err = device_create_file(&vol->dev, &attr_vol_reserved_ebs);
130 if (err) 134 if (err)
131 return err; 135 return err;
132 err = device_create_file(&vol->dev, &vol_type); 136 err = device_create_file(&vol->dev, &attr_vol_type);
133 if (err) 137 if (err)
134 return err; 138 return err;
135 err = device_create_file(&vol->dev, &vol_name); 139 err = device_create_file(&vol->dev, &attr_vol_name);
136 if (err) 140 if (err)
137 return err; 141 return err;
138 err = device_create_file(&vol->dev, &vol_corrupted); 142 err = device_create_file(&vol->dev, &attr_vol_corrupted);
139 if (err) 143 if (err)
140 return err; 144 return err;
141 err = device_create_file(&vol->dev, &vol_alignment); 145 err = device_create_file(&vol->dev, &attr_vol_alignment);
142 if (err) 146 if (err)
143 return err; 147 return err;
144 err = device_create_file(&vol->dev, &vol_usable_eb_size); 148 err = device_create_file(&vol->dev, &attr_vol_usable_eb_size);
145 if (err) 149 if (err)
146 return err; 150 return err;
147 err = device_create_file(&vol->dev, &vol_data_bytes); 151 err = device_create_file(&vol->dev, &attr_vol_data_bytes);
148 if (err) 152 if (err)
149 return err; 153 return err;
150 err = device_create_file(&vol->dev, &vol_upd_marker); 154 err = device_create_file(&vol->dev, &attr_vol_upd_marker);
151 if (err) 155 if (err)
152 return err; 156 return err;
153 return 0; 157 return 0;
@@ -159,14 +163,14 @@ static int volume_sysfs_init(struct ubi_device *ubi, struct ubi_volume *vol)
159 */ 163 */
160static void volume_sysfs_close(struct ubi_volume *vol) 164static void volume_sysfs_close(struct ubi_volume *vol)
161{ 165{
162 device_remove_file(&vol->dev, &vol_upd_marker); 166 device_remove_file(&vol->dev, &attr_vol_upd_marker);
163 device_remove_file(&vol->dev, &vol_data_bytes); 167 device_remove_file(&vol->dev, &attr_vol_data_bytes);
164 device_remove_file(&vol->dev, &vol_usable_eb_size); 168 device_remove_file(&vol->dev, &attr_vol_usable_eb_size);
165 device_remove_file(&vol->dev, &vol_alignment); 169 device_remove_file(&vol->dev, &attr_vol_alignment);
166 device_remove_file(&vol->dev, &vol_corrupted); 170 device_remove_file(&vol->dev, &attr_vol_corrupted);
167 device_remove_file(&vol->dev, &vol_name); 171 device_remove_file(&vol->dev, &attr_vol_name);
168 device_remove_file(&vol->dev, &vol_type); 172 device_remove_file(&vol->dev, &attr_vol_type);
169 device_remove_file(&vol->dev, &vol_reserved_ebs); 173 device_remove_file(&vol->dev, &attr_vol_reserved_ebs);
170 device_unregister(&vol->dev); 174 device_unregister(&vol->dev);
171} 175}
172 176