From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Salah Triki <salah.triki@acm.org>
Cc: minchan@kernel.org, ngupta@vflare.org,
sergey.senozhatsky.work@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] zram: Replace pr_* with dev_*
Date: Wed, 5 Aug 2015 08:42:25 +0900 [thread overview]
Message-ID: <20150804234225.GA4430@swordfish> (raw)
In-Reply-To: <1438716174-3684-1-git-send-email-salah.triki@acm.org>
On (08/04/15 20:22), Salah Triki wrote:
> This patch replaces pr_info/pr_warn/pr_err with
> dev_info/dev_warn/dev_err.
Hi,
what's the benefit?
-ss
> Signed-off-by: Salah Triki <salah.triki@acm.org>
> ---
> 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
>
next prev parent reply other threads:[~2015-08-04 23:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 19:22 [PATCH] zram: Replace pr_* with dev_* Salah Triki
2015-08-04 23:42 ` Sergey Senozhatsky [this message]
2015-08-04 23:57 ` Sergey Senozhatsky
2015-08-05 1:16 ` Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150804234225.GA4430@swordfish \
--to=sergey.senozhatsky.work@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=salah.triki@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.