Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp939320pxb; Wed, 3 Mar 2021 21:50:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzm0L68gs1WS8FWy3EeeLZAPYc2WVPeM1ribbqKwKpr4SgJiiCLxjVhM8I1XD9FgacyAYBP X-Received: by 2002:a05:6402:1398:: with SMTP id b24mr2490859edv.108.1614837013534; Wed, 03 Mar 2021 21:50:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614837013; cv=none; d=google.com; s=arc-20160816; b=GbC2CFxuy+8jSEDH9WnNT+bxH0tBa3Zp9Ko8eZygAClpaUZtihz5AkbTUa+ed1xO2V G/pFclL8o8D9eQjnc8drvSGHpRiT5j9BvwUN74Q+q/p6/F+1wZAXBR0pxJcdy2VgFtX3 gLci9frEFwM4sv3SrSQ2Y+H/jKfz6Opu61Dvfv5blEJluDBfK/iAORk39bjrytz6Qh3V J+Vv7owv3Cdrk2+OCIM+aOzQN9FYS4Y4uqhTDbKz6q6i1j1VH4YwOSKjPauTzUAZhtp4 /2AZYwl3AbZYYdPLIv2ydYtvXvwsmhaoSBWF1OP6MFlJUQJS7XSOw1L1WNj0z1VDMwg9 Qumw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=GyggWr6aAXYZ8Ifw6iUNpXFEHKzudTJVITHV+1rO9U4=; b=oHSr+NdSKqv4Iz24SlslGOOyAEu2vqD7GvizQQqPNKA9x5nIiLTb0sTFRP70dcrfKj Fvua/c6kZx8KRKRTzBv2fm5EUQd01iZUxm59rjx4N0Nu5OD7QEvFXO7gdh+hpaPLnaWr hnAR1K5/G3SlNzAundwHcLaqsQAcgUGt+v3d2/4LQuayiGvWldVzMiJMjgUPV3B74FSa nvYsD303IiSXIV3/DHY7Rak8sjJ0OIrGwnz0BI7Q+9+bFrpaV1zIds72EXaFSdeR7zbK vrFtLTuPKP4oPiziUnWlIFi2sbD5ZiGJmnIl0Ho2R67UUA2PXHt9/tgjk6v4C6mk1Z8L TD1A== 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 eb13si17966227edb.8.2021.03.03.21.49.51; Wed, 03 Mar 2021 21:50:13 -0800 (PST) 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 S1836424AbhCBHCR (ORCPT + 99 others); Tue, 2 Mar 2021 02:02:17 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:13402 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1575085AbhCBGSn (ORCPT ); Tue, 2 Mar 2021 01:18:43 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4DqRgL5T2kzjTLM; Tue, 2 Mar 2021 14:14:54 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Tue, 2 Mar 2021 14:16:12 +0800 From: Tian Tao To: , , CC: Subject: [PATCH] w1: ds2708 and ds2781 use the new API kobj_to_dev() Date: Tue, 2 Mar 2021 14:17:02 +0800 Message-ID: <1614665822-12258-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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fix the below warnning which reported by coccicheck. /drivers/w1/slaves/w1_ds2780.c:93:60-61: WARNING opportunity for kobj_to_dev(). /drivers/w1/slaves/w1_ds2781.c:90:60-61: WARNING opportunity for kobj_to_dev(). Signed-off-by: Tian Tao --- drivers/w1/slaves/w1_ds2780.c | 2 +- drivers/w1/slaves/w1_ds2781.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c index c281fe5..9dcb5a5 100644 --- a/drivers/w1/slaves/w1_ds2780.c +++ b/drivers/w1/slaves/w1_ds2780.c @@ -90,7 +90,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { - struct device *dev = container_of(kobj, struct device, kobj); + struct device *dev = kobj_to_dev(kobj); return w1_ds2780_io(dev, buf, off, count, 0); } diff --git a/drivers/w1/slaves/w1_ds2781.c b/drivers/w1/slaves/w1_ds2781.c index f0d393a..2cb7c02 100644 --- a/drivers/w1/slaves/w1_ds2781.c +++ b/drivers/w1/slaves/w1_ds2781.c @@ -87,7 +87,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { - struct device *dev = container_of(kobj, struct device, kobj); + struct device *dev = kobj_to_dev(kobj); return w1_ds2781_io(dev, buf, off, count, 0); } -- 2.7.4