LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH next 00/25] cleanup: use dev_get_drvdata() directly
@ 2019-04-23  7:49 Kefeng Wang
  2019-04-23  7:49 ` [PATCH next 01/25] ACPI / DPTF: Use dev_get_drvdata() Kefeng Wang
                   ` (24 more replies)
  0 siblings, 25 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masahiro Yamada, Kefeng Wang

Many drivers call to_platform_device() to get platform_device, then
get drvdata by platform_get_drvdata(), but in platfrom_get_drvdata(),
the platform_device is converted back to struct device again.

Using dev_get_drvdata() directly, only build test on arm64/x86_64.

Kefeng Wang (25):
  ACPI / DPTF: Use dev_get_drvdata()
  crypto: picoxcell: Use dev_get_drvdata()
  dmaengine: Use dev_get_drvdata()
  drm/exynos: Use dev_get_drvdata()
  drm/msm: Use dev_get_drvdata()
  drm/omap: Use dev_get_drvdata()
  hwmon: s3c: Use dev_get_drvdata()
  iio: adc: at91: Use dev_get_drvdata()
  input: keyboard: Use dev_get_drvdata()
  input: misc: Use dev_get_drvdata()
  input: mouse: Use dev_get_drvdata()
  input: touchscreen: Use dev_get_drvdata()
  iommu/omap: Use dev_get_drvdata()
  mailbox: bcm-flexrm-mailbox: Use dev_get_drvdata()
  media: platform: Use dev_get_drvdata()
  mfd: Use dev_get_drvdata()
  mmc: omap_hsmmc: Use dev_get_drvdata()
  net: can: Use dev_get_drvdata()
  net: calxedaxgmac: Use dev_get_drvdata()
  platform/x86: asus-wmi: Use dev_get_drvdata()
  rtc: Use dev_get_drvdata()
  media: staging/imx7: Use dev_get_drvdata()
  thermal: Use dev_get_drvdata()
  usb: musb: dsps: Use dev_get_drvdata()
  video: fbdev: Use dev_get_drvdata()

 drivers/acpi/dptf/dptf_power.c                |  3 +--
 drivers/crypto/picoxcell_crypto.c             |  2 +-
 drivers/dma/bcm-sba-raid.c                    |  3 +--
 drivers/dma/nbpfaxi.c                         |  4 ++--
 drivers/gpu/drm/exynos/exynos_drm_fimc.c      |  8 +++----
 drivers/gpu/drm/exynos/exynos_drm_gsc.c       |  5 ++---
 drivers/gpu/drm/msm/adreno/adreno_device.c    |  6 ++----
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       | 13 +++++-------
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c      |  6 ++----
 drivers/gpu/drm/msm/dsi/dsi_host.c            |  6 ++----
 drivers/gpu/drm/msm/msm_drv.c                 |  3 +--
 drivers/gpu/drm/msm/msm_gpu.c                 |  6 +++---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 18 ++++++----------
 drivers/hwmon/s3c-hwmon.c                     |  4 ++--
 drivers/iio/adc/at91-sama5d2_adc.c            | 12 ++++-------
 drivers/iio/adc/at91_adc.c                    |  4 ++--
 drivers/input/keyboard/ep93xx_keypad.c        | 10 ++++-----
 drivers/input/keyboard/gpio_keys.c            |  6 ++----
 drivers/input/keyboard/imx_keypad.c           | 10 ++++-----
 drivers/input/keyboard/lpc32xx-keys.c         |  6 ++----
 drivers/input/keyboard/matrix_keypad.c        | 10 ++++-----
 drivers/input/keyboard/omap4-keypad.c         | 10 ++++-----
 drivers/input/keyboard/pmic8xxx-keypad.c      |  6 ++----
 drivers/input/keyboard/pxa27x_keypad.c        | 10 ++++-----
 drivers/input/keyboard/samsung-keypad.c       | 12 ++++-------
 drivers/input/keyboard/snvs_pwrkey.c          | 10 ++++-----
 drivers/input/keyboard/spear-keyboard.c       | 10 ++++-----
 drivers/input/keyboard/st-keyscan.c           |  6 ++----
 drivers/input/keyboard/tegra-kbc.c            | 10 ++++-----
 drivers/input/misc/max77693-haptic.c          |  6 ++----
 drivers/input/misc/max8925_onkey.c            | 10 ++++-----
 drivers/input/misc/max8997_haptic.c           |  3 +--
 drivers/input/misc/msm-vibrator.c             |  6 ++----
 drivers/input/misc/palmas-pwrbutton.c         |  6 ++----
 drivers/input/misc/regulator-haptic.c         |  6 ++----
 drivers/input/misc/stpmic1_onkey.c            |  6 ++----
 drivers/input/misc/twl4030-vibra.c            |  3 +--
 drivers/input/misc/twl6040-vibra.c            |  3 +--
 drivers/input/mouse/navpoint.c                |  6 ++----
 drivers/input/touchscreen/imx6ul_tsc.c        |  6 ++----
 drivers/input/touchscreen/s3c2410_ts.c        |  3 +--
 drivers/iommu/omap-iommu.c                    |  3 +--
 drivers/mailbox/bcm-flexrm-mailbox.c          |  6 ++----
 .../media/platform/cros-ec-cec/cros-ec-cec.c  |  6 ++----
 drivers/mfd/ssbi.c                            |  2 +-
 drivers/mfd/t7l66xb.c                         | 12 ++++-------
 drivers/mfd/tc6387xb.c                        | 12 ++++-------
 drivers/mfd/tc6393xb.c                        | 21 +++++++------------
 drivers/mmc/host/omap_hsmmc.c                 |  4 ++--
 drivers/net/can/softing/softing_main.c        |  4 ++--
 drivers/net/ethernet/calxeda/xgmac.c          |  4 ++--
 drivers/platform/x86/asus-wmi.c               |  3 +--
 drivers/rtc/rtc-hid-sensor-time.c             |  3 +--
 drivers/rtc/rtc-pxa.c                         |  3 +--
 drivers/rtc/rtc-rk808.c                       |  6 ++----
 drivers/rtc/rtc-tx4939.c                      | 17 ++++++---------
 drivers/rtc/rtc-wm831x.c                      | 18 +++++++---------
 drivers/rtc/rtc-wm8350.c                      | 12 ++++-------
 drivers/staging/media/imx/imx7-mipi-csis.c    |  6 ++----
 .../processor_thermal_device.c                |  8 +------
 drivers/thermal/st/stm_thermal.c              |  6 ++----
 drivers/usb/musb/musb_dsps.c                  |  6 ++----
 drivers/video/fbdev/nuc900fb.c                |  2 +-
 drivers/video/fbdev/s3c2410fb.c               |  2 +-
 drivers/video/fbdev/uvesafb.c                 | 16 +++++++-------
 65 files changed, 171 insertions(+), 294 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 01/25] ACPI / DPTF: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
