Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2180567ybi; Thu, 4 Jul 2019 06:26:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGeStu+GLfcfRYFavhzhVunj1pYSwV/u9JZK25CfNqlyXnu8KpbEv3zzf3yrJ6vHXchleJ X-Received: by 2002:a63:c34c:: with SMTP id e12mr42403612pgd.195.1562246803792; Thu, 04 Jul 2019 06:26:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562246803; cv=none; d=google.com; s=arc-20160816; b=ndtMy3KMoonUVqZZUF1LNYhUqRQxu962Xp6gGFlXh3FMR5IHGZCvMj/LXJZlkpqO4+ 2whxNA6sWNnctKvr/HG6SQ9CJ4j4w3sgFLgNxhkM6OMxGHEFr93gr5txESnI/X5ycvhI ipC7L9TFKOw4ugjuFUVDUQXun1sm+VvHSWo3BENXn0UnEn3wlabMJhlFyyzThseJmFay K1BDkPOml2m29kva9O/TELSHPfBS9RYw3IfErniMVsWUGmuUVrf5c6b44Mhqs9iEGHYM hBkfB5dvSL+sE+y958ZEmoCN6wfMFl4DWEekQ54tG0R4/5GkE6xp3xAAn2vQTkHKHw9K twmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=S5iUsd23goTvarMTVqpK2sCw764StJ8ZSDbGkI3s2b8=; b=bj/UDGZTArTdxBUvPCfuROhPwOL+pG1gdu7+g7xdWIH0EmFVQo6izk4qsBFrrdZJvW QCwcAYNdKZkqfJ7sBHpRMe5L9YwDR1wqpVGg1GecZf4Cm7it5nEm++rBaF22BQD8cH5V MmgWaOs4o+h9bzAkvwkIzjo95t7zA2V9YxuXIDsXWX96qa63KDvcwWKs/VS3zv9eGHfv iK/syIfvc459MUsQ5BfjPZd/K4Vd/OnJFgjZAsrF0Gq8Jv3b03zPWaWu/jwuWplcbbnD OD+upMf7sCjrPdJSfMo6ZbsgHjzWzswQhItMYk0/KjMS6lQVHgYd5qXXRoy9xps1Y4Da Yp2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OmgRd6S1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1si5196150plp.264.2019.07.04.06.26.27; Thu, 04 Jul 2019 06:26:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OmgRd6S1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727238AbfGDN0D (ORCPT + 99 others); Thu, 4 Jul 2019 09:26:03 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39278 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727026AbfGDN0D (ORCPT ); Thu, 4 Jul 2019 09:26:03 -0400 Received: by mail-pg1-f195.google.com with SMTP id u17so2441384pgi.6; Thu, 04 Jul 2019 06:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S5iUsd23goTvarMTVqpK2sCw764StJ8ZSDbGkI3s2b8=; b=OmgRd6S12FaBdQHsShwhta+VQpuDk1YlDmFpmHgvDOqr2G2oLKyuD66zwe62aBBu01 PWqkeqE23Qyb7IWZlbNeiDCqTWNWOtqnSbR4hz7ye8Nxpr4tBFRudyDcrz7yJjjdGZjS cdXxW1k7INxfQaOm/DCObKYnA1c0w5RzbKGFrwRz03mSEP9pgRjeyMjWQ0iJ4jxMDl4m vdx8byGagNGlKtcxBTkpp0j7yF0MTM+R/qmkqhGOSnQP41ekWhF86oyeaXRAtoXZU2oH 4I+njhisLrAnZssOWofxwBdBn3iDauVAoi64cZP2QMv87IqbystVKLeATpYPpzPo1Ke2 TayQ== 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=S5iUsd23goTvarMTVqpK2sCw764StJ8ZSDbGkI3s2b8=; b=bT9vOv+3GRlAW6n1tcseKb+K1nTyfqh+KU+1kovQwAOi05iIVDZcxLehKHoZakdm3L K9joUdgrPdKTUCCLXG2Um85ny9+Mp2ZrxAP0C/XDOgMxeJK7W4K8fpAfbUBx0c2cO2TS S5ByL2U43wMLabdeHtpp/UxZh3IFB3/UJ+REbo+OflIYYco9YGxL4YI4mT/htsUMG292 0eZj1VqTkC2yBWs5sQI8yRvmyQRsBm9ogulr/V+k38jiFI3EwYqQPKft3WI6iuCIYI01 17Nsqsg7h5lKCqKLIVLHIz4Ll8Yab/Tfo8A9Ijr+x8rUIvnenOqy7PLRcFF78IUqnVHK bIdg== X-Gm-Message-State: APjAAAX2Yiqz+LNzQbN67+4dr5rirjQd4drT/jaEYu9XHpZ8zxhrso2u PU3amnUFdHFJWBffW1OGhm8IjrWedqUboD31WM0= X-Received: by 2002:a63:c0e:: with SMTP id b14mr43436137pgl.4.1562246762433; Thu, 04 Jul 2019 06:26:02 -0700 (PDT) MIME-Version: 1.0 References: <20190704023647.4873-1-huangfq.daxian@gmail.com> In-Reply-To: <20190704023647.4873-1-huangfq.daxian@gmail.com> From: Andy Shevchenko Date: Thu, 4 Jul 2019 16:25:50 +0300 Message-ID: Subject: Re: [Patch v2 10/10] platform/x86/asus-wmi: using dev_get_drvdata directly To: Fuqian Huang Cc: Corentin Chary , Darren Hart , Andy Shevchenko , acpi4asus-user , Platform Driver , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 4, 2019 at 5:37 AM Fuqian Huang wrote: > > Several drivers cast a struct device pointer to a struct > platform_device pointer only to then call platform_get_drvdata(). > To improve readability, these constructs can be simplified > by using dev_get_drvdata() directly. v1 had been applied. > Signed-off-by: Fuqian Huang > --- > Changes in v2: > - Make the commit message more clearly. > > drivers/platform/x86/asus-wmi.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c > index 9b18a184e0aa..49049b02a015 100644 > --- a/drivers/platform/x86/asus-wmi.c > +++ b/drivers/platform/x86/asus-wmi.c > @@ -1353,8 +1353,7 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj, > struct attribute *attr, int idx) > { > struct device *dev = container_of(kobj, struct device, kobj); > - struct platform_device *pdev = to_platform_device(dev->parent); > - struct asus_wmi *asus = platform_get_drvdata(pdev); > + struct asus_wmi *asus = dev_get_drvdata(dev->parent); > int dev_id = -1; > int fan_attr = -1; > u32 value = ASUS_WMI_UNSUPPORTED_METHOD; > -- > 2.11.0 > -- With Best Regards, Andy Shevchenko