aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-15 11:13:56 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 12:15:14 -0500
commit49dfc299288fe183b62a3f679a40c91b482d6d73 (patch)
treea4860162ae77f9c118619ec5562626c25a2f7800 /drivers/mtd
parent732aeacff6b2fcf3750cad9018bdd663a21a6a12 (diff)
UBI: remove redundant field
Remove redundant ubi->major field - we have it in ubi->cdev.dev already. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/build.c12
-rw-r--r--drivers/mtd/ubi/cdev.c2
-rw-r--r--drivers/mtd/ubi/kapi.c4
-rw-r--r--drivers/mtd/ubi/ubi.h2
-rw-r--r--drivers/mtd/ubi/vmt.c12
5 files changed, 16 insertions, 16 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 023653977a1a..b0791f795056 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -150,7 +150,7 @@ static int ubi_sysfs_init(struct ubi_device *ubi)
150 int err; 150 int err;
151 151
152 ubi->dev.release = dev_release; 152 ubi->dev.release = dev_release;
153 ubi->dev.devt = MKDEV(ubi->major, 0); 153 ubi->dev.devt = ubi->cdev.dev;
154 ubi->dev.class = ubi_class; 154 ubi->dev.class = ubi_class;
155 sprintf(&ubi->dev.bus_id[0], UBI_NAME_STR"%d", ubi->ubi_num); 155 sprintf(&ubi->dev.bus_id[0], UBI_NAME_STR"%d", ubi->ubi_num);
156 err = device_register(&ubi->dev); 156 err = device_register(&ubi->dev);
@@ -278,12 +278,11 @@ static int uif_init(struct ubi_device *ubi)
278 return err; 278 return err;
279 } 279 }
280 280
281 ubi_assert(MINOR(dev) == 0);
281 cdev_init(&ubi->cdev, &ubi_cdev_operations); 282 cdev_init(&ubi->cdev, &ubi_cdev_operations);
282 ubi->major = MAJOR(dev); 283 dbg_msg("%s major is %u", ubi->ubi_name, MAJOR(dev));
283 dbg_msg("%s major is %u", ubi->ubi_name, ubi->major);
284 ubi->cdev.owner = THIS_MODULE; 284 ubi->cdev.owner = THIS_MODULE;
285 285
286 dev = MKDEV(ubi->major, 0);
287 err = cdev_add(&ubi->cdev, dev, 1); 286 err = cdev_add(&ubi->cdev, dev, 1);
288 if (err) { 287 if (err) {
289 ubi_err("cannot add character device %s", ubi->ubi_name); 288 ubi_err("cannot add character device %s", ubi->ubi_name);
@@ -309,8 +308,7 @@ out_volumes:
309out_cdev: 308out_cdev:
310 cdev_del(&ubi->cdev); 309 cdev_del(&ubi->cdev);
311out_unreg: 310out_unreg:
312 unregister_chrdev_region(MKDEV(ubi->major, 0), 311 unregister_chrdev_region(ubi->cdev.dev, ubi->vtbl_slots + 1);
313 ubi->vtbl_slots + 1);
314 return err; 312 return err;
315} 313}
316 314
@@ -323,7 +321,7 @@ static void uif_close(struct ubi_device *ubi)
323 kill_volumes(ubi); 321 kill_volumes(ubi);
324 ubi_sysfs_close(ubi); 322 ubi_sysfs_close(ubi);
325 cdev_del(&ubi->cdev); 323 cdev_del(&ubi->cdev);
326 unregister_chrdev_region(MKDEV(ubi->major, 0), ubi->vtbl_slots + 1); 324 unregister_chrdev_region(ubi->cdev.dev, ubi->vtbl_slots + 1);
327} 325}
328 326
329/** 327/**
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index fe4da1e96c52..9771e7f410c1 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -61,7 +61,7 @@ static struct ubi_device *major_to_device(int major)
61 int i; 61 int i;
62 62
63 for (i = 0; i < ubi_devices_cnt; i++) 63 for (i = 0; i < ubi_devices_cnt; i++)
64 if (ubi_devices[i] && ubi_devices[i]->major == major) 64 if (ubi_devices[i] && MAJOR(ubi_devices[i]->cdev.dev) == major)
65 return ubi_devices[i]; 65 return ubi_devices[i];
66 BUG(); 66 BUG();
67 return NULL; 67 return NULL;
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c
index e1ef802a03a7..3bf2c951c2e5 100644
--- a/drivers/mtd/ubi/kapi.c
+++ b/drivers/mtd/ubi/kapi.c
@@ -46,7 +46,7 @@ int ubi_get_device_info(int ubi_num, struct ubi_device_info *di)
46 di->leb_size = ubi->leb_size; 46 di->leb_size = ubi->leb_size;
47 di->min_io_size = ubi->min_io_size; 47 di->min_io_size = ubi->min_io_size;
48 di->ro_mode = ubi->ro_mode; 48 di->ro_mode = ubi->ro_mode;
49 di->cdev = MKDEV(ubi->major, 0); 49 di->cdev = ubi->cdev.dev;
50 return 0; 50 return 0;
51} 51}
52EXPORT_SYMBOL_GPL(ubi_get_device_info); 52EXPORT_SYMBOL_GPL(ubi_get_device_info);
@@ -73,7 +73,7 @@ void ubi_get_volume_info(struct ubi_volume_desc *desc,
73 vi->usable_leb_size = vol->usable_leb_size; 73 vi->usable_leb_size = vol->usable_leb_size;
74 vi->name_len = vol->name_len; 74 vi->name_len = vol->name_len;
75 vi->name = vol->name; 75 vi->name = vol->name;
76 vi->cdev = MKDEV(ubi->major, vi->vol_id + 1); 76 vi->cdev = vol->cdev.dev;
77} 77}
78EXPORT_SYMBOL_GPL(ubi_get_volume_info); 78EXPORT_SYMBOL_GPL(ubi_get_volume_info);
79 79
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index 5e941a633030..318ce2543fb8 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -204,7 +204,6 @@ struct ubi_wl_entry;
204 * @cdev: character device object to create character device 204 * @cdev: character device object to create character device
205 * @ubi_num: UBI device number 205 * @ubi_num: UBI device number
206 * @ubi_name: UBI device name 206 * @ubi_name: UBI device name
207 * @major: character device major number
208 * @vol_count: number of volumes in this UBI device 207 * @vol_count: number of volumes in this UBI device
209 * @volumes: volumes of this UBI device 208 * @volumes: volumes of this UBI device
210 * @volumes_lock: protects @volumes, @rsvd_pebs, @avail_pebs, beb_rsvd_pebs, 209 * @volumes_lock: protects @volumes, @rsvd_pebs, @avail_pebs, beb_rsvd_pebs,
@@ -287,7 +286,6 @@ struct ubi_device {
287 struct device dev; 286 struct device dev;
288 int ubi_num; 287 int ubi_num;
289 char ubi_name[sizeof(UBI_NAME_STR)+5]; 288 char ubi_name[sizeof(UBI_NAME_STR)+5];
290 int major;
291 int vol_count; 289 int vol_count;
292 struct ubi_volume *volumes[UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT]; 290 struct ubi_volume *volumes[UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT];
293 spinlock_t volumes_lock; 291 spinlock_t volumes_lock;
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 58d6abe50bfc..6609c319c83c 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -192,6 +192,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
192 struct ubi_volume *vol; 192 struct ubi_volume *vol;
193 struct ubi_vtbl_record vtbl_rec; 193 struct ubi_vtbl_record vtbl_rec;
194 uint64_t bytes; 194 uint64_t bytes;
195 dev_t dev;
195 196
196 if (ubi->ro_mode) 197 if (ubi->ro_mode)
197 return -EROFS; 198 return -EROFS;
@@ -301,7 +302,8 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
301 /* Register character device for the volume */ 302 /* Register character device for the volume */
302 cdev_init(&vol->cdev, &ubi_vol_cdev_operations); 303 cdev_init(&vol->cdev, &ubi_vol_cdev_operations);
303 vol->cdev.owner = THIS_MODULE; 304 vol->cdev.owner = THIS_MODULE;
304 err = cdev_add(&vol->cdev, MKDEV(ubi->major, vol_id + 1), 1); 305 dev = MKDEV(MAJOR(ubi->cdev.dev), vol_id + 1);
306 err = cdev_add(&vol->cdev, dev, 1);
305 if (err) { 307 if (err) {
306 ubi_err("cannot add character device for volume %d", vol_id); 308 ubi_err("cannot add character device for volume %d", vol_id);
307 goto out_mapping; 309 goto out_mapping;
@@ -313,7 +315,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
313 315
314 vol->dev.release = vol_release; 316 vol->dev.release = vol_release;
315 vol->dev.parent = &ubi->dev; 317 vol->dev.parent = &ubi->dev;
316 vol->dev.devt = MKDEV(ubi->major, vol->vol_id + 1); 318 vol->dev.devt = dev;
317 vol->dev.class = ubi_class; 319 vol->dev.class = ubi_class;
318 sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id); 320 sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id);
319 err = device_register(&vol->dev); 321 err = device_register(&vol->dev);
@@ -576,6 +578,7 @@ out_free:
576int ubi_add_volume(struct ubi_device *ubi, int vol_id) 578int ubi_add_volume(struct ubi_device *ubi, int vol_id)
577{ 579{
578 int err; 580 int err;
581 dev_t dev;
579 struct ubi_volume *vol = ubi->volumes[vol_id]; 582 struct ubi_volume *vol = ubi->volumes[vol_id];
580 583
581 dbg_msg("add volume %d", vol_id); 584 dbg_msg("add volume %d", vol_id);
@@ -585,7 +588,8 @@ int ubi_add_volume(struct ubi_device *ubi, int vol_id)
585 /* Register character device for the volume */ 588 /* Register character device for the volume */
586 cdev_init(&vol->cdev, &ubi_vol_cdev_operations); 589 cdev_init(&vol->cdev, &ubi_vol_cdev_operations);
587 vol->cdev.owner = THIS_MODULE; 590 vol->cdev.owner = THIS_MODULE;
588 err = cdev_add(&vol->cdev, MKDEV(ubi->major, vol->vol_id + 1), 1); 591 dev = MKDEV(MAJOR(ubi->cdev.dev), vol->vol_id + 1);
592 err = cdev_add(&vol->cdev, dev, 1);
589 if (err) { 593 if (err) {
590 ubi_err("cannot add character device for volume %d", vol_id); 594 ubi_err("cannot add character device for volume %d", vol_id);
591 return err; 595 return err;
@@ -597,7 +601,7 @@ int ubi_add_volume(struct ubi_device *ubi, int vol_id)
597 601
598 vol->dev.release = vol_release; 602 vol->dev.release = vol_release;
599 vol->dev.parent = &ubi->dev; 603 vol->dev.parent = &ubi->dev;
600 vol->dev.devt = MKDEV(ubi->major, vol->vol_id + 1); 604 vol->dev.devt = dev;
601 vol->dev.class = ubi_class; 605 vol->dev.class = ubi_class;
602 sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id); 606 sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id);
603 err = device_register(&vol->dev); 607 err = device_register(&vol->dev);