* [PATCH 00/61] tree-wide: simplify getting .drvdata
@ 2018-04-19 14:05 Wolfram Sang
2018-04-19 14:06 ` [PATCH 41/61] power: supply: " Wolfram Sang
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Wolfram Sang @ 2018-04-19 14:05 UTC (permalink / raw)
To: linux-kernel
Cc: linux-ide, alsa-devel, linux-iio, kernel-janitors, linux-fbdev,
dri-devel, platform-driver-x86, Wolfram Sang, linux-mtd,
linux-clk, ac100, devel, linux-samsung-soc, linux-rockchip,
linux-serial, linux-input, linux-media, linux-pwm, linux-watchdog,
linux-pm, linux-arm-msm, acpi4asus-user, greybus-dev,
linux-mediatek, linux-tegra, linux-omap, linux-soc,
linux-arm-kernel
I got tired of fixing this in Renesas drivers manually, so I took the big
hammer. Remove this cumbersome code pattern which got copy-pasted too much
already:
- struct platform_device *pdev = to_platform_device(dev);
- struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
+ struct ep93xx_keypad *keypad = dev_get_drvdata(dev);
I send this out as one patch per directory per subsystem. I think they should
be applied individually. If you prefer a broken out series per subsystem, I can
provide this as well. Just mail me.
A branch (tested by buildbot; only with all commits squashed into one commit
before) can be found here:
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git coccinelle/get_drvdata
Open for other comments, suggestions, too, of course.
Here is the cocci-script I created (after <n> iterations by manually checking
samples):
@@
struct device* d;
identifier pdev;
expression *ptr;
@@
(
- struct platform_device *pdev = to_platform_device(d);
|
- struct platform_device *pdev;
...
- pdev = to_platform_device(d);
)
<... when != pdev
- &pdev->dev
+ d
...>
ptr =
- platform_get_drvdata(pdev)
+ dev_get_drvdata(d)
<... when != pdev
- &pdev->dev
+ d
...>
Kind regards,
Wolfram
Wolfram Sang (61):
ARM: plat-samsung: simplify getting .drvdata
ata: simplify getting .drvdata
auxdisplay: simplify getting .drvdata
bus: simplify getting .drvdata
clk: samsung: simplify getting .drvdata
crypto: simplify getting .drvdata
dma: simplify getting .drvdata
dmaengine: dw: simplify getting .drvdata
dmaengine: qcom: simplify getting .drvdata
gpio: simplify getting .drvdata
gpu: drm: msm: simplify getting .drvdata
gpu: drm: msm: adreno: simplify getting .drvdata
gpu: drm: msm: disp: mdp5: simplify getting .drvdata
gpu: drm: msm: dsi: simplify getting .drvdata
gpu: drm: omapdrm: displays: simplify getting .drvdata
gpu: drm: vc4: simplify getting .drvdata
hid: simplify getting .drvdata
iio: common: cros_ec_sensors: simplify getting .drvdata
iio: common: hid-sensors: simplify getting .drvdata
input: keyboard: simplify getting .drvdata
input: misc: simplify getting .drvdata
input: mouse: simplify getting .drvdata
input: touchscreen: simplify getting .drvdata
iommu: simplify getting .drvdata
media: platform: am437x: simplify getting .drvdata
media: platform: exynos4-is: simplify getting .drvdata
media: platform: s5p-mfc: simplify getting .drvdata
mmc: host: simplify getting .drvdata
mtd: devices: simplify getting .drvdata
mtd: nand: onenand: simplify getting .drvdata
net: dsa: simplify getting .drvdata
net: ethernet: cadence: simplify getting .drvdata
net: ethernet: davicom: simplify getting .drvdata
net: ethernet: smsc: simplify getting .drvdata
net: ethernet: ti: simplify getting .drvdata
net: ethernet: wiznet: simplify getting .drvdata
perf: simplify getting .drvdata
pinctrl: simplify getting .drvdata
pinctrl: intel: simplify getting .drvdata
platform: x86: simplify getting .drvdata
power: supply: simplify getting .drvdata
ptp: simplify getting .drvdata
pwm: simplify getting .drvdata
rtc: simplify getting .drvdata
slimbus: simplify getting .drvdata
spi: simplify getting .drvdata
staging: greybus: simplify getting .drvdata
staging: iio: adc: simplify getting .drvdata
staging: nvec: simplify getting .drvdata
thermal: simplify getting .drvdata
thermal: int340x_thermal: simplify getting .drvdata
thermal: st: simplify getting .drvdata
tty: serial: simplify getting .drvdata
uio: simplify getting .drvdata
usb: mtu3: simplify getting .drvdata
usb: phy: simplify getting .drvdata
video: fbdev: simplify getting .drvdata
video: fbdev: omap2: omapfb: displays: simplify getting .drvdata
watchdog: simplify getting .drvdata
net: dsa: simplify getting .drvdata
ASoC: atmel: simplify getting .drvdata
arch/arm/plat-samsung/adc.c | 3 +-
drivers/ata/pata_samsung_cf.c | 8 ++---
drivers/auxdisplay/arm-charlcd.c | 6 ++--
drivers/bus/brcmstb_gisb.c | 12 +++----
drivers/clk/samsung/clk-s3c2410-dclk.c | 6 ++--
drivers/crypto/exynos-rng.c | 6 ++--
drivers/crypto/picoxcell_crypto.c | 6 ++--
drivers/dma/at_hdmac.c | 9 ++---
drivers/dma/at_xdmac.c | 9 ++---
drivers/dma/dw/platform.c | 6 ++--
drivers/dma/fsldma.c | 6 ++--
drivers/dma/idma64.c | 6 ++--
drivers/dma/qcom/hidma.c | 3 +-
drivers/dma/qcom/hidma_mgmt_sys.c | 6 ++--
drivers/dma/ste_dma40.c | 12 +++----
drivers/dma/txx9dmac.c | 8 ++---
drivers/gpio/gpio-dwapb.c | 6 ++--
drivers/gpio/gpio-lynxpoint.c | 3 +-
drivers/gpio/gpio-omap.c | 12 +++----
drivers/gpio/gpio-tegra.c | 6 ++--
drivers/gpio/gpio-zynq.c | 6 ++--
drivers/gpu/drm/msm/adreno/adreno_device.c | 6 ++--
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/omapdrm/displays/panel-dsi-cm.c | 18 ++++------
drivers/gpu/drm/vc4/vc4_drv.c | 3 +-
drivers/hid/hid-sensor-custom.c | 12 +++----
.../common/cros_ec_sensors/cros_ec_sensors_core.c | 6 ++--
.../iio/common/hid-sensors/hid-sensor-trigger.c | 9 ++---
drivers/input/keyboard/ep93xx_keypad.c | 10 +++---
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/max8997_haptic.c | 3 +-
drivers/input/misc/palmas-pwrbutton.c | 6 ++--
drivers/input/misc/regulator-haptic.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/iommu/qcom_iommu.c | 6 ++--
drivers/media/platform/am437x/am437x-vpfe.c | 6 ++--
drivers/media/platform/exynos4-is/media-dev.c | 6 ++--
drivers/media/platform/exynos4-is/mipi-csis.c | 6 ++--
drivers/media/platform/s5p-mfc/s5p_mfc.c | 6 ++--
drivers/mmc/host/davinci_mmc.c | 6 ++--
drivers/mmc/host/sdhci-of-arasan.c | 6 ++--
drivers/mmc/host/wmt-sdmmc.c | 6 ++--
drivers/mtd/devices/docg3.c | 3 +-
drivers/mtd/nand/onenand/samsung.c | 6 ++--
drivers/net/dsa/bcm_sf2.c | 6 ++--
drivers/net/dsa/qca8k.c | 6 ++--
drivers/net/ethernet/cadence/macb_main.c | 6 ++--
drivers/net/ethernet/davicom/dm9000.c | 6 ++--
drivers/net/ethernet/smsc/smc91x.c | 3 +-
drivers/net/ethernet/ti/cpsw.c | 6 ++--
drivers/net/ethernet/ti/davinci_emac.c | 6 ++--
drivers/net/ethernet/wiznet/w5300.c | 6 ++--
drivers/perf/arm_spe_pmu.c | 6 ++--
drivers/pinctrl/intel/pinctrl-baytrail.c | 6 ++--
drivers/pinctrl/intel/pinctrl-cherryview.c | 6 ++--
drivers/pinctrl/intel/pinctrl-intel.c | 6 ++--
drivers/pinctrl/pinctrl-amd.c | 6 ++--
drivers/pinctrl/pinctrl-at91-pio4.c | 6 ++--
drivers/platform/x86/asus-laptop.c | 3 +-
drivers/platform/x86/asus-wmi.c | 3 +-
drivers/platform/x86/samsung-laptop.c | 3 +-
drivers/power/supply/gpio-charger.c | 3 +-
drivers/ptp/ptp_dte.c | 6 ++--
drivers/pwm/pwm-atmel-tcb.c | 6 ++--
drivers/pwm/pwm-rcar.c | 3 +-
drivers/rtc/rtc-bq4802.c | 6 ++--
drivers/rtc/rtc-ds1216.c | 6 ++--
drivers/rtc/rtc-ds1511.c | 9 ++---
drivers/rtc/rtc-ds1553.c | 15 +++-----
drivers/rtc/rtc-ds1685.c | 21 ++++-------
drivers/rtc/rtc-ds1742.c | 6 ++--
drivers/rtc/rtc-lpc32xx.c | 16 ++++-----
drivers/rtc/rtc-m48t59.c | 41 +++++++++-------------
drivers/rtc/rtc-mv.c | 3 +-
drivers/rtc/rtc-mxc.c | 21 ++++-------
drivers/rtc/rtc-pcap.c | 15 +++-----
drivers/rtc/rtc-sh.c | 15 +++-----
drivers/rtc/rtc-stk17ta8.c | 15 +++-----
drivers/rtc/rtc-test.c | 3 +-
drivers/rtc/rtc-zynqmp.c | 10 +++---
drivers/slimbus/qcom-ctrl.c | 6 ++--
drivers/spi/spi-cadence.c | 6 ++--
drivers/spi/spi-zynqmp-gqspi.c | 6 ++--
drivers/staging/greybus/arche-platform.c | 3 +-
drivers/staging/iio/adc/ad7606_par.c | 6 ++--
drivers/staging/nvec/nvec.c | 6 ++--
drivers/thermal/int340x_thermal/int3400_thermal.c | 9 ++---
drivers/thermal/rockchip_thermal.c | 8 ++---
drivers/thermal/spear_thermal.c | 8 ++---
drivers/thermal/st/st_thermal.c | 6 ++--
drivers/thermal/zx2967_thermal.c | 6 ++--
drivers/tty/serial/imx.c | 18 ++++------
drivers/tty/serial/qcom_geni_serial.c | 6 ++--
drivers/tty/serial/st-asc.c | 6 ++--
drivers/tty/serial/xilinx_uartps.c | 6 ++--
drivers/uio/uio_fsl_elbc_gpcm.c | 6 ++--
drivers/usb/mtu3/mtu3_plat.c | 6 ++--
drivers/usb/phy/phy-am335x.c | 6 ++--
drivers/video/fbdev/auo_k190x.c | 12 +++----
.../fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 18 ++++------
drivers/video/fbdev/sh_mobile_lcdcfb.c | 6 ++--
drivers/video/fbdev/sh_mobile_meram.c | 6 ++--
drivers/watchdog/cadence_wdt.c | 6 ++--
drivers/watchdog/of_xilinx_wdt.c | 6 ++--
drivers/watchdog/wdat_wdt.c | 6 ++--
net/dsa/legacy.c | 6 ++--
sound/soc/atmel/atmel_ssc_dai.c | 6 ++--
123 files changed, 319 insertions(+), 607 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 41/61] power: supply: simplify getting .drvdata
2018-04-19 14:05 [PATCH 00/61] tree-wide: simplify getting .drvdata Wolfram Sang
@ 2018-04-19 14:06 ` Wolfram Sang
2018-04-25 21:16 ` Sebastian Reichel
2018-04-19 14:06 ` [PATCH 50/61] thermal: " Wolfram Sang
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2018-04-19 14:06 UTC (permalink / raw)
To: linux-kernel
Cc: linux-renesas-soc, kernel-janitors, Wolfram Sang,
Sebastian Reichel, linux-pm
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only. buildbot is happy. Please apply individually.
drivers/power/supply/gpio-charger.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/power/supply/gpio-charger.c b/drivers/power/supply/gpio-charger.c
index bd2468ca6b63..c3f2a9479468 100644
--- a/drivers/power/supply/gpio-charger.c
+++ b/drivers/power/supply/gpio-charger.c
@@ -212,8 +212,7 @@ static int gpio_charger_suspend(struct device *dev)
static int gpio_charger_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct gpio_charger *gpio_charger = platform_get_drvdata(pdev);
+ struct gpio_charger *gpio_charger = dev_get_drvdata(dev);
if (device_may_wakeup(dev) && gpio_charger->wakeup_enabled)
disable_irq_wake(gpio_charger->irq);
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 41/61] power: supply: simplify getting .drvdata
2018-04-19 14:06 ` [PATCH 41/61] power: supply: " Wolfram Sang
@ 2018-04-25 21:16 ` Sebastian Reichel
0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2018-04-25 21:16 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-kernel, linux-renesas-soc, kernel-janitors, linux-pm
[-- Attachment #1: Type: text/plain, Size: 1173 bytes --]
Hi,
On Thu, Apr 19, 2018 at 04:06:11PM +0200, Wolfram Sang wrote:
> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
Thanks, queued.
-- Sebastian
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/power/supply/gpio-charger.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/power/supply/gpio-charger.c b/drivers/power/supply/gpio-charger.c
> index bd2468ca6b63..c3f2a9479468 100644
> --- a/drivers/power/supply/gpio-charger.c
> +++ b/drivers/power/supply/gpio-charger.c
> @@ -212,8 +212,7 @@ static int gpio_charger_suspend(struct device *dev)
>
> static int gpio_charger_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct gpio_charger *gpio_charger = platform_get_drvdata(pdev);
> + struct gpio_charger *gpio_charger = dev_get_drvdata(dev);
>
> if (device_may_wakeup(dev) && gpio_charger->wakeup_enabled)
> disable_irq_wake(gpio_charger->irq);
> --
> 2.11.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 50/61] thermal: simplify getting .drvdata
2018-04-19 14:05 [PATCH 00/61] tree-wide: simplify getting .drvdata Wolfram Sang
2018-04-19 14:06 ` [PATCH 41/61] power: supply: " Wolfram Sang
@ 2018-04-19 14:06 ` Wolfram Sang
2018-05-02 8:52 ` Shawn Guo
2018-05-03 12:23 ` Heiko Stuebner
2018-04-19 14:06 ` [PATCH 51/61] thermal: int340x_thermal: " Wolfram Sang
2018-04-19 14:06 ` [PATCH 52/61] thermal: st: " Wolfram Sang
3 siblings, 2 replies; 8+ messages in thread
From: Wolfram Sang @ 2018-04-19 14:06 UTC (permalink / raw)
To: linux-kernel
Cc: linux-renesas-soc, kernel-janitors, Wolfram Sang, Zhang Rui,
Eduardo Valentin, Heiko Stuebner, Jun Nie, Baoyou Xie, Shawn Guo,
linux-pm, linux-arm-kernel, linux-rockchip
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only. buildbot is happy. Please apply individually.
drivers/thermal/rockchip_thermal.c | 8 +++-----
drivers/thermal/spear_thermal.c | 8 +++-----
drivers/thermal/zx2967_thermal.c | 6 ++----
3 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index f36375d5a16c..9c7643d62ed7 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -1327,8 +1327,7 @@ static int rockchip_thermal_remove(struct platform_device *pdev)
static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
+ struct rockchip_thermal_data *thermal = dev_get_drvdata(dev);
int i;
for (i = 0; i < thermal->chip->chn_num; i++)
@@ -1346,8 +1345,7 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
static int __maybe_unused rockchip_thermal_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
+ struct rockchip_thermal_data *thermal = dev_get_drvdata(dev);
int i;
int error;
@@ -1376,7 +1374,7 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev)
id, thermal->regs,
thermal->tshut_temp);
if (error)
- dev_err(&pdev->dev, "%s: invalid tshut=%d, error=%d\n",
+ dev_err(dev, "%s: invalid tshut=%d, error=%d\n",
__func__, thermal->tshut_temp, error);
}
diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
index 81b35aace9de..8b9d567134d0 100644
--- a/drivers/thermal/spear_thermal.c
+++ b/drivers/thermal/spear_thermal.c
@@ -56,8 +56,7 @@ static struct thermal_zone_device_ops ops = {
static int __maybe_unused spear_thermal_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev);
+ struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev);
struct spear_thermal_dev *stdev = spear_thermal->devdata;
unsigned int actual_mask = 0;
@@ -73,15 +72,14 @@ static int __maybe_unused spear_thermal_suspend(struct device *dev)
static int __maybe_unused spear_thermal_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev);
+ struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev);
struct spear_thermal_dev *stdev = spear_thermal->devdata;
unsigned int actual_mask = 0;
int ret = 0;
ret = clk_enable(stdev->clk);
if (ret) {
- dev_err(&pdev->dev, "Can't enable clock\n");
+ dev_err(dev, "Can't enable clock\n");
return ret;
}
diff --git a/drivers/thermal/zx2967_thermal.c b/drivers/thermal/zx2967_thermal.c
index 6acce0bce7c0..145ebf371598 100644
--- a/drivers/thermal/zx2967_thermal.c
+++ b/drivers/thermal/zx2967_thermal.c
@@ -207,8 +207,7 @@ MODULE_DEVICE_TABLE(of, zx2967_thermal_id_table);
#ifdef CONFIG_PM_SLEEP
static int zx2967_thermal_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct zx2967_thermal_priv *priv = platform_get_drvdata(pdev);
+ struct zx2967_thermal_priv *priv = dev_get_drvdata(dev);
if (priv && priv->clk_topcrm)
clk_disable_unprepare(priv->clk_topcrm);
@@ -221,8 +220,7 @@ static int zx2967_thermal_suspend(struct device *dev)
static int zx2967_thermal_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct zx2967_thermal_priv *priv = platform_get_drvdata(pdev);
+ struct zx2967_thermal_priv *priv = dev_get_drvdata(dev);
int error;
error = clk_prepare_enable(priv->clk_topcrm);
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 50/61] thermal: simplify getting .drvdata
2018-04-19 14:06 ` [PATCH 50/61] thermal: " Wolfram Sang
@ 2018-05-02 8:52 ` Shawn Guo
2018-05-03 12:23 ` Heiko Stuebner
1 sibling, 0 replies; 8+ messages in thread
From: Shawn Guo @ 2018-05-02 8:52 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-kernel, linux-renesas-soc, kernel-janitors, Zhang Rui,
Eduardo Valentin, Heiko Stuebner, Jun Nie, Baoyou Xie, linux-pm,
linux-arm-kernel, linux-rockchip
On Thu, Apr 19, 2018 at 04:06:20PM +0200, Wolfram Sang wrote:
> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/thermal/rockchip_thermal.c | 8 +++-----
> drivers/thermal/spear_thermal.c | 8 +++-----
> drivers/thermal/zx2967_thermal.c | 6 ++----
> 3 files changed, 8 insertions(+), 14 deletions(-)
For zx2967_thermal,
Acked-by: Shawn Guo <shawnguo@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 50/61] thermal: simplify getting .drvdata
2018-04-19 14:06 ` [PATCH 50/61] thermal: " Wolfram Sang
2018-05-02 8:52 ` Shawn Guo
@ 2018-05-03 12:23 ` Heiko Stuebner
1 sibling, 0 replies; 8+ messages in thread
From: Heiko Stuebner @ 2018-05-03 12:23 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-kernel, linux-renesas-soc, kernel-janitors, Zhang Rui,
Eduardo Valentin, Jun Nie, Baoyou Xie, Shawn Guo, linux-pm,
linux-arm-kernel, linux-rockchip
Am Donnerstag, 19. April 2018, 16:06:20 CEST schrieb Wolfram Sang:
> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/thermal/rockchip_thermal.c | 8 +++-----
> drivers/thermal/spear_thermal.c | 8 +++-----
> drivers/thermal/zx2967_thermal.c | 6 ++----
> 3 files changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
> index f36375d5a16c..9c7643d62ed7 100644
> --- a/drivers/thermal/rockchip_thermal.c
> +++ b/drivers/thermal/rockchip_thermal.c
> @@ -1327,8 +1327,7 @@ static int rockchip_thermal_remove(struct platform_device *pdev)
>
> static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
> + struct rockchip_thermal_data *thermal = dev_get_drvdata(dev);
> int i;
>
> for (i = 0; i < thermal->chip->chn_num; i++)
> @@ -1346,8 +1345,7 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
>
> static int __maybe_unused rockchip_thermal_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
> + struct rockchip_thermal_data *thermal = dev_get_drvdata(dev);
> int i;
> int error;
>
> @@ -1376,7 +1374,7 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev)
> id, thermal->regs,
> thermal->tshut_temp);
> if (error)
> - dev_err(&pdev->dev, "%s: invalid tshut=%d, error=%d\n",
> + dev_err(dev, "%s: invalid tshut=%d, error=%d\n",
> __func__, thermal->tshut_temp, error);
> }
>
for the Rockchip-part
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 51/61] thermal: int340x_thermal: simplify getting .drvdata
2018-04-19 14:05 [PATCH 00/61] tree-wide: simplify getting .drvdata Wolfram Sang
2018-04-19 14:06 ` [PATCH 41/61] power: supply: " Wolfram Sang
2018-04-19 14:06 ` [PATCH 50/61] thermal: " Wolfram Sang
@ 2018-04-19 14:06 ` Wolfram Sang
2018-04-19 14:06 ` [PATCH 52/61] thermal: st: " Wolfram Sang
3 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2018-04-19 14:06 UTC (permalink / raw)
To: linux-kernel
Cc: linux-renesas-soc, kernel-janitors, Wolfram Sang, Zhang Rui,
Eduardo Valentin, linux-pm
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only. buildbot is happy. Please apply individually.
drivers/thermal/int340x_thermal/int3400_thermal.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c b/drivers/thermal/int340x_thermal/int3400_thermal.c
index e26b01c05e82..61ca7ce3624e 100644
--- a/drivers/thermal/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/int340x_thermal/int3400_thermal.c
@@ -48,8 +48,7 @@ static ssize_t available_uuids_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
+ struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
int i;
int length = 0;
@@ -68,8 +67,7 @@ static ssize_t available_uuids_show(struct device *dev,
static ssize_t current_uuid_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
+ struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
if (priv->uuid_bitmap & (1 << priv->current_uuid_index))
return sprintf(buf, "%s\n",
@@ -82,8 +80,7 @@ static ssize_t current_uuid_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
+ struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
int i;
for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; ++i) {
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 52/61] thermal: st: simplify getting .drvdata
2018-04-19 14:05 [PATCH 00/61] tree-wide: simplify getting .drvdata Wolfram Sang
` (2 preceding siblings ...)
2018-04-19 14:06 ` [PATCH 51/61] thermal: int340x_thermal: " Wolfram Sang
@ 2018-04-19 14:06 ` Wolfram Sang
3 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2018-04-19 14:06 UTC (permalink / raw)
To: linux-kernel
Cc: linux-renesas-soc, kernel-janitors, Wolfram Sang, Zhang Rui,
Eduardo Valentin, linux-pm
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only. buildbot is happy. Please apply individually.
drivers/thermal/st/st_thermal.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c
index be637e6b01d2..b2bbdf6eb02b 100644
--- a/drivers/thermal/st/st_thermal.c
+++ b/drivers/thermal/st/st_thermal.c
@@ -277,8 +277,7 @@ EXPORT_SYMBOL_GPL(st_thermal_unregister);
#ifdef CONFIG_PM_SLEEP
static int st_thermal_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
+ struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
return st_thermal_sensor_off(sensor);
}
@@ -286,8 +285,7 @@ static int st_thermal_suspend(struct device *dev)
static int st_thermal_resume(struct device *dev)
{
int ret;
- struct platform_device *pdev = to_platform_device(dev);
- struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
+ struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
ret = st_thermal_sensor_on(sensor);
if (ret)
--
2.11.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-05-03 12:23 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-19 14:05 [PATCH 00/61] tree-wide: simplify getting .drvdata Wolfram Sang
2018-04-19 14:06 ` [PATCH 41/61] power: supply: " Wolfram Sang
2018-04-25 21:16 ` Sebastian Reichel
2018-04-19 14:06 ` [PATCH 50/61] thermal: " Wolfram Sang
2018-05-02 8:52 ` Shawn Guo
2018-05-03 12:23 ` Heiko Stuebner
2018-04-19 14:06 ` [PATCH 51/61] thermal: int340x_thermal: " Wolfram Sang
2018-04-19 14:06 ` [PATCH 52/61] thermal: st: " Wolfram Sang
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).