Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1939190pxk; Sat, 26 Sep 2020 10:13:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbFGEWEpxxIr8nHCRwg40WMfoS09Uf/RL48crbTrRkZT/YmEq61SFkBAOQZs+t/8t9Y/qo X-Received: by 2002:a17:906:7f06:: with SMTP id d6mr8042331ejr.553.1601140391979; Sat, 26 Sep 2020 10:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601140391; cv=none; d=google.com; s=arc-20160816; b=IslDzacFkrqPvahYgvGsAsfBffgdYPhqjiciyM6FB+5sur86OtoeiO7uJs7hfatCqJ 0TpxP1nEmR2Cb8C96+0QVJOwwXyiaTaOTtZ8qjLHw/ZTKkxtTcxIyxYzBL/ENmErRwS8 jDxz1JH8+RXl4VRloBXxPcSY0pdnCigHP2ARiIeF7KHl18dNWN7Sq4SHdwMm1XjDtZk/ tcW/hwCEZ70PVBp6YnOuoAZQ4tYxT+eABr4M0LqRVRHbopP1TILKJvX/kO3cqnw0pJzj LRAbHJrbAx31mZqzszUV1vppd7zE6LFkmnoZo/ZZv/f2HC4Ovt5AOvrbCKrYZpp9Ptnj JvyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4TNtZY7T1WFexHeXE2tjx8zSAuQoR2lBax7QorKn3Es=; b=0D1T8udtDspA/6jMrg4lEr0/gfZCk0v16Qqbfh93vzkZxQe+AVLXjdD6Mnf9TScVff r4WJC4GnpTlzNU/8/Cd81rpSsn18jx8wY4I8n6A12VSWRrvM4Nkvqr4fZfmxh5L4dWrQ +HfThvTeteMrcQA6AAHqZZKJP626wdX2/mmfn2dtyHFI1lvqLxMSEiOLRgxdRAqo1tND wXws/JUtui8u/XJVeihIQQ3hW2kAYf1Degz7SQiPTelEoLZBnIc5kjfZz89/jera4heU Ie0tUUsPSKPfL2CUi9HI90zGfn2ky7JOBwJLxFANQAIJZbnQSgB5bEHYuiOeTmYHklOz 5JZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=i6XAQmiL; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si4439777edt.479.2020.09.26.10.12.48; Sat, 26 Sep 2020 10:13:11 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=i6XAQmiL; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728017AbgIZRLi (ORCPT + 99 others); Sat, 26 Sep 2020 13:11:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbgIZRLi (ORCPT ); Sat, 26 Sep 2020 13:11:38 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17887C0613CE for ; Sat, 26 Sep 2020 10:11:38 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id n13so5688717edo.10 for ; Sat, 26 Sep 2020 10:11:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4TNtZY7T1WFexHeXE2tjx8zSAuQoR2lBax7QorKn3Es=; b=i6XAQmiL/jaodeEz/PPMWiB4Sf6Ih5vRFdQ1uA7azEI4lDq6dXE+SebrRCcR+WKFtZ udOEXpyfEWHb5GTQzHGhhz5DaRsEZwcd2eqOZq+q8qDJBBWK4Hzz9oL2Cmeb6EpGVqi1 15RxQitwJb9yOZSMik1dKnUDG7t7BLzx8CiOwhLEQukKSLB24scSpVm1EDtzihHeLHLz kQo+r1bzwaf1ul/8YPzk40zzCwp0JcJZQz3kyR3Dh0o04hif32qKosphD5S5DErjYR1s /MzSH/l8lbacf3ohZCFEH52eMuWy5RM/497loKa3sc4m7POWGdviXzH+Rk6R5zcn3gua lsiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4TNtZY7T1WFexHeXE2tjx8zSAuQoR2lBax7QorKn3Es=; b=fK///Vt3xK3MBpiC6lkHtTEKG+9TWvSPvNOsxzZL60Hzui/cTa58EH5t1LElRtaKC6 GoaZ5oBZAOyfXd0/kCZwIzlYwN7ZtBg+bN2uFgUtnd+yVfVhL11+JC24u/5Q9Pvb+8q0 NeaYIBKZ4JYTxNNhSfF4IC4ssaw5/1yaGK2i8AloOOvx7+VEUXGPtp2BPG7Ap1oCPXXA V4kMyi/qIzgAApIckh9fbdvMp7ACRrnV88FmfFfbERs+iqd9XtSr+Tqd4PeongTRQDtx XuEnB1q7+DpJ55FKKNu8/LZ6wY4/ceAw3eSkmX1ljrJOV0zJX2J0wZe3khHuL3LwRuUZ /d3A== X-Gm-Message-State: AOAM532/AhJbsGqkl8qE1GGl5rMP8eJ5zl85W6eT24BeTRpTfz3LqhJD 3rGnUZncdodxZhe0R851qmdddwIgmEL2tSc35px5tg== X-Received: by 2002:aa7:d4d0:: with SMTP id t16mr7506374edr.83.1601140296368; Sat, 26 Sep 2020 10:11:36 -0700 (PDT) MIME-Version: 1.0 References: <1601103820-14002-1-git-send-email-wangqing@vivo.com> In-Reply-To: <1601103820-14002-1-git-send-email-wangqing@vivo.com> From: Guenter Roeck Date: Sat, 26 Sep 2020 10:11:25 -0700 Message-ID: Subject: Re: [PATCH] chrome: Use kobj_to_dev() instead To: Wang Qing Cc: Benson Leung , Enric Balletbo i Serra , Guenter Roeck , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 26, 2020 at 12:03 AM Wang Qing wrote: > > Use kobj_to_dev() instead of container_of(). > > Signed-off-by: Wang Qing Reviewed-by: Guenter Roeck > --- > 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; > -- > 2.7.4 >