lkml.org 
[lkml]   [2022]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] NVMe: use kobj_to_dev()
Date
From: Minghao Chi <chi.minghao@zte.com.cn>

Use kobj_to_dev() instead of open-coding it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
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 510e3860358b..48d2bb0a4fad 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3267,7 +3267,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) {
@@ -3572,7 +3572,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.25.1

\
 
 \ /
  Last update: 2022-05-10 12:56    [W:0.058 / U:1.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site