linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme-core: Switch to using the new API kobj_to_dev()
@ 2021-02-20  9:10 Yang Li
  2021-02-20 18:46 ` Chaitanya Kulkarni
  2021-02-22 19:29 ` Keith Busch
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Li @ 2021-02-20  9:10 UTC (permalink / raw)
  To: kbusch; +Cc: axboe, hch, sagi, linux-nvme, linux-kernel, Yang Li

fixed the following coccicheck:
./drivers/nvme/host/core.c:3440:60-61: WARNING opportunity for
kobj_to_dev()
./drivers/nvme/host/core.c:3679:60-61: WARNING opportunity for
kobj_to_dev()

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.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 f13eb4d..d56590f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3437,7 +3437,7 @@ static ssize_t nsid_show(struct device *dev, struct device_attribute *attr,
 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) {
@@ -3676,7 +3676,7 @@ static DEVICE_ATTR(reconnect_delay, S_IRUGO | S_IWUSR,
 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)
-- 
1.8.3.1


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

* Re: [PATCH] nvme-core: Switch to using the new API kobj_to_dev()
  2021-02-20  9:10 [PATCH] nvme-core: Switch to using the new API kobj_to_dev() Yang Li
@ 2021-02-20 18:46 ` Chaitanya Kulkarni
  2021-02-22 19:29 ` Keith Busch
  1 sibling, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-20 18:46 UTC (permalink / raw)
  To: Yang Li, kbusch; +Cc: sagi, linux-kernel, linux-nvme, axboe, hch

On 2/20/21 01:15, Yang Li wrote:
> fixed the following coccicheck:
> ./drivers/nvme/host/core.c:3440:60-61: WARNING opportunity for
> kobj_to_dev()
> ./drivers/nvme/host/core.c:3679:60-61: WARNING opportunity for
> kobj_to_dev()
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>


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

* Re: [PATCH] nvme-core: Switch to using the new API kobj_to_dev()
  2021-02-20  9:10 [PATCH] nvme-core: Switch to using the new API kobj_to_dev() Yang Li
  2021-02-20 18:46 ` Chaitanya Kulkarni
@ 2021-02-22 19:29 ` Keith Busch
  1 sibling, 0 replies; 3+ messages in thread
From: Keith Busch @ 2021-02-22 19:29 UTC (permalink / raw)
  To: Yang Li; +Cc: axboe, hch, sagi, linux-nvme, linux-kernel

On Sat, Feb 20, 2021 at 05:10:18PM +0800, Yang Li wrote:
> fixed the following coccicheck:
> ./drivers/nvme/host/core.c:3440:60-61: WARNING opportunity for
> kobj_to_dev()
> ./drivers/nvme/host/core.c:3679:60-61: WARNING opportunity for
> kobj_to_dev()
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

This was rejected the last time it posted 6 months ago:

http://lists.infradead.org/pipermail/linux-nvme/2020-September/019463.html

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

end of thread, other threads:[~2021-02-22 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-20  9:10 [PATCH] nvme-core: Switch to using the new API kobj_to_dev() Yang Li
2021-02-20 18:46 ` Chaitanya Kulkarni
2021-02-22 19:29 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).