public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: cgel.zte@gmail.com, kbusch@kernel.org
Cc: axboe@fb.com, hch@lst.de, sagi@grimberg.me,
	linux-nvme@lists.infradead.org,
	ye xingchen <ye.xingchen@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH linux-next] nvme:Use the function kobj_to_dev()
Date: Wed, 10 Aug 2022 19:32:40 -0600	[thread overview]
Message-ID: <fd6af173-4530-5bb3-db61-6612e5d574bb@kernel.dk> (raw)
In-Reply-To: <20220811012910.15820-1-ye.xingchen@zte.com.cn>

On 8/10/22 7:29 PM, cgel.zte@gmail.com wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
> 
> Use kobj_to_dev() instead of open-coding it.

This:

> -	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct device *dev = kobj_to_dev(kobj);

just makes the code harder to read, imho. The original line, I can tell
what it does. The new line, I have to go look it up.

Is some tool suggesting these transformations? Because they look like a
bad idea to me, and we should fix that rather than make the code worse.

-- 
Jens Axboe



  reply	other threads:[~2022-08-11  1:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11  1:29 [PATCH linux-next] nvme:Use the function kobj_to_dev() cgel.zte
2022-08-11  1:32 ` Jens Axboe [this message]
2022-08-11  5:59   ` Christoph Hellwig

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=fd6af173-4530-5bb3-db61-6612e5d574bb@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=axboe@fb.com \
    --cc=cgel.zte@gmail.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=ye.xingchen@zte.com.cn \
    --cc=zealci@zte.com.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox