Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4371125pxk; Wed, 30 Sep 2020 00:45:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywyzeU8g8TgiRM+JV1BZt4AoJtQ/08/BXgz0qQslyU0K/dHKDcVb+hOT+hkJRj/F+NVnqp X-Received: by 2002:a17:906:a207:: with SMTP id r7mr1576427ejy.32.1601451925149; Wed, 30 Sep 2020 00:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601451925; cv=none; d=google.com; s=arc-20160816; b=NAAQ3PezhFoVyf365vKPSTYKnRKZ4xnCU4RIPeJFnlo8L/o+EZRQjVGBrq54WQjiNV hKtcY1ioGypT/GsbGuk+dSc6C5UllI3j2eZlQLsbSfXO8HrXwk73kyIGAFy1nI/IEeDz 36FRtSVK0nJ3FR2C25N0ZaCPNhI9BTOdgOAz9zGYaYe7xI7dMy6nKXyxfGwTxqAMDG0x UJnwNuu8kMT4G4y0fSUpzxP80cZ8RcVZmP4MTVZvBz2Tj/BJrvVhHzQ5eaIaFH5ulkV2 OQ9dVSHbZMnO4ckXxLsFxLf2Eg4mb5OMKN00KkGvo9TKBmQTdgLdxdB2E7hlvkOHpdu5 nDKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:to :subject:from; bh=SsLkyRVqkwQNYQdWjlJDdsO+5q75RDkwJ8+8R2C+O8o=; b=OOi69xzFUDYAv0fyCCDRK4Di26pqC4hBXeuxotgOqZ21Q1miRMI343ngbf0dag3488 T3EX+BD/y29xd6Z/8iaVc/Ucv9eFsdfayUN3wsFclhL2T1ounLRCkOsut2njGVzCiMv/ 8Q1PQiDdx4OyFN1bM9ziv9xCAC/8QHMMzmpb9xstL6ttypVGKALSG17EMpFuxYSSMsX8 cz2U9xG9L3fP/PSy7EIZtGaR2tsgGP2rZpkerLBP4taR/n0pywO6F1uVvEnNakQRBMxM IBDgyjrFRf3IRur1J4/rIzeW2qQ3Lf+nkjDZQGFHrG/0haJnrSQUTgGYmK+c5KacWsuv zahg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x24si587443eju.477.2020.09.30.00.45.02; Wed, 30 Sep 2020 00:45:25 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728126AbgI3HlU (ORCPT + 99 others); Wed, 30 Sep 2020 03:41:20 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:44362 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725440AbgI3HlU (ORCPT ); Wed, 30 Sep 2020 03:41:20 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 6681F29AD2C From: Enric Balletbo i Serra Subject: Re: [PATCH] chrome: Use kobj_to_dev() instead To: Wang Qing , Benson Leung , Guenter Roeck , linux-kernel@vger.kernel.org References: <1601103820-14002-1-git-send-email-wangqing@vivo.com> Message-ID: <605f2193-e9ef-9e6a-4492-0cea620a2f18@collabora.com> Date: Wed, 30 Sep 2020 09:41:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <1601103820-14002-1-git-send-email-wangqing@vivo.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Wang Qing, Many thanks for your patch. On 26/9/20 9:03, Wang Qing wrote: > Use kobj_to_dev() instead of container_of(). > > Signed-off-by: Wang Qing > --- Applied for 5.10 > drivers/platform/chrome/cros_ec_sysfs.c | 2 +- > drivers/platform/chrome/cros_ec_vbc.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c > index d45ea5d..a643ea8 > --- a/drivers/platform/chrome/cros_ec_sysfs.c > +++ b/drivers/platform/chrome/cros_ec_sysfs.c > @@ -326,7 +326,7 @@ static struct attribute *__ec_attrs[] = { > static umode_t cros_ec_ctrl_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 cros_ec_dev *ec = to_cros_ec_dev(dev); > > if (a == &dev_attr_kb_wake_angle.attr && !ec->has_kb_wake_angle) > diff --git a/drivers/platform/chrome/cros_ec_vbc.c b/drivers/platform/chrome/cros_ec_vbc.c > index 46482d1..f3a70a3 > --- a/drivers/platform/chrome/cros_ec_vbc.c > +++ b/drivers/platform/chrome/cros_ec_vbc.c > @@ -17,7 +17,7 @@ static ssize_t vboot_context_read(struct file *filp, struct kobject *kobj, > struct bin_attribute *att, char *buf, > loff_t pos, size_t count) > { > - struct device *dev = container_of(kobj, struct device, kobj); > + struct device *dev = kobj_to_dev(kobj); > struct cros_ec_dev *ec = to_cros_ec_dev(dev); > struct cros_ec_device *ecdev = ec->ec_dev; > struct ec_params_vbnvcontext *params; > @@ -57,7 +57,7 @@ static ssize_t vboot_context_write(struct file *filp, struct kobject *kobj, > struct bin_attribute *attr, char *buf, > loff_t pos, size_t count) > { > - struct device *dev = container_of(kobj, struct device, kobj); > + struct device *dev = kobj_to_dev(kobj); > struct cros_ec_dev *ec = to_cros_ec_dev(dev); > struct cros_ec_device *ecdev = ec->ec_dev; > struct ec_params_vbnvcontext *params; >