From: Zhang Rui <rui.zhang@intel.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>, linux-kernel@vger.kernel.org
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
Eduardo Valentin <edubezval@gmail.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
linux-pm@vger.kernel.org
Subject: Re: [PATCH next 23/25] thermal: Use dev_get_drvdata()
Date: Mon, 29 Apr 2019 11:47:43 +0800 [thread overview]
Message-ID: <1556509663.2396.8.camel@intel.com> (raw)
In-Reply-To: <20190423075020.173734-24-wangkefeng.wang@huawei.com>
On 二, 2019-04-23 at 15:50 +0800, Kefeng Wang wrote:
> Using dev_get_drvdata directly.
>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Eduardo Valentin <edubezval@gmail.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> .../intel/int340x_thermal/processor_thermal_device.c | 8 +-----
> --
> drivers/thermal/st/stm_thermal.c | 6 ++----
> 2 files changed, 3 insertions(+), 11 deletions(-)
>
> diff --git
> a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> index 8e1cf4d789be..4ad54b8d4778 100644
> ---
> a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> +++
> b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> @@ -81,8 +81,6 @@ static ssize_t
> power_limit_##index##_##suffix##_show(struct device *dev, \
> struct device_attribute
> *attr, \
> char *buf) \
> { \
> - struct pci_dev *pci_dev; \
> - struct platform_device *pdev; \
> struct proc_thermal_device *proc_dev; \
> \
> if (proc_thermal_emum_mode == PROC_THERMAL_NONE) { \
> @@ -91,11 +89,7 @@ static ssize_t
> power_limit_##index##_##suffix##_show(struct device *dev, \
> } \
> \
> 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); \
> + proc_dev = dev_get_drvdata(dev); \
> } \
> return sprintf(buf, "%lu\n",\
> (unsigned long)proc_dev->power_limits[index].suffix * 1000);
> \
Sumeet has a patch to fix the same issue, which has been in my tree
https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git/commit
/?h=next&id=1948d498dcf680bc650391f23da2f97e59f9126d
Plus, the previous fix is wrong because proc_dev will be left
uninitialized if proc_thermal_emum_mode equals PROC_THERMAL_PCI.
thanks,
rui
> diff --git a/drivers/thermal/st/stm_thermal.c
> b/drivers/thermal/st/stm_thermal.c
> index bbd73c5a4a4e..cf9ddc52f30e 100644
> --- a/drivers/thermal/st/stm_thermal.c
> +++ b/drivers/thermal/st/stm_thermal.c
> @@ -570,8 +570,7 @@ static int stm_thermal_prepare(struct
> stm_thermal_sensor *sensor)
> static int stm_thermal_suspend(struct device *dev)
> {
> int ret;
> - struct platform_device *pdev = to_platform_device(dev);
> - struct stm_thermal_sensor *sensor =
> platform_get_drvdata(pdev);
> + struct stm_thermal_sensor *sensor = dev_get_drvdata(dev);
>
> ret = stm_thermal_sensor_off(sensor);
> if (ret)
> @@ -585,8 +584,7 @@ static int stm_thermal_suspend(struct device
> *dev)
> static int stm_thermal_resume(struct device *dev)
> {
> int ret;
> - struct platform_device *pdev = to_platform_device(dev);
> - struct stm_thermal_sensor *sensor =
> platform_get_drvdata(pdev);
> + struct stm_thermal_sensor *sensor = dev_get_drvdata(dev);
>
> ret = stm_thermal_prepare(sensor);
> if (ret)
next prev parent reply other threads:[~2019-04-29 3:47 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
2019-04-23 7:49 ` [PATCH next 01/25] ACPI / DPTF: Use dev_get_drvdata() Kefeng Wang
2019-05-01 10:13 ` Rafael J. Wysocki
2019-04-23 7:49 ` [PATCH next 02/25] crypto: picoxcell: " Kefeng Wang
2019-05-03 6:09 ` Herbert Xu
2019-04-23 7:49 ` [PATCH next 03/25] dmaengine: " Kefeng Wang
2019-04-26 11:52 ` Vinod Koul
2019-04-28 4:00 ` [PATCH next v2 1/2] dmaengine: bcm-sba-raid: " Kefeng Wang
2019-04-28 4:00 ` [PATCH next v2 2/2] dmaengine: nbpfaxi: " Kefeng Wang
2019-04-29 5:17 ` [PATCH next v2 1/2] dmaengine: bcm-sba-raid: " Vinod Koul
2019-04-23 7:49 ` [PATCH next 04/25] drm/exynos: " Kefeng Wang
2019-04-23 7:50 ` [PATCH next 05/25] drm/msm: " Kefeng Wang
2019-04-23 7:50 ` [PATCH next 06/25] drm/omap: " Kefeng Wang
2019-05-28 10:57 ` Tomi Valkeinen
2019-04-23 7:50 ` [PATCH next 07/25] hwmon: s3c: " Kefeng Wang
2019-04-23 13:43 ` Guenter Roeck
2019-04-23 7:50 ` [PATCH next 08/25] iio: adc: at91: " Kefeng Wang
2019-04-27 12:07 ` Jonathan Cameron
2019-04-23 7:50 ` [PATCH next 09/25] input: keyboard: " Kefeng Wang
2019-04-23 8:44 ` Dmitry Torokhov
2019-04-23 7:50 ` [PATCH next 10/25] input: misc: " Kefeng Wang
2019-04-23 7:50 ` [PATCH next 11/25] input: mouse: " Kefeng Wang
2019-04-23 7:50 ` [PATCH next 12/25] input: touchscreen: " Kefeng Wang
2019-04-23 7:50 ` [PATCH next 13/25] iommu/omap: " Kefeng Wang
2019-04-26 14:49 ` Joerg Roedel
2019-04-23 7:50 ` [PATCH next 14/25] mailbox: bcm-flexrm-mailbox: " Kefeng Wang
2019-04-23 7:50 ` [PATCH next 15/25] media: platform: " Kefeng Wang
2019-05-24 12:58 ` Mauro Carvalho Chehab
2019-04-23 7:50 ` [PATCH next 16/25] mfd: " Kefeng Wang
2019-05-08 10:32 ` Lee Jones
2019-05-08 13:52 ` [PATCH next v2] " Kefeng Wang
2019-05-09 6:14 ` Lee Jones
2019-05-09 14:23 ` [PATCH next v3] " Kefeng Wang
2019-05-10 7:02 ` Lee Jones
2019-04-23 7:50 ` [PATCH next 17/25] mmc: omap_hsmmc: " Kefeng Wang
2019-04-29 10:45 ` Ulf Hansson
2019-04-23 7:50 ` [PATCH next 18/25] net: can: " Kefeng Wang
2019-04-23 7:50 ` [PATCH next 19/25] net: calxedaxgmac: " Kefeng Wang
2019-04-23 7:50 ` [PATCH next 20/25] platform/x86: asus-wmi: " Kefeng Wang
2019-05-06 9:01 ` Andy Shevchenko
2019-04-23 7:50 ` [PATCH next 21/25] rtc: " Kefeng Wang
2019-04-26 18:52 ` Alexandre Belloni
2019-04-23 7:50 ` [PATCH next 22/25] media: staging/imx7: " Kefeng Wang
2019-04-23 8:34 ` Rui Miguel Silva
2019-04-23 7:50 ` [PATCH next 23/25] thermal: " Kefeng Wang
2019-04-29 3:47 ` Zhang Rui [this message]
2019-04-29 6:55 ` Kefeng Wang
2019-04-23 7:50 ` [PATCH next 24/25] usb: musb: dsps: " Kefeng Wang
2019-04-23 7:50 ` [PATCH next 25/25] video: fbdev: " Kefeng Wang
2019-05-06 13:48 ` Bartlomiej Zolnierkiewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1556509663.2396.8.camel@intel.com \
--to=rui.zhang@intel.com \
--cc=daniel.lezcano@linaro.org \
--cc=edubezval@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=wangkefeng.wang@huawei.com \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox