From patchwork Mon Apr 15 14:48:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumeet Pawnikar X-Patchwork-Id: 10900939 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C50CC17E6 for ; Mon, 15 Apr 2019 14:46:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC08F285B8 for ; Mon, 15 Apr 2019 14:46:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A02EA28622; Mon, 15 Apr 2019 14:46:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BB47285B8 for ; Mon, 15 Apr 2019 14:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726298AbfDOOql (ORCPT ); Mon, 15 Apr 2019 10:46:41 -0400 Received: from mga07.intel.com ([134.134.136.100]:10069 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726259AbfDOOql (ORCPT ); Mon, 15 Apr 2019 10:46:41 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2019 07:46:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,354,1549958400"; d="scan'208";a="140832497" Received: from linuxpc.iind.intel.com ([10.223.107.112]) by fmsmga008.fm.intel.com with ESMTP; 15 Apr 2019 07:46:38 -0700 From: Sumeet Pawnikar To: rui.zhang@intel.com, edubezval@gmail.com, daniel.lezcano@linaro.org, srinivas.pandruvada@linux.intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, andriy.shevchenko@intel.com, sumeet.r.pawnikar@intel.com Subject: [PATCH] thermal: intel: int340x: processor_thermal_device: simplify to get driver data Date: Mon, 15 Apr 2019 20:18:30 +0530 Message-Id: <1555339710-28028-1-git-send-email-sumeet.r.pawnikar@intel.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Pawnikar, Sumeet R" This simplifies getting the 'driver_data' from 'struct device' directly. Going through platform_device or pci_dev is not required. Also removes condition check as the private data stored with dev pointer, means irrespective of enumeration mode, we can use dev_get_drvdata(). This removes the unnecessary step back and forth. Signed-off-by: Sumeet Pawnikar Reviewed-by: Andy Shevchenko --- .../int340x_thermal/processor_thermal_device.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c index 8e1cf4d..2a7cbaa 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c @@ -81,22 +81,13 @@ enum proc_thermal_emum_mode_type { struct device_attribute *attr, \ char *buf) \ { \ - struct pci_dev *pci_dev; \ - struct platform_device *pdev; \ - struct proc_thermal_device *proc_dev; \ + struct proc_thermal_device *proc_dev = dev_get_drvdata(dev); \ \ if (proc_thermal_emum_mode == PROC_THERMAL_NONE) { \ dev_warn(dev, "Attempted to get power limit before device was initialized!\n"); \ return 0; \ } \ \ - if (proc_thermal_emum_mode == PROC_THERMAL_PLATFORM_DEV) { \ - pdev = to_platform_device(dev); \ - proc_dev = platform_get_drvdata(pdev); \ - } else { \ - pci_dev = to_pci_dev(dev); \ - proc_dev = pci_get_drvdata(pci_dev); \ - } \ return sprintf(buf, "%lu\n",\ (unsigned long)proc_dev->power_limits[index].suffix * 1000); \ }