[PATCH] zram: Replace pr_* with dev_*

From: Salah Triki
Date: Tue Aug 04 2015 - 15:23:13 EST


This patch replaces pr_info/pr_warn/pr_err with
dev_info/dev_warn/dev_err.

Signed-off-by: Salah Triki <salah.triki@xxxxxxx>
---
drivers/block/zram/zram_drv.c | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index fb655e8..8eecb72 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -333,7 +333,8 @@ static ssize_t max_comp_streams_store(struct device *dev,
down_write(&zram->init_lock);
if (init_done(zram)) {
if (!zcomp_set_max_streams(zram->comp, num)) {
- pr_info("Cannot change max compression streams\n");
+ dev_warn(dev, "Cannot change max compression streams to %d",
+ num);
ret = -EINVAL;
goto out;
}
@@ -368,7 +369,7 @@ static ssize_t comp_algorithm_store(struct device *dev,
down_write(&zram->init_lock);
if (init_done(zram)) {
up_write(&zram->init_lock);
- pr_info("Can't change algorithm for initialized device\n");
+ dev_warn(dev, "Can't change algorithm for initialized device");
return -EBUSY;
}
strlcpy(zram->compressor, buf, sizeof(zram->compressor));
@@ -508,14 +509,15 @@ static struct zram_meta *zram_meta_alloc(int device_id, u64 disksize)
num_pages = disksize >> PAGE_SHIFT;
meta->table = vzalloc(num_pages * sizeof(*meta->table));
if (!meta->table) {
- pr_err("Error allocating zram address table\n");
+ dev_err("Error allocating zram address table for device %d",
+ device_id);
goto out_error;
}

snprintf(pool_name, sizeof(pool_name), "zram%d", device_id);
meta->mem_pool = zs_create_pool(pool_name, GFP_NOIO | __GFP_HIGHMEM);
if (!meta->mem_pool) {
- pr_err("Error creating memory pool\n");
+ dev_err("Error creating memory pool for device %d", device_id);
goto out_error;
}

@@ -587,7 +589,8 @@ static int zram_decompress_page(struct zram *zram, char *mem, u32 index)

/* Should NEVER happen. Return bio error if it does. */
if (unlikely(ret)) {
- pr_err("Decompression failed! err=%d, page=%u\n", ret, index);
+ dev_err(disk_to_dev(zram->disk), "Decompression failed! err=%d, page=%u",
+ ret, index);
return ret;
}

@@ -621,7 +624,7 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
uncmem = user_mem;

if (!uncmem) {
- pr_info("Unable to allocate temp memory\n");
+ dev_warn("Unable to allocate temp memory");
ret = -ENOMEM;
goto out_cleanup;
}
@@ -706,7 +709,8 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
}

if (unlikely(ret)) {
- pr_err("Compression failed! err=%d\n", ret);
+ dev_err(disk_to_dev(zram->disk), "Compression failed! err=%d",
+ ret);
goto out;
}
src = zstrm->buffer;
@@ -718,7 +722,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,

handle = zs_malloc(meta->mem_pool, clen);
if (!handle) {
- pr_info("Error allocating memory for compressed page: %u, size=%zu\n",
+ dev_warn(dev, "Error allocating memory for compressed page: %u, size=%zu",
index, clen);
ret = -ENOMEM;
goto out;
@@ -1037,7 +1041,7 @@ static ssize_t disksize_store(struct device *dev,

comp = zcomp_create(zram->compressor, zram->max_comp_streams);
if (IS_ERR(comp)) {
- pr_info("Cannot initialise %s compressing backend\n",
+ dev_info(dev, "Cannot initialise %s compressing backend",
zram->compressor);
err = PTR_ERR(comp);
goto out_free_meta;
@@ -1045,7 +1049,7 @@ static ssize_t disksize_store(struct device *dev,

down_write(&zram->init_lock);
if (init_done(zram)) {
- pr_info("Cannot change disksize for initialized device\n");
+ dev_warn(dev, "Cannot change disksize for initialized device");
err = -EBUSY;
goto out_destroy_comp;
}
@@ -1204,7 +1208,7 @@ static int zram_add(void)

queue = blk_alloc_queue(GFP_KERNEL);
if (!queue) {
- pr_err("Error allocating disk queue for device %d\n",
+ dev_err("Error allocating disk queue for device %d",
device_id);
ret = -ENOMEM;
goto out_free_idr;
@@ -1215,7 +1219,7 @@ static int zram_add(void)
/* gendisk structure */
zram->disk = alloc_disk(1);
if (!zram->disk) {
- pr_warn("Error allocating disk structure for device %d\n",
+ dev_warn("Error allocating disk structure for device %d",
device_id);
ret = -ENOMEM;
goto out_free_queue;
@@ -1264,14 +1268,15 @@ static int zram_add(void)
ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj,
&zram_disk_attr_group);
if (ret < 0) {
- pr_warn("Error creating sysfs group");
+ dev_warn(disk_to_dev(zram->disk), "Error creating sysfs group");
goto out_free_disk;
}
strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
zram->meta = NULL;
zram->max_comp_streams = 1;

- pr_info("Added device: %s\n", zram->disk->disk_name);
+ dev_info(disk_to_dev(zram->disk), "Added device: %s",
+ zram->disk->disk_name);
return device_id;

out_free_disk:
@@ -1319,7 +1324,8 @@ static int zram_remove(struct zram *zram)
zram_reset_device(zram);
bdput(bdev);

- pr_info("Removed device: %s\n", zram->disk->disk_name);
+ dev_info(disk_to_dev(zram->disk), "Removed device: %s",
+ zram->disk->disk_name);

idr_remove(&zram_index_idr, zram->disk->first_minor);
blk_cleanup_queue(zram->disk->queue);
@@ -1404,13 +1410,13 @@ static int __init zram_init(void)

ret = class_register(&zram_control_class);
if (ret) {
- pr_warn("Unable to register zram-control class\n");
+ dev_warn("Unable to register zram-control class");
return ret;
}

zram_major = register_blkdev(0, "zram");
if (zram_major <= 0) {
- pr_warn("Unable to get major number\n");
+ dev_warn("Unable to get major number");
class_unregister(&zram_control_class);
return -EBUSY;
}
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/