Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1601796ybi; Wed, 3 Jul 2019 19:36:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHndlDmAs55BTEofFTeS+H5H/TA0xNylZ+ci21XU/tpENs7Gu8MOlb7tbgycDciZb9J55d X-Received: by 2002:a17:902:f301:: with SMTP id gb1mr45560267plb.292.1562207815254; Wed, 03 Jul 2019 19:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562207815; cv=none; d=google.com; s=arc-20160816; b=hKdZ6Mpd/ICH5Yip0K+NaKNOXzd/SsCuPfokgKib3gv15K+ZyMjFXP8EhM0i3NmsG4 OkTVuDphi2NGtDDhdsTtDgcdRtzAKBvaCA6nyMbL3Z3Obk5tCTvObZmxtgU2HjZXXW9X 2oqQDBCoDbjFwjb5cuzrtaEZqgyX1p0luoZG5nMBhTOh/ORaiczPDHrcyjyyqYMJ9VmQ 58EH+qUeTO62j/2y3JuH3rZqFIKoIKxcjBSY0L5Weepj253weotdkz4/q7hGMEDrIu+i tnHGv/Dvmbu6Nw7YOWLvHwt8NAJqu8jTZOCSmMQExSsYnUWbkcL3mAtlDm7+NODWplYD K1SA== 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=calKg31YDJ74yDzQJN7XSSUBsHnK7/+Pchjehhl+BSk=; b=m3+RgU3yEvPvS4fXMteAEzwX5iQb7XoCt5iWijC3xcFTAEe+djjaDGyYCn4e7T6oWd on6iqIZKvc11/gVG+0ldfYeL0xcupqBfA4V2rMs3xRYjbR4iCBR9ZfaoMw0UeLnr1VN2 tC1d+GHl1smPglhp1VuGuHbUryZaFqc7TEyhRT31dOsLEEraNieEY4A/5xg+swP4nu0W 4yPU2GgFWDycg4SmTvh0Fyuhuhp7CRWt6iMxDuMDIDyIF8z8FDxrpG5ZwccYCptBhvT4 gL/DwyXtye0Qs1SLZ6POIl1S7JqDzhvWyyXEb3xEEAsA690o9Gf8DBwFULqfm3oQ3F3Z t04A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=iQs2b90e; 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 3si3991582pfp.288.2019.07.03.19.36.40; Wed, 03 Jul 2019 19:36:55 -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=iQs2b90e; 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 S1727262AbfGDCgF (ORCPT + 99 others); Wed, 3 Jul 2019 22:36:05 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41720 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbfGDCgE (ORCPT ); Wed, 3 Jul 2019 22:36:04 -0400 Received: by mail-pg1-f196.google.com with SMTP id q4so2146692pgj.8 for ; Wed, 03 Jul 2019 19:36:04 -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=calKg31YDJ74yDzQJN7XSSUBsHnK7/+Pchjehhl+BSk=; b=iQs2b90eTP+P2KlFVEZCLVMHWJNammzNFcmzkyKAhLlut/Ybw8o8K0xGKutmmk6NK9 stKiMAYKREnsQ8jRQEsfNUpzFokHBOXHXckaEiZwyHVuu5OEGIR74xy8dZ22lPy2+oTO pqiR9Mt9yZbPg5INQQxUGYJrGxnD9oHO083RdgSoN36ZzQuIE09TTvIROkhWwOZEk3Tn aePttRcpNdP/IxDSZFticngv4IEZ0Csdlj9BJEHg4wVF7mO80l/H9U6rhwV4cl4W4+mA qyVP8deBLAhdCKvsgMMiddfHfssxZZ51wc+liQp2HOJvB6KTVEBT8NijJ/caa6NS8riB Sr2g== 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=calKg31YDJ74yDzQJN7XSSUBsHnK7/+Pchjehhl+BSk=; b=nPzbHtEuv5tn6tskLSg1NrFWLYf1fjXE1vrvRGo3NMBq/MryV7vlttiywEEtyfbMuZ Q+QuwYd/1m7IWnSrHRmG5wKv5e4rRecVZ7FdpyPqQcMwKqZeTSE/S+dqgV0ELHD32iHH qa6y3uUHHQlucqWrY9gO4U27FU/TGkKl3Rp7pZiElueLJUAtwC2zD9D9QuyX3PE9x73t pTWfXEjbvnBGxuTqYJAZ03CIK3W1ii2iPhYtI50OIb/zljxsZCeYSeNaSMl0tiskhTHl F5Z2rHdrIviFgoWMmNcuXZxcWeB2XlLrLwKnbrf08pW0knJLp3pYe5jTZ6k0F+2pY4Qn vvjw== X-Gm-Message-State: APjAAAUABe+XLdv1W2kW3Yyh1Svd6T2/GMi0pXBkVd26NXrlUe3WIiDD Nv+0zrQzPaE60ru9A5iVL4U= X-Received: by 2002:a17:90a:9a83:: with SMTP id e3mr16236570pjp.105.1562207764004; Wed, 03 Jul 2019 19:36:04 -0700 (PDT) Received: from hfq-skylake.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.googlemail.com with ESMTPSA id e10sm3921153pfi.173.2019.07.03.19.36.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jul 2019 19:36:03 -0700 (PDT) From: Fuqian Huang Cc: Tomi Valkeinen , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Fuqian Huang Subject: [Patch v2 03/10] drm/omapdrm: using dev_get_drvdata directly Date: Thu, 4 Jul 2019 10:35:57 +0800 Message-Id: <20190704023557.4551-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/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index 8edef8ef23b0..53240da139b1 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c @@ -407,8 +407,7 @@ static const struct backlight_ops dsicm_bl_ops = { static ssize_t dsicm_num_errors_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct panel_drv_data *ddata = dev_get_drvdata(dev); struct omap_dss_device *src = ddata->src; u8 errors = 0; int r; @@ -439,8 +438,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev, static ssize_t dsicm_hw_revision_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct panel_drv_data *ddata = dev_get_drvdata(dev); struct omap_dss_device *src = ddata->src; u8 id1, id2, id3; int r; @@ -506,8 +504,7 @@ static ssize_t dsicm_show_ulps(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct panel_drv_data *ddata = dev_get_drvdata(dev); unsigned int t; mutex_lock(&ddata->lock); @@ -521,8 +518,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct platform_device *pdev = to_platform_device(dev); - struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct panel_drv_data *ddata = dev_get_drvdata(dev); struct omap_dss_device *src = ddata->src; unsigned long t; int r; @@ -553,8 +549,7 @@ static ssize_t dsicm_show_ulps_timeout(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct panel_drv_data *ddata = dev_get_drvdata(dev); unsigned int t; mutex_lock(&ddata->lock); -- 2.11.0