@ 2019-04-23  7:49 ` Kefeng Wang
  2019-05-01 10:13   ` Rafael J. Wysocki
  2019-04-23  7:49 ` [PATCH next 02/25] crypto: picoxcell: " Kefeng Wang
                   ` (23 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Rafael J. Wysocki,
	Srinivas Pandruvada, linux-acpi

Using dev_get_drvdata directly.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: linux-acpi@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/acpi/dptf/dptf_power.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/acpi/dptf/dptf_power.c b/drivers/acpi/dptf/dptf_power.c
index e1c242568341..0c081390930a 100644
--- a/drivers/acpi/dptf/dptf_power.c
+++ b/drivers/acpi/dptf/dptf_power.c
@@ -31,8 +31,7 @@ static ssize_t name##_show(struct device *dev,\
 			   struct device_attribute *attr,\
 			   char *buf)\
 {\
-	struct platform_device *pdev = to_platform_device(dev);\
-	struct acpi_device *acpi_dev = platform_get_drvdata(pdev);\
+	struct acpi_device *acpi_dev = dev_get_drvdata(dev);\
 	unsigned long long val;\
 	acpi_status status;\
 \
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 02/25] crypto: picoxcell: Use dev_get_drvdata()
  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-04-23  7:49 ` Kefeng Wang
  2019-05-03  6:09   ` Herbert Xu
  2019-04-23  7:49 ` [PATCH next 03/25] dmaengine: " Kefeng Wang
                   ` (22 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Jamie Iles, Herbert Xu,
	David S. Miller, linux-crypto, linux-arm-kernel

Using dev_get_drvdata directly.

Cc: Jamie Iles <jamie@jamieiles.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/crypto/picoxcell_crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c
index 1b3acdeffede..b275d2af365a 100644
--- a/drivers/crypto/picoxcell_crypto.c
+++ b/drivers/crypto/picoxcell_crypto.c
@@ -1196,7 +1196,7 @@ static const struct dev_pm_ops spacc_pm_ops = {
 
 static inline struct spacc_engine *spacc_dev_to_engine(struct device *dev)
 {
-	return dev ? platform_get_drvdata(to_platform_device(dev)) : NULL;
+	return dev ? dev_get_drvdata(dev) : NULL;
 }
 
 static ssize_t spacc_stat_irq_thresh_show(struct device *dev,
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 03/25] dmaengine: Use dev_get_drvdata()
  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-04-23  7:49 ` [PATCH next 02/25] crypto: picoxcell: " Kefeng Wang
@ 2019-04-23  7:49 ` Kefeng Wang
  2019-04-26 11:52   ` Vinod Koul
  2019-04-23  7:49 ` [PATCH next 04/25] drm/exynos: " Kefeng Wang
                   ` (21 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masahiro Yamada, Kefeng Wang, Vinod Koul, dmaengine

Using dev_get_drvdata directly.

Cc: Vinod Koul <vinod.koul@intel.com>
Cc: dmaengine@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/dma/bcm-sba-raid.c | 3 +--
 drivers/dma/nbpfaxi.c      | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c
index 72878ac5c78d..fa81d0177765 100644
--- a/drivers/dma/bcm-sba-raid.c
+++ b/drivers/dma/bcm-sba-raid.c
@@ -1459,8 +1459,7 @@ static void sba_receive_message(struct mbox_client *cl, void *msg)
 
 static int sba_debugfs_stats_show(struct seq_file *file, void *offset)
 {
-	struct platform_device *pdev = to_platform_device(file->private);
-	struct sba_device *sba = platform_get_drvdata(pdev);
+	struct sba_device *sba = dev_get_drvdata(file->private);
 
 	/* Write stats in file */
 	sba_write_stats_in_seqfile(sba, file);
diff --git a/drivers/dma/nbpfaxi.c b/drivers/dma/nbpfaxi.c
index a67b292190f4..594409a6e975 100644
--- a/drivers/dma/nbpfaxi.c
+++ b/drivers/dma/nbpfaxi.c
@@ -1491,14 +1491,14 @@ MODULE_DEVICE_TABLE(platform, nbpf_ids);
 #ifdef CONFIG_PM
 static int nbpf_runtime_suspend(struct device *dev)
 {
-	struct nbpf_device *nbpf = platform_get_drvdata(to_platform_device(dev));
+	struct nbpf_device *nbpf = dev_get_drvdata(dev);
 	clk_disable_unprepare(nbpf->clk);
 	return 0;
 }
 
 static int nbpf_runtime_resume(struct device *dev)
 {
-	struct nbpf_device *nbpf = platform_get_drvdata(to_platform_device(dev));
+	struct nbpf_device *nbpf = dev_get_drvdata(dev);
 	return clk_prepare_enable(nbpf->clk);
 }
 #endif
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 04/25] drm/exynos: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (2 preceding siblings ...)
  2019-04-23  7:49 ` [PATCH next 03/25] dmaengine: " Kefeng Wang
@ 2019-04-23  7:49 ` Kefeng Wang
  2019-04-23  7:50 ` [PATCH next 05/25] drm/msm: " Kefeng Wang
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Inki Dae, Joonyoung Shim,
	Seung-Woo Kim, Kyungmin Park, David Airlie, Daniel Vetter,
	dri-devel, linux-samsung-soc

Using dev_get_drvdata directly.

Cc: Inki Dae <inki.dae@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-samsung-soc@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/gpu/drm/exynos/exynos_drm_fimc.c | 8 +++-----
 drivers/gpu/drm/exynos/exynos_drm_gsc.c  | 5 ++---
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index 90dfea0aec4d..b166572f9a4a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -48,8 +48,6 @@ static unsigned int fimc_mask = 0xc;
 module_param_named(fimc_devs, fimc_mask, uint, 0644);
 MODULE_PARM_DESC(fimc_devs, "Alias mask for assigning FIMC devices to Exynos DRM");
 
-#define get_fimc_context(dev)	platform_get_drvdata(to_platform_device(dev))
-
 enum {
 	FIMC_CLK_LCLK,
 	FIMC_CLK_GATE,
@@ -1364,7 +1362,7 @@ static int fimc_probe(struct platform_device *pdev)
 static int fimc_remove(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct fimc_context *ctx = get_fimc_context(dev);
+	struct fimc_context *ctx = dev_get_drvdata(dev);
 
 	component_del(dev, &fimc_component_ops);
 	pm_runtime_dont_use_autosuspend(dev);
@@ -1378,7 +1376,7 @@ static int fimc_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int fimc_runtime_suspend(struct device *dev)
 {
-	struct fimc_context *ctx = get_fimc_context(dev);
+	struct fimc_context *ctx = dev_get_drvdata(dev);
 
 	DRM_DEBUG_KMS("id[%d]\n", ctx->id);
 	clk_disable_unprepare(ctx->clocks[FIMC_CLK_GATE]);
@@ -1387,7 +1385,7 @@ static int fimc_runtime_suspend(struct device *dev)
 
 static int fimc_runtime_resume(struct device *dev)
 {
-	struct fimc_context *ctx = get_fimc_context(dev);
+	struct fimc_context *ctx = dev_get_drvdata(dev);
 
 	DRM_DEBUG_KMS("id[%d]\n", ctx->id);
 	return clk_prepare_enable(ctx->clocks[FIMC_CLK_GATE]);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index f048d97fe9e2..0c1e345834bc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -62,7 +62,6 @@
 #define GSC_COEF_DEPTH	3
 #define GSC_AUTOSUSPEND_DELAY		2000
 
-#define get_gsc_context(dev)	platform_get_drvdata(to_platform_device(dev))
 #define gsc_read(offset)		readl(ctx->regs + (offset))
 #define gsc_write(cfg, offset)	writel(cfg, ctx->regs + (offset))
 
@@ -1321,7 +1320,7 @@ static int gsc_remove(struct platform_device *pdev)
 
 static int __maybe_unused gsc_runtime_suspend(struct device *dev)
 {
-	struct gsc_context *ctx = get_gsc_context(dev);
+	struct gsc_context *ctx = dev_get_drvdata(dev);
 	int i;
 
 	DRM_DEBUG_KMS("id[%d]\n", ctx->id);
@@ -1334,7 +1333,7 @@ static int __maybe_unused gsc_runtime_suspend(struct device *dev)
 
 static int __maybe_unused gsc_runtime_resume(struct device *dev)
 {
-	struct gsc_context *ctx = get_gsc_context(dev);
+	struct gsc_context *ctx = dev_get_drvdata(dev);
 	int i, ret;
 
 	DRM_DEBUG_KMS("id[%d]\n", ctx->id);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 05/25] drm/msm: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (3 preceding siblings ...)
  2019-04-23  7:49 ` [PATCH next 04/25] drm/exynos: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-23  7:50 ` [PATCH next 06/25] drm/omap: " Kefeng Wang
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Rob Clark, Sean Paul, David Airlie,
	Daniel Vetter, dri-devel, freedreno

Using dev_get_drvdata directly.

Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/gpu/drm/msm/adreno/adreno_device.c |  6 ++----
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c    | 13 +++++--------
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c   |  6 ++----
 drivers/gpu/drm/msm/dsi/dsi_host.c         |  6 ++----
 drivers/gpu/drm/msm/msm_drv.c              |  3 +--
 drivers/gpu/drm/msm/msm_gpu.c              |  6 +++---
 6 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 714ed6505e47..13802af8294c 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -412,16 +412,14 @@ static const struct of_device_id dt_match[] = {
 #ifdef CONFIG_PM
 static int adreno_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct msm_gpu *gpu = platform_get_drvdata(pdev);
+	struct msm_gpu *gpu = dev_get_drvdata(dev);
 
 	return gpu->funcs->pm_resume(gpu);
 }
 
 static int adreno_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct msm_gpu *gpu = platform_get_drvdata(pdev);
+	struct msm_gpu *gpu = dev_get_drvdata(dev);
 
 	return gpu->funcs->pm_suspend(gpu);
 }
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 885bf88afa3e..0154eb9b343f 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1036,16 +1036,15 @@ static int dpu_bind(struct device *dev, struct device *master, void *data)
 
 static void dpu_unbind(struct device *dev, struct device *master, void *data)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct dpu_kms *dpu_kms = platform_get_drvdata(pdev);
+	struct dpu_kms *dpu_kms = dev_get_drvdata(dev);
 	struct dss_module_power *mp = &dpu_kms->mp;
 
 	msm_dss_put_clk(mp->clk_config, mp->num_clk);
-	devm_kfree(&pdev->dev, mp->clk_config);
+	devm_kfree(dev, mp->clk_config);
 	mp->num_clk = 0;
 
 	if (dpu_kms->rpm_enabled)
-		pm_runtime_disable(&pdev->dev);
+		pm_runtime_disable(dev);
 }
 
 static const struct component_ops dpu_ops = {
@@ -1067,8 +1066,7 @@ static int dpu_dev_remove(struct platform_device *pdev)
 static int __maybe_unused dpu_runtime_suspend(struct device *dev)
 {
 	int rc = -1;
-	struct platform_device *pdev = to_platform_device(dev);
-	struct dpu_kms *dpu_kms = platform_get_drvdata(pdev);
+	struct dpu_kms *dpu_kms = dev_get_drvdata(dev);
 	struct drm_device *ddev;
 	struct dss_module_power *mp = &dpu_kms->mp;
 
@@ -1088,8 +1086,7 @@ static int __maybe_unused dpu_runtime_suspend(struct device *dev)
 static int __maybe_unused dpu_runtime_resume(struct device *dev)
 {
 	int rc = -1;
-	struct platform_device *pdev = to_platform_device(dev);
-	struct dpu_kms *dpu_kms = platform_get_drvdata(pdev);
+	struct dpu_kms *dpu_kms = dev_get_drvdata(dev);
 	struct drm_encoder *encoder;
 	struct drm_device *ddev;
 	struct dss_module_power *mp = &dpu_kms->mp;
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 97179bec8902..8f7a01d7a663 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -1063,8 +1063,7 @@ static int mdp5_dev_remove(struct platform_device *pdev)
 
 static __maybe_unused int mdp5_runtime_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev);
+	struct mdp5_kms *mdp5_kms = dev_get_drvdata(dev);
 
 	DBG("");
 
@@ -1073,8 +1072,7 @@ static __maybe_unused int mdp5_runtime_suspend(struct device *dev)
 
 static __maybe_unused int mdp5_runtime_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev);
+	struct mdp5_kms *mdp5_kms = dev_get_drvdata(dev);
 
 	DBG("");
 
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 610183db1daf..4a158c41ef30 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -485,8 +485,7 @@ static void dsi_bus_clk_disable(struct msm_dsi_host *msm_host)
 
 int msm_dsi_runtime_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct msm_dsi *msm_dsi = platform_get_drvdata(pdev);
+	struct msm_dsi *msm_dsi = dev_get_drvdata(dev);
 	struct mipi_dsi_host *host = msm_dsi->host;
 	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
 
@@ -500,8 +499,7 @@ int msm_dsi_runtime_suspend(struct device *dev)
 
 int msm_dsi_runtime_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct msm_dsi *msm_dsi = platform_get_drvdata(pdev);
+	struct msm_dsi *msm_dsi = dev_get_drvdata(dev);
 	struct mipi_dsi_host *host = msm_dsi->host;
 	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
 
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 4697d854b827..9faa9290421a 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -251,8 +251,7 @@ static int vblank_ctrl_queue_work(struct msm_drm_private *priv,
 
 static int msm_drm_uninit(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct drm_device *ddev = platform_get_drvdata(pdev);
+	struct drm_device *ddev = dev_get_drvdata(dev);
 	struct msm_drm_private *priv = ddev->dev_private;
 	struct msm_kms *kms = priv->kms;
 	struct msm_mdss *mdss = priv->mdss;
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 10babd18e286..b8d154d6470f 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -35,7 +35,7 @@
 static int msm_devfreq_target(struct device *dev, unsigned long *freq,
 		u32 flags)
 {
-	struct msm_gpu *gpu = platform_get_drvdata(to_platform_device(dev));
+	struct msm_gpu *gpu = dev_get_drvdata(dev);
 	struct dev_pm_opp *opp;
 
 	opp = devfreq_recommended_opp(dev, freq, flags);
@@ -56,7 +56,7 @@ static int msm_devfreq_target(struct device *dev, unsigned long *freq,
 static int msm_devfreq_get_dev_status(struct device *dev,
 		struct devfreq_dev_status *status)
 {
-	struct msm_gpu *gpu = platform_get_drvdata(to_platform_device(dev));
+	struct msm_gpu *gpu = dev_get_drvdata(dev);
 	ktime_t time;
 
 	if (gpu->funcs->gpu_get_freq)
@@ -75,7 +75,7 @@ static int msm_devfreq_get_dev_status(struct device *dev,
 
 static int msm_devfreq_get_cur_freq(struct device *dev, unsigned long *freq)
 {
-	struct msm_gpu *gpu = platform_get_drvdata(to_platform_device(dev));
+	struct msm_gpu *gpu = dev_get_drvdata(dev);
 
 	if (gpu->funcs->gpu_get_freq)
 		*freq = gpu->funcs->gpu_get_freq(gpu);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 06/25] drm/omap: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (4 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 05/25] drm/msm: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-05-28 10:57   ` Tomi Valkeinen
  2019-04-23  7:50 ` [PATCH next 07/25] hwmon: s3c: " Kefeng Wang
                   ` (18 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Tomi Valkeinen, David Airlie,
	Daniel Vetter, dri-devel

Using dev_get_drvdata directly.

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c    | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 741a5e324767..913e8291a917 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -410,8 +410,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;
@@ -442,8 +441,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;
@@ -474,8 +472,7 @@ static ssize_t dsicm_store_ulps(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;
@@ -509,8 +506,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);
@@ -524,8 +520,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;
@@ -556,8 +551,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.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 07/25] hwmon: s3c: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (5 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 06/25] drm/omap: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-23 13:43   ` Guenter Roeck
  2019-04-23  7:50 ` [PATCH next 08/25] iio: adc: at91: " Kefeng Wang
                   ` (17 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Jean Delvare, Guenter Roeck, linux-hwmon

Using dev_get_drvdata directly.

Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/hwmon/s3c-hwmon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c
index 0c4710d35d16..0d65aa5985e2 100644
--- a/drivers/hwmon/s3c-hwmon.c
+++ b/drivers/hwmon/s3c-hwmon.c
@@ -98,7 +98,7 @@ static int s3c_hwmon_read_ch(struct device *dev,
 static ssize_t s3c_hwmon_show_raw(struct device *dev,
 				  struct device_attribute *attr, char *buf)
 {
-	struct s3c_hwmon *adc = platform_get_drvdata(to_platform_device(dev));
+	struct s3c_hwmon *adc = dev_get_drvdata(dev);
 	struct sensor_device_attribute *sa = to_sensor_dev_attr(attr);
 	int ret;
 
@@ -164,7 +164,7 @@ static ssize_t s3c_hwmon_ch_show(struct device *dev,
 				 char *buf)
 {
 	struct sensor_device_attribute *sen_attr = to_sensor_dev_attr(attr);
-	struct s3c_hwmon *hwmon = platform_get_drvdata(to_platform_device(dev));
+	struct s3c_hwmon *hwmon = dev_get_drvdata(dev);
 	struct s3c_hwmon_pdata *pdata = dev_get_platdata(dev);
 	struct s3c_hwmon_chcfg *cfg;
 	int ret;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 08/25] iio: adc: at91: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (6 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 07/25] hwmon: s3c: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-27 12:07   ` Jonathan Cameron
  2019-04-23  7:50 ` [PATCH next 09/25] input: keyboard: " Kefeng Wang
                   ` (16 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Ludovic Desroches,
	Jonathan Cameron, linux-iio

Using dev_get_drvdata directly.

Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/iio/adc/at91-sama5d2_adc.c | 12 ++++--------
 drivers/iio/adc/at91_adc.c         |  4 ++--
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index d5ea84cf6460..a3a4ca946308 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -1586,8 +1586,7 @@ static void at91_adc_hw_init(struct at91_adc_state *st)
 static ssize_t at91_adc_get_fifo_state(struct device *dev,
 				       struct device_attribute *attr, char *buf)
 {
-	struct iio_dev *indio_dev =
-			platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);
 
 	return scnprintf(buf, PAGE_SIZE, "%d\n", !!st->dma_st.dma_chan);
@@ -1596,8 +1595,7 @@ static ssize_t at91_adc_get_fifo_state(struct device *dev,
 static ssize_t at91_adc_get_watermark(struct device *dev,
 				      struct device_attribute *attr, char *buf)
 {
-	struct iio_dev *indio_dev =
-			platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);
 
 	return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark);
@@ -1849,8 +1847,7 @@ static int at91_adc_remove(struct platform_device *pdev)
 
 static __maybe_unused int at91_adc_suspend(struct device *dev)
 {
-	struct iio_dev *indio_dev =
-			platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);
 
 	/*
@@ -1870,8 +1867,7 @@ static __maybe_unused int at91_adc_suspend(struct device *dev)
 
 static __maybe_unused int at91_adc_resume(struct device *dev)
 {
-	struct iio_dev *indio_dev =
-			platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);
 	int ret;
 
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 596841a3c4db..1aa8af3491fd 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -1360,7 +1360,7 @@ static int at91_adc_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int at91_adc_suspend(struct device *dev)
 {
-	struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *idev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(idev);
 
 	pinctrl_pm_select_sleep_state(dev);
@@ -1371,7 +1371,7 @@ static int at91_adc_suspend(struct device *dev)
 
 static int at91_adc_resume(struct device *dev)
 {
-	struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev));
+	struct iio_dev *idev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(idev);
 
 	clk_prepare_enable(st->clk);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 09/25] input: keyboard: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (7 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 08/25] iio: adc: at91: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-23  8:44   ` Dmitry Torokhov
  2019-04-23  7:50 ` [PATCH next 10/25] input: misc: " Kefeng Wang
                   ` (15 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masahiro Yamada, Kefeng Wang, Dmitry Torokhov, linux-input

Using dev_get_drvdata directly.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/input/keyboard/ep93xx_keypad.c   | 10 ++++------
 drivers/input/keyboard/gpio_keys.c       |  6 ++----
 drivers/input/keyboard/imx_keypad.c      | 10 ++++------
 drivers/input/keyboard/lpc32xx-keys.c    |  6 ++----
 drivers/input/keyboard/matrix_keypad.c   | 10 ++++------
 drivers/input/keyboard/omap4-keypad.c    | 10 ++++------
 drivers/input/keyboard/pmic8xxx-keypad.c |  6 ++----
 drivers/input/keyboard/pxa27x_keypad.c   | 10 ++++------
 drivers/input/keyboard/samsung-keypad.c  | 12 ++++--------
 drivers/input/keyboard/snvs_pwrkey.c     | 10 ++++------
 drivers/input/keyboard/spear-keyboard.c  | 10 ++++------
 drivers/input/keyboard/st-keyscan.c      |  6 ++----
 drivers/input/keyboard/tegra-kbc.c       | 10 ++++------
 13 files changed, 44 insertions(+), 72 deletions(-)

diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
index f77b295e0123..7584a03db4b3 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -185,8 +185,7 @@ static void ep93xx_keypad_close(struct input_dev *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int ep93xx_keypad_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
+	struct ep93xx_keypad *keypad = dev_get_drvdata(dev);
 	struct input_dev *input_dev = keypad->input_dev;
 
 	mutex_lock(&input_dev->mutex);
@@ -198,7 +197,7 @@ static int ep93xx_keypad_suspend(struct device *dev)
 
 	mutex_unlock(&input_dev->mutex);
 
-	if (device_may_wakeup(&pdev->dev))
+	if (device_may_wakeup(dev))
 		enable_irq_wake(keypad->irq);
 
 	return 0;
@@ -206,11 +205,10 @@ static int ep93xx_keypad_suspend(struct device *dev)
 
 static int ep93xx_keypad_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
+	struct ep93xx_keypad *keypad = dev_get_drvdata(dev);
 	struct input_dev *input_dev = keypad->input_dev;
 
-	if (device_may_wakeup(&pdev->dev))
+	if (device_may_wakeup(dev))
 		disable_irq_wake(keypad->irq);
 
 	mutex_lock(&input_dev->mutex);
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 6cd199e8a370..0b4cc4834b2f 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -293,8 +293,7 @@ static ssize_t gpio_keys_show_##name(struct device *dev,		\
 				     struct device_attribute *attr,	\
 				     char *buf)				\
 {									\
-	struct platform_device *pdev = to_platform_device(dev);		\
-	struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);	\
+	struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev);		\
 									\
 	return gpio_keys_attr_show_helper(ddata, buf,			\
 					  type, only_disabled);		\
@@ -320,8 +319,7 @@ static ssize_t gpio_keys_store_##name(struct device *dev,		\
 				      const char *buf,			\
 				      size_t count)			\
 {									\
-	struct platform_device *pdev = to_platform_device(dev);		\
-	struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);	\
+	struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev);	\
 	ssize_t error;							\
 									\
 	error = gpio_keys_attr_store_helper(ddata, buf, type);		\
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
index 539cb670de41..cb6daca57646 100644
--- a/drivers/input/keyboard/imx_keypad.c
+++ b/drivers/input/keyboard/imx_keypad.c
@@ -528,8 +528,7 @@ static int imx_keypad_probe(struct platform_device *pdev)
 
 static int __maybe_unused imx_kbd_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct imx_keypad *kbd = platform_get_drvdata(pdev);
+	struct imx_keypad *kbd = dev_get_drvdata(dev);
 	struct input_dev *input_dev = kbd->input_dev;
 
 	/* imx kbd can wake up system even clock is disabled */
@@ -540,7 +539,7 @@ static int __maybe_unused imx_kbd_suspend(struct device *dev)
 
 	mutex_unlock(&input_dev->mutex);
 
-	if (device_may_wakeup(&pdev->dev))
+	if (device_may_wakeup(dev))
 		enable_irq_wake(kbd->irq);
 
 	return 0;
@@ -548,12 +547,11 @@ static int __maybe_unused imx_kbd_suspend(struct device *dev)
 
 static int __maybe_unused imx_kbd_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct imx_keypad *kbd = platform_get_drvdata(pdev);
+	struct imx_keypad *kbd = dev_get_drvdata(dev);
 	struct input_dev *input_dev = kbd->input_dev;
 	int ret = 0;
 
-	if (device_may_wakeup(&pdev->dev))
+	if (device_may_wakeup(dev))
 		disable_irq_wake(kbd->irq);
 
 	mutex_lock(&input_dev->mutex);
diff --git a/drivers/input/keyboard/lpc32xx-keys.c b/drivers/input/keyboard/lpc32xx-keys.c
index 1dd57ac0e7a2..0831a6f2a9d4 100644
--- a/drivers/input/keyboard/lpc32xx-keys.c
+++ b/drivers/input/keyboard/lpc32xx-keys.c
@@ -279,8 +279,7 @@ static int lpc32xx_kscan_probe(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int lpc32xx_kscan_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev);
+	struct lpc32xx_kscan_drv *kscandat = dev_get_drvdata(dev);
 	struct input_dev *input = kscandat->input;
 
 	mutex_lock(&input->mutex);
@@ -297,8 +296,7 @@ static int lpc32xx_kscan_suspend(struct device *dev)
 
 static int lpc32xx_kscan_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev);
+	struct lpc32xx_kscan_drv *kscandat = dev_get_drvdata(dev);
 	struct input_dev *input = kscandat->input;
 	int retval = 0;
 
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 3d1cb7bf5e35..a3477328d02b 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -276,12 +276,11 @@ static void matrix_keypad_disable_wakeup(struct matrix_keypad *keypad)
 
 static int matrix_keypad_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct matrix_keypad *keypad = platform_get_drvdata(pdev);
+	struct matrix_keypad *keypad = dev_get_drvdata(dev);
 
 	matrix_keypad_stop(keypad->input_dev);
 
-	if (device_may_wakeup(&pdev->dev))
+	if (device_may_wakeup(dev))
 		matrix_keypad_enable_wakeup(keypad);
 
 	return 0;
@@ -289,10 +288,9 @@ static int matrix_keypad_suspend(struct device *dev)
 
 static int matrix_keypad_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct matrix_keypad *keypad = platform_get_drvdata(pdev);
+	struct matrix_keypad *keypad = dev_get_drvdata(dev);
 
-	if (device_may_wakeup(&pdev->dev))
+	if (device_may_wakeup(dev))
 		matrix_keypad_disable_wakeup(keypad);
 
 	matrix_keypad_start(keypad->input_dev);
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 840e53732753..8c73a18daf8b 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -425,11 +425,10 @@ MODULE_DEVICE_TABLE(of, omap_keypad_dt_match);
 #ifdef CONFIG_PM_SLEEP
 static int omap4_keypad_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct omap4_keypad *keypad_data = platform_get_drvdata(pdev);
+	struct omap4_keypad *keypad_data = dev_get_drvdata(dev);
 	int error;
 
-	if (device_may_wakeup(&pdev->dev)) {
+	if (device_may_wakeup(dev)) {
 		error = enable_irq_wake(keypad_data->irq);
 		if (!error)
 			keypad_data->irq_wake_enabled = true;
@@ -440,10 +439,9 @@ static int omap4_keypad_suspend(struct device *dev)
 
 static int omap4_keypad_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct omap4_keypad *keypad_data = platform_get_drvdata(pdev);
+	struct omap4_keypad *keypad_data = dev_get_drvdata(dev);
 
-	if (device_may_wakeup(&pdev->dev) && keypad_data->irq_wake_enabled) {
+	if (device_may_wakeup(dev) && keypad_data->irq_wake_enabled) {
 		disable_irq_wake(keypad_data->irq);
 		keypad_data->irq_wake_enabled = false;
 	}
diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c
index 98b24ed18752..048a39321298 100644
--- a/drivers/input/keyboard/pmic8xxx-keypad.c
+++ b/drivers/input/keyboard/pmic8xxx-keypad.c
@@ -636,8 +636,7 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int pmic8xxx_kp_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct pmic8xxx_kp *kp = platform_get_drvdata(pdev);
+	struct pmic8xxx_kp *kp = dev_get_drvdata(dev);
 	struct input_dev *input_dev = kp->input;
 
 	if (device_may_wakeup(dev)) {
@@ -656,8 +655,7 @@ static int pmic8xxx_kp_suspend(struct device *dev)
 
 static int pmic8xxx_kp_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct pmic8xxx_kp *kp = platform_get_drvdata(pdev);
+	struct pmic8xxx_kp *kp = dev_get_drvdata(dev);
 	struct input_dev *input_dev = kp->input;
 
 	if (device_may_wakeup(dev)) {
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index d0bdaeadf86d..1f54a3162124 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -666,14 +666,13 @@ static void pxa27x_keypad_close(struct input_dev *dev)
 #ifdef CONFIG_PM_SLEEP
 static int pxa27x_keypad_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
+	struct pxa27x_keypad *keypad = dev_get_drvdata(dev);
 
 	/*
 	 * If the keypad is used a wake up source, clock can not be disabled.
 	 * Or it can not detect the key pressing.
 	 */
-	if (device_may_wakeup(&pdev->dev))
+	if (device_may_wakeup(dev))
 		enable_irq_wake(keypad->irq);
 	else
 		clk_disable_unprepare(keypad->clk);
@@ -683,8 +682,7 @@ static int pxa27x_keypad_suspend(struct device *dev)
 
 static int pxa27x_keypad_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
+	struct pxa27x_keypad *keypad = dev_get_drvdata(dev);
 	struct input_dev *input_dev = keypad->input_dev;
 	int ret = 0;
 
@@ -692,7 +690,7 @@ static int pxa27x_keypad_resume(struct device *dev)
 	 * If the keypad is used as wake up source, the clock is not turned
 	 * off. So do not need configure it again.
 	 */
-	if (device_may_wakeup(&pdev->dev)) {
+	if (device_may_wakeup(dev)) {
 		disable_irq_wake(keypad->irq);
 	} else {
 		mutex_lock(&input_dev->mutex);
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
index 1fe1aa2adf85..aadca4261b24 100644
--- a/drivers/input/keyboard/samsung-keypad.c
+++ b/drivers/input/keyboard/samsung-keypad.c
@@ -466,8 +466,7 @@ static int samsung_keypad_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int samsung_keypad_runtime_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct samsung_keypad *keypad = platform_get_drvdata(pdev);
+	struct samsung_keypad *keypad = dev_get_drvdata(dev);
 	unsigned int val;
 	int error;
 
@@ -490,8 +489,7 @@ static int samsung_keypad_runtime_suspend(struct device *dev)
 
 static int samsung_keypad_runtime_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct samsung_keypad *keypad = platform_get_drvdata(pdev);
+	struct samsung_keypad *keypad = dev_get_drvdata(dev);
 	unsigned int val;
 
 	if (keypad->stopped)
@@ -535,8 +533,7 @@ static void samsung_keypad_toggle_wakeup(struct samsung_keypad *keypad,
 
 static int samsung_keypad_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct samsung_keypad *keypad = platform_get_drvdata(pdev);
+	struct samsung_keypad *keypad = dev_get_drvdata(dev);
 	struct input_dev *input_dev = keypad->input_dev;
 
 	mutex_lock(&input_dev->mutex);
@@ -553,8 +550,7 @@ static int samsung_keypad_suspend(struct device *dev)
 
 static int samsung_keypad_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct samsung_keypad *keypad = platform_get_drvdata(pdev);
+	struct samsung_keypad *keypad = dev_get_drvdata(dev);
 	struct input_dev *input_dev = keypad->input_dev;
 
 	mutex_lock(&input_dev->mutex);
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index 4c67cf30a5d9..ba40dc3025ce 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -173,10 +173,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
 
 static int __maybe_unused imx_snvs_pwrkey_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+	struct pwrkey_drv_data *pdata = dev_get_drvdata(dev);
 
-	if (device_may_wakeup(&pdev->dev))
+	if (device_may_wakeup(dev))
 		enable_irq_wake(pdata->irq);
 
 	return 0;
@@ -184,10 +183,9 @@ static int __maybe_unused imx_snvs_pwrkey_suspend(struct device *dev)
 
 static int __maybe_unused imx_snvs_pwrkey_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
+	struct pwrkey_drv_data *pdata = dev_get_drvdata(dev);
 
-	if (device_may_wakeup(&pdev->dev))
+	if (device_may_wakeup(dev))
 		disable_irq_wake(pdata->irq);
 
 	return 0;
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index 7d25fa338ab4..a0276a3376d2 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -288,8 +288,7 @@ static int spear_kbd_remove(struct platform_device *pdev)
 
 static int __maybe_unused spear_kbd_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct spear_kbd *kbd = platform_get_drvdata(pdev);
+	struct spear_kbd *kbd = dev_get_drvdata(dev);
 	struct input_dev *input_dev = kbd->input;
 	unsigned int rate = 0, mode_ctl_reg, val;
 
@@ -300,7 +299,7 @@ static int __maybe_unused spear_kbd_suspend(struct device *dev)
 
 	mode_ctl_reg = readl_relaxed(kbd->io_base + MODE_CTL_REG);
 
-	if (device_may_wakeup(&pdev->dev)) {
+	if (device_may_wakeup(dev)) {
 		if (!enable_irq_wake(kbd->irq))
 			kbd->irq_wake_enabled = true;
 
@@ -341,13 +340,12 @@ static int __maybe_unused spear_kbd_suspend(struct device *dev)
 
 static int __maybe_unused spear_kbd_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct spear_kbd *kbd = platform_get_drvdata(pdev);
+	struct spear_kbd *kbd = dev_get_drvdata(dev);
 	struct input_dev *input_dev = kbd->input;
 
 	mutex_lock(&input_dev->mutex);
 
-	if (device_may_wakeup(&pdev->dev)) {
+	if (device_may_wakeup(dev)) {
 		if (kbd->irq_wake_enabled) {
 			kbd->irq_wake_enabled = false;
 			disable_irq_wake(kbd->irq);
diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c
index 3b85631fde91..454481651ace 100644
--- a/drivers/input/keyboard/st-keyscan.c
+++ b/drivers/input/keyboard/st-keyscan.c
@@ -218,8 +218,7 @@ static int keyscan_probe(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int keyscan_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct st_keyscan *keypad = platform_get_drvdata(pdev);
+	struct st_keyscan *keypad = dev_get_drvdata(dev);
 	struct input_dev *input = keypad->input_dev;
 
 	mutex_lock(&input->mutex);
@@ -235,8 +234,7 @@ static int keyscan_suspend(struct device *dev)
 
 static int keyscan_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct st_keyscan *keypad = platform_get_drvdata(pdev);
+	struct st_keyscan *keypad = dev_get_drvdata(dev);
 	struct input_dev *input = keypad->input_dev;
 	int retval = 0;
 
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
index 875205f445b5..861bfcbd817d 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -744,11 +744,10 @@ static void tegra_kbc_set_keypress_interrupt(struct tegra_kbc *kbc, bool enable)
 
 static int tegra_kbc_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct tegra_kbc *kbc = platform_get_drvdata(pdev);
+	struct tegra_kbc *kbc = dev_get_drvdata(dev);
 
 	mutex_lock(&kbc->idev->mutex);
-	if (device_may_wakeup(&pdev->dev)) {
+	if (device_may_wakeup(dev)) {
 		disable_irq(kbc->irq);
 		del_timer_sync(&kbc->timer);
 		tegra_kbc_set_fifo_interrupt(kbc, false);
@@ -781,12 +780,11 @@ static int tegra_kbc_suspend(struct device *dev)
 
 static int tegra_kbc_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct tegra_kbc *kbc = platform_get_drvdata(pdev);
+	struct tegra_kbc *kbc = dev_get_drvdata(dev);
 	int err = 0;
 
 	mutex_lock(&kbc->idev->mutex);
-	if (device_may_wakeup(&pdev->dev)) {
+	if (device_may_wakeup(dev)) {
 		disable_irq_wake(kbc->irq);
 		tegra_kbc_setup_wakekeys(kbc, false);
 		/* We will use fifo interrupts for key detection. */
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 10/25] input: misc: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (8 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 09/25] input: keyboard: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-23  7:50 ` [PATCH next 11/25] input: mouse: " Kefeng Wang
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masahiro Yamada, Kefeng Wang, Dmitry Torokhov, linux-input

Using dev_get_drvdata directly.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/input/misc/max77693-haptic.c  |  6 ++----
 drivers/input/misc/max8925_onkey.c    | 10 ++++------
 drivers/input/misc/max8997_haptic.c   |  3 +--
 drivers/input/misc/msm-vibrator.c     |  6 ++----
 drivers/input/misc/palmas-pwrbutton.c |  6 ++----
 drivers/input/misc/regulator-haptic.c |  6 ++----
 drivers/input/misc/stpmic1_onkey.c    |  6 ++----
 drivers/input/misc/twl4030-vibra.c    |  3 +--
 drivers/input/misc/twl6040-vibra.c    |  3 +--
 9 files changed, 17 insertions(+), 32 deletions(-)

diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c
index 46b0f48fbf49..8968fd48e95c 100644
--- a/drivers/input/misc/max77693-haptic.c
+++ b/drivers/input/misc/max77693-haptic.c
@@ -381,8 +381,7 @@ static int max77693_haptic_probe(struct platform_device *pdev)
 
 static int __maybe_unused max77693_haptic_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct max77693_haptic *haptic = platform_get_drvdata(pdev);
+	struct max77693_haptic *haptic = dev_get_drvdata(dev);
 
 	if (haptic->enabled) {
 		max77693_haptic_disable(haptic);
@@ -394,8 +393,7 @@ static int __maybe_unused max77693_haptic_suspend(struct device *dev)
 
 static int __maybe_unused max77693_haptic_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct max77693_haptic *haptic = platform_get_drvdata(pdev);
+	struct max77693_haptic *haptic = dev_get_drvdata(dev);
 
 	if (haptic->suspend_state) {
 		max77693_haptic_enable(haptic);
diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c
index 7c49b8d23894..af0ba592a0b3 100644
--- a/drivers/input/misc/max8925_onkey.c
+++ b/drivers/input/misc/max8925_onkey.c
@@ -135,9 +135,8 @@ static int max8925_onkey_probe(struct platform_device *pdev)
 
 static int __maybe_unused max8925_onkey_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct max8925_onkey_info *info = platform_get_drvdata(pdev);
-	struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
+	struct max8925_onkey_info *info = dev_get_drvdata(dev);
+	struct max8925_chip *chip = dev_get_drvdata(dev->parent);
 
 	if (device_may_wakeup(dev)) {
 		chip->wakeup_flag |= 1 << info->irq[0];
@@ -149,9 +148,8 @@ static int __maybe_unused max8925_onkey_suspend(struct device *dev)
 
 static int __maybe_unused max8925_onkey_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct max8925_onkey_info *info = platform_get_drvdata(pdev);
-	struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
+	struct max8925_onkey_info *info = dev_get_drvdata(dev);
+	struct max8925_chip *chip = dev_get_drvdata(dev->parent);
 
 	if (device_may_wakeup(dev)) {
 		chip->wakeup_flag &= ~(1 << info->irq[0]);
diff --git a/drivers/input/misc/max8997_haptic.c b/drivers/input/misc/max8997_haptic.c
index 99bc762881d5..5ffb0ac68d50 100644
--- a/drivers/input/misc/max8997_haptic.c
+++ b/drivers/input/misc/max8997_haptic.c
@@ -388,8 +388,7 @@ static int max8997_haptic_remove(struct platform_device *pdev)
 
 static int __maybe_unused max8997_haptic_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct max8997_haptic *chip = platform_get_drvdata(pdev);
+	struct max8997_haptic *chip = dev_get_drvdata(dev);
 
 	max8997_haptic_disable(chip);
 
diff --git a/drivers/input/misc/msm-vibrator.c b/drivers/input/misc/msm-vibrator.c
index b60f1aaee705..a28974bfb64e 100644
--- a/drivers/input/misc/msm-vibrator.c
+++ b/drivers/input/misc/msm-vibrator.c
@@ -234,8 +234,7 @@ static int msm_vibrator_probe(struct platform_device *pdev)
 
 static int __maybe_unused msm_vibrator_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct msm_vibrator *vibrator = platform_get_drvdata(pdev);
+	struct msm_vibrator *vibrator = dev_get_drvdata(dev);
 
 	cancel_work_sync(&vibrator->worker);
 
@@ -247,8 +246,7 @@ static int __maybe_unused msm_vibrator_suspend(struct device *dev)
 
 static int __maybe_unused msm_vibrator_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct msm_vibrator *vibrator = platform_get_drvdata(pdev);
+	struct msm_vibrator *vibrator = dev_get_drvdata(dev);
 
 	if (vibrator->enabled)
 		msm_vibrator_start(vibrator);
diff --git a/drivers/input/misc/palmas-pwrbutton.c b/drivers/input/misc/palmas-pwrbutton.c
index 1e1baed63929..27617868b292 100644
--- a/drivers/input/misc/palmas-pwrbutton.c
+++ b/drivers/input/misc/palmas-pwrbutton.c
@@ -270,8 +270,7 @@ static int palmas_pwron_remove(struct platform_device *pdev)
  */
 static int __maybe_unused palmas_pwron_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct palmas_pwron *pwron = platform_get_drvdata(pdev);
+	struct palmas_pwron *pwron = dev_get_drvdata(dev);
 
 	cancel_delayed_work_sync(&pwron->input_work);
 
@@ -291,8 +290,7 @@ static int __maybe_unused palmas_pwron_suspend(struct device *dev)
  */
 static int __maybe_unused palmas_pwron_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct palmas_pwron *pwron = platform_get_drvdata(pdev);
+	struct palmas_pwron *pwron = dev_get_drvdata(dev);
 
 	if (device_may_wakeup(dev))
 		disable_irq_wake(pwron->irq);
diff --git a/drivers/input/misc/regulator-haptic.c b/drivers/input/misc/regulator-haptic.c
index a1db1e5040dc..0b78a87f3192 100644
--- a/drivers/input/misc/regulator-haptic.c
+++ b/drivers/input/misc/regulator-haptic.c
@@ -206,8 +206,7 @@ static int regulator_haptic_probe(struct platform_device *pdev)
 
 static int __maybe_unused regulator_haptic_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct regulator_haptic *haptic = platform_get_drvdata(pdev);
+	struct regulator_haptic *haptic = dev_get_drvdata(dev);
 	int error;
 
 	error = mutex_lock_interruptible(&haptic->mutex);
@@ -225,8 +224,7 @@ static int __maybe_unused regulator_haptic_suspend(struct device *dev)
 
 static int __maybe_unused regulator_haptic_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct regulator_haptic *haptic = platform_get_drvdata(pdev);
+	struct regulator_haptic *haptic = dev_get_drvdata(dev);
 	unsigned int magnitude;
 
 	mutex_lock(&haptic->mutex);
diff --git a/drivers/input/misc/stpmic1_onkey.c b/drivers/input/misc/stpmic1_onkey.c
index 7b49c9997df7..ff4761540539 100644
--- a/drivers/input/misc/stpmic1_onkey.c
+++ b/drivers/input/misc/stpmic1_onkey.c
@@ -150,8 +150,7 @@ static int stpmic1_onkey_probe(struct platform_device *pdev)
 
 static int __maybe_unused stpmic1_onkey_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct stpmic1_onkey *onkey = platform_get_drvdata(pdev);
+	struct stpmic1_onkey *onkey = dev_get_drvdata(dev);
 
 	if (device_may_wakeup(dev)) {
 		enable_irq_wake(onkey->irq_falling);
@@ -162,8 +161,7 @@ static int __maybe_unused stpmic1_onkey_suspend(struct device *dev)
 
 static int __maybe_unused stpmic1_onkey_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct stpmic1_onkey *onkey = platform_get_drvdata(pdev);
+	struct stpmic1_onkey *onkey = dev_get_drvdata(dev);
 
 	if (device_may_wakeup(dev)) {
 		disable_irq_wake(onkey->irq_falling);
diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c
index c37aea9ac272..7b9104c058ca 100644
--- a/drivers/input/misc/twl4030-vibra.c
+++ b/drivers/input/misc/twl4030-vibra.c
@@ -159,8 +159,7 @@ static void twl4030_vibra_close(struct input_dev *input)
 /*** Module ***/
 static int __maybe_unused twl4030_vibra_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct vibra_info *info = platform_get_drvdata(pdev);
+	struct vibra_info *info = dev_get_drvdata(dev);
 
 	if (info->enabled)
 		vibra_disable(info);
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
index 15e0d352c4cc..c8539a4a98c6 100644
--- a/drivers/input/misc/twl6040-vibra.c
+++ b/drivers/input/misc/twl6040-vibra.c
@@ -226,8 +226,7 @@ static void twl6040_vibra_close(struct input_dev *input)
 
 static int __maybe_unused twl6040_vibra_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct vibra_info *info = platform_get_drvdata(pdev);
+	struct vibra_info *info = dev_get_drvdata(dev);
 
 	cancel_work_sync(&info->play_work);
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 11/25] input: mouse: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (9 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 10/25] input: misc: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-23  7:50 ` [PATCH next 12/25] input: touchscreen: " Kefeng Wang
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masahiro Yamada, Kefeng Wang, Dmitry Torokhov, linux-input

Using dev_get_drvdata directly.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/input/mouse/navpoint.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/input/mouse/navpoint.c b/drivers/input/mouse/navpoint.c
index d6e8f58a1de3..3d83a79e14d9 100644
--- a/drivers/input/mouse/navpoint.c
+++ b/drivers/input/mouse/navpoint.c
@@ -320,8 +320,7 @@ static int navpoint_remove(struct platform_device *pdev)
 
 static int __maybe_unused navpoint_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct navpoint *navpoint = platform_get_drvdata(pdev);
+	struct navpoint *navpoint = dev_get_drvdata(dev);
 	struct input_dev *input = navpoint->input;
 
 	mutex_lock(&input->mutex);
@@ -334,8 +333,7 @@ static int __maybe_unused navpoint_suspend(struct device *dev)
 
 static int __maybe_unused navpoint_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct navpoint *navpoint = platform_get_drvdata(pdev);
+	struct navpoint *navpoint = dev_get_drvdata(dev);
 	struct input_dev *input = navpoint->input;
 
 	mutex_lock(&input->mutex);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 12/25] input: touchscreen: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (10 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 11/25] input: mouse: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-23  7:50 ` [PATCH next 13/25] iommu/omap: " Kefeng Wang
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Dmitry Torokhov, Shawn Guo,
	Sascha Hauer, linux-input

Using dev_get_drvdata directly.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-input@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/input/touchscreen/imx6ul_tsc.c | 6 ++----
 drivers/input/touchscreen/s3c2410_ts.c | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c
index c10fc594f94d..493322ed0e34 100644
--- a/drivers/input/touchscreen/imx6ul_tsc.c
+++ b/drivers/input/touchscreen/imx6ul_tsc.c
@@ -511,8 +511,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev)
 
 static int __maybe_unused imx6ul_tsc_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct imx6ul_tsc *tsc = platform_get_drvdata(pdev);
+	struct imx6ul_tsc *tsc = dev_get_drvdata(dev);
 	struct input_dev *input_dev = tsc->input;
 
 	mutex_lock(&input_dev->mutex);
@@ -531,8 +530,7 @@ static int __maybe_unused imx6ul_tsc_suspend(struct device *dev)
 
 static int __maybe_unused imx6ul_tsc_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct imx6ul_tsc *tsc = platform_get_drvdata(pdev);
+	struct imx6ul_tsc *tsc = dev_get_drvdata(dev);
 	struct input_dev *input_dev = tsc->input;
 	int retval = 0;
 
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 1173890f6719..e5e9f6527ed8 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -396,8 +396,7 @@ static int s3c2410ts_suspend(struct device *dev)
 
 static int s3c2410ts_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct s3c2410_ts_mach_info *info = dev_get_platdata(&pdev->dev);
+	struct s3c2410_ts_mach_info *info = dev_get_platdata(dev);
 
 	clk_enable(ts.clock);
 	enable_irq(ts.irq_tc);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 13/25] iommu/omap: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (11 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 12/25] input: touchscreen: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-26 14:49   ` Joerg Roedel
  2019-04-23  7:50 ` [PATCH next 14/25] mailbox: bcm-flexrm-mailbox: " Kefeng Wang
                   ` (11 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masahiro Yamada, Kefeng Wang, Joerg Roedel, iommu

Using dev_get_drvdata directly.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/iommu/omap-iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index d2fb347aa4ff..b16c711fc5fc 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -38,8 +38,7 @@
 
 static const struct iommu_ops omap_iommu_ops;
 
-#define to_iommu(dev)							\
-	((struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)))
+#define to_iommu(dev)	((struct omap_iommu *)dev_get_drvdata(dev))
 
 /* bitmap of the page sizes currently supported */
 #define OMAP_IOMMU_PGSIZES	(SZ_4K | SZ_64K | SZ_1M | SZ_16M)
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 14/25] mailbox: bcm-flexrm-mailbox: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (12 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 13/25] iommu/omap: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-23  7:50 ` [PATCH next 15/25] media: platform: " Kefeng Wang
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masahiro Yamada, Kefeng Wang, Anup Patel, Jassi Brar

Using dev_get_drvdata directly.

Cc: Anup Patel <anup.patel@broadcom.com>
Cc: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/mailbox/bcm-flexrm-mailbox.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c
index a64116586b4c..0cfdd53d04a1 100644
--- a/drivers/mailbox/bcm-flexrm-mailbox.c
+++ b/drivers/mailbox/bcm-flexrm-mailbox.c
@@ -1165,8 +1165,7 @@ static int flexrm_process_completions(struct flexrm_ring *ring)
 
 static int flexrm_debugfs_conf_show(struct seq_file *file, void *offset)
 {
-	struct platform_device *pdev = to_platform_device(file->private);
-	struct flexrm_mbox *mbox = platform_get_drvdata(pdev);
+	struct flexrm_mbox *mbox = dev_get_drvdata(file->private);
 
 	/* Write config in file */
 	flexrm_write_config_in_seqfile(mbox, file);
@@ -1176,8 +1175,7 @@ static int flexrm_debugfs_conf_show(struct seq_file *file, void *offset)
 
 static int flexrm_debugfs_stats_show(struct seq_file *file, void *offset)
 {
-	struct platform_device *pdev = to_platform_device(file->private);
-	struct flexrm_mbox *mbox = platform_get_drvdata(pdev);
+	struct flexrm_mbox *mbox = dev_get_drvdata(file->private);
 
 	/* Write stats in file */
 	flexrm_write_stats_in_seqfile(mbox, file);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 15/25] media: platform: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (13 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 14/25] mailbox: bcm-flexrm-mailbox: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-05-24 12:58   ` Mauro Carvalho Chehab
  2019-04-23  7:50 ` [PATCH next 16/25] mfd: " Kefeng Wang
                   ` (9 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Mauro Carvalho Chehab,
	Benson Leung, Enric Balletbo i Serra, linux-media

Using dev_get_drvdata directly.

Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Benson Leung <bleung@chromium.org>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/media/platform/cros-ec-cec/cros-ec-cec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c
index 7bc4d8a9af28..2e218c7a3a1f 100644
--- a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c
+++ b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c
@@ -174,8 +174,7 @@ static const struct cec_adap_ops cros_ec_cec_ops = {
 #ifdef CONFIG_PM_SLEEP
 static int cros_ec_cec_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct cros_ec_cec *cros_ec_cec = dev_get_drvdata(&pdev->dev);
+	struct cros_ec_cec *cros_ec_cec = dev_get_drvdata(dev);
 
 	if (device_may_wakeup(dev))
 		enable_irq_wake(cros_ec_cec->cros_ec->irq);
@@ -185,8 +184,7 @@ static int cros_ec_cec_suspend(struct device *dev)
 
 static int cros_ec_cec_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct cros_ec_cec *cros_ec_cec = dev_get_drvdata(&pdev->dev);
+	struct cros_ec_cec *cros_ec_cec = dev_get_drvdata(dev);
 
 	if (device_may_wakeup(dev))
 		disable_irq_wake(cros_ec_cec->cros_ec->irq);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 16/25] mfd: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (14 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 15/25] media: platform: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-05-08 10:32   ` Lee Jones
  2019-04-23  7:50 ` [PATCH next 17/25] mmc: omap_hsmmc: " Kefeng Wang
                   ` (8 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Andy Gross, David Brown, Lee Jones,
	linux-arm-msm

Using dev_get_drvdata directly.

Cc: Andy Gross <andy.gross@linaro.org>
Cc: David Brown <david.brown@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: linux-arm-msm@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/mfd/ssbi.c     |  2 +-
 drivers/mfd/t7l66xb.c  | 12 ++++--------
 drivers/mfd/tc6387xb.c | 12 ++++--------
 drivers/mfd/tc6393xb.c | 21 +++++++--------------
 4 files changed, 16 insertions(+), 31 deletions(-)

diff --git a/drivers/mfd/ssbi.c b/drivers/mfd/ssbi.c
index 36b96fee4ce6..50f87d0f9151 100644
--- a/drivers/mfd/ssbi.c
+++ b/drivers/mfd/ssbi.c
@@ -80,7 +80,7 @@ struct ssbi {
 	int (*write)(struct ssbi *, u16 addr, const u8 *buf, int len);
 };
 
-#define to_ssbi(dev)	platform_get_drvdata(to_platform_device(dev))
+#define to_ssbi(dev)	dev_get_drvdata(dev)
 
 static inline u32 ssbi_readl(struct ssbi *ssbi, u32 reg)
 {
diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c
index 43d8683266de..e9cfb147345e 100644
--- a/drivers/mfd/t7l66xb.c
+++ b/drivers/mfd/t7l66xb.c
@@ -82,8 +82,7 @@ struct t7l66xb {
 
 static int t7l66xb_mmc_enable(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 	unsigned long flags;
 	u8 dev_ctl;
 	int ret;
@@ -108,8 +107,7 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc)
 
 static int t7l66xb_mmc_disable(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 	unsigned long flags;
 	u8 dev_ctl;
 
@@ -128,16 +126,14 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc)
 
 static void t7l66xb_mmc_pwr(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_pwr(t7l66xb->scr + 0x200, 0, state);
 }
 
 static void t7l66xb_mmc_clk_div(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_clk_div(t7l66xb->scr + 0x200, 0, state);
 }
diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c
index 85fab3729102..f417c6fecfe2 100644
--- a/drivers/mfd/tc6387xb.c
+++ b/drivers/mfd/tc6387xb.c
@@ -80,16 +80,14 @@ static int tc6387xb_resume(struct platform_device *dev)
 
 static void tc6387xb_mmc_pwr(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_pwr(tc6387xb->scr + 0x200, 0, state);
 }
 
 static void tc6387xb_mmc_clk_div(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_clk_div(tc6387xb->scr + 0x200, 0, state);
 }
@@ -97,8 +95,7 @@ static void tc6387xb_mmc_clk_div(struct platform_device *mmc, int state)
 
 static int tc6387xb_mmc_enable(struct platform_device *mmc)
 {
-	struct platform_device *dev      = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	clk_prepare_enable(tc6387xb->clk32k);
 
@@ -110,8 +107,7 @@ static int tc6387xb_mmc_enable(struct platform_device *mmc)
 
 static int tc6387xb_mmc_disable(struct platform_device *mmc)
 {
-	struct platform_device *dev      = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	clk_disable_unprepare(tc6387xb->clk32k);
 
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 0c9f0390e891..ad0351f22675 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -122,8 +122,7 @@ enum {
 
 static int tc6393xb_nand_enable(struct platform_device *nand)
 {
-	struct platform_device *dev = to_platform_device(nand->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(nand->dev.parent);
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&tc6393xb->lock, flags);
@@ -312,8 +311,7 @@ static int tc6393xb_fb_disable(struct platform_device *dev)
 
 int tc6393xb_lcd_set_power(struct platform_device *fb, bool on)
 {
-	struct platform_device *dev = to_platform_device(fb->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(fb->dev.parent);
 	u8 fer;
 	unsigned long flags;
 
@@ -334,8 +332,7 @@ EXPORT_SYMBOL(tc6393xb_lcd_set_power);
 
 int tc6393xb_lcd_mode(struct platform_device *fb,
 					const struct fb_videomode *mode) {
-	struct platform_device *dev = to_platform_device(fb->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(fb->dev.parent);
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&tc6393xb->lock, flags);
@@ -351,8 +348,7 @@ EXPORT_SYMBOL(tc6393xb_lcd_mode);
 
 static int tc6393xb_mmc_enable(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_enable(tc6393xb->scr + 0x200, 0,
 		tc6393xb_mmc_resources[0].start & 0xfffe);
@@ -362,8 +358,7 @@ static int tc6393xb_mmc_enable(struct platform_device *mmc)
 
 static int tc6393xb_mmc_resume(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_resume(tc6393xb->scr + 0x200, 0,
 		tc6393xb_mmc_resources[0].start & 0xfffe);
@@ -373,16 +368,14 @@ static int tc6393xb_mmc_resume(struct platform_device *mmc)
 
 static void tc6393xb_mmc_pwr(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_pwr(tc6393xb->scr + 0x200, 0, state);
 }
 
 static void tc6393xb_mmc_clk_div(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_clk_div(tc6393xb->scr + 0x200, 0, state);
 }
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 17/25] mmc: omap_hsmmc: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (15 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 16/25] mfd: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-29 10:45   ` Ulf Hansson
  2019-04-23  7:50 ` [PATCH next 18/25] net: can: " Kefeng Wang
                   ` (7 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Ulf Hansson, Linus Walleij,
	linux-mmc, linux-omap

Using dev_get_drvdata directly.

Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-mmc@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/mmc/host/omap_hsmmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 29a1ddaa7466..952fa4063ff8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2077,7 +2077,7 @@ static int omap_hsmmc_runtime_suspend(struct device *dev)
 	unsigned long flags;
 	int ret = 0;
 
-	host = platform_get_drvdata(to_platform_device(dev));
+	host = dev_get_drvdata(dev);
 	omap_hsmmc_context_save(host);
 	dev_dbg(dev, "disabled\n");
 
@@ -2118,7 +2118,7 @@ static int omap_hsmmc_runtime_resume(struct device *dev)
 	struct omap_hsmmc_host *host;
 	unsigned long flags;
 
-	host = platform_get_drvdata(to_platform_device(dev));
+	host = dev_get_drvdata(dev);
 	omap_hsmmc_context_restore(host);
 	dev_dbg(dev, "enabled\n");
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 18/25] net: can: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (16 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 17/25] mmc: omap_hsmmc: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-23  7:50 ` [PATCH next 19/25] net: calxedaxgmac: " Kefeng Wang
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Wolfgang Grandegger,
	Marc Kleine-Budde, David S. Miller, netdev

Using dev_get_drvdata directly.

Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/net/can/softing/softing_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
index e22696190583..6de68036ed41 100644
--- a/drivers/net/can/softing/softing_main.c
+++ b/drivers/net/can/softing/softing_main.c
@@ -694,7 +694,7 @@ static void softing_netdev_cleanup(struct net_device *netdev)
 static ssize_t show_##name(struct device *dev, \
 		struct device_attribute *attr, char *buf) \
 { \
-	struct softing *card = platform_get_drvdata(to_platform_device(dev)); \
+	struct softing *card = dev_get_drvdata(dev); \
 	return sprintf(buf, "%u\n", card->member); \
 } \
 static DEVICE_ATTR(name, 0444, show_##name, NULL)
@@ -703,7 +703,7 @@ static DEVICE_ATTR(name, 0444, show_##name, NULL)
 static ssize_t show_##name(struct device *dev, \
 		struct device_attribute *attr, char *buf) \
 { \
-	struct softing *card = platform_get_drvdata(to_platform_device(dev)); \
+	struct softing *card = dev_get_drvdata(dev); \
 	return sprintf(buf, "%s\n", card->member); \
 } \
 static DEVICE_ATTR(name, 0444, show_##name, NULL)
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 19/25] net: calxedaxgmac: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (17 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 18/25] net: can: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-23  7:50 ` [PATCH next 20/25] platform/x86: asus-wmi: " Kefeng Wang
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masahiro Yamada, Kefeng Wang, David S. Miller, netdev

Using dev_get_drvdata directly.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/net/ethernet/calxeda/xgmac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 13741ee49b9b..a71390c7c9de 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -1866,7 +1866,7 @@ static void xgmac_pmt(void __iomem *ioaddr, unsigned long mode)
 
 static int xgmac_suspend(struct device *dev)
 {
-	struct net_device *ndev = platform_get_drvdata(to_platform_device(dev));
+	struct net_device *ndev = dev_get_drvdata(dev);
 	struct xgmac_priv *priv = netdev_priv(ndev);
 	u32 value;
 
@@ -1892,7 +1892,7 @@ static int xgmac_suspend(struct device *dev)
 
 static int xgmac_resume(struct device *dev)
 {
-	struct net_device *ndev = platform_get_drvdata(to_platform_device(dev));
+	struct net_device *ndev = dev_get_drvdata(dev);
 	struct xgmac_priv *priv = netdev_priv(ndev);
 	void __iomem *ioaddr = priv->base;
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 20/25] platform/x86: asus-wmi: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (18 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 19/25] net: calxedaxgmac: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-05-06  9:01   ` Andy Shevchenko
  2019-04-23  7:50 ` [PATCH next 21/25] rtc: " Kefeng Wang
                   ` (4 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Darren Hart, Andy Shevchenko,
	platform-driver-x86

Using dev_get_drvdata directly.

Cc: Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 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 ee1fa93708ec..fb9e4e02c068 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1361,8 +1361,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.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 21/25] rtc: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (19 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 20/25] platform/x86: asus-wmi: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-26 18:52   ` Alexandre Belloni
  2019-04-23  7:50 ` [PATCH next 22/25] media: staging/imx7: " Kefeng Wang
                   ` (3 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Alessandro Zummo,
	Alexandre Belloni, linux-rtc

Using dev_get_drvdata directly.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-rtc@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/rtc/rtc-hid-sensor-time.c |  3 +--
 drivers/rtc/rtc-pxa.c             |  3 +--
 drivers/rtc/rtc-rk808.c           |  6 ++----
 drivers/rtc/rtc-tx4939.c          | 17 ++++++-----------
 drivers/rtc/rtc-wm831x.c          | 18 +++++++-----------
 drivers/rtc/rtc-wm8350.c          | 12 ++++--------
 6 files changed, 21 insertions(+), 38 deletions(-)

diff --git a/drivers/rtc/rtc-hid-sensor-time.c b/drivers/rtc/rtc-hid-sensor-time.c
index 3e1abb455472..f27c40e8331f 100644
--- a/drivers/rtc/rtc-hid-sensor-time.c
+++ b/drivers/rtc/rtc-hid-sensor-time.c
@@ -205,8 +205,7 @@ static int hid_time_parse_report(struct platform_device *pdev,
 static int hid_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
 	unsigned long flags;
-	struct hid_time_state *time_state =
-		platform_get_drvdata(to_platform_device(dev));
+	struct hid_time_state *time_state = dev_get_drvdata(dev);
 	int ret;
 
 	reinit_completion(&time_state->comp_last_time);
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c
index e1887b86fdc7..d4766734e40b 100644
--- a/drivers/rtc/rtc-pxa.c
+++ b/drivers/rtc/rtc-pxa.c
@@ -145,8 +145,7 @@ static void rtsr_set_bits(struct pxa_rtc *pxa_rtc, u32 mask)
 
 static irqreturn_t pxa_rtc_irq(int irq, void *dev_id)
 {
-	struct platform_device *pdev = to_platform_device(dev_id);
-	struct pxa_rtc *pxa_rtc = platform_get_drvdata(pdev);
+	struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev_id);
 	u32 rtsr;
 	unsigned long events = 0;
 
diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c
index 1fb864d4ef83..5c5d9f125669 100644
--- a/drivers/rtc/rtc-rk808.c
+++ b/drivers/rtc/rtc-rk808.c
@@ -336,8 +336,7 @@ static const struct rtc_class_ops rk808_rtc_ops = {
 /* Turn off the alarm if it should not be a wake source. */
 static int rk808_rtc_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct rk808_rtc *rk808_rtc = dev_get_drvdata(&pdev->dev);
+	struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev);
 
 	if (device_may_wakeup(dev))
 		enable_irq_wake(rk808_rtc->irq);
@@ -350,8 +349,7 @@ static int rk808_rtc_suspend(struct device *dev)
  */
 static int rk808_rtc_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct rk808_rtc *rk808_rtc = dev_get_drvdata(&pdev->dev);
+	struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev);
 
 	if (device_may_wakeup(dev))
 		disable_irq_wake(rk808_rtc->irq);
diff --git a/drivers/rtc/rtc-tx4939.c b/drivers/rtc/rtc-tx4939.c
index 2d24babc4057..5a29915a06ec 100644
--- a/drivers/rtc/rtc-tx4939.c
+++ b/drivers/rtc/rtc-tx4939.c
@@ -42,11 +42,6 @@ struct tx4939rtc_plat_data {
 	spinlock_t lock;
 };
 
-static struct tx4939rtc_plat_data *get_tx4939rtc_plat_data(struct device *dev)
-{
-	return platform_get_drvdata(to_platform_device(dev));
-}
-
 static int tx4939_rtc_cmd(struct tx4939_rtc_reg __iomem *rtcreg, int cmd)
 {
 	int i = 0;
@@ -64,7 +59,7 @@ static int tx4939_rtc_cmd(struct tx4939_rtc_reg __iomem *rtcreg, int cmd)
 
 static int tx4939_rtc_set_time(struct device *dev, struct rtc_time *tm)
 {
-	struct tx4939rtc_plat_data *pdata = get_tx4939rtc_plat_data(dev);
+	struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev);
 	struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg;
 	unsigned long secs = rtc_tm_to_time64(tm);
 	int i, ret;
@@ -89,7 +84,7 @@ static int tx4939_rtc_set_time(struct device *dev, struct rtc_time *tm)
 
 static int tx4939_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
-	struct tx4939rtc_plat_data *pdata = get_tx4939rtc_plat_data(dev);
+	struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev);
 	struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg;
 	int i, ret;
 	unsigned long sec;
@@ -115,7 +110,7 @@ static int tx4939_rtc_read_time(struct device *dev, struct rtc_time *tm)
 
 static int tx4939_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 {
-	struct tx4939rtc_plat_data *pdata = get_tx4939rtc_plat_data(dev);
+	struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev);
 	struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg;
 	int i, ret;
 	unsigned long sec;
@@ -140,7 +135,7 @@ static int tx4939_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 
 static int tx4939_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 {
-	struct tx4939rtc_plat_data *pdata = get_tx4939rtc_plat_data(dev);
+	struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev);
 	struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg;
 	int i, ret;
 	unsigned long sec;
@@ -170,7 +165,7 @@ static int tx4939_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 
 static int tx4939_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
 {
-	struct tx4939rtc_plat_data *pdata = get_tx4939rtc_plat_data(dev);
+	struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev);
 
 	spin_lock_irq(&pdata->lock);
 	tx4939_rtc_cmd(pdata->rtcreg,
@@ -182,7 +177,7 @@ static int tx4939_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
 
 static irqreturn_t tx4939_rtc_interrupt(int irq, void *dev_id)
 {
-	struct tx4939rtc_plat_data *pdata = get_tx4939rtc_plat_data(dev_id);
+	struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev_id);
 	struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg;
 	unsigned long events = RTC_IRQF;
 
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c
index 6a0defd16088..ff7460853416 100644
--- a/drivers/rtc/rtc-wm831x.c
+++ b/drivers/rtc/rtc-wm831x.c
@@ -344,11 +344,10 @@ static const struct rtc_class_ops wm831x_rtc_ops = {
 /* Turn off the alarm if it should not be a wake source. */
 static int wm831x_rtc_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct wm831x_rtc *wm831x_rtc = dev_get_drvdata(&pdev->dev);
+	struct wm831x_rtc *wm831x_rtc = dev_get_drvdata(dev);
 	int ret, enable;
 
-	if (wm831x_rtc->alarm_enabled && device_may_wakeup(&pdev->dev))
+	if (wm831x_rtc->alarm_enabled && device_may_wakeup(dev))
 		enable = WM831X_RTC_ALM_ENA;
 	else
 		enable = 0;
@@ -356,7 +355,7 @@ static int wm831x_rtc_suspend(struct device *dev)
 	ret = wm831x_set_bits(wm831x_rtc->wm831x, WM831X_RTC_CONTROL,
 			      WM831X_RTC_ALM_ENA, enable);
 	if (ret != 0)
-		dev_err(&pdev->dev, "Failed to update RTC alarm: %d\n", ret);
+		dev_err(dev, "Failed to update RTC alarm: %d\n", ret);
 
 	return 0;
 }
@@ -366,15 +365,13 @@ static int wm831x_rtc_suspend(struct device *dev)
  */
 static int wm831x_rtc_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct wm831x_rtc *wm831x_rtc = dev_get_drvdata(&pdev->dev);
+	struct wm831x_rtc *wm831x_rtc = dev_get_drvdata(dev);
 	int ret;
 
 	if (wm831x_rtc->alarm_enabled) {
 		ret = wm831x_rtc_start_alarm(wm831x_rtc);
 		if (ret != 0)
-			dev_err(&pdev->dev,
-				"Failed to restart RTC alarm: %d\n", ret);
+			dev_err(dev, "Failed to restart RTC alarm: %d\n", ret);
 	}
 
 	return 0;
@@ -383,14 +380,13 @@ static int wm831x_rtc_resume(struct device *dev)
 /* Unconditionally disable the alarm */
 static int wm831x_rtc_freeze(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct wm831x_rtc *wm831x_rtc = dev_get_drvdata(&pdev->dev);
+	struct wm831x_rtc *wm831x_rtc = dev_get_drvdata(dev);
 	int ret;
 
 	ret = wm831x_set_bits(wm831x_rtc->wm831x, WM831X_RTC_CONTROL,
 			      WM831X_RTC_ALM_ENA, 0);
 	if (ret != 0)
-		dev_err(&pdev->dev, "Failed to stop RTC alarm: %d\n", ret);
+		dev_err(dev, "Failed to stop RTC alarm: %d\n", ret);
 
 	return 0;
 }
diff --git a/drivers/rtc/rtc-wm8350.c b/drivers/rtc/rtc-wm8350.c
index 483c7993516b..f54fa12c4b4b 100644
--- a/drivers/rtc/rtc-wm8350.c
+++ b/drivers/rtc/rtc-wm8350.c
@@ -340,8 +340,7 @@ static const struct rtc_class_ops wm8350_rtc_ops = {
 #ifdef CONFIG_PM_SLEEP
 static int wm8350_rtc_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct wm8350 *wm8350 = dev_get_drvdata(&pdev->dev);
+	struct wm8350 *wm8350 = dev_get_drvdata(dev);
 	int ret = 0;
 	u16 reg;
 
@@ -351,8 +350,7 @@ static int wm8350_rtc_suspend(struct device *dev)
 	    reg & WM8350_RTC_ALMSTS) {
 		ret = wm8350_rtc_stop_alarm(wm8350);
 		if (ret != 0)
-			dev_err(&pdev->dev, "Failed to stop RTC alarm: %d\n",
-				ret);
+			dev_err(dev, "Failed to stop RTC alarm: %d\n", ret);
 	}
 
 	return ret;
@@ -360,15 +358,13 @@ static int wm8350_rtc_suspend(struct device *dev)
 
 static int wm8350_rtc_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct wm8350 *wm8350 = dev_get_drvdata(&pdev->dev);
+	struct wm8350 *wm8350 = dev_get_drvdata(dev);
 	int ret;
 
 	if (wm8350->rtc.alarm_enabled) {
 		ret = wm8350_rtc_start_alarm(wm8350);
 		if (ret != 0)
-			dev_err(&pdev->dev,
-				"Failed to restart RTC alarm: %d\n", ret);
+			dev_err(dev, "Failed to restart RTC alarm: %d\n", ret);
 	}
 
 	return 0;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 22/25] media: staging/imx7: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (20 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 21/25] rtc: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-23  8:34   ` Rui Miguel Silva
  2019-04-23  7:50 ` [PATCH next 23/25] thermal: " Kefeng Wang
                   ` (2 subsequent siblings)
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Rui Miguel Silva, Steve Longerbeam,
	Philipp Zabel, NXP Linux Team, linux-media

Using dev_get_drvdata directly.

Cc: Rui Miguel Silva <rmfrfs@gmail.com>
Cc: Steve Longerbeam <slongerbeam@gmail.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/staging/media/imx/imx7-mipi-csis.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c
index 6cae2960eea1..19455f425416 100644
--- a/drivers/staging/media/imx/imx7-mipi-csis.c
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -1027,8 +1027,7 @@ static int mipi_csis_probe(struct platform_device *pdev)
 
 static int mipi_csis_pm_suspend(struct device *dev, bool runtime)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct v4l2_subdev *mipi_sd = platform_get_drvdata(pdev);
+	struct v4l2_subdev *mipi_sd = dev_get_drvdata(dev);
 	struct csi_state *state = mipi_sd_to_csis_state(mipi_sd);
 	int ret = 0;
 
@@ -1052,8 +1051,7 @@ static int mipi_csis_pm_suspend(struct device *dev, bool runtime)
 
 static int mipi_csis_pm_resume(struct device *dev, bool runtime)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct v4l2_subdev *mipi_sd = platform_get_drvdata(pdev);
+	struct v4l2_subdev *mipi_sd = dev_get_drvdata(dev);
 	struct csi_state *state = mipi_sd_to_csis_state(mipi_sd);
 	int ret = 0;
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 23/25] thermal: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (21 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 22/25] media: staging/imx7: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-29  3:47   ` Zhang Rui
  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
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Zhang Rui, Eduardo Valentin,
	Daniel Lezcano, linux-pm

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); \
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)
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 24/25] usb: musb: dsps: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (22 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 23/25] thermal: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-04-23  7:50 ` [PATCH next 25/25] video: fbdev: " Kefeng Wang
  24 siblings, 0 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Bin Liu, Greg Kroah-Hartman, linux-usb

Using dev_get_drvdata directly.

Cc: Bin Liu <b-liu@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/usb/musb/musb_dsps.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 403eb97915f8..327d4f7baaf7 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -168,8 +168,7 @@ static void dsps_mod_timer_optional(struct dsps_glue *glue)
 static void dsps_musb_enable(struct musb *musb)
 {
 	struct device *dev = musb->controller;
-	struct platform_device *pdev = to_platform_device(dev->parent);
-	struct dsps_glue *glue = platform_get_drvdata(pdev);
+	struct dsps_glue *glue = dev_get_drvdata(dev->parent);
 	const struct dsps_musb_wrapper *wrp = glue->wrp;
 	void __iomem *reg_base = musb->ctrl_base;
 	u32 epmask, coremask;
@@ -195,8 +194,7 @@ static void dsps_musb_enable(struct musb *musb)
 static void dsps_musb_disable(struct musb *musb)
 {
 	struct device *dev = musb->controller;
-	struct platform_device *pdev = to_platform_device(dev->parent);
-	struct dsps_glue *glue = platform_get_drvdata(pdev);
+	struct dsps_glue *glue = dev_get_drvdata(dev->parent);
 	const struct dsps_musb_wrapper *wrp = glue->wrp;
 	void __iomem *reg_base = musb->ctrl_base;
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next 25/25] video: fbdev: Use dev_get_drvdata()
  2019-04-23  7:49 [PATCH next 00/25] cleanup: use dev_get_drvdata() directly Kefeng Wang
                   ` (23 preceding siblings ...)
  2019-04-23  7:50 ` [PATCH next 24/25] usb: musb: dsps: " Kefeng Wang
@ 2019-04-23  7:50 ` Kefeng Wang
  2019-05-06 13:48   ` Bartlomiej Zolnierkiewicz
  24 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-04-23  7:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masahiro Yamada, Kefeng Wang, Wan ZongShun, Kukjin Kim,
	Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
	Michal Januszewski, dri-devel, linux-fbdev

Using dev_get_drvdata directly.

Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Michal Januszewski <spock@gentoo.org>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/video/fbdev/nuc900fb.c  |  2 +-
 drivers/video/fbdev/s3c2410fb.c |  2 +-
 drivers/video/fbdev/uvesafb.c   | 16 ++++++++--------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/video/fbdev/nuc900fb.c b/drivers/video/fbdev/nuc900fb.c
index 6680edae4696..44ea5380a546 100644
--- a/drivers/video/fbdev/nuc900fb.c
+++ b/drivers/video/fbdev/nuc900fb.c
@@ -455,7 +455,7 @@ static int nuc900fb_cpufreq_transition(struct notifier_block *nb,
 	struct fb_info *fbinfo;
 	long delta_f;
 	info = container_of(nb, struct nuc900fb_info, freq_transition);
-	fbinfo = platform_get_drvdata(to_platform_device(info->dev));
+	fbinfo = dev_get_drvdata(info->dev);
 
 	delta_f = info->clk_rate - clk_get_rate(info->clk);
 
diff --git a/drivers/video/fbdev/s3c2410fb.c b/drivers/video/fbdev/s3c2410fb.c
index a67e4567e656..a702da89910b 100644
--- a/drivers/video/fbdev/s3c2410fb.c
+++ b/drivers/video/fbdev/s3c2410fb.c
@@ -777,7 +777,7 @@ static int s3c2410fb_cpufreq_transition(struct notifier_block *nb,
 	long delta_f;
 
 	info = container_of(nb, struct s3c2410fb_info, freq_transition);
-	fbinfo = platform_get_drvdata(to_platform_device(info->dev));
+	fbinfo = dev_get_drvdata(info->dev);
 
 	/* work out change, <0 for speed-up */
 	delta_f = info->clk_rate - clk_get_rate(info->clk);
diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c
index 34dc8e53a1e9..d707fdb97354 100644
--- a/drivers/video/fbdev/uvesafb.c
+++ b/drivers/video/fbdev/uvesafb.c
@@ -1543,7 +1543,7 @@ static void uvesafb_ioremap(struct fb_info *info)
 static ssize_t uvesafb_show_vbe_ver(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct fb_info *info = platform_get_drvdata(to_platform_device(dev));
+	struct fb_info *info = dev_get_drvdata(dev);
 	struct uvesafb_par *par = info->par;
 
 	return snprintf(buf, PAGE_SIZE, "%.4x\n", par->vbe_ib.vbe_version);
@@ -1554,7 +1554,7 @@ static DEVICE_ATTR(vbe_version, S_IRUGO, uvesafb_show_vbe_ver, NULL);
 static ssize_t uvesafb_show_vbe_modes(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct fb_info *info = platform_get_drvdata(to_platform_device(dev));
+	struct fb_info *info = dev_get_drvdata(dev);
 	struct uvesafb_par *par = info->par;
 	int ret = 0, i;
 
@@ -1573,7 +1573,7 @@ static DEVICE_ATTR(vbe_modes, S_IRUGO, uvesafb_show_vbe_modes, NULL);
 static ssize_t uvesafb_show_vendor(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct fb_info *info = platform_get_drvdata(to_platform_device(dev));
+	struct fb_info *info = dev_get_drvdata(dev);
 	struct uvesafb_par *par = info->par;
 
 	if (par->vbe_ib.oem_vendor_name_ptr)
@@ -1588,7 +1588,7 @@ static DEVICE_ATTR(oem_vendor, S_IRUGO, uvesafb_show_vendor, NULL);
 static ssize_t uvesafb_show_product_name(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct fb_info *info = platform_get_drvdata(to_platform_device(dev));
+	struct fb_info *info = dev_get_drvdata(dev);
 	struct uvesafb_par *par = info->par;
 
 	if (par->vbe_ib.oem_product_name_ptr)
@@ -1603,7 +1603,7 @@ static DEVICE_ATTR(oem_product_name, S_IRUGO, uvesafb_show_product_name, NULL);
 static ssize_t uvesafb_show_product_rev(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct fb_info *info = platform_get_drvdata(to_platform_device(dev));
+	struct fb_info *info = dev_get_drvdata(dev);
 	struct uvesafb_par *par = info->par;
 
 	if (par->vbe_ib.oem_product_rev_ptr)
@@ -1618,7 +1618,7 @@ static DEVICE_ATTR(oem_product_rev, S_IRUGO, uvesafb_show_product_rev, NULL);
 static ssize_t uvesafb_show_oem_string(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct fb_info *info = platform_get_drvdata(to_platform_device(dev));
+	struct fb_info *info = dev_get_drvdata(dev);
 	struct uvesafb_par *par = info->par;
 
 	if (par->vbe_ib.oem_string_ptr)
@@ -1633,7 +1633,7 @@ static DEVICE_ATTR(oem_string, S_IRUGO, uvesafb_show_oem_string, NULL);
 static ssize_t uvesafb_show_nocrtc(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
-	struct fb_info *info = platform_get_drvdata(to_platform_device(dev));
+	struct fb_info *info = dev_get_drvdata(dev);
 	struct uvesafb_par *par = info->par;
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", par->nocrtc);
@@ -1642,7 +1642,7 @@ static ssize_t uvesafb_show_nocrtc(struct device *dev,
 static ssize_t uvesafb_store_nocrtc(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
-	struct fb_info *info = platform_get_drvdata(to_platform_device(dev));
+	struct fb_info *info = dev_get_drvdata(dev);
 	struct uvesafb_par *par = info->par;
 
 	if (count > 0) {
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 22/25] media: staging/imx7: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 22/25] media: staging/imx7: " Kefeng Wang
@ 2019-04-23  8:34   ` Rui Miguel Silva
  0 siblings, 0 replies; 50+ messages in thread
From: Rui Miguel Silva @ 2019-04-23  8:34 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-kernel, Masahiro Yamada, Steve Longerbeam, Philipp Zabel,
	NXP Linux Team, linux-media

Hi Kefeng,
Thanks for the patch.

On Tue 23 Apr 2019 at 08:50, Kefeng Wang wrote:
> Using dev_get_drvdata directly.
>
> Cc: Rui Miguel Silva <rmfrfs@gmail.com>

There was already a patch sent by Wolfram that does the same thing
[0].

Thanks anyway.

---
Cheers,
	Rui

[0]: https://lore.kernel.org/linux-media/20190319163622.30607-1-wsa+renesas@sang-engineering.com/

> Cc: Steve Longerbeam <slongerbeam@gmail.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/staging/media/imx/imx7-mipi-csis.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c
> index 6cae2960eea1..19455f425416 100644
> --- a/drivers/staging/media/imx/imx7-mipi-csis.c
> +++ b/drivers/staging/media/imx/imx7-mipi-csis.c
> @@ -1027,8 +1027,7 @@ static int mipi_csis_probe(struct platform_device *pdev)
>  
>  static int mipi_csis_pm_suspend(struct device *dev, bool runtime)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct v4l2_subdev *mipi_sd = platform_get_drvdata(pdev);
> +	struct v4l2_subdev *mipi_sd = dev_get_drvdata(dev);
>  	struct csi_state *state = mipi_sd_to_csis_state(mipi_sd);
>  	int ret = 0;
>  
> @@ -1052,8 +1051,7 @@ static int mipi_csis_pm_suspend(struct device *dev, bool runtime)
>  
>  static int mipi_csis_pm_resume(struct device *dev, bool runtime)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct v4l2_subdev *mipi_sd = platform_get_drvdata(pdev);
> +	struct v4l2_subdev *mipi_sd = dev_get_drvdata(dev);
>  	struct csi_state *state = mipi_sd_to_csis_state(mipi_sd);
>  	int ret = 0;


^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 09/25] input: keyboard: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 09/25] input: keyboard: " Kefeng Wang
@ 2019-04-23  8:44   ` Dmitry Torokhov
  0 siblings, 0 replies; 50+ messages in thread
From: Dmitry Torokhov @ 2019-04-23  8:44 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: linux-kernel, Masahiro Yamada, linux-input

Hi Kefeng,

On Tue, Apr 23, 2019 at 03:50:04PM +0800, Kefeng Wang wrote:
> Using dev_get_drvdata directly.

This assumes that generic device's driver data is exactly the same as platform
device's driver data. This is true today, but does not have to be true
tomorrow.

What is the benefit of violating the layering and accessing "parent"
object's abstraction directly? Performance impact must be negligible...

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 07/25] hwmon: s3c: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 07/25] hwmon: s3c: " Kefeng Wang
@ 2019-04-23 13:43   ` Guenter Roeck
  0 siblings, 0 replies; 50+ messages in thread
From: Guenter Roeck @ 2019-04-23 13:43 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: linux-kernel, Masahiro Yamada, Jean Delvare, linux-hwmon

On Tue, Apr 23, 2019 at 03:50:02PM +0800, Kefeng Wang wrote:
> Using dev_get_drvdata directly.
> 
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/s3c-hwmon.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c
> index 0c4710d35d16..0d65aa5985e2 100644
> --- a/drivers/hwmon/s3c-hwmon.c
> +++ b/drivers/hwmon/s3c-hwmon.c
> @@ -98,7 +98,7 @@ static int s3c_hwmon_read_ch(struct device *dev,
>  static ssize_t s3c_hwmon_show_raw(struct device *dev,
>  				  struct device_attribute *attr, char *buf)
>  {
> -	struct s3c_hwmon *adc = platform_get_drvdata(to_platform_device(dev));
> +	struct s3c_hwmon *adc = dev_get_drvdata(dev);
>  	struct sensor_device_attribute *sa = to_sensor_dev_attr(attr);
>  	int ret;
>  
> @@ -164,7 +164,7 @@ static ssize_t s3c_hwmon_ch_show(struct device *dev,
>  				 char *buf)
>  {
>  	struct sensor_device_attribute *sen_attr = to_sensor_dev_attr(attr);
> -	struct s3c_hwmon *hwmon = platform_get_drvdata(to_platform_device(dev));
> +	struct s3c_hwmon *hwmon = dev_get_drvdata(dev);
>  	struct s3c_hwmon_pdata *pdata = dev_get_platdata(dev);
>  	struct s3c_hwmon_chcfg *cfg;
>  	int ret;

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 03/25] dmaengine: Use dev_get_drvdata()
  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
  0 siblings, 1 reply; 50+ messages in thread
From: Vinod Koul @ 2019-04-26 11:52 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: linux-kernel, Masahiro Yamada, Vinod Koul, dmaengine

On 23-04-19, 15:49, Kefeng Wang wrote:
> Using dev_get_drvdata directly.
> 
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: dmaengine@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/dma/bcm-sba-raid.c | 3 +--
>  drivers/dma/nbpfaxi.c      | 4 ++--

I would prefer these to be two patches, one for each driver

-- 
~Vinod

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 13/25] iommu/omap: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 13/25] iommu/omap: " Kefeng Wang
@ 2019-04-26 14:49   ` Joerg Roedel
  0 siblings, 0 replies; 50+ messages in thread
From: Joerg Roedel @ 2019-04-26 14:49 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: linux-kernel, Masahiro Yamada, iommu

On Tue, Apr 23, 2019 at 03:50:08PM +0800, Kefeng Wang wrote:
>  drivers/iommu/omap-iommu.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 21/25] rtc: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 21/25] rtc: " Kefeng Wang
@ 2019-04-26 18:52   ` Alexandre Belloni
  0 siblings, 0 replies; 50+ messages in thread
From: Alexandre Belloni @ 2019-04-26 18:52 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: linux-kernel, Masahiro Yamada, Alessandro Zummo, linux-rtc

On 23/04/2019 15:50:16+0800, Kefeng Wang wrote:
> Using dev_get_drvdata directly.
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: linux-rtc@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/rtc/rtc-hid-sensor-time.c |  3 +--
>  drivers/rtc/rtc-pxa.c             |  3 +--
>  drivers/rtc/rtc-rk808.c           |  6 ++----
>  drivers/rtc/rtc-tx4939.c          | 17 ++++++-----------
>  drivers/rtc/rtc-wm831x.c          | 18 +++++++-----------
>  drivers/rtc/rtc-wm8350.c          | 12 ++++--------
>  6 files changed, 21 insertions(+), 38 deletions(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 08/25] iio: adc: at91: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 08/25] iio: adc: at91: " Kefeng Wang
@ 2019-04-27 12:07   ` Jonathan Cameron
  0 siblings, 0 replies; 50+ messages in thread
From: Jonathan Cameron @ 2019-04-27 12:07 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-kernel, Masahiro Yamada, Ludovic Desroches,
	Jonathan Cameron, linux-iio

On Tue, 23 Apr 2019 15:50:03 +0800
Kefeng Wang <wangkefeng.wang@huawei.com> wrote:

> Using dev_get_drvdata directly.
> 
> Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
> Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: linux-iio@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

A sensible cleanup, thanks.

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/at91-sama5d2_adc.c | 12 ++++--------
>  drivers/iio/adc/at91_adc.c         |  4 ++--
>  2 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> index d5ea84cf6460..a3a4ca946308 100644
> --- a/drivers/iio/adc/at91-sama5d2_adc.c
> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> @@ -1586,8 +1586,7 @@ static void at91_adc_hw_init(struct at91_adc_state *st)
>  static ssize_t at91_adc_get_fifo_state(struct device *dev,
>  				       struct device_attribute *attr, char *buf)
>  {
> -	struct iio_dev *indio_dev =
> -			platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(indio_dev);
>  
>  	return scnprintf(buf, PAGE_SIZE, "%d\n", !!st->dma_st.dma_chan);
> @@ -1596,8 +1595,7 @@ static ssize_t at91_adc_get_fifo_state(struct device *dev,
>  static ssize_t at91_adc_get_watermark(struct device *dev,
>  				      struct device_attribute *attr, char *buf)
>  {
> -	struct iio_dev *indio_dev =
> -			platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(indio_dev);
>  
>  	return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark);
> @@ -1849,8 +1847,7 @@ static int at91_adc_remove(struct platform_device *pdev)
>  
>  static __maybe_unused int at91_adc_suspend(struct device *dev)
>  {
> -	struct iio_dev *indio_dev =
> -			platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(indio_dev);
>  
>  	/*
> @@ -1870,8 +1867,7 @@ static __maybe_unused int at91_adc_suspend(struct device *dev)
>  
>  static __maybe_unused int at91_adc_resume(struct device *dev)
>  {
> -	struct iio_dev *indio_dev =
> -			platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(indio_dev);
>  	int ret;
>  
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 596841a3c4db..1aa8af3491fd 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -1360,7 +1360,7 @@ static int at91_adc_remove(struct platform_device *pdev)
>  #ifdef CONFIG_PM_SLEEP
>  static int at91_adc_suspend(struct device *dev)
>  {
> -	struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *idev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(idev);
>  
>  	pinctrl_pm_select_sleep_state(dev);
> @@ -1371,7 +1371,7 @@ static int at91_adc_suspend(struct device *dev)
>  
>  static int at91_adc_resume(struct device *dev)
>  {
> -	struct iio_dev *idev = platform_get_drvdata(to_platform_device(dev));
> +	struct iio_dev *idev = dev_get_drvdata(dev);
>  	struct at91_adc_state *st = iio_priv(idev);
>  
>  	clk_prepare_enable(st->clk);


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next v2 1/2] dmaengine: bcm-sba-raid: Use dev_get_drvdata()
  2019-04-26 11:52   ` Vinod Koul
@ 2019-04-28  4:00     ` 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
  0 siblings, 2 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-28  4:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kefeng Wang, Vinod Koul, dmaengine

Using dev_get_drvdata directly.

Cc: Vinod Koul <vinod.koul@intel.com>
Cc: dmaengine@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/dma/bcm-sba-raid.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c
index 72878ac5c78d..fa81d0177765 100644
--- a/drivers/dma/bcm-sba-raid.c
+++ b/drivers/dma/bcm-sba-raid.c
@@ -1459,8 +1459,7 @@ static void sba_receive_message(struct mbox_client *cl, void *msg)
 
 static int sba_debugfs_stats_show(struct seq_file *file, void *offset)
 {
-	struct platform_device *pdev = to_platform_device(file->private);
-	struct sba_device *sba = platform_get_drvdata(pdev);
+	struct sba_device *sba = dev_get_drvdata(file->private);
 
 	/* Write stats in file */
 	sba_write_stats_in_seqfile(sba, file);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next v2 2/2] dmaengine: nbpfaxi: Use dev_get_drvdata()
  2019-04-28  4:00     ` [PATCH next v2 1/2] dmaengine: bcm-sba-raid: " Kefeng Wang
@ 2019-04-28  4:00       ` Kefeng Wang
  2019-04-29  5:17       ` [PATCH next v2 1/2] dmaengine: bcm-sba-raid: " Vinod Koul
  1 sibling, 0 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-28  4:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kefeng Wang, Vinod Koul, dmaengine

Using dev_get_drvdata directly.

Cc: Vinod Koul <vinod.koul@intel.com>
Cc: dmaengine@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/dma/nbpfaxi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/nbpfaxi.c b/drivers/dma/nbpfaxi.c
index a67b292190f4..594409a6e975 100644
--- a/drivers/dma/nbpfaxi.c
+++ b/drivers/dma/nbpfaxi.c
@@ -1491,14 +1491,14 @@ MODULE_DEVICE_TABLE(platform, nbpf_ids);
 #ifdef CONFIG_PM
 static int nbpf_runtime_suspend(struct device *dev)
 {
-	struct nbpf_device *nbpf = platform_get_drvdata(to_platform_device(dev));
+	struct nbpf_device *nbpf = dev_get_drvdata(dev);
 	clk_disable_unprepare(nbpf->clk);
 	return 0;
 }
 
 static int nbpf_runtime_resume(struct device *dev)
 {
-	struct nbpf_device *nbpf = platform_get_drvdata(to_platform_device(dev));
+	struct nbpf_device *nbpf = dev_get_drvdata(dev);
 	return clk_prepare_enable(nbpf->clk);
 }
 #endif
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 23/25] thermal: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 23/25] thermal: " Kefeng Wang
@ 2019-04-29  3:47   ` Zhang Rui
  2019-04-29  6:55     ` Kefeng Wang
  0 siblings, 1 reply; 50+ messages in thread
From: Zhang Rui @ 2019-04-29  3:47 UTC (permalink / raw)
  To: Kefeng Wang, linux-kernel
  Cc: Masahiro Yamada, Eduardo Valentin, Daniel Lezcano, linux-pm

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)

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next v2 1/2] dmaengine: bcm-sba-raid: Use dev_get_drvdata()
  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       ` Vinod Koul
  1 sibling, 0 replies; 50+ messages in thread
From: Vinod Koul @ 2019-04-29  5:17 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: linux-kernel, Vinod Koul, dmaengine

On 28-04-19, 12:00, Kefeng Wang wrote:
> Using dev_get_drvdata directly.
> 

Applied both, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 23/25] thermal: Use dev_get_drvdata()
  2019-04-29  3:47   ` Zhang Rui
@ 2019-04-29  6:55     ` Kefeng Wang
  0 siblings, 0 replies; 50+ messages in thread
From: Kefeng Wang @ 2019-04-29  6:55 UTC (permalink / raw)
  To: Zhang Rui, linux-kernel
  Cc: Masahiro Yamada, Eduardo Valentin, Daniel Lezcano, linux-pm


On 2019/4/29 11:47, Zhang Rui wrote:
> 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.

oh, Sumeet's patch is the right one and much cleaner.


>
> 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)
> .
>


^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 17/25] mmc: omap_hsmmc: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 17/25] mmc: omap_hsmmc: " Kefeng Wang
@ 2019-04-29 10:45   ` Ulf Hansson
  0 siblings, 0 replies; 50+ messages in thread
From: Ulf Hansson @ 2019-04-29 10:45 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Linux Kernel Mailing List, Masahiro Yamada, Linus Walleij,
	linux-mmc, linux-omap

On Tue, 23 Apr 2019 at 09:40, Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
> Using dev_get_drvdata directly.
>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-mmc@vger.kernel.org
> Cc: linux-omap@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/omap_hsmmc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 29a1ddaa7466..952fa4063ff8 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -2077,7 +2077,7 @@ static int omap_hsmmc_runtime_suspend(struct device *dev)
>         unsigned long flags;
>         int ret = 0;
>
> -       host = platform_get_drvdata(to_platform_device(dev));
> +       host = dev_get_drvdata(dev);
>         omap_hsmmc_context_save(host);
>         dev_dbg(dev, "disabled\n");
>
> @@ -2118,7 +2118,7 @@ static int omap_hsmmc_runtime_resume(struct device *dev)
>         struct omap_hsmmc_host *host;
>         unsigned long flags;
>
> -       host = platform_get_drvdata(to_platform_device(dev));
> +       host = dev_get_drvdata(dev);
>         omap_hsmmc_context_restore(host);
>         dev_dbg(dev, "enabled\n");
>
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 01/25] ACPI / DPTF: Use dev_get_drvdata()
  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
  0 siblings, 0 replies; 50+ messages in thread
From: Rafael J. Wysocki @ 2019-05-01 10:13 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-kernel, Masahiro Yamada, Srinivas Pandruvada, linux-acpi

On Tuesday, April 23, 2019 9:49:56 AM CEST Kefeng Wang wrote:
> Using dev_get_drvdata directly.
> 
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: linux-acpi@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/acpi/dptf/dptf_power.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/dptf/dptf_power.c b/drivers/acpi/dptf/dptf_power.c
> index e1c242568341..0c081390930a 100644
> --- a/drivers/acpi/dptf/dptf_power.c
> +++ b/drivers/acpi/dptf/dptf_power.c
> @@ -31,8 +31,7 @@ static ssize_t name##_show(struct device *dev,\
>  			   struct device_attribute *attr,\
>  			   char *buf)\
>  {\
> -	struct platform_device *pdev = to_platform_device(dev);\
> -	struct acpi_device *acpi_dev = platform_get_drvdata(pdev);\
> +	struct acpi_device *acpi_dev = dev_get_drvdata(dev);\
>  	unsigned long long val;\
>  	acpi_status status;\
>  \
> 

Applied, thanks!





^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 02/25] crypto: picoxcell: Use dev_get_drvdata()
  2019-04-23  7:49 ` [PATCH next 02/25] crypto: picoxcell: " Kefeng Wang
@ 2019-05-03  6:09   ` Herbert Xu
  0 siblings, 0 replies; 50+ messages in thread
From: Herbert Xu @ 2019-05-03  6:09 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-kernel, Masahiro Yamada, Jamie Iles, David S. Miller,
	linux-crypto, linux-arm-kernel

On Tue, Apr 23, 2019 at 03:49:57PM +0800, Kefeng Wang wrote:
> Using dev_get_drvdata directly.
> 
> Cc: Jamie Iles <jamie@jamieiles.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-crypto@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/crypto/picoxcell_crypto.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 20/25] platform/x86: asus-wmi: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 20/25] platform/x86: asus-wmi: " Kefeng Wang
@ 2019-05-06  9:01   ` Andy Shevchenko
  0 siblings, 0 replies; 50+ messages in thread
From: Andy Shevchenko @ 2019-05-06  9:01 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Linux Kernel Mailing List, Masahiro Yamada, Darren Hart,
	Andy Shevchenko, Platform Driver

On Tue, Apr 23, 2019 at 10:40 AM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
> Using dev_get_drvdata directly.
>

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Cc: Darren Hart <dvhart@infradead.org>
> Cc: Andy Shevchenko <andy@infradead.org>
> Cc: platform-driver-x86@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  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 ee1fa93708ec..fb9e4e02c068 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -1361,8 +1361,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.20.1
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 25/25] video: fbdev: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 25/25] video: fbdev: " Kefeng Wang
@ 2019-05-06 13:48   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 50+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-05-06 13:48 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-kernel, Masahiro Yamada, Wan ZongShun, Kukjin Kim,
	Krzysztof Kozlowski, Michal Januszewski, dri-devel, linux-fbdev


On 04/23/2019 09:50 AM, Kefeng Wang wrote:
> Using dev_get_drvdata directly.
> 
> Cc: Wan ZongShun <mcuos.com@gmail.com>
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Cc: Krzysztof Kozlowski <krzk@kernel.org>
> Cc: Michal Januszewski <spock@gentoo.org>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-fbdev@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

Patch queued for v5.2, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 16/25] mfd: Use dev_get_drvdata()
  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
  0 siblings, 1 reply; 50+ messages in thread
From: Lee Jones @ 2019-05-08 10:32 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-kernel, Masahiro Yamada, Andy Gross, David Brown, linux-arm-msm

On Tue, 23 Apr 2019, Kefeng Wang wrote:

> Using dev_get_drvdata directly.
> 
> Cc: Andy Gross <andy.gross@linaro.org>
> Cc: David Brown <david.brown@linaro.org>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: linux-arm-msm@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/mfd/ssbi.c     |  2 +-
>  drivers/mfd/t7l66xb.c  | 12 ++++--------
>  drivers/mfd/tc6387xb.c | 12 ++++--------
>  drivers/mfd/tc6393xb.c | 21 +++++++--------------
>  4 files changed, 16 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/mfd/ssbi.c b/drivers/mfd/ssbi.c
> index 36b96fee4ce6..50f87d0f9151 100644
> --- a/drivers/mfd/ssbi.c
> +++ b/drivers/mfd/ssbi.c
> @@ -80,7 +80,7 @@ struct ssbi {
>  	int (*write)(struct ssbi *, u16 addr, const u8 *buf, int len);
>  };
>  
> -#define to_ssbi(dev)	platform_get_drvdata(to_platform_device(dev))
> +#define to_ssbi(dev)	dev_get_drvdata(dev)

If you could replace 'to_ssbi(dev)' with 'dev_get_drvdata(dev)' it
would be better.

The rest of the changes look fine.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next v2] mfd: Use dev_get_drvdata()
  2019-05-08 10:32   ` Lee Jones
@ 2019-05-08 13:52     ` Kefeng Wang
  2019-05-09  6:14       ` Lee Jones
  0 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-05-08 13:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: Kefeng Wang, Andy Gross, David Brown, Lee Jones, linux-arm-msm

Using dev_get_drvdata directly.

Cc: Andy Gross <andy.gross@linaro.org>
Cc: David Brown <david.brown@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: linux-arm-msm@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
v2:
-use dev_get_drvdata() instead of to_ssbi()

 drivers/mfd/ssbi.c     |  6 ++----
 drivers/mfd/t7l66xb.c  | 12 ++++--------
 drivers/mfd/tc6387xb.c | 12 ++++--------
 drivers/mfd/tc6393xb.c | 21 +++++++--------------
 4 files changed, 17 insertions(+), 34 deletions(-)

diff --git a/drivers/mfd/ssbi.c b/drivers/mfd/ssbi.c
index 36b96fee4ce6..0ae27cd30268 100644
--- a/drivers/mfd/ssbi.c
+++ b/drivers/mfd/ssbi.c
@@ -80,8 +80,6 @@ struct ssbi {
 	int (*write)(struct ssbi *, u16 addr, const u8 *buf, int len);
 };
 
-#define to_ssbi(dev)	platform_get_drvdata(to_platform_device(dev))
-
 static inline u32 ssbi_readl(struct ssbi *ssbi, u32 reg)
 {
 	return readl(ssbi->base + reg);
@@ -243,7 +241,7 @@ ssbi_pa_write_bytes(struct ssbi *ssbi, u16 addr, const u8 *buf, int len)
 
 int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len)
 {
-	struct ssbi *ssbi = to_ssbi(dev);
+	struct ssbi *ssbi = dev_get_drvdata(dev);
 	unsigned long flags;
 	int ret;
 
@@ -257,7 +255,7 @@ EXPORT_SYMBOL_GPL(ssbi_read);
 
 int ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len)
 {
-	struct ssbi *ssbi = to_ssbi(dev);
+	struct ssbi *ssbi = dev_get_drvdata(dev);
 	unsigned long flags;
 	int ret;
 
diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c
index 43d8683266de..e9cfb147345e 100644
--- a/drivers/mfd/t7l66xb.c
+++ b/drivers/mfd/t7l66xb.c
@@ -82,8 +82,7 @@ struct t7l66xb {
 
 static int t7l66xb_mmc_enable(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 	unsigned long flags;
 	u8 dev_ctl;
 	int ret;
@@ -108,8 +107,7 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc)
 
 static int t7l66xb_mmc_disable(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 	unsigned long flags;
 	u8 dev_ctl;
 
@@ -128,16 +126,14 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc)
 
 static void t7l66xb_mmc_pwr(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_pwr(t7l66xb->scr + 0x200, 0, state);
 }
 
 static void t7l66xb_mmc_clk_div(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_clk_div(t7l66xb->scr + 0x200, 0, state);
 }
diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c
index 85fab3729102..f417c6fecfe2 100644
--- a/drivers/mfd/tc6387xb.c
+++ b/drivers/mfd/tc6387xb.c
@@ -80,16 +80,14 @@ static int tc6387xb_resume(struct platform_device *dev)
 
 static void tc6387xb_mmc_pwr(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_pwr(tc6387xb->scr + 0x200, 0, state);
 }
 
 static void tc6387xb_mmc_clk_div(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_clk_div(tc6387xb->scr + 0x200, 0, state);
 }
@@ -97,8 +95,7 @@ static void tc6387xb_mmc_clk_div(struct platform_device *mmc, int state)
 
 static int tc6387xb_mmc_enable(struct platform_device *mmc)
 {
-	struct platform_device *dev      = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	clk_prepare_enable(tc6387xb->clk32k);
 
@@ -110,8 +107,7 @@ static int tc6387xb_mmc_enable(struct platform_device *mmc)
 
 static int tc6387xb_mmc_disable(struct platform_device *mmc)
 {
-	struct platform_device *dev      = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	clk_disable_unprepare(tc6387xb->clk32k);
 
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 0c9f0390e891..ad0351f22675 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -122,8 +122,7 @@ enum {
 
 static int tc6393xb_nand_enable(struct platform_device *nand)
 {
-	struct platform_device *dev = to_platform_device(nand->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(nand->dev.parent);
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&tc6393xb->lock, flags);
@@ -312,8 +311,7 @@ static int tc6393xb_fb_disable(struct platform_device *dev)
 
 int tc6393xb_lcd_set_power(struct platform_device *fb, bool on)
 {
-	struct platform_device *dev = to_platform_device(fb->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(fb->dev.parent);
 	u8 fer;
 	unsigned long flags;
 
@@ -334,8 +332,7 @@ EXPORT_SYMBOL(tc6393xb_lcd_set_power);
 
 int tc6393xb_lcd_mode(struct platform_device *fb,
 					const struct fb_videomode *mode) {
-	struct platform_device *dev = to_platform_device(fb->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(fb->dev.parent);
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&tc6393xb->lock, flags);
@@ -351,8 +348,7 @@ EXPORT_SYMBOL(tc6393xb_lcd_mode);
 
 static int tc6393xb_mmc_enable(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_enable(tc6393xb->scr + 0x200, 0,
 		tc6393xb_mmc_resources[0].start & 0xfffe);
@@ -362,8 +358,7 @@ static int tc6393xb_mmc_enable(struct platform_device *mmc)
 
 static int tc6393xb_mmc_resume(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_resume(tc6393xb->scr + 0x200, 0,
 		tc6393xb_mmc_resources[0].start & 0xfffe);
@@ -373,16 +368,14 @@ static int tc6393xb_mmc_resume(struct platform_device *mmc)
 
 static void tc6393xb_mmc_pwr(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_pwr(tc6393xb->scr + 0x200, 0, state);
 }
 
 static void tc6393xb_mmc_clk_div(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_clk_div(tc6393xb->scr + 0x200, 0, state);
 }
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next v2] mfd: Use dev_get_drvdata()
  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
  0 siblings, 1 reply; 50+ messages in thread
From: Lee Jones @ 2019-05-09  6:14 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: linux-kernel, Andy Gross, David Brown, linux-arm-msm

On Wed, 08 May 2019, Kefeng Wang wrote:

> Using dev_get_drvdata directly.
> 
> Cc: Andy Gross <andy.gross@linaro.org>
> Cc: David Brown <david.brown@linaro.org>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: linux-arm-msm@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> v2:
> -use dev_get_drvdata() instead of to_ssbi()
> 
>  drivers/mfd/ssbi.c     |  6 ++----
>  drivers/mfd/t7l66xb.c  | 12 ++++--------
>  drivers/mfd/tc6387xb.c | 12 ++++--------
>  drivers/mfd/tc6393xb.c | 21 +++++++--------------
>  4 files changed, 17 insertions(+), 34 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH next v3] mfd: Use dev_get_drvdata()
  2019-05-09  6:14       ` Lee Jones
@ 2019-05-09 14:23         ` Kefeng Wang
  2019-05-10  7:02           ` Lee Jones
  0 siblings, 1 reply; 50+ messages in thread
From: Kefeng Wang @ 2019-05-09 14:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kefeng Wang, David Brown, Lee Jones, linux-arm-msm

Using dev_get_drvdata directly.

Cc: David Brown <david.brown@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: linux-arm-msm@vger.kernel.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
v3:
- fix build issue('dev' undeclared) in tc6393xb_nand_enable()
v2:
-use dev_get_drvdata() instead of to_ssbi()

 drivers/mfd/ssbi.c     |  6 ++----
 drivers/mfd/t7l66xb.c  | 12 ++++--------
 drivers/mfd/tc6387xb.c | 12 ++++--------
 drivers/mfd/tc6393xb.c | 23 ++++++++---------------
 4 files changed, 18 insertions(+), 35 deletions(-)

diff --git a/drivers/mfd/ssbi.c b/drivers/mfd/ssbi.c
index 36b96fee4ce6..0ae27cd30268 100644
--- a/drivers/mfd/ssbi.c
+++ b/drivers/mfd/ssbi.c
@@ -80,8 +80,6 @@ struct ssbi {
 	int (*write)(struct ssbi *, u16 addr, const u8 *buf, int len);
 };
 
-#define to_ssbi(dev)	platform_get_drvdata(to_platform_device(dev))
-
 static inline u32 ssbi_readl(struct ssbi *ssbi, u32 reg)
 {
 	return readl(ssbi->base + reg);
@@ -243,7 +241,7 @@ ssbi_pa_write_bytes(struct ssbi *ssbi, u16 addr, const u8 *buf, int len)
 
 int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len)
 {
-	struct ssbi *ssbi = to_ssbi(dev);
+	struct ssbi *ssbi = dev_get_drvdata(dev);
 	unsigned long flags;
 	int ret;
 
@@ -257,7 +255,7 @@ EXPORT_SYMBOL_GPL(ssbi_read);
 
 int ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len)
 {
-	struct ssbi *ssbi = to_ssbi(dev);
+	struct ssbi *ssbi = dev_get_drvdata(dev);
 	unsigned long flags;
 	int ret;
 
diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c
index 43d8683266de..e9cfb147345e 100644
--- a/drivers/mfd/t7l66xb.c
+++ b/drivers/mfd/t7l66xb.c
@@ -82,8 +82,7 @@ struct t7l66xb {
 
 static int t7l66xb_mmc_enable(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 	unsigned long flags;
 	u8 dev_ctl;
 	int ret;
@@ -108,8 +107,7 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc)
 
 static int t7l66xb_mmc_disable(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 	unsigned long flags;
 	u8 dev_ctl;
 
@@ -128,16 +126,14 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc)
 
 static void t7l66xb_mmc_pwr(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_pwr(t7l66xb->scr + 0x200, 0, state);
 }
 
 static void t7l66xb_mmc_clk_div(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
+	struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_clk_div(t7l66xb->scr + 0x200, 0, state);
 }
diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c
index 85fab3729102..f417c6fecfe2 100644
--- a/drivers/mfd/tc6387xb.c
+++ b/drivers/mfd/tc6387xb.c
@@ -80,16 +80,14 @@ static int tc6387xb_resume(struct platform_device *dev)
 
 static void tc6387xb_mmc_pwr(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_pwr(tc6387xb->scr + 0x200, 0, state);
 }
 
 static void tc6387xb_mmc_clk_div(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_clk_div(tc6387xb->scr + 0x200, 0, state);
 }
@@ -97,8 +95,7 @@ static void tc6387xb_mmc_clk_div(struct platform_device *mmc, int state)
 
 static int tc6387xb_mmc_enable(struct platform_device *mmc)
 {
-	struct platform_device *dev      = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	clk_prepare_enable(tc6387xb->clk32k);
 
@@ -110,8 +107,7 @@ static int tc6387xb_mmc_enable(struct platform_device *mmc)
 
 static int tc6387xb_mmc_disable(struct platform_device *mmc)
 {
-	struct platform_device *dev      = to_platform_device(mmc->dev.parent);
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
+	struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
 
 	clk_disable_unprepare(tc6387xb->clk32k);
 
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 0c9f0390e891..6943048a64c2 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -122,14 +122,13 @@ enum {
 
 static int tc6393xb_nand_enable(struct platform_device *nand)
 {
-	struct platform_device *dev = to_platform_device(nand->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(nand->dev.parent);
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&tc6393xb->lock, flags);
 
 	/* SMD buffer on */
-	dev_dbg(&dev->dev, "SMD buffer on\n");
+	dev_dbg(nand->dev.parent, "SMD buffer on\n");
 	tmio_iowrite8(0xff, tc6393xb->scr + SCR_GPI_BCR(1));
 
 	raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
@@ -312,8 +311,7 @@ static int tc6393xb_fb_disable(struct platform_device *dev)
 
 int tc6393xb_lcd_set_power(struct platform_device *fb, bool on)
 {
-	struct platform_device *dev = to_platform_device(fb->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(fb->dev.parent);
 	u8 fer;
 	unsigned long flags;
 
@@ -334,8 +332,7 @@ EXPORT_SYMBOL(tc6393xb_lcd_set_power);
 
 int tc6393xb_lcd_mode(struct platform_device *fb,
 					const struct fb_videomode *mode) {
-	struct platform_device *dev = to_platform_device(fb->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(fb->dev.parent);
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&tc6393xb->lock, flags);
@@ -351,8 +348,7 @@ EXPORT_SYMBOL(tc6393xb_lcd_mode);
 
 static int tc6393xb_mmc_enable(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_enable(tc6393xb->scr + 0x200, 0,
 		tc6393xb_mmc_resources[0].start & 0xfffe);
@@ -362,8 +358,7 @@ static int tc6393xb_mmc_enable(struct platform_device *mmc)
 
 static int tc6393xb_mmc_resume(struct platform_device *mmc)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_resume(tc6393xb->scr + 0x200, 0,
 		tc6393xb_mmc_resources[0].start & 0xfffe);
@@ -373,16 +368,14 @@ static int tc6393xb_mmc_resume(struct platform_device *mmc)
 
 static void tc6393xb_mmc_pwr(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_pwr(tc6393xb->scr + 0x200, 0, state);
 }
 
 static void tc6393xb_mmc_clk_div(struct platform_device *mmc, int state)
 {
-	struct platform_device *dev = to_platform_device(mmc->dev.parent);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
+	struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
 
 	tmio_core_mmc_clk_div(tc6393xb->scr + 0x200, 0, state);
 }
-- 
2.20.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next v3] mfd: Use dev_get_drvdata()
  2019-05-09 14:23         ` [PATCH next v3] " Kefeng Wang
@ 2019-05-10  7:02           ` Lee Jones
  0 siblings, 0 replies; 50+ messages in thread
From: Lee Jones @ 2019-05-10  7:02 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: linux-kernel, David Brown, linux-arm-msm

On Thu, 09 May 2019, Kefeng Wang wrote:

> Using dev_get_drvdata directly.
> 
> Cc: David Brown <david.brown@linaro.org>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: linux-arm-msm@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> v3:
> - fix build issue('dev' undeclared) in tc6393xb_nand_enable()
> v2:
> -use dev_get_drvdata() instead of to_ssbi()
> 
>  drivers/mfd/ssbi.c     |  6 ++----
>  drivers/mfd/t7l66xb.c  | 12 ++++--------
>  drivers/mfd/tc6387xb.c | 12 ++++--------
>  drivers/mfd/tc6393xb.c | 23 ++++++++---------------
>  4 files changed, 18 insertions(+), 35 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 15/25] media: platform: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 15/25] media: platform: " Kefeng Wang
@ 2019-05-24 12:58   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 50+ messages in thread
From: Mauro Carvalho Chehab @ 2019-05-24 12:58 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-kernel, Masahiro Yamada, Benson Leung,
	Enric Balletbo i Serra, linux-media

Em Tue, 23 Apr 2019 15:50:10 +0800
Kefeng Wang <wangkefeng.wang@huawei.com> escreveu:

> Using dev_get_drvdata directly.

Patch looks ok to me. Assuming that this will be applied via some
other tree:

Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

> 
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Benson Leung <bleung@chromium.org>
> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/media/platform/cros-ec-cec/cros-ec-cec.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c
> index 7bc4d8a9af28..2e218c7a3a1f 100644
> --- a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c
> +++ b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c
> @@ -174,8 +174,7 @@ static const struct cec_adap_ops cros_ec_cec_ops = {
>  #ifdef CONFIG_PM_SLEEP
>  static int cros_ec_cec_suspend(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct cros_ec_cec *cros_ec_cec = dev_get_drvdata(&pdev->dev);
> +	struct cros_ec_cec *cros_ec_cec = dev_get_drvdata(dev);
>  
>  	if (device_may_wakeup(dev))
>  		enable_irq_wake(cros_ec_cec->cros_ec->irq);
> @@ -185,8 +184,7 @@ static int cros_ec_cec_suspend(struct device *dev)
>  
>  static int cros_ec_cec_resume(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct cros_ec_cec *cros_ec_cec = dev_get_drvdata(&pdev->dev);
> +	struct cros_ec_cec *cros_ec_cec = dev_get_drvdata(dev);
>  
>  	if (device_may_wakeup(dev))
>  		disable_irq_wake(cros_ec_cec->cros_ec->irq);



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH next 06/25] drm/omap: Use dev_get_drvdata()
  2019-04-23  7:50 ` [PATCH next 06/25] drm/omap: " Kefeng Wang
@ 2019-05-28 10:57   ` Tomi Valkeinen
  0 siblings, 0 replies; 50+ messages in thread
From: Tomi Valkeinen @ 2019-05-28 10:57 UTC (permalink / raw)
  To: Kefeng Wang, linux-kernel
  Cc: Masahiro Yamada, David Airlie, Daniel Vetter, dri-devel

On 23/04/2019 10:50, Kefeng Wang wrote:
> Using dev_get_drvdata directly.
> 
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>   .../gpu/drm/omapdrm/displays/panel-dsi-cm.c    | 18 ++++++------------
>   1 file changed, 6 insertions(+), 12 deletions(-)

Thanks! I have picked this up.

  Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2019-05-28 10:58 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).