All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/nvme/host: Use kobj_to_dev() API
@ 2021-06-18 14:10 ` zhouchuangao
  0 siblings, 0 replies; 12+ messages in thread
From: zhouchuangao @ 2021-06-18 14:10 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-nvme, linux-kernel
  Cc: zhouchuangao

Use kobj_to_dev() API instead of container_of().

Signed-off-by: zhouchuangao <zhouchuangao@vivo.com>
---
 drivers/nvme/host/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 468d264..bec6965 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3195,7 +3195,7 @@ static struct attribute *nvme_ns_id_attrs[] = {
 static umode_t nvme_ns_id_attrs_are_visible(struct kobject *kobj,
 		struct attribute *a, int n)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct nvme_ns_ids *ids = &dev_to_ns_head(dev)->ids;
 
 	if (a == &dev_attr_uuid.attr) {
@@ -3467,7 +3467,7 @@ static struct attribute *nvme_dev_attrs[] = {
 static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,
 		struct attribute *a, int n)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
 
 	if (a == &dev_attr_delete_controller.attr && !ctrl->ops->delete_ctrl)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] drivers/nvme/host: Use kobj_to_dev() API
@ 2021-06-18 14:10 ` zhouchuangao
  0 siblings, 0 replies; 12+ messages in thread
From: zhouchuangao @ 2021-06-18 14:10 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-nvme, linux-kernel
  Cc: zhouchuangao

Use kobj_to_dev() API instead of container_of().

