Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1247213pxa; Thu, 20 Aug 2020 06:41:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwxS3XlZVBjZcX+HHolllJpucVENQeZuVsLJ+yhjZ00sxH2S2hH568jsrk/V9ReqsmYjuW X-Received: by 2002:a17:906:abc6:: with SMTP id kq6mr2494891ejb.216.1597930899145; Thu, 20 Aug 2020 06:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597930899; cv=none; d=google.com; s=arc-20160816; b=eUTAMzzjRpDp56FVRdX+AKi5eQywv9Ifyp5k5q7x2oNpvICDisZxQmacwX8Hsqofq0 kmlCgsxHes6QlYhW0eJOrFENeWy/2uQjpvJbtZooB1N9qtaTmyzjW8neE2uNJPK/vWgb 3JxcFCGctlrpCjh3xldysp0qfJk208jYPckHn1CHTYkMNG7kQ16bJNp0a3ojdJDuZsRi F/B4H5TqVC00ZK3DQ/2tRbfhvSeVuen7wGwAdGJDYd7MC3iDKIXQ1kaQQjrD2kyOL/R+ hYn1LpHeLKdnd9Si+1wk+SHhr6jHZqKnk+xTlleXiPRJYdYVRHsy/lJSBKlTt/zVa8yR 87mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=EXGy9NL41uGNZ0fjZdePvC/pBRwLmLcRKJxtZwALEps=; b=W2GPmVTNV2ehaPhsQUttEsuYuk5a1lDGoDeYL7TjI+N56+H/4Uz1UJb2Qr2qoYwv3n Jfy3isHzynYORtZhhY+F4omutjmGrRancUTk7gyWtIkF6VxytMNtiXx1CZ6bgxxFGzA3 bGA5PNK4KyXgYWORIvo6swZumxJ440mBX+S4UHBWNo3hhyMR+shrKL/eH6Dy2MZMexLm EbOCfrSfFxHTHTsd6MikDcInnt7TEegxRl/0Q+HqwcbUme3or+8BI3k0qeisYgLDv3M8 U27jNNI5l0q3QoMjfo6RFdtzHkD6CBC+316FUlObtJX0d4zXFnerx3EfClgVtyxpoEJT KHlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si1219939eji.729.2020.08.20.06.41.14; Thu, 20 Aug 2020 06:41:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727926AbgHTNko (ORCPT + 99 others); Thu, 20 Aug 2020 09:40:44 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:51600 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725820AbgHTJaW (ORCPT ); Thu, 20 Aug 2020 05:30:22 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5661E68EB82655C34646; Thu, 20 Aug 2020 17:30:19 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Thu, 20 Aug 2020 17:30:09 +0800 From: Tian Tao To: , CC: Subject: [PATCH] nvmem: core: Use kobj_to_dev() instead of container_of() Date: Thu, 20 Aug 2020 17:28:03 +0800 Message-ID: <1597915683-44794-1-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use kobj_to_dev() instead of container_of() Signed-off-by: Tian Tao --- drivers/nvmem/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 6cd3edb..7641e56 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -128,7 +128,7 @@ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj, if (attr->private) dev = attr->private; else - dev = container_of(kobj, struct device, kobj); + dev = kobj_to_dev(kobj); nvmem = to_nvmem_device(dev); /* Stop the user from reading */ @@ -168,7 +168,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj, if (attr->private) dev = attr->private; else - dev = container_of(kobj, struct device, kobj); + dev = kobj_to_dev(kobj); nvmem = to_nvmem_device(dev); /* Stop the user from writing */ @@ -219,7 +219,7 @@ static umode_t nvmem_bin_attr_get_umode(struct nvmem_device *nvmem) static umode_t nvmem_bin_attr_is_visible(struct kobject *kobj, struct bin_attribute *attr, int i) { - struct device *dev = container_of(kobj, struct device, kobj); + struct device *dev = kobj_to_dev(kobj); struct nvmem_device *nvmem = to_nvmem_device(dev); return nvmem_bin_attr_get_umode(nvmem); -- 2.7.4