Skip to content

Commit

Permalink
UBI: extend UBI layer debug/messaging capabilities - cosmetics
Browse files Browse the repository at this point in the history
Some cosmetic fixes to the patch "UBI: Extend UBI layer debug/messaging
capabilities".

Signed-off-by: Tanya Brokhman <tlinder@codeaurora.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
  • Loading branch information
Tanya Brokhman authored and Richard Weinberger committed Jan 28, 2015
1 parent fee1756 commit 45fc5c8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 22 deletions.
6 changes: 3 additions & 3 deletions drivers/mtd/ubi/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,

/* Make sure ubi_num is not busy */
if (ubi_devices[ubi_num]) {
ubi_err(ubi, "ubi%d already exists", ubi_num);
ubi_err(ubi, "already exists");
return -EEXIST;
}
}
Expand Down Expand Up @@ -973,7 +973,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
mutex_init(&ubi->fm_mutex);
init_rwsem(&ubi->fm_sem);

ubi_msg(ubi, "attaching mtd%d to ubi%d", mtd->index, ubi_num);
ubi_msg(ubi, "attaching mtd%d", mtd->index);

err = io_init(ubi, max_beb_per1024);
if (err)
Expand Down Expand Up @@ -1428,7 +1428,7 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp)
}

if (len == 0) {
pr_err("UBI warning: empty 'mtd=' parameter - ignored\n");
pr_warn("UBI warning: empty 'mtd=' parameter - ignored\n");
return 0;
}

Expand Down
9 changes: 4 additions & 5 deletions drivers/mtd/ubi/cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@

/**
* get_exclusive - get exclusive access to an UBI volume.
* @ubi: UBI device description object
* @desc: volume descriptor
*
* This function changes UBI volume open mode to "exclusive". Returns previous
* mode value (positive integer) in case of success and a negative error code
* in case of failure.
*/
static int get_exclusive(struct ubi_device *ubi, struct ubi_volume_desc *desc)
static int get_exclusive(struct ubi_volume_desc *desc)
{
int users, err;
struct ubi_volume *vol = desc->vol;
Expand All @@ -64,7 +63,7 @@ static int get_exclusive(struct ubi_device *ubi, struct ubi_volume_desc *desc)
users = vol->readers + vol->writers + vol->exclusive + vol->metaonly;
ubi_assert(users > 0);
if (users > 1) {
ubi_err(ubi, "%d users for volume %d", users, vol->vol_id);
ubi_err(vol->ubi, "%d users for volume %d", users, vol->vol_id);
err = -EBUSY;
} else {
vol->readers = vol->writers = vol->metaonly = 0;
Expand Down Expand Up @@ -423,7 +422,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
break;
}

err = get_exclusive(ubi, desc);
err = get_exclusive(desc);
if (err < 0)
break;

Expand Down Expand Up @@ -459,7 +458,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
req.bytes < 0 || req.lnum >= vol->usable_leb_size)
break;

err = get_exclusive(ubi, desc);
err = get_exclusive(desc);
if (err < 0)
break;

Expand Down
3 changes: 1 addition & 2 deletions drivers/mtd/ubi/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1419,8 +1419,7 @@ int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len)

fail:
ubi_err(ubi, "self-check failed for PEB %d", pnum);
ubi_msg(ubi, "hex dump of the %d-%d region",
offset, offset + len);
ubi_msg(ubi, "hex dump of the %d-%d region", offset, offset + len);
print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, buf, len, 1);
err = -EINVAL;
error:
Expand Down
7 changes: 3 additions & 4 deletions drivers/mtd/ubi/vtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,14 +655,13 @@ static int init_volumes(struct ubi_device *ubi,

/**
* check_av - check volume attaching information.
* @ubi: UBI device description object
* @vol: UBI volume description object
* @av: volume attaching information
*
* This function returns zero if the volume attaching information is consistent
* to the data read from the volume tabla, and %-EINVAL if not.
*/
static int check_av(const struct ubi_device *ubi, const struct ubi_volume *vol,
static int check_av(const struct ubi_volume *vol,
const struct ubi_ainf_volume *av)
{
int err;
Expand Down Expand Up @@ -690,7 +689,7 @@ static int check_av(const struct ubi_device *ubi, const struct ubi_volume *vol,
return 0;

bad:
ubi_err(ubi, "bad attaching information, error %d", err);
ubi_err(vol->ubi, "bad attaching information, error %d", err);
ubi_dump_av(av);
ubi_dump_vol_info(vol);
return -EINVAL;
Expand Down Expand Up @@ -753,7 +752,7 @@ static int check_attaching_info(const struct ubi_device *ubi,
ubi_msg(ubi, "finish volume %d removal", av->vol_id);
ubi_remove_av(ai, av);
} else if (av) {
err = check_av(ubi, vol, av);
err = check_av(vol, av);
if (err)
return err;
}
Expand Down
10 changes: 2 additions & 8 deletions drivers/mtd/ubi/wl.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,8 @@ struct ubi_wl_entry *ubi_wl_get_fm_peb(struct ubi_device *ubi, int anchor)
{
struct ubi_wl_entry *e = NULL;

if (!ubi->free.rb_node || (ubi->free_count - ubi->beb_rsvd_pebs < 1)) {
ubi_warn(ubi, "Can't get peb for fastmap:anchor=%d, free_cnt=%d, reserved=%d",
anchor, ubi->free_count, ubi->beb_rsvd_pebs);
if (!ubi->free.rb_node || (ubi->free_count - ubi->beb_rsvd_pebs < 1))
goto out;
}

if (anchor)
e = find_anchor_wl_entry(&ubi->free);
Expand Down Expand Up @@ -1806,11 +1803,8 @@ int ubi_thread(void *u)
for (;;) {
int err;

if (kthread_should_stop()) {
ubi_msg(ubi, "background thread \"%s\" should stop, PID %d",
ubi->bgt_name, task_pid_nr(current));
if (kthread_should_stop())
break;
}

if (try_to_freeze())
continue;
Expand Down

0 comments on commit 45fc5c8

Please sign in to comment.