Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2990234pxu; Mon, 14 Dec 2020 17:06:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJzp3kfzXqFglMal+muscEgxH3KmLRfnWxyY1zOVLoK45KZmcyGf1jyh+1mfSY12nlyK1O1h X-Received: by 2002:a17:906:6404:: with SMTP id d4mr24072873ejm.159.1607994397403; Mon, 14 Dec 2020 17:06:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607994397; cv=none; d=google.com; s=arc-20160816; b=yIFTz1WY3gTSwz8N3XsRNbfNaBks/YPAX3ti1nrZw5MlUpej+x9sHWwSriKoa6PJEM TTGgzx2QMA5vWIuvfBLgzjkJduGvKL+v65IfWYRs0FeBg+7lZNFE7fkmjqHP/ihvX4EG bxNU3W//GzQf5u9QTQlB9pbqauIH85q1V6bzeY5RaUpEu+SewaA4TYtm4FMhK+eBVNLN W5Vu6vs3D4OhNskUxT1vjMApz9firG11HcuHbVia9ytGH85eVTd+ZJ+JBQoK+ii8uQWp u79nlwuuiE8I3qrUg/FggE/Bnn9fwpLiTnOTEq+YJfHXI5a4VSS4GVncpmwQiOuj3orn Zt7A== 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=YfIXMVpdX2dPnD0lVqmR5T6kFV4jZIeJMVLthI6qps0=; b=s+FKQ+wcIBr7YdT0x9VyJAE96TYicEKNX/gzAJQL1prStm3Sqi2KSfCWuLjPbfl8iy Y4HkFuR5He+9Xf9ibIpa2bd/Uwuqu9cVm6Ww0VTsyjQ89wXckUo3eanvhxvF8y+15o01 IHQP2PJV7IWCuebq/QaE3U0KrSBwi8ofiW0E4+sPynSyiHO59iJU3QlSX+dq3bAG0/XA qe4uBMhb41FFH395SWpCIzmzI6Ivbxc9EPIQUXheUF6KzvLofniVWndmOS+eVzBx5J82 Fy1+S/nfrTXGP45R2FCruTvlZsLIil0xbYwW+rvVptmm3W38veMestVm5N92wGWSpmYs EZGw== 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 ck10si37427edb.568.2020.12.14.17.06.13; Mon, 14 Dec 2020 17:06:37 -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 S1726363AbgLOBBD (ORCPT + 99 others); Mon, 14 Dec 2020 20:01:03 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9176 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730037AbgLOBBD (ORCPT ); Mon, 14 Dec 2020 20:01:03 -0500 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Cw0K836Pqz15dSh; Tue, 15 Dec 2020 08:59:40 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Tue, 15 Dec 2020 09:00:14 +0800 From: Tian Tao To: CC: , Subject: [PATCH] power: supply: ds2780: Switch to using the new API kobj_to_dev() Date: Tue, 15 Dec 2020 09:00:24 +0800 Message-ID: <1607994024-32199-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 fixed the following coccicheck: drivers/power/supply/ds2780_battery.c:627:60-61: WARNING opportunity for kobj_to_dev() drivers/power/supply/ds2780_battery.c:672:60-61: WARNING opportunity for kobj_to_dev() drivers/power/supply/ds2780_battery.c:640:60-61: WARNING opportunity for kobj_to_dev() drivers/power/supply/ds2780_battery.c:685:60-61: WARNING opportunity for kobj_to_dev() Signed-off-by: Tian Tao --- drivers/power/supply/ds2780_battery.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/power/supply/ds2780_battery.c b/drivers/power/supply/ds2780_battery.c index dd57a47..2b8c90d 100644 --- a/drivers/power/supply/ds2780_battery.c +++ b/drivers/power/supply/ds2780_battery.c @@ -624,7 +624,7 @@ static ssize_t ds2780_read_param_eeprom_bin(struct file *filp, 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); struct power_supply *psy = to_power_supply(dev); struct ds2780_device_info *dev_info = to_ds2780_device_info(psy); @@ -637,7 +637,7 @@ static ssize_t ds2780_write_param_eeprom_bin(struct file *filp, 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); struct power_supply *psy = to_power_supply(dev); struct ds2780_device_info *dev_info = to_ds2780_device_info(psy); int ret; @@ -669,7 +669,7 @@ static ssize_t ds2780_read_user_eeprom_bin(struct file *filp, 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); struct power_supply *psy = to_power_supply(dev); struct ds2780_device_info *dev_info = to_ds2780_device_info(psy); @@ -682,7 +682,7 @@ static ssize_t ds2780_write_user_eeprom_bin(struct file *filp, 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); struct power_supply *psy = to_power_supply(dev); struct ds2780_device_info *dev_info = to_ds2780_device_info(psy); int ret; -- 2.7.4