Signed-off-by: zhouchuangao <zhouchuangao@vivo.com>
---
 drivers/nvme/host/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 468d264..bec6965 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3195,7 +3195,7 @@ static struct attribute *nvme_ns_id_attrs[] = {
 static umode_t nvme_ns_id_attrs_are_visible(struct kobject *kobj,
 		struct attribute *a, int n)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct nvme_ns_ids *ids = &dev_to_ns_head(dev)->ids;
 
 	if (a == &dev_attr_uuid.attr) {
@@ -3467,7 +3467,7 @@ static struct attribute *nvme_dev_attrs[] = {
 static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,
 		struct attribute *a, int n)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
 
 	if (a == &dev_attr_delete_controller.attr && !ctrl->ops->delete_ctrl)
-- 
2.7.4


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] drivers/nvme/host: Use kobj_to_dev() API
  2021-06-18 14:10 ` zhouchuangao
@ 2021-06-18 14:18   ` Christoph Hellwig
  -1 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2021-06-18 14:18 UTC (permalink / raw)
  To: zhouchuangao
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-nvme, linux-kernel

On Fri, Jun 18, 2021 at 07:10:58AM -0700, zhouchuangao wrote:
> Use kobj_to_dev() API instead of container_of().

Why?  That just makes the code harder to read.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drivers/nvme/host: Use kobj_to_dev() API
@ 2021-06-18 14:18   ` Christoph Hellwig
  0 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2021-06-18 14:18 UTC (permalink / raw)
  To: zhouchuangao
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-nvme, linux-kernel

On Fri, Jun 18, 2021 at 07:10:58AM -0700, zhouchuangao wrote:
> Use kobj_to_dev() API instead of container_of().

Why?  That just makes the code harder to read.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re:Re: [PATCH] drivers/nvme/host: Use kobj_to_dev() API
  2021-06-18 14:18   ` Christoph Hellwig
@ 2021-06-19  5:01     ` 周传高
  -1 siblings, 0 replies; 12+ messages in thread
From: 周传高 @ 2021-06-19  5:01 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-nvme, linux-kernel


>On Fri, Jun 18, 2021 at 07:10:58AM -0700, zhouchuangao wrote:
>> Use kobj_to_dev() API instead of container_of().
>
>Why?  That just makes the code harder to read.

In my opinion, the kobj_to_dev() interface is provided by the kernel so that
we can get device based on kobj without having to pass more parameters.
I think it's easier to use.

Thansk,
zhouchaungao


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re:Re: [PATCH] drivers/nvme/host: Use kobj_to_dev() API
@ 2021-06-19  5:01     ` 周传高
  0 siblings, 0 replies; 12+ messages in thread
From: 周传高 @ 2021-06-19  5:01 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-nvme, linux-kernel


>On Fri, Jun 18, 2021 at 07:10:58AM -0700, zhouchuangao wrote:
>> Use kobj_to_dev() API instead of container_of().
>
>Why?  That just makes the code harder to read.

In my opinion, the kobj_to_dev() interface is provided by the kernel so that
we can get device based on kobj without having to pass more parameters.
I think it's easier to use.

Thansk,
zhouchaungao

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: [PATCH] drivers/nvme/host: Use kobj_to_dev() API
  2021-06-19  5:01     ` 周传高
@ 2021-06-20 17:27       ` Keith Busch
  -1 siblings, 0 replies; 12+ messages in thread
From: Keith Busch @ 2021-06-20 17:27 UTC (permalink / raw)
  To: 周传高
  Cc: Christoph Hellwig, Jens Axboe, Sagi Grimberg, linux-nvme, linux-kernel

On Sat, Jun 19, 2021 at 01:01:34PM +0800, 周传高 wrote:
> >On Fri, Jun 18, 2021 at 07:10:58AM -0700, zhouchuangao wrote:
> >> Use kobj_to_dev() API instead of container_of().
> >
> >Why?  That just makes the code harder to read.
> 
> In my opinion, the kobj_to_dev() interface is provided by the kernel so that
> we can get device based on kobj without having to pass more parameters.
> I think it's easier to use.

This same patch has been proposed and rejected numerous times. Do we
need to place a comment in the code to prevent future requests?

http://lists.infradead.org/pipermail/linux-nvme/2021-March/023316.html
http://lists.infradead.org/pipermail/linux-nvme/2021-February/023060.html
http://lists.infradead.org/pipermail/linux-nvme/2020-September/019462.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: [PATCH] drivers/nvme/host: Use kobj_to_dev() API
@ 2021-06-20 17:27       ` Keith Busch
  0 siblings, 0 replies; 12+ messages in thread
From: Keith Busch @ 2021-06-20 17:27 UTC (permalink / raw)
  To: 周传高
  Cc: Christoph Hellwig, Jens Axboe, Sagi Grimberg, linux-nvme, linux-kernel

On Sat, Jun 19, 2021 at 01:01:34PM +0800, 周传高 wrote:
> >On Fri, Jun 18, 2021 at 07:10:58AM -0700, zhouchuangao wrote:
> >> Use kobj_to_dev() API instead of container_of().
> >
> >Why?  That just makes the code harder to read.
> 
> In my opinion, the kobj_to_dev() interface is provided by the kernel so that
> we can get device based on kobj without having to pass more parameters.
> I think it's easier to use.

This same patch has been proposed and rejected numerous times. Do we
need to place a comment in the code to prevent future requests?

http://lists.infradead.org/pipermail/linux-nvme/2021-March/023316.html
http://lists.infradead.org/pipermail/linux-nvme/2021-February/023060.html
http://lists.infradead.org/pipermail/linux-nvme/2020-September/019462.html

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drivers/nvme/host: Use kobj_to_dev() API
  2021-06-20 17:27       ` Keith Busch
@ 2021-06-21  3:11         ` Chaitanya Kulkarni
  -1 siblings, 0 replies; 12+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-21  3:11 UTC (permalink / raw)
  To: Keith Busch
  Cc: 周传高,
	Christoph Hellwig, Jens Axboe, Sagi Grimberg, linux-nvme,
	linux-kernel

Keith,

On 6/20/21 10:34, Keith Busch wrote:
> On Sat, Jun 19, 2021 at 01:01:34PM +0800, 周传高 wrote:
>>> On Fri, Jun 18, 2021 at 07:10:58AM -0700, zhouchuangao wrote:
>>>> Use kobj_to_dev() API instead of container_of().
>>> Why?  That just makes the code harder to read.
>> In my opinion, the kobj_to_dev() interface is provided by the kernel so that
>> we can get device based on kobj without having to pass more parameters.
>> I think it's easier to use.
> This same patch has been proposed and rejected numerous times. Do we
> need to place a comment in the code to prevent future requests?
>
> http://lists.infradead.org/pipermail/linux-nvme/2021-March/023316.html
> http://lists.infradead.org/pipermail/linux-nvme/2021-February/023060.html
> http://lists.infradead.org/pipermail/linux-nvme/2020-September/019462.html
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
>

Just sent a patch with your suggested-by see if that is useful.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drivers/nvme/host: Use kobj_to_dev() API
@ 2021-06-21  3:11         ` Chaitanya Kulkarni
  0 siblings, 0 replies; 12+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-21  3:11 UTC (permalink / raw)
  To: Keith Busch
  Cc: 周传高,
	Christoph Hellwig, Jens Axboe, Sagi Grimberg, linux-nvme,
	linux-kernel

Keith,

On 6/20/21 10:34, Keith Busch wrote:
> On Sat, Jun 19, 2021 at 01:01:34PM +0800, 周传高 wrote:
>>> On Fri, Jun 18, 2021 at 07:10:58AM -0700, zhouchuangao wrote:
>>>> Use kobj_to_dev() API instead of container_of().
>>> Why?  That just makes the code harder to read.
>> In my opinion, the kobj_to_dev() interface is provided by the kernel so that
>> we can get device based on kobj without having to pass more parameters.
>> I think it's easier to use.
> This same patch has been proposed and rejected numerous times. Do we
> need to place a comment in the code to prevent future requests?
>
> http://lists.infradead.org/pipermail/linux-nvme/2021-March/023316.html
> http://lists.infradead.org/pipermail/linux-nvme/2021-February/023060.html
> http://lists.infradead.org/pipermail/linux-nvme/2020-September/019462.html
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
>

Just sent a patch with your suggested-by see if that is useful.


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drivers/nvme/host: Use kobj_to_dev() API
  2021-06-18 14:18   ` Christoph Hellwig
@ 2021-06-21 10:18     ` Enrico Weigelt, metux IT consult
  -1 siblings, 0 replies; 12+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2021-06-21 10:18 UTC (permalink / raw)
  To: Christoph Hellwig, zhouchuangao
  Cc: Keith Busch, Jens Axboe, Sagi Grimberg, linux-nvme, linux-kernel

On 18.06.21 16:18, Christoph Hellwig wrote:
> On Fri, Jun 18, 2021 at 07:10:58AM -0700, zhouchuangao wrote:
>> Use kobj_to_dev() API instead of container_of().
> 
> Why?  That just makes the code harder to read.

Why so ? Why to we have kobj_to_dev() at all ?
Do you suggest, we shall get rid of it (and all similar ones) ?

--mtx

-- 
---
Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert
werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren
GPG/PGP-Schlüssel zu.
---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drivers/nvme/host: Use kobj_to_dev() API
@ 2021-06-21 10:18     ` Enrico Weigelt, metux IT consult
  0 siblings, 0 replies; 12+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2021-06-21 10:18 UTC (permalink / raw)
  To: Christoph Hellwig, zhouchuangao
  Cc: Keith Busch, Jens Axboe, Sagi Grimberg, linux-nvme, linux-kernel

On 18.06.21 16:18, Christoph Hellwig wrote:
> On Fri, Jun 18, 2021 at 07:10:58AM -0700, zhouchuangao wrote:
>> Use kobj_to_dev() API instead of container_of().
> 
> Why?  That just makes the code harder to read.

Why so ? Why to we have kobj_to_dev() at all ?
Do you suggest, we shall get rid of it (and all similar ones) ?

--mtx

-- 
---
Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert
werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren
GPG/PGP-Schlüssel zu.
---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-06-21 10:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 14:10 [PATCH] drivers/nvme/host: Use kobj_to_dev() API zhouchuangao
2021-06-18 14:10 ` zhouchuangao
2021-06-18 14:18 ` Christoph Hellwig
2021-06-18 14:18   ` Christoph Hellwig
2021-06-19  5:01   ` 周传高
2021-06-19  5:01     ` 周传高
2021-06-20 17:27     ` Keith Busch
2021-06-20 17:27       ` Keith Busch
2021-06-21  3:11       ` Chaitanya Kulkarni
2021-06-21  3:11         ` Chaitanya Kulkarni
2021-06-21 10:18   ` Enrico Weigelt, metux IT consult
2021-06-21 10:18     ` Enrico Weigelt, metux IT consult

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.