Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1603527ybi; Wed, 3 Jul 2019 19:39:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqz55v7lliz/0dre2UcexYdRsCCXXOf/02MlMKvIz4Gr3ee2NAt2w1v2Fxmlcj1v76Tql/TZ X-Received: by 2002:a17:902:294a:: with SMTP id g68mr47248330plb.169.1562207965910; Wed, 03 Jul 2019 19:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562207965; cv=none; d=google.com; s=arc-20160816; b=eH8xHfduJ+dZGOjjthK0NIo50mM1ax8Sa/IG3MGiRAgj6dGA9R4I6fEvhuASO7hmrT NpkWsZJ7Ywfkf1MPBFamERZJw/hPYydeP9j4hHTdMpkFLIBtwYDhYtNdx7mIiO4LHMvq 8n8Ozzmhni2ZeT9r1oiRNDRWSK7z9evUD751EDo04UXJBHHIYsuL0p/bR7H6/Sh1W0Q7 JBx4elOtenqpFGlWsUemoB6483UkCxn7+1pFHdg/RWDfSe/BISS7gc6NM4my3vLDNPir FPIiXZobtmJUPf2vjZeQpubbICa9vejYeYp5NIcOoXSIxMGPpfxtFQyBWfd7uriGafVS h5fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature; bh=2ZSY8dUe+kI50ne1+y2CFQaSDYbQtEYZ74W1nwW0ZUY=; b=wdyxKYscRnPn62GrrauhMlQy3tqanerIUi5e1VTffHfTrE4vV5GlDqNtes5HRzlulA bySNsNq8Y8Kt9TGoU+xBTEFlIrQW94+2BXl2RXBkX8xRo2UVW3UFUFTN0M9umJMfbbsZ RisfqSPWt40Bjhej0gUZgud0MxTFL0pcJPmKg7JrguahwFLKs2kBb2C7d/qW0Uru7xZH PZWwhViEONM6rSrVwx74ugYK682m1Ip0Y5Li31fMojXeVbrqr6WjeE8r7c+jU2Vmbt61 TPOkKAZSBICubYWI+y8qsODScz/JQt3cMd1mZi7zFenEcsdwOQysNZhQMAjA7qQxBsrD oD7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=aASMFOix; 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=fail (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 u13si3848874pgp.478.2019.07.03.19.39.11; Wed, 03 Jul 2019 19:39:25 -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=fail header.i=@gmail.com header.s=20161025 header.b=aASMFOix; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727492AbfGDCgz (ORCPT + 99 others); Wed, 3 Jul 2019 22:36:55 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:39088 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727390AbfGDCgy (ORCPT ); Wed, 3 Jul 2019 22:36:54 -0400 Received: by mail-pg1-f196.google.com with SMTP id u17so1668260pgi.6; Wed, 03 Jul 2019 19:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=2ZSY8dUe+kI50ne1+y2CFQaSDYbQtEYZ74W1nwW0ZUY=; b=aASMFOixncAfiUd8Qqgc4EqdBaToyLLuZM+xa4uQDSsHVH7ltixuSKu85mqmoXWET8 g0o70gB8g3/LDD8YL4UnRoHzU5BbyJmbDUWM63UTZuC0ebZOi6d+RMjRgpW+TrVztJei bmvFuiWYzj5Wq6tjJl3SY4yIfoczJw8yaQdeh8zYp8VYP/5tk7gk7hAUQsQXgBtGcfi4 22B2dNbLzV5VOqsvlqf+It7FKmYWgSUnjbi5OuKeTfcbWIg3uaOPo1VUC+b9JTorhd+d Db+YFE444zBWiXlPVH/OEHe2moyNufDbMxHJ6/mBscxOWhwPSIAn+4Sw+kdNpP2aCJ4/ QiAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2ZSY8dUe+kI50ne1+y2CFQaSDYbQtEYZ74W1nwW0ZUY=; b=Waj6hm7PWy/4lDLcgQomX0gUNE0y+IEfgYehBMjQrTE0mNsOXx7ugOYZOZb40Eydym sPdb+njeEvyMKcouh+M77jTJxw+SoRnhGiDz7MJvuO64P4+zE1yOrDKQgAXWpvWSuqLv URUMghOi1zSt+KRu4yZFbfkGhgF3qD6rpzsHbGXkoXt8+HW25mF7K2R9ZgUIi5uLL65K wkKWYu79EYcYx/ub7Rz7uyXWI63PJZScWFZEONoyWbElGMfUofoGtUWqOn7odx8b0eAe 7vR9PDrOak9cxl67v/LdgyHX9GeFOV+2QA+DJDgTXx6JdWa9bmy1HcV8jcbAL2mxFQap T2sA== X-Gm-Message-State: APjAAAU7t7kJ3YSGIFXMf8g+bJDjIatjPMTtJQotMAtfGcnDuSmnK0mD bt04/JpU52EwnRYnliKORzA= X-Received: by 2002:a17:90a:9a8d:: with SMTP id e13mr16763513pjp.77.1562207814017; Wed, 03 Jul 2019 19:36:54 -0700 (PDT) Received: from hfq-skylake.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.googlemail.com with ESMTPSA id v23sm3859428pff.185.2019.07.03.19.36.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jul 2019 19:36:53 -0700 (PDT) From: Fuqian Huang Cc: Corentin Chary , Darren Hart , Andy Shevchenko , acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Fuqian Huang Subject: [Patch v2 10/10] platform/x86/asus-wmi: using dev_get_drvdata directly Date: Thu, 4 Jul 2019 10:36:47 +0800 Message-Id: <20190704023647.4873-1-huangfq.daxian@gmail.com> X-Mailer: git-send-email 2.11.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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