[PATCH 3/3] zram: Replace pr_* with dev_*

Salah Triki
2015-08-06T23:04:18Z

dev_* attach the messages to the devices.
---
drivers/block/zram/zram_drv.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 1c2f8b9..73f3453 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -589,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\n",
+ ret, index);
return ret;
}

@@ -623,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_info(disk_to_dev(zram->disk), "Unable to allocate temp memory\n");
ret = -ENOMEM;
goto out_cleanup;
}
@@ -708,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\n",
+ ret);
goto out;
}
src = zstrm->buffer;
@@ -720,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_info(disk_to_dev(zram->disk), "Error allocating memory for compressed page: %u, size=%zu\n",
index, clen);
ret = -ENOMEM;
goto out;
@@ -1039,15 +1041,15 @@ 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",
- zram->compressor);
+ dev_info(dev, "Cannot initialise %s compressing backend\n",
+ zram->compressor);
err = PTR_ERR(comp);
goto out_free_meta;
}

down_write(&zram->init_lock);
if (init_done(zram)) {
- pr_info("Cannot change disksize for initialized device\n");
+ dev_info(dev, "Cannot change disksize for initialized device\n");
err = -EBUSY;
goto out_destroy_comp;
}
@@ -1206,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(disk_to_dev(zram->disk), "Error allocating disk queue for device %d\n",
device_id);
ret = -ENOMEM;
goto out_free_idr;
@@ -1217,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(disk_to_dev(zram->disk), "Error allocating disk structure for device %d\n",
device_id);
ret = -ENOMEM;
goto out_free_queue;
@@ -1266,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\n",
+ zram->disk->disk_name);
return device_id;

out_free_disk:
@@ -1321,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\n",
+ zram->disk->disk_name);

idr_remove(&zram_index_idr, zram->disk->first_minor);
blk_cleanup_queue(zram->disk->queue);
--
1.9.1