Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84219
b: refs/heads/master
c: 49dfc29
h: refs/heads/master
i:
  84217: 82782bf
  84215: 56140f6
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Dec 26, 2007
1 parent 4d8d13f commit d89b5b4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 732aeacff6b2fcf3750cad9018bdd663a21a6a12
refs/heads/master: 49dfc299288fe183b62a3f679a40c91b482d6d73
12 changes: 5 additions & 7 deletions trunk/drivers/mtd/ubi/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static int ubi_sysfs_init(struct ubi_device *ubi)
int err;

ubi->dev.release = dev_release;
ubi->dev.devt = MKDEV(ubi->major, 0);
ubi->dev.devt = ubi->cdev.dev;
ubi->dev.class = ubi_class;
sprintf(&ubi->dev.bus_id[0], UBI_NAME_STR"%d", ubi->ubi_num);
err = device_register(&ubi->dev);
Expand Down Expand Up @@ -278,12 +278,11 @@ static int uif_init(struct ubi_device *ubi)
return err;
}

ubi_assert(MINOR(dev) == 0);
cdev_init(&ubi->cdev, &ubi_cdev_operations);
ubi->major = MAJOR(dev);
dbg_msg("%s major is %u", ubi->ubi_name, ubi->major);
dbg_msg("%s major is %u", ubi->ubi_name, MAJOR(dev));
ubi->cdev.owner = THIS_MODULE;

dev = MKDEV(ubi->major, 0);
err = cdev_add(&ubi->cdev, dev, 1);
if (err) {
ubi_err("cannot add character device %s", ubi->ubi_name);
Expand All @@ -309,8 +308,7 @@ static int uif_init(struct ubi_device *ubi)
out_cdev:
cdev_del(&ubi->cdev);
out_unreg:
unregister_chrdev_region(MKDEV(ubi->major, 0),
ubi->vtbl_slots + 1);
unregister_chrdev_region(ubi->cdev.dev, ubi->vtbl_slots + 1);
return err;
}

Expand All @@ -323,7 +321,7 @@ static void uif_close(struct ubi_device *ubi)
kill_volumes(ubi);
ubi_sysfs_close(ubi);
cdev_del(&ubi->cdev);
unregister_chrdev_region(MKDEV(ubi->major, 0), ubi->vtbl_slots + 1);
unregister_chrdev_region(ubi->cdev.dev, ubi->vtbl_slots + 1);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/mtd/ubi/cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static struct ubi_device *major_to_device(int major)
int i;

for (i = 0; i < ubi_devices_cnt; i++)
if (ubi_devices[i] && ubi_devices[i]->major == major)
if (ubi_devices[i] && MAJOR(ubi_devices[i]->cdev.dev) == major)
return ubi_devices[i];
BUG();
return NULL;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/mtd/ubi/kapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int ubi_get_device_info(int ubi_num, struct ubi_device_info *di)
di->leb_size = ubi->leb_size;
di->min_io_size = ubi->min_io_size;
di->ro_mode = ubi->ro_mode;
di->cdev = MKDEV(ubi->major, 0);
di->cdev = ubi->cdev.dev;
return 0;
}
EXPORT_SYMBOL_GPL(ubi_get_device_info);
Expand All @@ -73,7 +73,7 @@ void ubi_get_volume_info(struct ubi_volume_desc *desc,
vi->usable_leb_size = vol->usable_leb_size;
vi->name_len = vol->name_len;
vi->name = vol->name;
vi->cdev = MKDEV(ubi->major, vi->vol_id + 1);
vi->cdev = vol->cdev.dev;
}
EXPORT_SYMBOL_GPL(ubi_get_volume_info);

Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/mtd/ubi/ubi.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ struct ubi_wl_entry;
* @cdev: character device object to create character device
* @ubi_num: UBI device number
* @ubi_name: UBI device name
* @major: character device major number
* @vol_count: number of volumes in this UBI device
* @volumes: volumes of this UBI device
* @volumes_lock: protects @volumes, @rsvd_pebs, @avail_pebs, beb_rsvd_pebs,
Expand Down Expand Up @@ -287,7 +286,6 @@ struct ubi_device {
struct device dev;
int ubi_num;
char ubi_name[sizeof(UBI_NAME_STR)+5];
int major;
int vol_count;
struct ubi_volume *volumes[UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT];
spinlock_t volumes_lock;
Expand Down
12 changes: 8 additions & 4 deletions trunk/drivers/mtd/ubi/vmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
struct ubi_volume *vol;
struct ubi_vtbl_record vtbl_rec;
uint64_t bytes;
dev_t dev;

if (ubi->ro_mode)
return -EROFS;
Expand Down Expand Up @@ -301,7 +302,8 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
/* Register character device for the volume */
cdev_init(&vol->cdev, &ubi_vol_cdev_operations);
vol->cdev.owner = THIS_MODULE;
err = cdev_add(&vol->cdev, MKDEV(ubi->major, vol_id + 1), 1);
dev = MKDEV(MAJOR(ubi->cdev.dev), vol_id + 1);
err = cdev_add(&vol->cdev, dev, 1);
if (err) {
ubi_err("cannot add character device for volume %d", vol_id);
goto out_mapping;
Expand All @@ -313,7 +315,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)

vol->dev.release = vol_release;
vol->dev.parent = &ubi->dev;
vol->dev.devt = MKDEV(ubi->major, vol->vol_id + 1);
vol->dev.devt = dev;
vol->dev.class = ubi_class;
sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id);
err = device_register(&vol->dev);
Expand Down Expand Up @@ -576,6 +578,7 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs)
int ubi_add_volume(struct ubi_device *ubi, int vol_id)
{
int err;
dev_t dev;
struct ubi_volume *vol = ubi->volumes[vol_id];

dbg_msg("add volume %d", vol_id);
Expand All @@ -585,7 +588,8 @@ int ubi_add_volume(struct ubi_device *ubi, int vol_id)
/* Register character device for the volume */
cdev_init(&vol->cdev, &ubi_vol_cdev_operations);
vol->cdev.owner = THIS_MODULE;
err = cdev_add(&vol->cdev, MKDEV(ubi->major, vol->vol_id + 1), 1);
dev = MKDEV(MAJOR(ubi->cdev.dev), vol->vol_id + 1);
err = cdev_add(&vol->cdev, dev, 1);
if (err) {
ubi_err("cannot add character device for volume %d", vol_id);
return err;
Expand All @@ -597,7 +601,7 @@ int ubi_add_volume(struct ubi_device *ubi, int vol_id)

vol->dev.release = vol_release;
vol->dev.parent = &ubi->dev;
vol->dev.devt = MKDEV(ubi->major, vol->vol_id + 1);
vol->dev.devt = dev;
vol->dev.class = ubi_class;
sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id);
err = device_register(&vol->dev);
Expand Down

0 comments on commit d89b5b4

Please sign in to comment.