2018-04-19 14:26:55

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 00/61] tree-wide: simplify getting .drvdata

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



2018-04-19 14:09:46

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 61/61] ASoC: atmel: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

sound/soc/atmel/atmel_ssc_dai.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index a1e2c5682dcd..4a0275a6505d 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -1002,8 +1002,7 @@ static const struct snd_soc_component_driver atmel_ssc_component = {

static int asoc_ssc_init(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ssc_device *ssc = platform_get_drvdata(pdev);
+ struct ssc_device *ssc = dev_get_drvdata(dev);
int ret;

ret = snd_soc_register_component(dev, &atmel_ssc_component,
@@ -1033,8 +1032,7 @@ static int asoc_ssc_init(struct device *dev)

static void asoc_ssc_exit(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ssc_device *ssc = platform_get_drvdata(pdev);
+ struct ssc_device *ssc = dev_get_drvdata(dev);

if (ssc->pdata->use_dma)
atmel_pcm_dma_platform_unregister(dev);
--
2.11.0


2018-04-19 14:10:10

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 55/61] usb: mtu3: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/usb/mtu3/mtu3_plat.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index 628d5ce356ca..46551f6d16fd 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -447,8 +447,7 @@ static int mtu3_remove(struct platform_device *pdev)
*/
static int __maybe_unused mtu3_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ssusb_mtk *ssusb = platform_get_drvdata(pdev);
+ struct ssusb_mtk *ssusb = dev_get_drvdata(dev);

dev_dbg(dev, "%s\n", __func__);

@@ -466,8 +465,7 @@ static int __maybe_unused mtu3_suspend(struct device *dev)

static int __maybe_unused mtu3_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ssusb_mtk *ssusb = platform_get_drvdata(pdev);
+ struct ssusb_mtk *ssusb = dev_get_drvdata(dev);
int ret;

dev_dbg(dev, "%s\n", __func__);
--
2.11.0


2018-04-19 14:10:39

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 59/61] watchdog: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/watchdog/cadence_wdt.c | 6 ++----
drivers/watchdog/of_xilinx_wdt.c | 6 ++----
drivers/watchdog/wdat_wdt.c | 6 ++----
3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c
index 3ec1f418837d..c3924356d173 100644
--- a/drivers/watchdog/cadence_wdt.c
+++ b/drivers/watchdog/cadence_wdt.c
@@ -418,8 +418,7 @@ static void cdns_wdt_shutdown(struct platform_device *pdev)
*/
static int __maybe_unused cdns_wdt_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct cdns_wdt *wdt = platform_get_drvdata(pdev);
+ struct cdns_wdt *wdt = dev_get_drvdata(dev);

if (watchdog_active(&wdt->cdns_wdt_device)) {
cdns_wdt_stop(&wdt->cdns_wdt_device);
@@ -438,8 +437,7 @@ static int __maybe_unused cdns_wdt_suspend(struct device *dev)
static int __maybe_unused cdns_wdt_resume(struct device *dev)
{
int ret;
- struct platform_device *pdev = to_platform_device(dev);
- struct cdns_wdt *wdt = platform_get_drvdata(pdev);
+ struct cdns_wdt *wdt = dev_get_drvdata(dev);

if (watchdog_active(&wdt->cdns_wdt_device)) {
ret = clk_prepare_enable(wdt->clk);
diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
index 4acbe05e27bb..d3f7eb046678 100644
--- a/drivers/watchdog/of_xilinx_wdt.c
+++ b/drivers/watchdog/of_xilinx_wdt.c
@@ -268,8 +268,7 @@ static int xwdt_remove(struct platform_device *pdev)
*/
static int __maybe_unused xwdt_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct xwdt_device *xdev = platform_get_drvdata(pdev);
+ struct xwdt_device *xdev = dev_get_drvdata(dev);

if (watchdog_active(&xdev->xilinx_wdt_wdd))
xilinx_wdt_stop(&xdev->xilinx_wdt_wdd);
@@ -285,8 +284,7 @@ static int __maybe_unused xwdt_suspend(struct device *dev)
*/
static int __maybe_unused xwdt_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct xwdt_device *xdev = platform_get_drvdata(pdev);
+ struct xwdt_device *xdev = dev_get_drvdata(dev);
int ret = 0;

if (watchdog_active(&xdev->xilinx_wdt_wdd))
diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
index 0da9943d405f..56ad19608a9b 100644
--- a/drivers/watchdog/wdat_wdt.c
+++ b/drivers/watchdog/wdat_wdt.c
@@ -447,8 +447,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int wdat_wdt_suspend_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct wdat_wdt *wdat = platform_get_drvdata(pdev);
+ struct wdat_wdt *wdat = dev_get_drvdata(dev);
int ret;

if (!watchdog_active(&wdat->wdd))
@@ -475,8 +474,7 @@ static int wdat_wdt_suspend_noirq(struct device *dev)

static int wdat_wdt_resume_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct wdat_wdt *wdat = platform_get_drvdata(pdev);
+ struct wdat_wdt *wdat = dev_get_drvdata(dev);
int ret;

if (!watchdog_active(&wdat->wdd))
--
2.11.0


2018-04-19 14:11:10

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 53/61] tty: serial: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

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 ++----
4 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 91f3a1a5cb7f..f370c1cf4f27 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2408,8 +2408,7 @@ static void imx_uart_enable_wakeup(struct imx_port *sport, bool on)

static int imx_uart_suspend_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct imx_port *sport = platform_get_drvdata(pdev);
+ struct imx_port *sport = dev_get_drvdata(dev);

imx_uart_save_context(sport);

@@ -2420,8 +2419,7 @@ static int imx_uart_suspend_noirq(struct device *dev)

static int imx_uart_resume_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct imx_port *sport = platform_get_drvdata(pdev);
+ struct imx_port *sport = dev_get_drvdata(dev);
int ret;

ret = clk_enable(sport->clk_ipg);
@@ -2435,8 +2433,7 @@ static int imx_uart_resume_noirq(struct device *dev)

static int imx_uart_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct imx_port *sport = platform_get_drvdata(pdev);
+ struct imx_port *sport = dev_get_drvdata(dev);
int ret;

uart_suspend_port(&imx_uart_uart_driver, &sport->port);
@@ -2454,8 +2451,7 @@ static int imx_uart_suspend(struct device *dev)

static int imx_uart_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct imx_port *sport = platform_get_drvdata(pdev);
+ struct imx_port *sport = dev_get_drvdata(dev);

/* disable wakeup from i.MX UART */
imx_uart_enable_wakeup(sport, false);
@@ -2470,8 +2466,7 @@ static int imx_uart_resume(struct device *dev)

static int imx_uart_freeze(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct imx_port *sport = platform_get_drvdata(pdev);
+ struct imx_port *sport = dev_get_drvdata(dev);

uart_suspend_port(&imx_uart_uart_driver, &sport->port);

@@ -2480,8 +2475,7 @@ static int imx_uart_freeze(struct device *dev)

static int imx_uart_thaw(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct imx_port *sport = platform_get_drvdata(pdev);
+ struct imx_port *sport = dev_get_drvdata(dev);

uart_resume_port(&imx_uart_uart_driver, &sport->port);

diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 65ff669373d4..66558d42d980 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1085,8 +1085,7 @@ static int qcom_geni_serial_remove(struct platform_device *pdev)

static int __maybe_unused qcom_geni_serial_sys_suspend_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct qcom_geni_serial_port *port = platform_get_drvdata(pdev);
+ struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
struct uart_port *uport = &port->uport;

uart_suspend_port(uport->private_data, uport);
@@ -1095,8 +1094,7 @@ static int __maybe_unused qcom_geni_serial_sys_suspend_noirq(struct device *dev)

static int __maybe_unused qcom_geni_serial_sys_resume_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct qcom_geni_serial_port *port = platform_get_drvdata(pdev);
+ struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
struct uart_port *uport = &port->uport;

if (console_suspend_enabled && uport->suspended) {
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index 5f9f01fac6dd..7971997cdead 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -842,16 +842,14 @@ static int asc_serial_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int asc_serial_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct uart_port *port = platform_get_drvdata(pdev);
+ struct uart_port *port = dev_get_drvdata(dev);

return uart_suspend_port(&asc_uart_driver, port);
}

static int asc_serial_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct uart_port *port = platform_get_drvdata(pdev);
+ struct uart_port *port = dev_get_drvdata(dev);

return uart_resume_port(&asc_uart_driver, port);
}
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index abcb4d09a2d8..3ec4efbf25a9 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -1430,8 +1430,7 @@ static int cdns_uart_resume(struct device *device)
#endif /* ! CONFIG_PM_SLEEP */
static int __maybe_unused cdns_runtime_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct uart_port *port = platform_get_drvdata(pdev);
+ struct uart_port *port = dev_get_drvdata(dev);
struct cdns_uart *cdns_uart = port->private_data;

clk_disable(cdns_uart->uartclk);
@@ -1441,8 +1440,7 @@ static int __maybe_unused cdns_runtime_suspend(struct device *dev)

static int __maybe_unused cdns_runtime_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct uart_port *port = platform_get_drvdata(pdev);
+ struct uart_port *port = dev_get_drvdata(dev);
struct cdns_uart *cdns_uart = port->private_data;

clk_enable(cdns_uart->pclk);
--
2.11.0


2018-04-19 14:11:13

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 58/61] video: fbdev: omap2: omapfb: displays: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

.../video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
index bef431530090..87497a00241f 100644
--- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
+++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
@@ -387,8 +387,7 @@ static void dsicm_get_resolution(struct omap_dss_device *dssdev,
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 *in = ddata->in;
u8 errors = 0;
int r;
@@ -419,8 +418,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 *in = ddata->in;
u8 id1, id2, id3;
int r;
@@ -451,8 +449,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 *in = ddata->in;
unsigned long t;
int r;
@@ -486,8 +483,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 t;

mutex_lock(&ddata->lock);
@@ -501,8 +497,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 *in = ddata->in;
unsigned long t;
int r;
@@ -533,8 +528,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 t;

mutex_lock(&ddata->lock);
--
2.11.0


2018-04-19 14:11:29

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 60/61] net: dsa: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

net/dsa/legacy.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index 42a7b85b84e1..f8d6b212328f 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -687,8 +687,7 @@ static void dsa_shutdown(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int dsa_suspend(struct device *d)
{
- struct platform_device *pdev = to_platform_device(d);
- struct dsa_switch_tree *dst = platform_get_drvdata(pdev);
+ struct dsa_switch_tree *dst = dev_get_drvdata(d);
int i, ret = 0;

for (i = 0; i < dst->pd->nr_chips; i++) {
@@ -703,8 +702,7 @@ static int dsa_suspend(struct device *d)

static int dsa_resume(struct device *d)
{
- struct platform_device *pdev = to_platform_device(d);
- struct dsa_switch_tree *dst = platform_get_drvdata(pdev);
+ struct dsa_switch_tree *dst = dev_get_drvdata(d);
int i, ret = 0;

for (i = 0; i < dst->pd->nr_chips; i++) {
--
2.11.0


2018-04-19 14:12:02

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 56/61] usb: phy: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/usb/phy/phy-am335x.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c
index b36fa8b953d0..27bdb7222527 100644
--- a/drivers/usb/phy/phy-am335x.c
+++ b/drivers/usb/phy/phy-am335x.c
@@ -96,8 +96,7 @@ static int am335x_phy_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int am335x_phy_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct am335x_phy *am_phy = platform_get_drvdata(pdev);
+ struct am335x_phy *am_phy = dev_get_drvdata(dev);

/*
* Enable phy wakeup only if dev->power.can_wakeup is true.
@@ -117,8 +116,7 @@ static int am335x_phy_suspend(struct device *dev)

static int am335x_phy_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct am335x_phy *am_phy = platform_get_drvdata(pdev);
+ struct am335x_phy *am_phy = dev_get_drvdata(dev);

phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, true);

--
2.11.0


2018-04-19 14:12:09

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 57/61] video: fbdev: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/video/fbdev/auo_k190x.c | 12 ++++--------
drivers/video/fbdev/sh_mobile_lcdcfb.c | 6 ++----
drivers/video/fbdev/sh_mobile_meram.c | 6 ++----
3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/video/fbdev/auo_k190x.c b/drivers/video/fbdev/auo_k190x.c
index 9d24d1b3e9ef..9bf6a6e02342 100644
--- a/drivers/video/fbdev/auo_k190x.c
+++ b/drivers/video/fbdev/auo_k190x.c
@@ -776,8 +776,7 @@ static void auok190x_recover(struct auok190xfb_par *par)
*/
static int __maybe_unused auok190x_runtime_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct fb_info *info = platform_get_drvdata(pdev);
+ struct fb_info *info = dev_get_drvdata(dev);
struct auok190xfb_par *par = info->par;
struct auok190x_board *board = par->board;
u16 standby_param;
@@ -823,8 +822,7 @@ static int __maybe_unused auok190x_runtime_suspend(struct device *dev)

static int __maybe_unused auok190x_runtime_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct fb_info *info = platform_get_drvdata(pdev);
+ struct fb_info *info = dev_get_drvdata(dev);
struct auok190xfb_par *par = info->par;
struct auok190x_board *board = par->board;

@@ -857,8 +855,7 @@ static int __maybe_unused auok190x_runtime_resume(struct device *dev)

static int __maybe_unused auok190x_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct fb_info *info = platform_get_drvdata(pdev);
+ struct fb_info *info = dev_get_drvdata(dev);
struct auok190xfb_par *par = info->par;
struct auok190x_board *board = par->board;
int ret;
@@ -897,8 +894,7 @@ static int __maybe_unused auok190x_suspend(struct device *dev)

static int __maybe_unused auok190x_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct fb_info *info = platform_get_drvdata(pdev);
+ struct fb_info *info = dev_get_drvdata(dev);
struct auok190xfb_par *par = info->par;
struct auok190x_board *board = par->board;

diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c
index c3a46506e47e..86bd4090b011 100644
--- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
+++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
@@ -2354,8 +2354,7 @@ static int sh_mobile_lcdc_resume(struct device *dev)

static int sh_mobile_lcdc_runtime_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
+ struct sh_mobile_lcdc_priv *priv = dev_get_drvdata(dev);

/* turn off LCDC hardware */
lcdc_write(priv, _LDCNT1R, 0);
@@ -2365,8 +2364,7 @@ static int sh_mobile_lcdc_runtime_suspend(struct device *dev)

static int sh_mobile_lcdc_runtime_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
+ struct sh_mobile_lcdc_priv *priv = dev_get_drvdata(dev);

__sh_mobile_lcdc_start(priv);

diff --git a/drivers/video/fbdev/sh_mobile_meram.c b/drivers/video/fbdev/sh_mobile_meram.c
index baadfb207b2e..f5d8bd7ef509 100644
--- a/drivers/video/fbdev/sh_mobile_meram.c
+++ b/drivers/video/fbdev/sh_mobile_meram.c
@@ -572,8 +572,7 @@ EXPORT_SYMBOL_GPL(sh_mobile_meram_cache_update);
#ifdef CONFIG_PM
static int sh_mobile_meram_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
+ struct sh_mobile_meram_priv *priv = dev_get_drvdata(dev);
unsigned int i, j;

for (i = 0; i < MERAM_REGS_SIZE; i++)
@@ -596,8 +595,7 @@ static int sh_mobile_meram_suspend(struct device *dev)

static int sh_mobile_meram_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
+ struct sh_mobile_meram_priv *priv = dev_get_drvdata(dev);
unsigned int i, j;

for (i = 0; i < 32; i++) {
--
2.11.0


2018-04-19 14:12:37

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 52/61] thermal: st: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

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


2018-04-19 14:12:57

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 54/61] uio: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/uio/uio_fsl_elbc_gpcm.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/uio/uio_fsl_elbc_gpcm.c b/drivers/uio/uio_fsl_elbc_gpcm.c
index b46323d9dc18..50b460c540f7 100644
--- a/drivers/uio/uio_fsl_elbc_gpcm.c
+++ b/drivers/uio/uio_fsl_elbc_gpcm.c
@@ -73,8 +73,7 @@ DEVICE_ATTR(reg_or, S_IRUGO|S_IWUSR|S_IWGRP, reg_show, reg_store);
static ssize_t reg_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct uio_info *info = platform_get_drvdata(pdev);
+ struct uio_info *info = dev_get_drvdata(dev);
struct fsl_elbc_gpcm *priv = info->priv;
struct fsl_lbc_bank *bank = &priv->lbc->bank[priv->bank];

@@ -93,8 +92,7 @@ static ssize_t reg_show(struct device *dev, struct device_attribute *attr,
static ssize_t reg_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct uio_info *info = platform_get_drvdata(pdev);
+ struct uio_info *info = dev_get_drvdata(dev);
struct fsl_elbc_gpcm *priv = info->priv;
struct fsl_lbc_bank *bank = &priv->lbc->bank[priv->bank];
unsigned long val;
--
2.11.0


2018-04-19 14:13:08

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 51/61] thermal: int340x_thermal: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

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


2018-04-19 14:13:46

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 50/61] thermal: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

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


2018-04-19 14:14:03

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 49/61] staging: nvec: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/staging/nvec/nvec.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 52054a528723..2a5e0dcf4162 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -925,8 +925,7 @@ static int tegra_nvec_remove(struct platform_device *pdev)
static int nvec_suspend(struct device *dev)
{
int err;
- struct platform_device *pdev = to_platform_device(dev);
- struct nvec_chip *nvec = platform_get_drvdata(pdev);
+ struct nvec_chip *nvec = dev_get_drvdata(dev);
struct nvec_msg *msg;
char ap_suspend[] = { NVEC_SLEEP, AP_SUSPEND };

@@ -946,8 +945,7 @@ static int nvec_suspend(struct device *dev)

static int nvec_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct nvec_chip *nvec = platform_get_drvdata(pdev);
+ struct nvec_chip *nvec = dev_get_drvdata(dev);

dev_dbg(nvec->dev, "resuming\n");
tegra_init_i2c_slave(nvec);
--
2.11.0


2018-04-19 14:14:23

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 48/61] staging: iio: adc: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/staging/iio/adc/ad7606_par.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7606_par.c b/drivers/staging/iio/adc/ad7606_par.c
index 3eb6f8f312dd..a34c2a1d5373 100644
--- a/drivers/staging/iio/adc/ad7606_par.c
+++ b/drivers/staging/iio/adc/ad7606_par.c
@@ -18,8 +18,7 @@
static int ad7606_par16_read_block(struct device *dev,
int count, void *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad7606_state *st = iio_priv(indio_dev);

insw((unsigned long)st->base_address, buf, count);
@@ -34,8 +33,7 @@ static const struct ad7606_bus_ops ad7606_par16_bops = {
static int ad7606_par8_read_block(struct device *dev,
int count, void *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad7606_state *st = iio_priv(indio_dev);

insb((unsigned long)st->base_address, buf, count * 2);
--
2.11.0


2018-04-19 14:14:33

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 23/61] input: touchscreen: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/input/touchscreen/imx6ul_tsc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c
index ee82a975bfd2..da9e0a774e4b 100644
--- a/drivers/input/touchscreen/imx6ul_tsc.c
+++ b/drivers/input/touchscreen/imx6ul_tsc.c
@@ -515,8 +515,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);
@@ -535,8 +534,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;

--
2.11.0


2018-04-19 14:14:44

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 45/61] slimbus: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/slimbus/qcom-ctrl.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c
index ffb46f915334..45c38fff15d2 100644
--- a/drivers/slimbus/qcom-ctrl.c
+++ b/drivers/slimbus/qcom-ctrl.c
@@ -655,8 +655,7 @@ static int qcom_slim_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
static int qcom_slim_runtime_suspend(struct device *device)
{
- struct platform_device *pdev = to_platform_device(device);
- struct qcom_slim_ctrl *ctrl = platform_get_drvdata(pdev);
+ struct qcom_slim_ctrl *ctrl = dev_get_drvdata(device);
int ret;

dev_dbg(device, "pm_runtime: suspending...\n");
@@ -673,8 +672,7 @@ static int qcom_slim_runtime_suspend(struct device *device)

static int qcom_slim_runtime_resume(struct device *device)
{
- struct platform_device *pdev = to_platform_device(device);
- struct qcom_slim_ctrl *ctrl = platform_get_drvdata(pdev);
+ struct qcom_slim_ctrl *ctrl = dev_get_drvdata(device);
int ret = 0;

dev_dbg(device, "pm_runtime: resuming...\n");
--
2.11.0


2018-04-19 14:14:44

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 44/61] rtc: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

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 ++++------
15 files changed, 71 insertions(+), 131 deletions(-)

diff --git a/drivers/rtc/rtc-bq4802.c b/drivers/rtc/rtc-bq4802.c
index bd170cb3361c..d768f6747961 100644
--- a/drivers/rtc/rtc-bq4802.c
+++ b/drivers/rtc/rtc-bq4802.c
@@ -48,8 +48,7 @@ static void bq4802_write_mem(struct bq4802 *p, int off, u8 val)

static int bq4802_read_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct bq4802 *p = platform_get_drvdata(pdev);
+ struct bq4802 *p = dev_get_drvdata(dev);
unsigned long flags;
unsigned int century;
u8 val;
@@ -91,8 +90,7 @@ static int bq4802_read_time(struct device *dev, struct rtc_time *tm)

static int bq4802_set_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct bq4802 *p = platform_get_drvdata(pdev);
+ struct bq4802 *p = dev_get_drvdata(dev);
u8 sec, min, hrs, day, mon, yrs, century, val;
unsigned long flags;
unsigned int year;
diff --git a/drivers/rtc/rtc-ds1216.c b/drivers/rtc/rtc-ds1216.c
index 5f158715fb4c..50fabe1cd286 100644
--- a/drivers/rtc/rtc-ds1216.c
+++ b/drivers/rtc/rtc-ds1216.c
@@ -76,8 +76,7 @@ static void ds1216_switch_ds_to_clock(u8 __iomem *ioaddr)

static int ds1216_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ds1216_priv *priv = platform_get_drvdata(pdev);
+ struct ds1216_priv *priv = dev_get_drvdata(dev);
struct ds1216_regs regs;

ds1216_switch_ds_to_clock(priv->ioaddr);
@@ -104,8 +103,7 @@ static int ds1216_rtc_read_time(struct device *dev, struct rtc_time *tm)

static int ds1216_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ds1216_priv *priv = platform_get_drvdata(pdev);
+ struct ds1216_priv *priv = dev_get_drvdata(dev);
struct ds1216_regs regs;

ds1216_switch_ds_to_clock(priv->ioaddr);
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index a7d5ca428d68..b8b6e51c0461 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -314,8 +314,7 @@ ds1511_rtc_update_alarm(struct rtc_plat_data *pdata)
static int
ds1511_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);

if (pdata->irq <= 0)
return -EINVAL;
@@ -334,8 +333,7 @@ ds1511_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
static int
ds1511_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);

if (pdata->irq <= 0)
return -EINVAL;
@@ -373,8 +371,7 @@ ds1511_interrupt(int irq, void *dev_id)

static int ds1511_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);

if (pdata->irq <= 0)
return -EINVAL;
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index 2441b9a2b366..34af7a802f43 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -73,8 +73,7 @@ struct rtc_plat_data {

static int ds1553_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr;
u8 century;

@@ -98,8 +97,7 @@ static int ds1553_rtc_set_time(struct device *dev, struct rtc_time *tm)

static int ds1553_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr;
unsigned int year, month, day, hour, minute, second, week;
unsigned int century;
@@ -155,8 +153,7 @@ static void ds1553_rtc_update_alarm(struct rtc_plat_data *pdata)

static int ds1553_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);

if (pdata->irq <= 0)
return -EINVAL;
@@ -172,8 +169,7 @@ static int ds1553_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)

static int ds1553_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);

if (pdata->irq <= 0)
return -EINVAL;
@@ -208,8 +204,7 @@ static irqreturn_t ds1553_rtc_interrupt(int irq, void *dev_id)

static int ds1553_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);

if (pdata->irq <= 0)
return -EINVAL;
diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index 1a39829d2b40..f0f8011dce3d 100644
--- a/drivers/rtc/rtc-ds1685.c
+++ b/drivers/rtc/rtc-ds1685.c
@@ -267,8 +267,7 @@ ds1685_rtc_get_ssn(struct ds1685_priv *rtc, u8 *ssn)
static int
ds1685_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ds1685_priv *rtc = platform_get_drvdata(pdev);
+ struct ds1685_priv *rtc = dev_get_drvdata(dev);
u8 ctrlb, century;
u8 seconds, minutes, hours, wday, mday, month, years;

@@ -317,8 +316,7 @@ ds1685_rtc_read_time(struct device *dev, struct rtc_time *tm)
static int
ds1685_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ds1685_priv *rtc = platform_get_drvdata(pdev);
+ struct ds1685_priv *rtc = dev_get_drvdata(dev);
u8 ctrlb, seconds, minutes, hours, wday, mday, month, years, century;

/* Fetch the time info from rtc_time. */
@@ -394,8 +392,7 @@ ds1685_rtc_set_time(struct device *dev, struct rtc_time *tm)
static int
ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ds1685_priv *rtc = platform_get_drvdata(pdev);
+ struct ds1685_priv *rtc = dev_get_drvdata(dev);
u8 seconds, minutes, hours, mday, ctrlb, ctrlc;
int ret;

@@ -453,8 +450,7 @@ ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
static int
ds1685_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ds1685_priv *rtc = platform_get_drvdata(pdev);
+ struct ds1685_priv *rtc = dev_get_drvdata(dev);
u8 ctrlb, seconds, minutes, hours, mday;
int ret;

@@ -1119,8 +1115,7 @@ static ssize_t
ds1685_rtc_sysfs_battery_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ds1685_priv *rtc = platform_get_drvdata(pdev);
+ struct ds1685_priv *rtc = dev_get_drvdata(dev);
u8 ctrld;

ctrld = rtc->read(rtc, RTC_CTRL_D);
@@ -1140,8 +1135,7 @@ static ssize_t
ds1685_rtc_sysfs_auxbatt_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ds1685_priv *rtc = platform_get_drvdata(pdev);
+ struct ds1685_priv *rtc = dev_get_drvdata(dev);
u8 ctrl4a;

ds1685_rtc_switch_to_bank1(rtc);
@@ -1163,8 +1157,7 @@ static ssize_t
ds1685_rtc_sysfs_serial_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ds1685_priv *rtc = platform_get_drvdata(pdev);
+ struct ds1685_priv *rtc = dev_get_drvdata(dev);
u8 ssn[8];

ds1685_rtc_switch_to_bank1(rtc);
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c
index 2d781180e968..5b7f02e89941 100644
--- a/drivers/rtc/rtc-ds1742.c
+++ b/drivers/rtc/rtc-ds1742.c
@@ -58,8 +58,7 @@ struct rtc_plat_data {

static int ds1742_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr_rtc;
u8 century;

@@ -83,8 +82,7 @@ static int ds1742_rtc_set_time(struct device *dev, struct rtc_time *tm)

static int ds1742_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr_rtc;
unsigned int year, month, day, hour, minute, second, week;
unsigned int century;
diff --git a/drivers/rtc/rtc-lpc32xx.c b/drivers/rtc/rtc-lpc32xx.c
index 3ba87239aacc..910e600275b9 100644
--- a/drivers/rtc/rtc-lpc32xx.c
+++ b/drivers/rtc/rtc-lpc32xx.c
@@ -294,11 +294,10 @@ static int lpc32xx_rtc_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
static int lpc32xx_rtc_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct lpc32xx_rtc *rtc = platform_get_drvdata(pdev);
+ struct lpc32xx_rtc *rtc = dev_get_drvdata(dev);

if (rtc->irq >= 0) {
- if (device_may_wakeup(&pdev->dev))
+ if (device_may_wakeup(dev))
enable_irq_wake(rtc->irq);
else
disable_irq_wake(rtc->irq);
@@ -309,10 +308,9 @@ static int lpc32xx_rtc_suspend(struct device *dev)

static int lpc32xx_rtc_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct lpc32xx_rtc *rtc = platform_get_drvdata(pdev);
+ struct lpc32xx_rtc *rtc = dev_get_drvdata(dev);

- if (rtc->irq >= 0 && device_may_wakeup(&pdev->dev))
+ if (rtc->irq >= 0 && device_may_wakeup(dev))
disable_irq_wake(rtc->irq);

return 0;
@@ -321,8 +319,7 @@ static int lpc32xx_rtc_resume(struct device *dev)
/* Unconditionally disable the alarm */
static int lpc32xx_rtc_freeze(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct lpc32xx_rtc *rtc = platform_get_drvdata(pdev);
+ struct lpc32xx_rtc *rtc = dev_get_drvdata(dev);

spin_lock_irq(&rtc->lock);

@@ -337,8 +334,7 @@ static int lpc32xx_rtc_freeze(struct device *dev)

static int lpc32xx_rtc_thaw(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct lpc32xx_rtc *rtc = platform_get_drvdata(pdev);
+ struct lpc32xx_rtc *rtc = dev_get_drvdata(dev);

if (rtc->alarm_enabled) {
spin_lock_irq(&rtc->lock);
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 216fac62c888..1053a406b3aa 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -47,8 +47,7 @@ struct m48t59_private {
static void
m48t59_mem_writeb(struct device *dev, u32 ofs, u8 val)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
+ struct m48t59_private *m48t59 = dev_get_drvdata(dev);

writeb(val, m48t59->ioaddr+ofs);
}
@@ -56,8 +55,7 @@ m48t59_mem_writeb(struct device *dev, u32 ofs, u8 val)
static u8
m48t59_mem_readb(struct device *dev, u32 ofs)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
+ struct m48t59_private *m48t59 = dev_get_drvdata(dev);

return readb(m48t59->ioaddr+ofs);
}
@@ -67,9 +65,8 @@ m48t59_mem_readb(struct device *dev, u32 ofs)
*/
static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev);
- struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
+ struct m48t59_plat_data *pdata = dev_get_platdata(dev);
+ struct m48t59_private *m48t59 = dev_get_drvdata(dev);
unsigned long flags;
u8 val;

@@ -110,9 +107,8 @@ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm)

static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev);
- struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
+ struct m48t59_plat_data *pdata = dev_get_platdata(dev);
+ struct m48t59_private *m48t59 = dev_get_drvdata(dev);
unsigned long flags;
u8 val = 0;
int year = tm->tm_year;
@@ -157,9 +153,8 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm)
*/
static int m48t59_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev);
- struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
+ struct m48t59_plat_data *pdata = dev_get_platdata(dev);
+ struct m48t59_private *m48t59 = dev_get_drvdata(dev);
struct rtc_time *tm = &alrm->time;
unsigned long flags;
u8 val;
@@ -204,9 +199,8 @@ static int m48t59_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
*/
static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev);
- struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
+ struct m48t59_plat_data *pdata = dev_get_platdata(dev);
+ struct m48t59_private *m48t59 = dev_get_drvdata(dev);
struct rtc_time *tm = &alrm->time;
u8 mday, hour, min, sec;
unsigned long flags;
@@ -265,9 +259,8 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
*/
static int m48t59_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev);
- struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
+ struct m48t59_plat_data *pdata = dev_get_platdata(dev);
+ struct m48t59_private *m48t59 = dev_get_drvdata(dev);
unsigned long flags;

spin_lock_irqsave(&m48t59->lock, flags);
@@ -282,9 +275,8 @@ static int m48t59_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)

static int m48t59_rtc_proc(struct device *dev, struct seq_file *seq)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev);
- struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
+ struct m48t59_plat_data *pdata = dev_get_platdata(dev);
+ struct m48t59_private *m48t59 = dev_get_drvdata(dev);
unsigned long flags;
u8 val;

@@ -303,9 +295,8 @@ static int m48t59_rtc_proc(struct device *dev, struct seq_file *seq)
static irqreturn_t m48t59_rtc_interrupt(int irq, void *dev_id)
{
struct device *dev = (struct device *)dev_id;
- struct platform_device *pdev = to_platform_device(dev);
- struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev);
- struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
+ struct m48t59_plat_data *pdata = dev_get_platdata(dev);
+ struct m48t59_private *m48t59 = dev_get_drvdata(dev);
u8 event;

spin_lock(&m48t59->lock);
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index bc52dbb0c0e2..4b198b3778d3 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -176,8 +176,7 @@ static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)

static int mv_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr;

if (pdata->irq < 0)
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c
index bce427d202ee..822ebe4be3c3 100644
--- a/drivers/rtc/rtc-mxc.c
+++ b/drivers/rtc/rtc-mxc.c
@@ -109,8 +109,7 @@ static inline int is_imx1_rtc(struct rtc_plat_data *data)
*/
static time64_t get_alarm_or_time(struct device *dev, int time_alarm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr;
u32 day = 0, hr = 0, min = 0, sec = 0, hr_min = 0;

@@ -139,8 +138,7 @@ static time64_t get_alarm_or_time(struct device *dev, int time_alarm)
static void set_alarm_or_time(struct device *dev, int time_alarm, time64_t time)
{
u32 tod, day, hr, min, sec, temp;
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr;

day = div_s64_rem(time, 86400, &tod);
@@ -176,8 +174,7 @@ static void set_alarm_or_time(struct device *dev, int time_alarm, time64_t time)
static void rtc_update_alarm(struct device *dev, struct rtc_time *alrm)
{
time64_t time;
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr;

time = rtc_tm_to_time64(alrm);
@@ -190,8 +187,7 @@ static void rtc_update_alarm(struct device *dev, struct rtc_time *alrm)
static void mxc_rtc_irq_enable(struct device *dev, unsigned int bit,
unsigned int enabled)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr;
u32 reg;

@@ -266,8 +262,7 @@ static int mxc_rtc_read_time(struct device *dev, struct rtc_time *tm)
*/
static int mxc_rtc_set_mmss(struct device *dev, time64_t time)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);

/*
* TTC_DAYR register is 9-bit in MX1 SoC, save time and day of year only
@@ -295,8 +290,7 @@ static int mxc_rtc_set_mmss(struct device *dev, time64_t time)
*/
static int mxc_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr;

rtc_time64_to_tm(get_alarm_or_time(dev, MXC_RTC_ALARM), &alrm->time);
@@ -310,8 +304,7 @@ static int mxc_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
*/
static int mxc_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);

rtc_update_alarm(dev, &alrm->time);

diff --git a/drivers/rtc/rtc-pcap.c b/drivers/rtc/rtc-pcap.c
index c05f524ba9af..f176cb9d0dbc 100644
--- a/drivers/rtc/rtc-pcap.c
+++ b/drivers/rtc/rtc-pcap.c
@@ -43,8 +43,7 @@ static irqreturn_t pcap_rtc_irq(int irq, void *_pcap_rtc)

static int pcap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
+ struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
struct rtc_time *tm = &alrm->time;
unsigned long secs;
u32 tod; /* time of day, seconds since midnight */
@@ -63,8 +62,7 @@ static int pcap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)

static int pcap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
+ struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
struct rtc_time *tm = &alrm->time;
unsigned long secs;
u32 tod, days;
@@ -82,8 +80,7 @@ static int pcap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)

static int pcap_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
+ struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
unsigned long secs;
u32 tod, days;

@@ -100,8 +97,7 @@ static int pcap_rtc_read_time(struct device *dev, struct rtc_time *tm)

static int pcap_rtc_set_mmss(struct device *dev, unsigned long secs)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
+ struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
u32 tod, days;

tod = secs % SEC_PER_DAY;
@@ -115,8 +111,7 @@ static int pcap_rtc_set_mmss(struct device *dev, unsigned long secs)

static int pcap_rtc_irq_enable(struct device *dev, int pirq, unsigned int en)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
+ struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);

if (en)
enable_irq(pcap_to_irq(pcap_rtc->pcap, pirq));
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index 4e8ab370ce63..4f98543d1ea5 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -359,8 +359,7 @@ static int sh_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)

static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct sh_rtc *rtc = platform_get_drvdata(pdev);
+ struct sh_rtc *rtc = dev_get_drvdata(dev);
unsigned int sec128, sec2, yr, yr100, cf_bit;

do {
@@ -419,8 +418,7 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm)

static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct sh_rtc *rtc = platform_get_drvdata(pdev);
+ struct sh_rtc *rtc = dev_get_drvdata(dev);
unsigned int tmp;
int year;

@@ -475,8 +473,7 @@ static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off)

static int sh_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct sh_rtc *rtc = platform_get_drvdata(pdev);
+ struct sh_rtc *rtc = dev_get_drvdata(dev);
struct rtc_time *tm = &wkalrm->time;

spin_lock_irq(&rtc->lock);
@@ -509,8 +506,7 @@ static inline void sh_rtc_write_alarm_value(struct sh_rtc *rtc,

static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct sh_rtc *rtc = platform_get_drvdata(pdev);
+ struct sh_rtc *rtc = dev_get_drvdata(dev);
unsigned int rcr1;
struct rtc_time *tm = &wkalrm->time;
int mon;
@@ -723,8 +719,7 @@ static int __exit sh_rtc_remove(struct platform_device *pdev)

static void sh_rtc_set_irq_wake(struct device *dev, int enabled)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct sh_rtc *rtc = platform_get_drvdata(pdev);
+ struct sh_rtc *rtc = dev_get_drvdata(dev);

irq_set_irq_wake(rtc->periodic_irq, enabled);

diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c
index e70b78d17a98..fccbecbb2c98 100644
--- a/drivers/rtc/rtc-stk17ta8.c
+++ b/drivers/rtc/rtc-stk17ta8.c
@@ -74,8 +74,7 @@ struct rtc_plat_data {

static int stk17ta8_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr;
u8 flags;

@@ -97,8 +96,7 @@ static int stk17ta8_rtc_set_time(struct device *dev, struct rtc_time *tm)

static int stk17ta8_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr;
unsigned int year, month, day, hour, minute, second, week;
unsigned int century;
@@ -163,8 +161,7 @@ static void stk17ta8_rtc_update_alarm(struct rtc_plat_data *pdata)

static int stk17ta8_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);

if (pdata->irq <= 0)
return -EINVAL;
@@ -180,8 +177,7 @@ static int stk17ta8_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)

static int stk17ta8_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);

if (pdata->irq <= 0)
return -EINVAL;
@@ -217,8 +213,7 @@ static irqreturn_t stk17ta8_rtc_interrupt(int irq, void *dev_id)
static int stk17ta8_rtc_alarm_irq_enable(struct device *dev,
unsigned int enabled)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+ struct rtc_plat_data *pdata = dev_get_drvdata(dev);

if (pdata->irq <= 0)
return -EINVAL;
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c
index 3a2da4c892d6..390f928fd6fc 100644
--- a/drivers/rtc/rtc-test.c
+++ b/drivers/rtc/rtc-test.c
@@ -84,8 +84,7 @@ static ssize_t test_irq_store(struct device *dev,
const char *buf, size_t count)
{
int retval;
- struct platform_device *plat_dev = to_platform_device(dev);
- struct rtc_device *rtc = platform_get_drvdata(plat_dev);
+ struct rtc_device *rtc = dev_get_drvdata(dev);

retval = count;
if (strncmp(buf, "tick", 4) == 0 && rtc->pie_enabled)
diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index fba994dc31eb..c532bd13fbe5 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -278,10 +278,9 @@ static int xlnx_rtc_remove(struct platform_device *pdev)

static int __maybe_unused xlnx_rtc_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct xlnx_rtc_dev *xrtcdev = platform_get_drvdata(pdev);
+ struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);

- if (device_may_wakeup(&pdev->dev))
+ if (device_may_wakeup(dev))
enable_irq_wake(xrtcdev->alarm_irq);
else
xlnx_rtc_alarm_irq_enable(dev, 0);
@@ -291,10 +290,9 @@ static int __maybe_unused xlnx_rtc_suspend(struct device *dev)

static int __maybe_unused xlnx_rtc_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct xlnx_rtc_dev *xrtcdev = platform_get_drvdata(pdev);
+ struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);

- if (device_may_wakeup(&pdev->dev))
+ if (device_may_wakeup(dev))
disable_irq_wake(xrtcdev->alarm_irq);
else
xlnx_rtc_alarm_irq_enable(dev, 1);
--
2.11.0


2018-04-19 14:14:48

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 43/61] pwm: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/pwm/pwm-atmel-tcb.c | 6 ++----
drivers/pwm/pwm-rcar.c | 3 +--
2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index 4fb1be246c44..0d0f8376bc35 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -460,8 +460,7 @@ MODULE_DEVICE_TABLE(of, atmel_tcb_pwm_dt_ids);
#ifdef CONFIG_PM_SLEEP
static int atmel_tcb_pwm_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
+ struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev);
void __iomem *base = tcbpwm->tc->regs;
int i;

@@ -478,8 +477,7 @@ static int atmel_tcb_pwm_suspend(struct device *dev)

static int atmel_tcb_pwm_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
+ struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev);
void __iomem *base = tcbpwm->tc->regs;
int i;

diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
index 91d11f2e2fef..748f614d5375 100644
--- a/drivers/pwm/pwm-rcar.c
+++ b/drivers/pwm/pwm-rcar.c
@@ -261,8 +261,7 @@ MODULE_DEVICE_TABLE(of, rcar_pwm_of_table);
#ifdef CONFIG_PM_SLEEP
static struct pwm_device *rcar_pwm_dev_to_pwm_dev(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev);
+ struct rcar_pwm_chip *rcar_pwm = dev_get_drvdata(dev);
struct pwm_chip *chip = &rcar_pwm->chip;

return &chip->pwms[0];
--
2.11.0


2018-04-19 14:15:16

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 47/61] staging: greybus: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/staging/greybus/arche-platform.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
index 83254a72a7bb..8fe8b6e35432 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -315,8 +315,7 @@ static ssize_t state_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
+ struct arche_platform_drvdata *arche_pdata = dev_get_drvdata(dev);
int ret = 0;

mutex_lock(&arche_pdata->platform_state_mutex);
--
2.11.0


2018-04-19 14:15:36

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 42/61] ptp: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/ptp/ptp_dte.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/ptp/ptp_dte.c b/drivers/ptp/ptp_dte.c
index 6edd3b9c7f01..5481a27d4fec 100644
--- a/drivers/ptp/ptp_dte.c
+++ b/drivers/ptp/ptp_dte.c
@@ -287,8 +287,7 @@ static int ptp_dte_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int ptp_dte_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ptp_dte *ptp_dte = platform_get_drvdata(pdev);
+ struct ptp_dte *ptp_dte = dev_get_drvdata(dev);
u8 i;

for (i = 0; i < DTE_NUM_REGS_TO_RESTORE; i++) {
@@ -304,8 +303,7 @@ static int ptp_dte_suspend(struct device *dev)

static int ptp_dte_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ptp_dte *ptp_dte = platform_get_drvdata(pdev);
+ struct ptp_dte *ptp_dte = dev_get_drvdata(dev);
u8 i;

for (i = 0; i < DTE_NUM_REGS_TO_RESTORE; i++) {
--
2.11.0


2018-04-19 14:15:57

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 41/61] power: supply: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

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


2018-04-19 14:16:34

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 40/61] platform: x86: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/platform/x86/asus-laptop.c | 3 +--
drivers/platform/x86/asus-wmi.c | 3 +--
drivers/platform/x86/samsung-laptop.c | 3 +--
3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index c4768be24ba9..700c48ddfa7c 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -1593,8 +1593,7 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
int idx)
{
struct device *dev = container_of(kobj, struct device, kobj);
- struct platform_device *pdev = to_platform_device(dev);
- struct asus_laptop *asus = platform_get_drvdata(pdev);
+ struct asus_laptop *asus = dev_get_drvdata(dev);
acpi_handle handle = asus->handle;
bool supported;

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index a32c5c00e0e7..ef87e78ca772 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1862,8 +1862,7 @@ static umode_t asus_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);
- struct asus_wmi *asus = platform_get_drvdata(pdev);
+ struct asus_wmi *asus = dev_get_drvdata(dev);
bool ok = true;
int devid = -1;

diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index 03305e0b89ff..7b160ee98115 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -1216,8 +1216,7 @@ static umode_t samsung_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);
- struct samsung_laptop *samsung = platform_get_drvdata(pdev);
+ struct samsung_laptop *samsung = dev_get_drvdata(dev);
bool ok = true;

if (attr == &dev_attr_performance_level.attr)
--
2.11.0


2018-04-19 14:16:51

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 39/61] pinctrl: intel: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/pinctrl/intel/pinctrl-baytrail.c | 6 ++----
drivers/pinctrl/intel/pinctrl-cherryview.c | 6 ++----
drivers/pinctrl/intel/pinctrl-intel.c | 6 ++----
3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 6b52ea1440a6..71dadf8081af 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1848,8 +1848,7 @@ static int byt_pinctrl_probe(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int byt_gpio_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct byt_gpio *vg = platform_get_drvdata(pdev);
+ struct byt_gpio *vg = dev_get_drvdata(dev);
int i;

for (i = 0; i < vg->soc_data->npins; i++) {
@@ -1877,8 +1876,7 @@ static int byt_gpio_suspend(struct device *dev)

static int byt_gpio_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct byt_gpio *vg = platform_get_drvdata(pdev);
+ struct byt_gpio *vg = dev_get_drvdata(dev);
int i;

for (i = 0; i < vg->soc_data->npins; i++) {
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index b1ae1618fefe..dd9b2554548f 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -1752,8 +1752,7 @@ static int chv_pinctrl_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int chv_pinctrl_suspend_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct chv_pinctrl *pctrl = platform_get_drvdata(pdev);
+ struct chv_pinctrl *pctrl = dev_get_drvdata(dev);
unsigned long flags;
int i;

@@ -1786,8 +1785,7 @@ static int chv_pinctrl_suspend_noirq(struct device *dev)

static int chv_pinctrl_resume_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct chv_pinctrl *pctrl = platform_get_drvdata(pdev);
+ struct chv_pinctrl *pctrl = dev_get_drvdata(dev);
unsigned long flags;
int i;

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 1e24a6b8a64e..04a052292619 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -1409,8 +1409,7 @@ static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned pin)

int intel_pinctrl_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct intel_pinctrl *pctrl = platform_get_drvdata(pdev);
+ struct intel_pinctrl *pctrl = dev_get_drvdata(dev);
struct intel_community_context *communities;
struct intel_pad_context *pads;
int i;
@@ -1471,8 +1470,7 @@ static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)

int intel_pinctrl_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct intel_pinctrl *pctrl = platform_get_drvdata(pdev);
+ struct intel_pinctrl *pctrl = dev_get_drvdata(dev);
const struct intel_community_context *communities;
const struct intel_pad_context *pads;
int i;
--
2.11.0


2018-04-19 14:17:13

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 38/61] pinctrl: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/pinctrl/pinctrl-amd.c | 6 ++----
drivers/pinctrl/pinctrl-at91-pio4.c | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
index 04ae139671c8..c2c7067b0660 100644
--- a/drivers/pinctrl/pinctrl-amd.c
+++ b/drivers/pinctrl/pinctrl-amd.c
@@ -777,8 +777,7 @@ static bool amd_gpio_should_save(struct amd_gpio *gpio_dev, unsigned int pin)

static int amd_gpio_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct amd_gpio *gpio_dev = platform_get_drvdata(pdev);
+ struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
int i;

@@ -796,8 +795,7 @@ static int amd_gpio_suspend(struct device *dev)

static int amd_gpio_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct amd_gpio *gpio_dev = platform_get_drvdata(pdev);
+ struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
int i;

diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index 4b57a13758a4..7065068f73f5 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -831,8 +831,7 @@ static struct pinctrl_desc atmel_pinctrl_desc = {

static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
+ struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(dev);
int i, j;

/*
@@ -860,8 +859,7 @@ static int __maybe_unused atmel_pctrl_suspend(struct device *dev)

static int __maybe_unused atmel_pctrl_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
+ struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(dev);
int i, j;

for (i = 0; i < atmel_pioctrl->nbanks; i++) {
--
2.11.0


2018-04-19 14:17:23

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 18/61] iio: common: cros_ec_sensors: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
index a620eb5ce202..3df6c0e09832 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
@@ -448,8 +448,7 @@ EXPORT_SYMBOL_GPL(cros_ec_sensors_core_write);

static int __maybe_unused cros_ec_sensors_prepare(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct cros_ec_sensors_core_state *st = iio_priv(indio_dev);

if (st->curr_sampl_freq == 0)
@@ -471,8 +470,7 @@ static int __maybe_unused cros_ec_sensors_prepare(struct device *dev)

static void __maybe_unused cros_ec_sensors_complete(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct cros_ec_sensors_core_state *st = iio_priv(indio_dev);

if (st->curr_sampl_freq == 0)
--
2.11.0


2018-04-19 14:17:35

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 22/61] input: mouse: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

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


2018-04-19 14:17:50

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 36/61] net: ethernet: wiznet: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/net/ethernet/wiznet/w5300.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c
index 56ae573001e8..692fc71d904d 100644
--- a/drivers/net/ethernet/wiznet/w5300.c
+++ b/drivers/net/ethernet/wiznet/w5300.c
@@ -661,8 +661,7 @@ static int w5300_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int w5300_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *ndev = platform_get_drvdata(pdev);
+ struct net_device *ndev = dev_get_drvdata(dev);
struct w5300_priv *priv = netdev_priv(ndev);

if (netif_running(ndev)) {
@@ -676,8 +675,7 @@ static int w5300_suspend(struct device *dev)

static int w5300_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *ndev = platform_get_drvdata(pdev);
+ struct net_device *ndev = dev_get_drvdata(dev);
struct w5300_priv *priv = netdev_priv(ndev);

if (!netif_running(ndev)) {
--
2.11.0


2018-04-19 14:18:19

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 35/61] net: ethernet: ti: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/net/ethernet/ti/cpsw.c | 6 ++----
drivers/net/ethernet/ti/davinci_emac.c | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 30371274409d..ef0c88e71a71 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -3300,8 +3300,7 @@ static int cpsw_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int cpsw_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *ndev = platform_get_drvdata(pdev);
+ struct net_device *ndev = dev_get_drvdata(dev);
struct cpsw_common *cpsw = ndev_to_cpsw(ndev);

if (cpsw->data.dual_emac) {
@@ -3324,8 +3323,7 @@ static int cpsw_suspend(struct device *dev)

static int cpsw_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *ndev = platform_get_drvdata(pdev);
+ struct net_device *ndev = dev_get_drvdata(dev);
struct cpsw_common *cpsw = ndev_to_cpsw(ndev);

/* Select default pin state */
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index abceea802ea1..ef223613114d 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1985,8 +1985,7 @@ static int davinci_emac_remove(struct platform_device *pdev)

static int davinci_emac_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *ndev = platform_get_drvdata(pdev);
+ struct net_device *ndev = dev_get_drvdata(dev);

if (netif_running(ndev))
emac_dev_stop(ndev);
@@ -1996,8 +1995,7 @@ static int davinci_emac_suspend(struct device *dev)

static int davinci_emac_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *ndev = platform_get_drvdata(pdev);
+ struct net_device *ndev = dev_get_drvdata(dev);

if (netif_running(ndev))
emac_dev_open(ndev);
--
2.11.0


2018-04-19 14:18:44

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 37/61] perf: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/perf/arm_spe_pmu.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
index 28bb642af18b..54ec278d2fc4 100644
--- a/drivers/perf/arm_spe_pmu.c
+++ b/drivers/perf/arm_spe_pmu.c
@@ -131,8 +131,7 @@ static ssize_t arm_spe_pmu_cap_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct arm_spe_pmu *spe_pmu = platform_get_drvdata(pdev);
+ struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev);
struct dev_ext_attribute *ea =
container_of(attr, struct dev_ext_attribute, attr);
int cap = (long)ea->var;
@@ -247,8 +246,7 @@ static ssize_t arm_spe_pmu_get_attr_cpumask(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct arm_spe_pmu *spe_pmu = platform_get_drvdata(pdev);
+ struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev);

return cpumap_print_to_pagebuf(true, buf, &spe_pmu->supported_cpus);
}
--
2.11.0


2018-04-19 14:18:44

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 17/61] hid: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/hid/hid-sensor-custom.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index e8a114157f87..cd0c2a7c8003 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -157,8 +157,7 @@ static int usage_id_cmp(const void *p1, const void *p2)
static ssize_t enable_sensor_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
+ struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);

return sprintf(buf, "%d\n", sensor_inst->enable);
}
@@ -237,8 +236,7 @@ static ssize_t enable_sensor_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
+ struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
int value;
int ret = -EINVAL;

@@ -283,8 +281,7 @@ static const struct attribute_group enable_sensor_attr_group = {
static ssize_t show_value(struct device *dev, struct device_attribute *attr,
char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
+ struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
struct hid_sensor_hub_attribute_info *attribute;
int index, usage, field_index;
char name[HID_CUSTOM_NAME_LENGTH];
@@ -392,8 +389,7 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr,
static ssize_t store_value(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
+ struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
int index, field_index, usage;
char name[HID_CUSTOM_NAME_LENGTH];
int value;
--
2.11.0


2018-04-19 14:19:17

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 33/61] net: ethernet: davicom: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/net/ethernet/davicom/dm9000.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index 50222b7b81f3..0a82fcf16d35 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1722,8 +1722,7 @@ dm9000_probe(struct platform_device *pdev)
static int
dm9000_drv_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *ndev = platform_get_drvdata(pdev);
+ struct net_device *ndev = dev_get_drvdata(dev);
struct board_info *db;

if (ndev) {
@@ -1745,8 +1744,7 @@ dm9000_drv_suspend(struct device *dev)
static int
dm9000_drv_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *ndev = platform_get_drvdata(pdev);
+ struct net_device *ndev = dev_get_drvdata(dev);
struct board_info *db = netdev_priv(ndev);

if (ndev) {
--
2.11.0


2018-04-19 14:20:01

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 31/61] net: dsa: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/net/dsa/bcm_sf2.c | 6 ++----
drivers/net/dsa/qca8k.c | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 0378eded31f2..a61b937d1a37 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1148,16 +1148,14 @@ static void bcm_sf2_sw_shutdown(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int bcm_sf2_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);
+ struct bcm_sf2_priv *priv = dev_get_drvdata(dev);

return dsa_switch_suspend(priv->dev->ds);
}

static int bcm_sf2_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);
+ struct bcm_sf2_priv *priv = dev_get_drvdata(dev);

return dsa_switch_resume(priv->dev->ds);
}
diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 600d5ad1fbde..9f503e5db88a 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -910,8 +910,7 @@ qca8k_set_pm(struct qca8k_priv *priv, int enable)

static int qca8k_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct qca8k_priv *priv = platform_get_drvdata(pdev);
+ struct qca8k_priv *priv = dev_get_drvdata(dev);

qca8k_set_pm(priv, 0);

@@ -920,8 +919,7 @@ static int qca8k_suspend(struct device *dev)

static int qca8k_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct qca8k_priv *priv = platform_get_drvdata(pdev);
+ struct qca8k_priv *priv = dev_get_drvdata(dev);

qca8k_set_pm(priv, 1);

--
2.11.0


2018-04-19 14:20:02

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 34/61] net: ethernet: smsc: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/net/ethernet/smsc/smc91x.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
index 080428762858..3e84a499fe92 100644
--- a/drivers/net/ethernet/smsc/smc91x.c
+++ b/drivers/net/ethernet/smsc/smc91x.c
@@ -2453,8 +2453,7 @@ static int smc_drv_remove(struct platform_device *pdev)

static int smc_drv_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *ndev = platform_get_drvdata(pdev);
+ struct net_device *ndev = dev_get_drvdata(dev);

if (ndev) {
if (netif_running(ndev)) {
--
2.11.0


2018-04-19 14:20:21

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 19/61] iio: common: hid-sensors: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index cfb6588565ba..2ce0efd98cc0 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -304,8 +304,7 @@ EXPORT_SYMBOL(hid_sensor_setup_trigger);

static int __maybe_unused hid_sensor_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);

return _hid_sensor_power_state(attrb, false);
@@ -313,8 +312,7 @@ static int __maybe_unused hid_sensor_suspend(struct device *dev)

static int __maybe_unused hid_sensor_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);
schedule_work(&attrb->work);
return 0;
@@ -322,8 +320,7 @@ static int __maybe_unused hid_sensor_resume(struct device *dev)

static int __maybe_unused hid_sensor_runtime_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);
return _hid_sensor_power_state(attrb, true);
}
--
2.11.0


2018-04-19 14:20:21

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 30/61] mtd: nand: onenand: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/mtd/nand/onenand/samsung.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/onenand/samsung.c b/drivers/mtd/nand/onenand/samsung.c
index 2e9d076e445a..4cce4c0311ca 100644
--- a/drivers/mtd/nand/onenand/samsung.c
+++ b/drivers/mtd/nand/onenand/samsung.c
@@ -958,8 +958,7 @@ static int s3c_onenand_remove(struct platform_device *pdev)

static int s3c_pm_ops_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct mtd_info *mtd = platform_get_drvdata(pdev);
+ struct mtd_info *mtd = dev_get_drvdata(dev);
struct onenand_chip *this = mtd->priv;

this->wait(mtd, FL_PM_SUSPENDED);
@@ -968,8 +967,7 @@ static int s3c_pm_ops_suspend(struct device *dev)

static int s3c_pm_ops_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct mtd_info *mtd = platform_get_drvdata(pdev);
+ struct mtd_info *mtd = dev_get_drvdata(dev);
struct onenand_chip *this = mtd->priv;

this->unlock_all(mtd);
--
2.11.0


2018-04-19 14:20:53

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 32/61] net: ethernet: cadence: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/net/ethernet/cadence/macb_main.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index b4c9268100bb..136bfd5d0be9 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4056,8 +4056,7 @@ static int macb_remove(struct platform_device *pdev)

static int __maybe_unused macb_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *netdev = platform_get_drvdata(pdev);
+ struct net_device *netdev = dev_get_drvdata(dev);
struct macb *bp = netdev_priv(netdev);

netif_carrier_off(netdev);
@@ -4079,8 +4078,7 @@ static int __maybe_unused macb_suspend(struct device *dev)

static int __maybe_unused macb_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *netdev = platform_get_drvdata(pdev);
+ struct net_device *netdev = dev_get_drvdata(dev);
struct macb *bp = netdev_priv(netdev);

if (bp->wol & MACB_WOL_ENABLED) {
--
2.11.0


2018-04-19 14:21:41

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 29/61] mtd: devices: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/mtd/devices/docg3.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index c594fe5eac08..802d8f159e90 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1470,8 +1470,7 @@ static struct docg3 *sysfs_dev2docg3(struct device *dev,
struct device_attribute *attr)
{
int floor;
- struct platform_device *pdev = to_platform_device(dev);
- struct mtd_info **docg3_floors = platform_get_drvdata(pdev);
+ struct mtd_info **docg3_floors = dev_get_drvdata(dev);

floor = attr->attr.name[1] - '0';
if (floor < 0 || floor >= DOC_MAX_NBFLOORS)
--
2.11.0


2018-04-19 14:21:55

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 27/61] media: platform: s5p-mfc: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/media/platform/s5p-mfc/s5p_mfc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index a80251ed3143..9ca707cb2a42 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1449,8 +1449,7 @@ static int s5p_mfc_remove(struct platform_device *pdev)

static int s5p_mfc_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct s5p_mfc_dev *m_dev = platform_get_drvdata(pdev);
+ struct s5p_mfc_dev *m_dev = dev_get_drvdata(dev);
int ret;

if (m_dev->num_inst == 0)
@@ -1484,8 +1483,7 @@ static int s5p_mfc_suspend(struct device *dev)

static int s5p_mfc_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct s5p_mfc_dev *m_dev = platform_get_drvdata(pdev);
+ struct s5p_mfc_dev *m_dev = dev_get_drvdata(dev);

if (m_dev->num_inst == 0)
return 0;
--
2.11.0


2018-04-19 14:22:18

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 28/61] mmc: host: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/mmc/host/davinci_mmc.c | 6 ++----
drivers/mmc/host/sdhci-of-arasan.c | 6 ++----
drivers/mmc/host/wmt-sdmmc.c | 6 ++----
3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 8e363174f9d6..9e68c3645e22 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1377,8 +1377,7 @@ static int __exit davinci_mmcsd_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
static int davinci_mmcsd_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct mmc_davinci_host *host = platform_get_drvdata(pdev);
+ struct mmc_davinci_host *host = dev_get_drvdata(dev);

writel(0, host->base + DAVINCI_MMCIM);
mmc_davinci_reset_ctrl(host, 1);
@@ -1389,8 +1388,7 @@ static int davinci_mmcsd_suspend(struct device *dev)

static int davinci_mmcsd_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct mmc_davinci_host *host = platform_get_drvdata(pdev);
+ struct mmc_davinci_host *host = dev_get_drvdata(dev);

clk_enable(host->clk);
mmc_davinci_reset_ctrl(host, 0);
diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index c33a5f7393bd..bed3612247b0 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -359,8 +359,7 @@ static const struct sdhci_pltfm_data sdhci_arasan_cqe_pdata = {
*/
static int sdhci_arasan_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct sdhci_host *host = platform_get_drvdata(pdev);
+ struct sdhci_host *host = dev_get_drvdata(dev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
int ret;
@@ -403,8 +402,7 @@ static int sdhci_arasan_suspend(struct device *dev)
*/
static int sdhci_arasan_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct sdhci_host *host = platform_get_drvdata(pdev);
+ struct sdhci_host *host = dev_get_drvdata(dev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
int ret;
diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
index fd30ac7da5e5..3ba42f508014 100644
--- a/drivers/mmc/host/wmt-sdmmc.c
+++ b/drivers/mmc/host/wmt-sdmmc.c
@@ -928,8 +928,7 @@ static int wmt_mci_remove(struct platform_device *pdev)
static int wmt_mci_suspend(struct device *dev)
{
u32 reg_tmp;
- struct platform_device *pdev = to_platform_device(dev);
- struct mmc_host *mmc = platform_get_drvdata(pdev);
+ struct mmc_host *mmc = dev_get_drvdata(dev);
struct wmt_mci_priv *priv;

if (!mmc)
@@ -953,8 +952,7 @@ static int wmt_mci_suspend(struct device *dev)
static int wmt_mci_resume(struct device *dev)
{
u32 reg_tmp;
- struct platform_device *pdev = to_platform_device(dev);
- struct mmc_host *mmc = platform_get_drvdata(pdev);
+ struct mmc_host *mmc = dev_get_drvdata(dev);
struct wmt_mci_priv *priv;

if (mmc) {
--
2.11.0


2018-04-19 14:22:34

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 26/61] media: platform: exynos4-is: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/media/platform/exynos4-is/media-dev.c | 6 ++----
drivers/media/platform/exynos4-is/mipi-csis.c | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index 78b48a1fa26c..deb499f76412 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -1201,8 +1201,7 @@ static const struct media_device_ops fimc_md_ops = {
static ssize_t fimc_md_sysfs_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct fimc_md *fmd = platform_get_drvdata(pdev);
+ struct fimc_md *fmd = dev_get_drvdata(dev);

if (fmd->user_subdev_api)
return strlcpy(buf, "Sub-device API (sub-dev)\n", PAGE_SIZE);
@@ -1214,8 +1213,7 @@ static ssize_t fimc_md_sysfs_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct fimc_md *fmd = platform_get_drvdata(pdev);
+ struct fimc_md *fmd = dev_get_drvdata(dev);
bool subdev_api;
int i;

diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c
index cba46a656338..b4e28a299e26 100644
--- a/drivers/media/platform/exynos4-is/mipi-csis.c
+++ b/drivers/media/platform/exynos4-is/mipi-csis.c
@@ -891,8 +891,7 @@ static int s5pcsis_probe(struct platform_device *pdev)

static int s5pcsis_pm_suspend(struct device *dev, bool runtime)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct v4l2_subdev *sd = platform_get_drvdata(pdev);
+ struct v4l2_subdev *sd = dev_get_drvdata(dev);
struct csis_state *state = sd_to_csis_state(sd);
int ret = 0;

@@ -921,8 +920,7 @@ static int s5pcsis_pm_suspend(struct device *dev, bool runtime)

static int s5pcsis_pm_resume(struct device *dev, bool runtime)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct v4l2_subdev *sd = platform_get_drvdata(pdev);
+ struct v4l2_subdev *sd = dev_get_drvdata(dev);
struct csis_state *state = sd_to_csis_state(sd);
int ret = 0;

--
2.11.0


2018-04-19 14:22:59

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 25/61] media: platform: am437x: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/media/platform/am437x/am437x-vpfe.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c
index 601ae6487617..58ebc2220d0e 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -2662,8 +2662,7 @@ static void vpfe_save_context(struct vpfe_ccdc *ccdc)

static int vpfe_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct vpfe_device *vpfe = platform_get_drvdata(pdev);
+ struct vpfe_device *vpfe = dev_get_drvdata(dev);
struct vpfe_ccdc *ccdc = &vpfe->ccdc;

/* if streaming has not started we don't care */
@@ -2720,8 +2719,7 @@ static void vpfe_restore_context(struct vpfe_ccdc *ccdc)

static int vpfe_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct vpfe_device *vpfe = platform_get_drvdata(pdev);
+ struct vpfe_device *vpfe = dev_get_drvdata(dev);
struct vpfe_ccdc *ccdc = &vpfe->ccdc;

/* if streaming has not started we don't care */
--
2.11.0


2018-04-19 14:23:20

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 20/61] input: keyboard: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

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 ++++------
12 files changed, 42 insertions(+), 68 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/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
index 25d61d8d4fc4..56328ced81e2 100644
--- a/drivers/input/keyboard/imx_keypad.c
+++ b/drivers/input/keyboard/imx_keypad.c
@@ -532,8 +532,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 */
@@ -544,7 +543,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;
@@ -552,12 +551,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 41614c185918..73ca55e4babe 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 940d38b08e6b..13578b884ace 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -422,11 +422,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;
@@ -437,10 +436,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 316414465c77..27790a8a44f5 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 53c768b95939..f439f7bd2f5f 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -180,10 +180,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;
@@ -191,10 +190,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 babcfb165e4f..3b4727e4b411 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.11.0


2018-04-19 14:23:29

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 21/61] input: misc: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

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 +--
6 files changed, 9 insertions(+), 18 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/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/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/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.11.0


2018-04-19 14:24:58

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 14/61] gpu: drm: msm: dsi: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/gpu/drm/msm/dsi/dsi_host.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 7a03a9489708..10ed20736072 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -471,8 +471,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);

@@ -486,8 +485,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);

--
2.11.0


2018-04-19 14:25:02

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 24/61] iommu: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/iommu/qcom_iommu.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c
index 65b9c99707f8..fe88a4880d3a 100644
--- a/drivers/iommu/qcom_iommu.c
+++ b/drivers/iommu/qcom_iommu.c
@@ -885,16 +885,14 @@ static int qcom_iommu_device_remove(struct platform_device *pdev)

static int __maybe_unused qcom_iommu_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct qcom_iommu_dev *qcom_iommu = platform_get_drvdata(pdev);
+ struct qcom_iommu_dev *qcom_iommu = dev_get_drvdata(dev);

return qcom_iommu_enable_clocks(qcom_iommu);
}

static int __maybe_unused qcom_iommu_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct qcom_iommu_dev *qcom_iommu = platform_get_drvdata(pdev);
+ struct qcom_iommu_dev *qcom_iommu = dev_get_drvdata(dev);

qcom_iommu_disable_clocks(qcom_iommu);

--
2.11.0


2018-04-19 14:25:03

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 15/61] gpu: drm: omapdrm: displays: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/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 428de90fced1..8f8573a00e07 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -412,8 +412,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 *in = ddata->in;
u8 errors = 0;
int r;
@@ -444,8 +443,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 *in = ddata->in;
u8 id1, id2, id3;
int r;
@@ -476,8 +474,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 *in = ddata->in;
unsigned long t;
int r;
@@ -511,8 +508,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);
@@ -526,8 +522,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 *in = ddata->in;
unsigned long t;
int r;
@@ -558,8 +553,7 @@ static ssize_t dsicm_show_ulps_timeout(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct panel_drv_data *ddata = platform_get_drvdata(pdev);
+ struct panel_drv_data *ddata = dev_get_drvdata(dev);
unsigned int t;

mutex_lock(&ddata->lock);
--
2.11.0


2018-04-19 14:25:03

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 04/61] bus: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/bus/brcmstb_gisb.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c
index 68ac3e93b600..f58ff67e97ac 100644
--- a/drivers/bus/brcmstb_gisb.c
+++ b/drivers/bus/brcmstb_gisb.c
@@ -150,8 +150,7 @@ static ssize_t gisb_arb_get_timeout(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct brcmstb_gisb_arb_device *gdev = platform_get_drvdata(pdev);
+ struct brcmstb_gisb_arb_device *gdev = dev_get_drvdata(dev);
u32 timeout;

mutex_lock(&gdev->lock);
@@ -165,8 +164,7 @@ static ssize_t gisb_arb_set_timeout(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct brcmstb_gisb_arb_device *gdev = platform_get_drvdata(pdev);
+ struct brcmstb_gisb_arb_device *gdev = dev_get_drvdata(dev);
int val, ret;

ret = kstrtoint(buf, 10, &val);
@@ -418,8 +416,7 @@ static int __init brcmstb_gisb_arb_probe(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int brcmstb_gisb_arb_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct brcmstb_gisb_arb_device *gdev = platform_get_drvdata(pdev);
+ struct brcmstb_gisb_arb_device *gdev = dev_get_drvdata(dev);

gdev->saved_timeout = gisb_read(gdev, ARB_TIMER);

@@ -431,8 +428,7 @@ static int brcmstb_gisb_arb_suspend(struct device *dev)
*/
static int brcmstb_gisb_arb_resume_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct brcmstb_gisb_arb_device *gdev = platform_get_drvdata(pdev);
+ struct brcmstb_gisb_arb_device *gdev = dev_get_drvdata(dev);

gisb_write(gdev, gdev->saved_timeout, ARB_TIMER);

--
2.11.0


2018-04-19 14:25:20

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 13/61] gpu: drm: msm: disp: mdp5: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 6d8e3a9a6fc0..d50927f00c6f 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -1014,8 +1014,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("");

@@ -1024,8 +1023,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("");

--
2.11.0


2018-04-19 14:25:25

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 01/61] ARM: plat-samsung: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

arch/arm/plat-samsung/adc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 42bac8d5ab5d..2da35735fa38 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -413,8 +413,7 @@ static int s3c_adc_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
static int s3c_adc_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct adc_device *adc = platform_get_drvdata(pdev);
+ struct adc_device *adc = dev_get_drvdata(dev);
unsigned long flags;
u32 con;

--
2.11.0


2018-04-19 14:25:31

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 16/61] gpu: drm: vc4: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/gpu/drm/vc4/vc4_drv.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 94b99c90425a..af9515ae0e0a 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -318,8 +318,7 @@ static int vc4_drm_bind(struct device *dev)

static void vc4_drm_unbind(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct drm_device *drm = platform_get_drvdata(pdev);
+ struct drm_device *drm = dev_get_drvdata(dev);

drm_dev_unregister(drm);

--
2.11.0


2018-04-19 14:25:47

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 10/61] gpio: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

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 ++----
5 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 226977f78482..caaabb79e31f 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -732,8 +732,7 @@ static int dwapb_gpio_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int dwapb_gpio_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct dwapb_gpio *gpio = platform_get_drvdata(pdev);
+ struct dwapb_gpio *gpio = dev_get_drvdata(dev);
struct gpio_chip *gc = &gpio->ports[0].gc;
unsigned long flags;
int i;
@@ -777,8 +776,7 @@ static int dwapb_gpio_suspend(struct device *dev)

static int dwapb_gpio_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct dwapb_gpio *gpio = platform_get_drvdata(pdev);
+ struct dwapb_gpio *gpio = dev_get_drvdata(dev);
struct gpio_chip *gc = &gpio->ports[0].gc;
unsigned long flags;
int i;
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
index 1e557b10d73e..55fa33b7209f 100644
--- a/drivers/gpio/gpio-lynxpoint.c
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -408,8 +408,7 @@ static int lp_gpio_runtime_resume(struct device *dev)

static int lp_gpio_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct lp_gpio *lg = platform_get_drvdata(pdev);
+ struct lp_gpio *lg = dev_get_drvdata(dev);
unsigned long reg;
int i;

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 35971a341c40..b4f8a048a2a1 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -856,8 +856,7 @@ static void omap_gpio_unmask_irq(struct irq_data *d)

static int omap_mpuio_suspend_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct gpio_bank *bank = platform_get_drvdata(pdev);
+ struct gpio_bank *bank = dev_get_drvdata(dev);
void __iomem *mask_reg = bank->base +
OMAP_MPUIO_GPIO_MASKIT / bank->stride;
unsigned long flags;
@@ -871,8 +870,7 @@ static int omap_mpuio_suspend_noirq(struct device *dev)

static int omap_mpuio_resume_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct gpio_bank *bank = platform_get_drvdata(pdev);
+ struct gpio_bank *bank = dev_get_drvdata(dev);
void __iomem *mask_reg = bank->base +
OMAP_MPUIO_GPIO_MASKIT / bank->stride;
unsigned long flags;
@@ -1284,8 +1282,7 @@ static void omap_gpio_restore_context(struct gpio_bank *bank);

static int omap_gpio_runtime_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct gpio_bank *bank = platform_get_drvdata(pdev);
+ struct gpio_bank *bank = dev_get_drvdata(dev);
u32 l1 = 0, l2 = 0;
unsigned long flags;
u32 wake_low, wake_hi;
@@ -1352,8 +1349,7 @@ static void omap_gpio_init_context(struct gpio_bank *p);

static int omap_gpio_runtime_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct gpio_bank *bank = platform_get_drvdata(pdev);
+ struct gpio_bank *bank = dev_get_drvdata(dev);
u32 l = 0, gen, gen0, gen1;
unsigned long flags;
int c;
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 94396caaca75..04c963f03b68 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -403,8 +403,7 @@ static void tegra_gpio_irq_handler(struct irq_desc *desc)
#ifdef CONFIG_PM_SLEEP
static int tegra_gpio_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct tegra_gpio_info *tgi = platform_get_drvdata(pdev);
+ struct tegra_gpio_info *tgi = dev_get_drvdata(dev);
unsigned long flags;
unsigned int b, p;

@@ -443,8 +442,7 @@ static int tegra_gpio_resume(struct device *dev)

static int tegra_gpio_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct tegra_gpio_info *tgi = platform_get_drvdata(pdev);
+ struct tegra_gpio_info *tgi = dev_get_drvdata(dev);
unsigned long flags;
unsigned int b, p;

diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
index 75ee877e5cd5..49534241bb1e 100644
--- a/drivers/gpio/gpio-zynq.c
+++ b/drivers/gpio/gpio-zynq.c
@@ -697,8 +697,7 @@ static int __maybe_unused zynq_gpio_resume(struct device *dev)

static int __maybe_unused zynq_gpio_runtime_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct zynq_gpio *gpio = platform_get_drvdata(pdev);
+ struct zynq_gpio *gpio = dev_get_drvdata(dev);

clk_disable_unprepare(gpio->clk);

@@ -707,8 +706,7 @@ static int __maybe_unused zynq_gpio_runtime_suspend(struct device *dev)

static int __maybe_unused zynq_gpio_runtime_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct zynq_gpio *gpio = platform_get_drvdata(pdev);
+ struct zynq_gpio *gpio = dev_get_drvdata(dev);

return clk_prepare_enable(gpio->clk);
}
--
2.11.0


2018-04-19 14:25:52

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 12/61] gpu: drm: msm: adreno: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/gpu/drm/msm/adreno/adreno_device.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 8e0cb161754b..125c115c7ab4 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -301,16 +301,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);
}
--
2.11.0


2018-04-19 14:26:30

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 11/61] gpu: drm: msm: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/gpu/drm/msm/msm_drv.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 30cd514d8f7c..5fdd6cf6bf42 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -203,8 +203,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_vblank_ctrl *vbl_ctrl = &priv->vblank_ctrl;
--
2.11.0


2018-04-19 14:27:24

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 09/61] dmaengine: qcom: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/dma/qcom/hidma.c | 3 +--
drivers/dma/qcom/hidma_mgmt_sys.c | 6 ++----
2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c
index 963cc5228d05..43d4b00b8138 100644
--- a/drivers/dma/qcom/hidma.c
+++ b/drivers/dma/qcom/hidma.c
@@ -616,8 +616,7 @@ static irqreturn_t hidma_chirq_handler_msi(int chirq, void *arg)
static ssize_t hidma_show_values(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct hidma_dev *mdev = platform_get_drvdata(pdev);
+ struct hidma_dev *mdev = dev_get_drvdata(dev);

buf[0] = 0;

diff --git a/drivers/dma/qcom/hidma_mgmt_sys.c b/drivers/dma/qcom/hidma_mgmt_sys.c
index d61f1068a34b..cbb89eafd844 100644
--- a/drivers/dma/qcom/hidma_mgmt_sys.c
+++ b/drivers/dma/qcom/hidma_mgmt_sys.c
@@ -107,8 +107,7 @@ static struct hidma_mgmt_fileinfo hidma_mgmt_files[] = {
static ssize_t show_values(struct device *dev, struct device_attribute *attr,
char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct hidma_mgmt_dev *mdev = platform_get_drvdata(pdev);
+ struct hidma_mgmt_dev *mdev = dev_get_drvdata(dev);
unsigned int i;

buf[0] = 0;
@@ -125,8 +124,7 @@ static ssize_t show_values(struct device *dev, struct device_attribute *attr,
static ssize_t set_values(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct hidma_mgmt_dev *mdev = platform_get_drvdata(pdev);
+ struct hidma_mgmt_dev *mdev = dev_get_drvdata(dev);
unsigned long tmp;
unsigned int i;
int rc;
--
2.11.0


2018-04-19 14:27:40

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 02/61] ata: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/ata/pata_samsung_cf.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c
index bb96dc35950d..00602988bee9 100644
--- a/drivers/ata/pata_samsung_cf.c
+++ b/drivers/ata/pata_samsung_cf.c
@@ -608,17 +608,15 @@ static int __exit pata_s3c_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int pata_s3c_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ata_host *host = platform_get_drvdata(pdev);
+ struct ata_host *host = dev_get_drvdata(dev);

return ata_host_suspend(host, PMSG_SUSPEND);
}

static int pata_s3c_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ata_host *host = platform_get_drvdata(pdev);
- struct s3c_ide_platdata *pdata = dev_get_platdata(&pdev->dev);
+ struct ata_host *host = dev_get_drvdata(dev);
+ struct s3c_ide_platdata *pdata = dev_get_platdata(dev);
struct s3c_ide_info *info = host->private_data;

pata_s3c_hwinit(info, pdata);
--
2.11.0


2018-04-19 14:27:49

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 08/61] dmaengine: dw: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/dma/dw/platform.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index bc31fe802061..f62dd0944908 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -293,8 +293,7 @@ MODULE_DEVICE_TABLE(acpi, dw_dma_acpi_id_table);

static int dw_suspend_late(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct dw_dma_chip *chip = platform_get_drvdata(pdev);
+ struct dw_dma_chip *chip = dev_get_drvdata(dev);

dw_dma_disable(chip);
clk_disable_unprepare(chip->clk);
@@ -304,8 +303,7 @@ static int dw_suspend_late(struct device *dev)

static int dw_resume_early(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct dw_dma_chip *chip = platform_get_drvdata(pdev);
+ struct dw_dma_chip *chip = dev_get_drvdata(dev);
int ret;

ret = clk_prepare_enable(chip->clk);
--
2.11.0


2018-04-19 14:27:52

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 07/61] dma: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/dma/at_hdmac.c | 9 +++------
drivers/dma/at_xdmac.c | 9 +++------
drivers/dma/fsldma.c | 6 ++----
drivers/dma/idma64.c | 6 ++----
drivers/dma/ste_dma40.c | 12 ++++--------
drivers/dma/txx9dmac.c | 8 +++-----
6 files changed, 17 insertions(+), 33 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index a861b5b4d443..75f38d19fcbe 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -2041,8 +2041,7 @@ static void at_dma_shutdown(struct platform_device *pdev)

static int at_dma_prepare(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_dma *atdma = platform_get_drvdata(pdev);
+ struct at_dma *atdma = dev_get_drvdata(dev);
struct dma_chan *chan, *_chan;

list_for_each_entry_safe(chan, _chan, &atdma->dma_common.channels,
@@ -2076,8 +2075,7 @@ static void atc_suspend_cyclic(struct at_dma_chan *atchan)

static int at_dma_suspend_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_dma *atdma = platform_get_drvdata(pdev);
+ struct at_dma *atdma = dev_get_drvdata(dev);
struct dma_chan *chan, *_chan;

/* preserve data */
@@ -2118,8 +2116,7 @@ static void atc_resume_cyclic(struct at_dma_chan *atchan)

static int at_dma_resume_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_dma *atdma = platform_get_drvdata(pdev);
+ struct at_dma *atdma = dev_get_drvdata(dev);
struct dma_chan *chan, *_chan;

/* bring back DMA controller */
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index 94236ec9d410..4bf72561667c 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -1833,8 +1833,7 @@ static void at_xdmac_free_chan_resources(struct dma_chan *chan)
#ifdef CONFIG_PM
static int atmel_xdmac_prepare(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_xdmac *atxdmac = platform_get_drvdata(pdev);
+ struct at_xdmac *atxdmac = dev_get_drvdata(dev);
struct dma_chan *chan, *_chan;

list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) {
@@ -1853,8 +1852,7 @@ static int atmel_xdmac_prepare(struct device *dev)
#ifdef CONFIG_PM_SLEEP
static int atmel_xdmac_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_xdmac *atxdmac = platform_get_drvdata(pdev);
+ struct at_xdmac *atxdmac = dev_get_drvdata(dev);
struct dma_chan *chan, *_chan;

list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) {
@@ -1878,8 +1876,7 @@ static int atmel_xdmac_suspend(struct device *dev)

static int atmel_xdmac_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_xdmac *atxdmac = platform_get_drvdata(pdev);
+ struct at_xdmac *atxdmac = dev_get_drvdata(dev);
struct at_xdmac_chan *atchan;
struct dma_chan *chan, *_chan;
int i;
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 3eaece888e75..1117b5123a6f 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1328,8 +1328,7 @@ static int fsldma_of_remove(struct platform_device *op)
#ifdef CONFIG_PM
static int fsldma_suspend_late(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct fsldma_device *fdev = platform_get_drvdata(pdev);
+ struct fsldma_device *fdev = dev_get_drvdata(dev);
struct fsldma_chan *chan;
int i;

@@ -1360,8 +1359,7 @@ static int fsldma_suspend_late(struct device *dev)

static int fsldma_resume_early(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct fsldma_device *fdev = platform_get_drvdata(pdev);
+ struct fsldma_device *fdev = dev_get_drvdata(dev);
struct fsldma_chan *chan;
u32 mode;
int i;
diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c
index 1953e57505f4..e5c911200bdb 100644
--- a/drivers/dma/idma64.c
+++ b/drivers/dma/idma64.c
@@ -670,8 +670,7 @@ static int idma64_platform_remove(struct platform_device *pdev)

static int idma64_pm_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct idma64_chip *chip = platform_get_drvdata(pdev);
+ struct idma64_chip *chip = dev_get_drvdata(dev);

idma64_off(chip->idma64);
return 0;
@@ -679,8 +678,7 @@ static int idma64_pm_suspend(struct device *dev)

static int idma64_pm_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct idma64_chip *chip = platform_get_drvdata(pdev);
+ struct idma64_chip *chip = dev_get_drvdata(dev);

idma64_on(chip->idma64);
return 0;
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index c2b089af0420..1bc149af990e 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -2889,8 +2889,7 @@ static int __init d40_dmaengine_init(struct d40_base *base,
#ifdef CONFIG_PM_SLEEP
static int dma40_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct d40_base *base = platform_get_drvdata(pdev);
+ struct d40_base *base = dev_get_drvdata(dev);
int ret;

ret = pm_runtime_force_suspend(dev);
@@ -2904,8 +2903,7 @@ static int dma40_suspend(struct device *dev)

static int dma40_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct d40_base *base = platform_get_drvdata(pdev);
+ struct d40_base *base = dev_get_drvdata(dev);
int ret = 0;

if (base->lcpa_regulator) {
@@ -2970,8 +2968,7 @@ static void d40_save_restore_registers(struct d40_base *base, bool save)

static int dma40_runtime_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct d40_base *base = platform_get_drvdata(pdev);
+ struct d40_base *base = dev_get_drvdata(dev);

d40_save_restore_registers(base, true);

@@ -2985,8 +2982,7 @@ static int dma40_runtime_suspend(struct device *dev)

static int dma40_runtime_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct d40_base *base = platform_get_drvdata(pdev);
+ struct d40_base *base = dev_get_drvdata(dev);

d40_save_restore_registers(base, false);

diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c
index 4d8c7b9078fd..eb45af71d3a3 100644
--- a/drivers/dma/txx9dmac.c
+++ b/drivers/dma/txx9dmac.c
@@ -1244,8 +1244,7 @@ static void txx9dmac_shutdown(struct platform_device *pdev)

static int txx9dmac_suspend_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct txx9dmac_dev *ddev = platform_get_drvdata(pdev);
+ struct txx9dmac_dev *ddev = dev_get_drvdata(dev);

txx9dmac_off(ddev);
return 0;
@@ -1253,9 +1252,8 @@ static int txx9dmac_suspend_noirq(struct device *dev)

static int txx9dmac_resume_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct txx9dmac_dev *ddev = platform_get_drvdata(pdev);
- struct txx9dmac_platform_data *pdata = dev_get_platdata(&pdev->dev);
+ struct txx9dmac_dev *ddev = dev_get_drvdata(dev);
+ struct txx9dmac_platform_data *pdata = dev_get_platdata(dev);
u32 mcr;

mcr = TXX9_DMA_MCR_MSTEN | MCR_LE;
--
2.11.0


2018-04-19 14:28:31

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 05/61] clk: samsung: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/clk/samsung/clk-s3c2410-dclk.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/samsung/clk-s3c2410-dclk.c b/drivers/clk/samsung/clk-s3c2410-dclk.c
index 077df3e539a7..f41d89cef0f1 100644
--- a/drivers/clk/samsung/clk-s3c2410-dclk.c
+++ b/drivers/clk/samsung/clk-s3c2410-dclk.c
@@ -219,8 +219,7 @@ static int s3c24xx_dclk1_div_notify(struct notifier_block *nb,
#ifdef CONFIG_PM_SLEEP
static int s3c24xx_dclk_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct s3c24xx_dclk *s3c24xx_dclk = platform_get_drvdata(pdev);
+ struct s3c24xx_dclk *s3c24xx_dclk = dev_get_drvdata(dev);

s3c24xx_dclk->reg_save = readl_relaxed(s3c24xx_dclk->base);
return 0;
@@ -228,8 +227,7 @@ static int s3c24xx_dclk_suspend(struct device *dev)

static int s3c24xx_dclk_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct s3c24xx_dclk *s3c24xx_dclk = platform_get_drvdata(pdev);
+ struct s3c24xx_dclk *s3c24xx_dclk = dev_get_drvdata(dev);

writel_relaxed(s3c24xx_dclk->reg_save, s3c24xx_dclk->base);
return 0;
--
2.11.0


2018-04-19 14:28:42

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 06/61] crypto: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/crypto/exynos-rng.c | 6 ++----
drivers/crypto/picoxcell_crypto.c | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/crypto/exynos-rng.c b/drivers/crypto/exynos-rng.c
index 86f5f459762e..2cfabb99cb6e 100644
--- a/drivers/crypto/exynos-rng.c
+++ b/drivers/crypto/exynos-rng.c
@@ -319,8 +319,7 @@ static int exynos_rng_remove(struct platform_device *pdev)

static int __maybe_unused exynos_rng_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct exynos_rng_dev *rng = platform_get_drvdata(pdev);
+ struct exynos_rng_dev *rng = dev_get_drvdata(dev);
int ret;

/* If we were never seeded then after resume it will be the same */
@@ -350,8 +349,7 @@ static int __maybe_unused exynos_rng_suspend(struct device *dev)

static int __maybe_unused exynos_rng_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct exynos_rng_dev *rng = platform_get_drvdata(pdev);
+ struct exynos_rng_dev *rng = dev_get_drvdata(dev);
int ret;

/* Never seeded so nothing to do */
diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c
index a4df966adbf6..321d5e2ac833 100644
--- a/drivers/crypto/picoxcell_crypto.c
+++ b/drivers/crypto/picoxcell_crypto.c
@@ -1169,8 +1169,7 @@ static void spacc_spacc_complete(unsigned long data)
#ifdef CONFIG_PM
static int spacc_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct spacc_engine *engine = platform_get_drvdata(pdev);
+ struct spacc_engine *engine = dev_get_drvdata(dev);

/*
* We only support standby mode. All we have to do is gate the clock to
@@ -1184,8 +1183,7 @@ static int spacc_suspend(struct device *dev)

static int spacc_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct spacc_engine *engine = platform_get_drvdata(pdev);
+ struct spacc_engine *engine = dev_get_drvdata(dev);

return clk_enable(engine->clk);
}
--
2.11.0


2018-04-19 14:30:08

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 03/61] auxdisplay: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/auxdisplay/arm-charlcd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/auxdisplay/arm-charlcd.c b/drivers/auxdisplay/arm-charlcd.c
index b3176ee92b90..26246ab7a066 100644
--- a/drivers/auxdisplay/arm-charlcd.c
+++ b/drivers/auxdisplay/arm-charlcd.c
@@ -329,8 +329,7 @@ static int __init charlcd_probe(struct platform_device *pdev)

static int charlcd_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct charlcd *lcd = platform_get_drvdata(pdev);
+ struct charlcd *lcd = dev_get_drvdata(dev);

/* Power the display off */
charlcd_4bit_command(lcd, HD_DISPCTRL);
@@ -339,8 +338,7 @@ static int charlcd_suspend(struct device *dev)

static int charlcd_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct charlcd *lcd = platform_get_drvdata(pdev);
+ struct charlcd *lcd = dev_get_drvdata(dev);

/* Turn the display back on */
charlcd_4bit_command(lcd, HD_DISPCTRL | HD_DISPCTRL_ON);
--
2.11.0


2018-04-19 14:36:10

by Miguel Ojeda

[permalink] [raw]
Subject: Re: [PATCH 03/61] auxdisplay: simplify getting .drvdata

[CC'ing Linus W.]

On Thu, Apr 19, 2018 at 4:05 PM, Wolfram Sang
<[email protected]> 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 <[email protected]>

Seems fine and other drivers in platform/ also call dev_get_drvdata
directly for this.

If Linus does not have anything against it, I will put it in my queue.

Thanks,
Miguel

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/auxdisplay/arm-charlcd.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/auxdisplay/arm-charlcd.c b/drivers/auxdisplay/arm-charlcd.c
> index b3176ee92b90..26246ab7a066 100644
> --- a/drivers/auxdisplay/arm-charlcd.c
> +++ b/drivers/auxdisplay/arm-charlcd.c
> @@ -329,8 +329,7 @@ static int __init charlcd_probe(struct platform_device *pdev)
>
> static int charlcd_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct charlcd *lcd = platform_get_drvdata(pdev);
> + struct charlcd *lcd = dev_get_drvdata(dev);
>
> /* Power the display off */
> charlcd_4bit_command(lcd, HD_DISPCTRL);
> @@ -339,8 +338,7 @@ static int charlcd_suspend(struct device *dev)
>
> static int charlcd_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct charlcd *lcd = platform_get_drvdata(pdev);
> + struct charlcd *lcd = dev_get_drvdata(dev);
>
> /* Turn the display back on */
> charlcd_4bit_command(lcd, HD_DISPCTRL | HD_DISPCTRL_ON);
> --
> 2.11.0
>

2018-04-19 14:48:32

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 46/61] spi: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
---

Build tested only. buildbot is happy. Please apply individually.

drivers/spi/spi-cadence.c | 6 ++----
drivers/spi/spi-zynqmp-gqspi.c | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
index 5c9516ae4942..de394422b611 100644
--- a/drivers/spi/spi-cadence.c
+++ b/drivers/spi/spi-cadence.c
@@ -686,8 +686,7 @@ static int cdns_spi_remove(struct platform_device *pdev)
*/
static int __maybe_unused cdns_spi_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct spi_master *master = platform_get_drvdata(pdev);
+ struct spi_master *master = dev_get_drvdata(dev);

return spi_master_suspend(master);
}
@@ -702,8 +701,7 @@ static int __maybe_unused cdns_spi_suspend(struct device *dev)
*/
static int __maybe_unused cdns_spi_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct spi_master *master = platform_get_drvdata(pdev);
+ struct spi_master *master = dev_get_drvdata(dev);
struct cdns_spi *xspi = spi_master_get_devdata(master);

cdns_spi_init_hw(xspi);
diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c
index 18aeaceee286..3608db4ff368 100644
--- a/drivers/spi/spi-zynqmp-gqspi.c
+++ b/drivers/spi/spi-zynqmp-gqspi.c
@@ -918,8 +918,7 @@ static int zynqmp_qspi_start_transfer(struct spi_master *master,
*/
static int __maybe_unused zynqmp_qspi_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct spi_master *master = platform_get_drvdata(pdev);
+ struct spi_master *master = dev_get_drvdata(dev);

spi_master_suspend(master);

@@ -939,8 +938,7 @@ static int __maybe_unused zynqmp_qspi_suspend(struct device *dev)
*/
static int __maybe_unused zynqmp_qspi_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct spi_master *master = platform_get_drvdata(pdev);
+ struct spi_master *master = dev_get_drvdata(dev);
struct zynqmp_qspi *xqspi = spi_master_get_devdata(master);
int ret = 0;

--
2.11.0


2018-04-19 15:16:22

by Grygorii Strashko

[permalink] [raw]
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata



On 04/19/2018 09:05 AM, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.

for gpio-omap.c:
Reviewed-by: Grygorii Strashko <[email protected]>
>
> 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 ++----
> 5 files changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index 226977f78482..caaabb79e31f 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -732,8 +732,7 @@ static int dwapb_gpio_remove(struct platform_device *pdev)
> #ifdef CONFIG_PM_SLEEP
> static int dwapb_gpio_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct dwapb_gpio *gpio = platform_get_drvdata(pdev);
> + struct dwapb_gpio *gpio = dev_get_drvdata(dev);
> struct gpio_chip *gc = &gpio->ports[0].gc;
> unsigned long flags;
> int i;
> @@ -777,8 +776,7 @@ static int dwapb_gpio_suspend(struct device *dev)
>
> static int dwapb_gpio_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct dwapb_gpio *gpio = platform_get_drvdata(pdev);
> + struct dwapb_gpio *gpio = dev_get_drvdata(dev);
> struct gpio_chip *gc = &gpio->ports[0].gc;
> unsigned long flags;
> int i;
> diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
> index 1e557b10d73e..55fa33b7209f 100644
> --- a/drivers/gpio/gpio-lynxpoint.c
> +++ b/drivers/gpio/gpio-lynxpoint.c
> @@ -408,8 +408,7 @@ static int lp_gpio_runtime_resume(struct device *dev)
>
> static int lp_gpio_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct lp_gpio *lg = platform_get_drvdata(pdev);
> + struct lp_gpio *lg = dev_get_drvdata(dev);
> unsigned long reg;
> int i;
>
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index 35971a341c40..b4f8a048a2a1 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -856,8 +856,7 @@ static void omap_gpio_unmask_irq(struct irq_data *d)
>
> static int omap_mpuio_suspend_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct gpio_bank *bank = platform_get_drvdata(pdev);
> + struct gpio_bank *bank = dev_get_drvdata(dev);
> void __iomem *mask_reg = bank->base +
> OMAP_MPUIO_GPIO_MASKIT / bank->stride;
> unsigned long flags;
> @@ -871,8 +870,7 @@ static int omap_mpuio_suspend_noirq(struct device *dev)
>
> static int omap_mpuio_resume_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct gpio_bank *bank = platform_get_drvdata(pdev);
> + struct gpio_bank *bank = dev_get_drvdata(dev);
> void __iomem *mask_reg = bank->base +
> OMAP_MPUIO_GPIO_MASKIT / bank->stride;
> unsigned long flags;
> @@ -1284,8 +1282,7 @@ static void omap_gpio_restore_context(struct gpio_bank *bank);
>
> static int omap_gpio_runtime_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct gpio_bank *bank = platform_get_drvdata(pdev);
> + struct gpio_bank *bank = dev_get_drvdata(dev);
> u32 l1 = 0, l2 = 0;
> unsigned long flags;
> u32 wake_low, wake_hi;
> @@ -1352,8 +1349,7 @@ static void omap_gpio_init_context(struct gpio_bank *p);
>
> static int omap_gpio_runtime_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct gpio_bank *bank = platform_get_drvdata(pdev);
> + struct gpio_bank *bank = dev_get_drvdata(dev);
> u32 l = 0, gen, gen0, gen1;
> unsigned long flags;
> int c;
> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> index 94396caaca75..04c963f03b68 100644
> --- a/drivers/gpio/gpio-tegra.c
> +++ b/drivers/gpio/gpio-tegra.c
> @@ -403,8 +403,7 @@ static void tegra_gpio_irq_handler(struct irq_desc *desc)
> #ifdef CONFIG_PM_SLEEP
> static int tegra_gpio_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct tegra_gpio_info *tgi = platform_get_drvdata(pdev);
> + struct tegra_gpio_info *tgi = dev_get_drvdata(dev);
> unsigned long flags;
> unsigned int b, p;
>
> @@ -443,8 +442,7 @@ static int tegra_gpio_resume(struct device *dev)
>
> static int tegra_gpio_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct tegra_gpio_info *tgi = platform_get_drvdata(pdev);
> + struct tegra_gpio_info *tgi = dev_get_drvdata(dev);
> unsigned long flags;
> unsigned int b, p;
>
> diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
> index 75ee877e5cd5..49534241bb1e 100644
> --- a/drivers/gpio/gpio-zynq.c
> +++ b/drivers/gpio/gpio-zynq.c
> @@ -697,8 +697,7 @@ static int __maybe_unused zynq_gpio_resume(struct device *dev)
>
> static int __maybe_unused zynq_gpio_runtime_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct zynq_gpio *gpio = platform_get_drvdata(pdev);
> + struct zynq_gpio *gpio = dev_get_drvdata(dev);
>
> clk_disable_unprepare(gpio->clk);
>
> @@ -707,8 +706,7 @@ static int __maybe_unused zynq_gpio_runtime_suspend(struct device *dev)
>
> static int __maybe_unused zynq_gpio_runtime_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct zynq_gpio *gpio = platform_get_drvdata(pdev);
> + struct zynq_gpio *gpio = dev_get_drvdata(dev);
>
> return clk_prepare_enable(gpio->clk);
> }
>

--
regards,
-grygorii

2018-04-19 15:17:25

by Grygorii Strashko

[permalink] [raw]
Subject: Re: [PATCH 35/61] net: ethernet: ti: simplify getting .drvdata



On 04/19/2018 09:06 AM, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.

Reviewed-by: Grygorii Strashko <[email protected]>

--
regards,
-grygorii

2018-04-19 15:19:04

by Sinan Kaya

[permalink] [raw]
Subject: Re: [PATCH 09/61] dmaengine: qcom: simplify getting .drvdata

On 4/19/2018 10:05 AM, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/dma/qcom/hidma.c | 3 +--
> drivers/dma/qcom/hidma_mgmt_sys.c | 6 ++----
> 2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c
> index 963cc5228d05..43d4b00b8138 100644
> --- a/drivers/dma/qcom/hidma.c
> +++ b/drivers/dma/qcom/hidma.c
> @@ -616,8 +616,7 @@ static irqreturn_t hidma_chirq_handler_msi(int chirq, void *arg)
> static ssize_t hidma_show_values(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct hidma_dev *mdev = platform_get_drvdata(pdev);
> + struct hidma_dev *mdev = dev_get_drvdata(dev);
>
> buf[0] = 0;
>
> diff --git a/drivers/dma/qcom/hidma_mgmt_sys.c b/drivers/dma/qcom/hidma_mgmt_sys.c
> index d61f1068a34b..cbb89eafd844 100644
> --- a/drivers/dma/qcom/hidma_mgmt_sys.c
> +++ b/drivers/dma/qcom/hidma_mgmt_sys.c
> @@ -107,8 +107,7 @@ static struct hidma_mgmt_fileinfo hidma_mgmt_files[] = {
> static ssize_t show_values(struct device *dev, struct device_attribute *attr,
> char *buf)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct hidma_mgmt_dev *mdev = platform_get_drvdata(pdev);
> + struct hidma_mgmt_dev *mdev = dev_get_drvdata(dev);
> unsigned int i;
>
> buf[0] = 0;
> @@ -125,8 +124,7 @@ static ssize_t show_values(struct device *dev, struct device_attribute *attr,
> static ssize_t set_values(struct device *dev, struct device_attribute *attr,
> const char *buf, size_t count)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct hidma_mgmt_dev *mdev = platform_get_drvdata(pdev);
> + struct hidma_mgmt_dev *mdev = dev_get_drvdata(dev);
> unsigned long tmp;
> unsigned int i;
> int rc;
>

Reviewed-by: Sinan Kaya <[email protected]>

--
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

2018-04-19 16:24:27

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH 02/61] ata: simplify getting .drvdata

Hello!

On 04/19/2018 05:05 PM, Wolfram Sang wrote:

> We should get drvdata from struct device directly. Going via

Note that the name of the field in the 'struct device' is driver_data,
not drvdata. Otherwise the patch looks good.

> platform_device is an unneeded step back and forth.
>
> Signed-off-by: Wolfram Sang <[email protected]>
[...]

MBR, Sergei

2018-04-19 16:27:03

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH 53/61] tty: serial: simplify getting .drvdata

Hello Wolfram,

On Thu, Apr 19, 2018 at 04:06:23PM +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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/tty/serial/imx.c | 18 ++++++------------

for serial/imx.c:

Acked-by: Uwe Kleine-K?nig <[email protected]>

Thanks Wolfram for going through this
Uwe


--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |

2018-04-19 20:07:53

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 59/61] watchdog: simplify getting .drvdata

On Thu, Apr 19, 2018 at 04:06:29PM +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 <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/watchdog/cadence_wdt.c | 6 ++----
> drivers/watchdog/of_xilinx_wdt.c | 6 ++----
> drivers/watchdog/wdat_wdt.c | 6 ++----
> 3 files changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c
> index 3ec1f418837d..c3924356d173 100644
> --- a/drivers/watchdog/cadence_wdt.c
> +++ b/drivers/watchdog/cadence_wdt.c
> @@ -418,8 +418,7 @@ static void cdns_wdt_shutdown(struct platform_device *pdev)
> */
> static int __maybe_unused cdns_wdt_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct cdns_wdt *wdt = platform_get_drvdata(pdev);
> + struct cdns_wdt *wdt = dev_get_drvdata(dev);
>
> if (watchdog_active(&wdt->cdns_wdt_device)) {
> cdns_wdt_stop(&wdt->cdns_wdt_device);
> @@ -438,8 +437,7 @@ static int __maybe_unused cdns_wdt_suspend(struct device *dev)
> static int __maybe_unused cdns_wdt_resume(struct device *dev)
> {
> int ret;
> - struct platform_device *pdev = to_platform_device(dev);
> - struct cdns_wdt *wdt = platform_get_drvdata(pdev);
> + struct cdns_wdt *wdt = dev_get_drvdata(dev);
>
> if (watchdog_active(&wdt->cdns_wdt_device)) {
> ret = clk_prepare_enable(wdt->clk);
> diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
> index 4acbe05e27bb..d3f7eb046678 100644
> --- a/drivers/watchdog/of_xilinx_wdt.c
> +++ b/drivers/watchdog/of_xilinx_wdt.c
> @@ -268,8 +268,7 @@ static int xwdt_remove(struct platform_device *pdev)
> */
> static int __maybe_unused xwdt_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct xwdt_device *xdev = platform_get_drvdata(pdev);
> + struct xwdt_device *xdev = dev_get_drvdata(dev);
>
> if (watchdog_active(&xdev->xilinx_wdt_wdd))
> xilinx_wdt_stop(&xdev->xilinx_wdt_wdd);
> @@ -285,8 +284,7 @@ static int __maybe_unused xwdt_suspend(struct device *dev)
> */
> static int __maybe_unused xwdt_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct xwdt_device *xdev = platform_get_drvdata(pdev);
> + struct xwdt_device *xdev = dev_get_drvdata(dev);
> int ret = 0;
>
> if (watchdog_active(&xdev->xilinx_wdt_wdd))
> diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
> index 0da9943d405f..56ad19608a9b 100644
> --- a/drivers/watchdog/wdat_wdt.c
> +++ b/drivers/watchdog/wdat_wdt.c
> @@ -447,8 +447,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
> #ifdef CONFIG_PM_SLEEP
> static int wdat_wdt_suspend_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct wdat_wdt *wdat = platform_get_drvdata(pdev);
> + struct wdat_wdt *wdat = dev_get_drvdata(dev);
> int ret;
>
> if (!watchdog_active(&wdat->wdd))
> @@ -475,8 +474,7 @@ static int wdat_wdt_suspend_noirq(struct device *dev)
>
> static int wdat_wdt_resume_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct wdat_wdt *wdat = platform_get_drvdata(pdev);
> + struct wdat_wdt *wdat = dev_get_drvdata(dev);
> int ret;
>
> if (!watchdog_active(&wdat->wdd))
> --
> 2.11.0
>

2018-04-19 22:25:19

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 00/61] tree-wide: simplify getting .drvdata

(Dropping the bazillion lists)

Quoting Wolfram Sang (2018-04-19 07:05:30)
>
> 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
> ...>
>

Can you throw this into scripts/coccinelle/ so we can have the build
testers run this all the time?

2018-04-19 23:58:18

by Darren Hart

[permalink] [raw]
Subject: Re: [PATCH 40/61] platform: x86: simplify getting .drvdata

On Thu, Apr 19, 2018 at 04:06:10PM +0200, Wolfram Sang wrote:
> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.
>

It is indeed, thanks.

> Signed-off-by: Wolfram Sang <[email protected]>

> ---
>
> Build tested only. buildbot is happy. Please apply individually.

Queued up for testing.

(I'm not sure what you mean by "Please apply individually")
--
Darren Hart
VMware Open Source Technology Center

2018-04-20 04:24:02

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH 08/61] dmaengine: dw: simplify getting .drvdata

On 19-04-18, 16:05, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/dma/dw/platform.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)

Acked-by: Viresh Kumar <[email protected]>

--
viresh

2018-04-20 04:25:56

by Viresh Kumar

[permalink] [raw]
Subject: Re: [greybus-dev] [PATCH 47/61] staging: greybus: simplify getting .drvdata

On 19-04-18, 16:06, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/staging/greybus/arche-platform.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Acked-by: Viresh Kumar <[email protected]>

--
viresh

2018-04-20 06:09:08

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 06/61] crypto: simplify getting .drvdata

On Thu, Apr 19, 2018 at 4:05 PM, Wolfram Sang
<[email protected]> 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/crypto/exynos-rng.c | 6 ++----
> drivers/crypto/picoxcell_crypto.c | 6 ++----
> 2 files changed, 4 insertions(+), 8 deletions(-)

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2018-04-20 07:11:48

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH 28/61] mmc: host: simplify getting .drvdata

On 19 April 2018 at 16:05, Wolfram Sang
<[email protected]> 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 <[email protected]>

Thanks, applied for next!

Kind regards
Uffe

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/mmc/host/davinci_mmc.c | 6 ++----
> drivers/mmc/host/sdhci-of-arasan.c | 6 ++----
> drivers/mmc/host/wmt-sdmmc.c | 6 ++----
> 3 files changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index 8e363174f9d6..9e68c3645e22 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -1377,8 +1377,7 @@ static int __exit davinci_mmcsd_remove(struct platform_device *pdev)
> #ifdef CONFIG_PM
> static int davinci_mmcsd_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct mmc_davinci_host *host = platform_get_drvdata(pdev);
> + struct mmc_davinci_host *host = dev_get_drvdata(dev);
>
> writel(0, host->base + DAVINCI_MMCIM);
> mmc_davinci_reset_ctrl(host, 1);
> @@ -1389,8 +1388,7 @@ static int davinci_mmcsd_suspend(struct device *dev)
>
> static int davinci_mmcsd_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct mmc_davinci_host *host = platform_get_drvdata(pdev);
> + struct mmc_davinci_host *host = dev_get_drvdata(dev);
>
> clk_enable(host->clk);
> mmc_davinci_reset_ctrl(host, 0);
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index c33a5f7393bd..bed3612247b0 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -359,8 +359,7 @@ static const struct sdhci_pltfm_data sdhci_arasan_cqe_pdata = {
> */
> static int sdhci_arasan_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct sdhci_host *host = platform_get_drvdata(pdev);
> + struct sdhci_host *host = dev_get_drvdata(dev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
> int ret;
> @@ -403,8 +402,7 @@ static int sdhci_arasan_suspend(struct device *dev)
> */
> static int sdhci_arasan_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct sdhci_host *host = platform_get_drvdata(pdev);
> + struct sdhci_host *host = dev_get_drvdata(dev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
> int ret;
> diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
> index fd30ac7da5e5..3ba42f508014 100644
> --- a/drivers/mmc/host/wmt-sdmmc.c
> +++ b/drivers/mmc/host/wmt-sdmmc.c
> @@ -928,8 +928,7 @@ static int wmt_mci_remove(struct platform_device *pdev)
> static int wmt_mci_suspend(struct device *dev)
> {
> u32 reg_tmp;
> - struct platform_device *pdev = to_platform_device(dev);
> - struct mmc_host *mmc = platform_get_drvdata(pdev);
> + struct mmc_host *mmc = dev_get_drvdata(dev);
> struct wmt_mci_priv *priv;
>
> if (!mmc)
> @@ -953,8 +952,7 @@ static int wmt_mci_suspend(struct device *dev)
> static int wmt_mci_resume(struct device *dev)
> {
> u32 reg_tmp;
> - struct platform_device *pdev = to_platform_device(dev);
> - struct mmc_host *mmc = platform_get_drvdata(pdev);
> + struct mmc_host *mmc = dev_get_drvdata(dev);
> struct wmt_mci_priv *priv;
>
> if (mmc) {
> --
> 2.11.0
>

2018-04-20 07:15:46

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 40/61] platform: x86: simplify getting .drvdata


> (I'm not sure what you mean by "Please apply individually")

Right, that is not very precise. "Individually" as "per subsystem
individually". I.e. I don't want to collect tags and push it upstream as
one huge pull-request.

Thanks!


Attachments:
(No filename) (245.00 B)
signature.asc (849.00 B)
Download all attachments

2018-04-20 07:17:10

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 00/61] tree-wide: simplify getting .drvdata


> Can you throw this into scripts/coccinelle/ so we can have the build
> testers run this all the time?

Sure, I first wanted to check if there were comments regarding the
script.

Thanks!


Attachments:
(No filename) (200.00 B)
signature.asc (849.00 B)
Download all attachments

2018-04-20 07:22:16

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata

Hi Wolfram,

On 19.4.2018 16:05, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> 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 ++----
> 5 files changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index 226977f78482..caaabb79e31f 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -732,8 +732,7 @@ static int dwapb_gpio_remove(struct platform_device *pdev)
> #ifdef CONFIG_PM_SLEEP
> static int dwapb_gpio_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct dwapb_gpio *gpio = platform_get_drvdata(pdev);
> + struct dwapb_gpio *gpio = dev_get_drvdata(dev);
> struct gpio_chip *gc = &gpio->ports[0].gc;
> unsigned long flags;
> int i;
> @@ -777,8 +776,7 @@ static int dwapb_gpio_suspend(struct device *dev)
>
> static int dwapb_gpio_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct dwapb_gpio *gpio = platform_get_drvdata(pdev);
> + struct dwapb_gpio *gpio = dev_get_drvdata(dev);
> struct gpio_chip *gc = &gpio->ports[0].gc;
> unsigned long flags;
> int i;
> diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
> index 1e557b10d73e..55fa33b7209f 100644
> --- a/drivers/gpio/gpio-lynxpoint.c
> +++ b/drivers/gpio/gpio-lynxpoint.c
> @@ -408,8 +408,7 @@ static int lp_gpio_runtime_resume(struct device *dev)
>
> static int lp_gpio_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct lp_gpio *lg = platform_get_drvdata(pdev);
> + struct lp_gpio *lg = dev_get_drvdata(dev);
> unsigned long reg;
> int i;
>
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index 35971a341c40..b4f8a048a2a1 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -856,8 +856,7 @@ static void omap_gpio_unmask_irq(struct irq_data *d)
>
> static int omap_mpuio_suspend_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct gpio_bank *bank = platform_get_drvdata(pdev);
> + struct gpio_bank *bank = dev_get_drvdata(dev);
> void __iomem *mask_reg = bank->base +
> OMAP_MPUIO_GPIO_MASKIT / bank->stride;
> unsigned long flags;
> @@ -871,8 +870,7 @@ static int omap_mpuio_suspend_noirq(struct device *dev)
>
> static int omap_mpuio_resume_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct gpio_bank *bank = platform_get_drvdata(pdev);
> + struct gpio_bank *bank = dev_get_drvdata(dev);
> void __iomem *mask_reg = bank->base +
> OMAP_MPUIO_GPIO_MASKIT / bank->stride;
> unsigned long flags;
> @@ -1284,8 +1282,7 @@ static void omap_gpio_restore_context(struct gpio_bank *bank);
>
> static int omap_gpio_runtime_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct gpio_bank *bank = platform_get_drvdata(pdev);
> + struct gpio_bank *bank = dev_get_drvdata(dev);
> u32 l1 = 0, l2 = 0;
> unsigned long flags;
> u32 wake_low, wake_hi;
> @@ -1352,8 +1349,7 @@ static void omap_gpio_init_context(struct gpio_bank *p);
>
> static int omap_gpio_runtime_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct gpio_bank *bank = platform_get_drvdata(pdev);
> + struct gpio_bank *bank = dev_get_drvdata(dev);
> u32 l = 0, gen, gen0, gen1;
> unsigned long flags;
> int c;
> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> index 94396caaca75..04c963f03b68 100644
> --- a/drivers/gpio/gpio-tegra.c
> +++ b/drivers/gpio/gpio-tegra.c
> @@ -403,8 +403,7 @@ static void tegra_gpio_irq_handler(struct irq_desc *desc)
> #ifdef CONFIG_PM_SLEEP
> static int tegra_gpio_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct tegra_gpio_info *tgi = platform_get_drvdata(pdev);
> + struct tegra_gpio_info *tgi = dev_get_drvdata(dev);
> unsigned long flags;
> unsigned int b, p;
>
> @@ -443,8 +442,7 @@ static int tegra_gpio_resume(struct device *dev)
>
> static int tegra_gpio_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct tegra_gpio_info *tgi = platform_get_drvdata(pdev);
> + struct tegra_gpio_info *tgi = dev_get_drvdata(dev);
> unsigned long flags;
> unsigned int b, p;
>
> diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
> index 75ee877e5cd5..49534241bb1e 100644
> --- a/drivers/gpio/gpio-zynq.c
> +++ b/drivers/gpio/gpio-zynq.c
> @@ -697,8 +697,7 @@ static int __maybe_unused zynq_gpio_resume(struct device *dev)
>
> static int __maybe_unused zynq_gpio_runtime_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct zynq_gpio *gpio = platform_get_drvdata(pdev);
> + struct zynq_gpio *gpio = dev_get_drvdata(dev);
>
> clk_disable_unprepare(gpio->clk);
>
> @@ -707,8 +706,7 @@ static int __maybe_unused zynq_gpio_runtime_suspend(struct device *dev)
>
> static int __maybe_unused zynq_gpio_runtime_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct zynq_gpio *gpio = platform_get_drvdata(pdev);
> + struct zynq_gpio *gpio = dev_get_drvdata(dev);
>
> return clk_prepare_enable(gpio->clk);
> }
>

There are two more occurences in this gpio-zynq driver.
zynq_gpio_resume, zynq_gpio_suspend. It wasn't detected because these
two lines are not together. But the same change can be applied for them too.

Thanks,
Michal



2018-04-20 07:24:52

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH 59/61] watchdog: simplify getting .drvdata

On 19.4.2018 16:06, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/watchdog/cadence_wdt.c | 6 ++----
> drivers/watchdog/of_xilinx_wdt.c | 6 ++----

Acked-by: Michal Simek <[email protected]>

Thanks,
Michal


2018-04-20 07:25:55

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH 47/61] staging: greybus: simplify getting .drvdata

On Thu, Apr 19, 2018 at 04:06:17PM +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 <[email protected]>

Acked-by: Johan Hovold <[email protected]>

2018-04-20 07:26:15

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH 53/61] tty: serial: simplify getting .drvdata

On 19.4.2018 16:06, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> 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 ++----

Acked-by: Michal Simek <[email protected]> (for xilinx)

Thanks,
Michal


2018-04-20 07:26:17

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH 46/61] spi: simplify getting .drvdata

On 19.4.2018 16:06, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/spi/spi-cadence.c | 6 ++----
> drivers/spi/spi-zynqmp-gqspi.c | 6 ++----
> 2 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
> index 5c9516ae4942..de394422b611 100644
> --- a/drivers/spi/spi-cadence.c
> +++ b/drivers/spi/spi-cadence.c
> @@ -686,8 +686,7 @@ static int cdns_spi_remove(struct platform_device *pdev)
> */
> static int __maybe_unused cdns_spi_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct spi_master *master = platform_get_drvdata(pdev);
> + struct spi_master *master = dev_get_drvdata(dev);
>
> return spi_master_suspend(master);
> }
> @@ -702,8 +701,7 @@ static int __maybe_unused cdns_spi_suspend(struct device *dev)
> */
> static int __maybe_unused cdns_spi_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct spi_master *master = platform_get_drvdata(pdev);
> + struct spi_master *master = dev_get_drvdata(dev);
> struct cdns_spi *xspi = spi_master_get_devdata(master);
>
> cdns_spi_init_hw(xspi);
> diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c
> index 18aeaceee286..3608db4ff368 100644
> --- a/drivers/spi/spi-zynqmp-gqspi.c
> +++ b/drivers/spi/spi-zynqmp-gqspi.c
> @@ -918,8 +918,7 @@ static int zynqmp_qspi_start_transfer(struct spi_master *master,
> */
> static int __maybe_unused zynqmp_qspi_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct spi_master *master = platform_get_drvdata(pdev);
> + struct spi_master *master = dev_get_drvdata(dev);
>
> spi_master_suspend(master);
>
> @@ -939,8 +938,7 @@ static int __maybe_unused zynqmp_qspi_suspend(struct device *dev)
> */
> static int __maybe_unused zynqmp_qspi_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct spi_master *master = platform_get_drvdata(pdev);
> + struct spi_master *master = dev_get_drvdata(dev);
> struct zynqmp_qspi *xqspi = spi_master_get_devdata(master);
> int ret = 0;
>
>

Acked-by: Michal Simek <[email protected]>

Thanks,
Michal



2018-04-20 07:26:35

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH 44/61] rtc: simplify getting .drvdata

On 19.4.2018 16:06, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> 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 ++++------

Acked-by: Michal Simek <[email protected]> (for zynqmp)

Thanks,
Michal


2018-04-20 07:47:59

by Chunfeng Yun

[permalink] [raw]
Subject: Re: [PATCH 55/61] usb: mtu3: simplify getting .drvdata

hi,

On Thu, 2018-04-19 at 16:06 +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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/usb/mtu3/mtu3_plat.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index 628d5ce356ca..46551f6d16fd 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -447,8 +447,7 @@ static int mtu3_remove(struct platform_device *pdev)
> */
> static int __maybe_unused mtu3_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct ssusb_mtk *ssusb = platform_get_drvdata(pdev);
> + struct ssusb_mtk *ssusb = dev_get_drvdata(dev);
>
> dev_dbg(dev, "%s\n", __func__);
>
> @@ -466,8 +465,7 @@ static int __maybe_unused mtu3_suspend(struct device *dev)
>
> static int __maybe_unused mtu3_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct ssusb_mtk *ssusb = platform_get_drvdata(pdev);
> + struct ssusb_mtk *ssusb = dev_get_drvdata(dev);
> int ret;
>
> dev_dbg(dev, "%s\n", __func__);

Acked-by: Chunfeng Yun <[email protected]>

Thanks




2018-04-20 08:09:33

by Nicolas Ferre

[permalink] [raw]
Subject: Re: [PATCH 61/61] ASoC: atmel: simplify getting .drvdata

On 19/04/2018 at 16:06, 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 <[email protected]>

Acked-by: Nicolas Ferre <[email protected]>

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> sound/soc/atmel/atmel_ssc_dai.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
> index a1e2c5682dcd..4a0275a6505d 100644
> --- a/sound/soc/atmel/atmel_ssc_dai.c
> +++ b/sound/soc/atmel/atmel_ssc_dai.c
> @@ -1002,8 +1002,7 @@ static const struct snd_soc_component_driver atmel_ssc_component = {
>
> static int asoc_ssc_init(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct ssc_device *ssc = platform_get_drvdata(pdev);
> + struct ssc_device *ssc = dev_get_drvdata(dev);
> int ret;
>
> ret = snd_soc_register_component(dev, &atmel_ssc_component,
> @@ -1033,8 +1032,7 @@ static int asoc_ssc_init(struct device *dev)
>
> static void asoc_ssc_exit(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct ssc_device *ssc = platform_get_drvdata(pdev);
> + struct ssc_device *ssc = dev_get_drvdata(dev);
>
> if (ssc->pdata->use_dma)
> atmel_pcm_dma_platform_unregister(dev);
>


--
Nicolas Ferre

2018-04-20 08:19:56

by Nicolas Ferre

[permalink] [raw]
Subject: Re: [PATCH 43/61] pwm: simplify getting .drvdata

On 19/04/2018 at 16:06, 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 <[email protected]>

Acked-by: Nicolas Ferre <[email protected]>

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/pwm/pwm-atmel-tcb.c | 6 ++----
> drivers/pwm/pwm-rcar.c | 3 +--
> 2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
> index 4fb1be246c44..0d0f8376bc35 100644
> --- a/drivers/pwm/pwm-atmel-tcb.c
> +++ b/drivers/pwm/pwm-atmel-tcb.c
> @@ -460,8 +460,7 @@ MODULE_DEVICE_TABLE(of, atmel_tcb_pwm_dt_ids);
> #ifdef CONFIG_PM_SLEEP
> static int atmel_tcb_pwm_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
> + struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev);
> void __iomem *base = tcbpwm->tc->regs;
> int i;
>
> @@ -478,8 +477,7 @@ static int atmel_tcb_pwm_suspend(struct device *dev)
>
> static int atmel_tcb_pwm_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
> + struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev);
> void __iomem *base = tcbpwm->tc->regs;
> int i;
>
> diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
> index 91d11f2e2fef..748f614d5375 100644
> --- a/drivers/pwm/pwm-rcar.c
> +++ b/drivers/pwm/pwm-rcar.c
> @@ -261,8 +261,7 @@ MODULE_DEVICE_TABLE(of, rcar_pwm_of_table);
> #ifdef CONFIG_PM_SLEEP
> static struct pwm_device *rcar_pwm_dev_to_pwm_dev(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev);
> + struct rcar_pwm_chip *rcar_pwm = dev_get_drvdata(dev);
> struct pwm_chip *chip = &rcar_pwm->chip;
>
> return &chip->pwms[0];
>


--
Nicolas Ferre

2018-04-20 08:49:29

by Patrice CHOTARD

[permalink] [raw]
Subject: Re: [PATCH 53/61] tty: serial: simplify getting .drvdata

Hi Wolfram

On 04/19/2018 04:06 PM, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> 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 ++----
> 4 files changed, 12 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 91f3a1a5cb7f..f370c1cf4f27 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -2408,8 +2408,7 @@ static void imx_uart_enable_wakeup(struct imx_port *sport, bool on)
>
> static int imx_uart_suspend_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct imx_port *sport = platform_get_drvdata(pdev);
> + struct imx_port *sport = dev_get_drvdata(dev);
>
> imx_uart_save_context(sport);
>
> @@ -2420,8 +2419,7 @@ static int imx_uart_suspend_noirq(struct device *dev)
>
> static int imx_uart_resume_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct imx_port *sport = platform_get_drvdata(pdev);
> + struct imx_port *sport = dev_get_drvdata(dev);
> int ret;
>
> ret = clk_enable(sport->clk_ipg);
> @@ -2435,8 +2433,7 @@ static int imx_uart_resume_noirq(struct device *dev)
>
> static int imx_uart_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct imx_port *sport = platform_get_drvdata(pdev);
> + struct imx_port *sport = dev_get_drvdata(dev);
> int ret;
>
> uart_suspend_port(&imx_uart_uart_driver, &sport->port);
> @@ -2454,8 +2451,7 @@ static int imx_uart_suspend(struct device *dev)
>
> static int imx_uart_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct imx_port *sport = platform_get_drvdata(pdev);
> + struct imx_port *sport = dev_get_drvdata(dev);
>
> /* disable wakeup from i.MX UART */
> imx_uart_enable_wakeup(sport, false);
> @@ -2470,8 +2466,7 @@ static int imx_uart_resume(struct device *dev)
>
> static int imx_uart_freeze(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct imx_port *sport = platform_get_drvdata(pdev);
> + struct imx_port *sport = dev_get_drvdata(dev);
>
> uart_suspend_port(&imx_uart_uart_driver, &sport->port);
>
> @@ -2480,8 +2475,7 @@ static int imx_uart_freeze(struct device *dev)
>
> static int imx_uart_thaw(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct imx_port *sport = platform_get_drvdata(pdev);
> + struct imx_port *sport = dev_get_drvdata(dev);
>
> uart_resume_port(&imx_uart_uart_driver, &sport->port);
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 65ff669373d4..66558d42d980 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1085,8 +1085,7 @@ static int qcom_geni_serial_remove(struct platform_device *pdev)
>
> static int __maybe_unused qcom_geni_serial_sys_suspend_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct qcom_geni_serial_port *port = platform_get_drvdata(pdev);
> + struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
> struct uart_port *uport = &port->uport;
>
> uart_suspend_port(uport->private_data, uport);
> @@ -1095,8 +1094,7 @@ static int __maybe_unused qcom_geni_serial_sys_suspend_noirq(struct device *dev)
>
> static int __maybe_unused qcom_geni_serial_sys_resume_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct qcom_geni_serial_port *port = platform_get_drvdata(pdev);
> + struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
> struct uart_port *uport = &port->uport;
>
> if (console_suspend_enabled && uport->suspended) {
> diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
> index 5f9f01fac6dd..7971997cdead 100644
> --- a/drivers/tty/serial/st-asc.c
> +++ b/drivers/tty/serial/st-asc.c
> @@ -842,16 +842,14 @@ static int asc_serial_remove(struct platform_device *pdev)
> #ifdef CONFIG_PM_SLEEP
> static int asc_serial_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct uart_port *port = platform_get_drvdata(pdev);
> + struct uart_port *port = dev_get_drvdata(dev);
>
> return uart_suspend_port(&asc_uart_driver, port);
> }
>
> static int asc_serial_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct uart_port *port = platform_get_drvdata(pdev);
> + struct uart_port *port = dev_get_drvdata(dev);
>
> return uart_resume_port(&asc_uart_driver, port);
> }
> diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
> index abcb4d09a2d8..3ec4efbf25a9 100644
> --- a/drivers/tty/serial/xilinx_uartps.c
> +++ b/drivers/tty/serial/xilinx_uartps.c
> @@ -1430,8 +1430,7 @@ static int cdns_uart_resume(struct device *device)
> #endif /* ! CONFIG_PM_SLEEP */
> static int __maybe_unused cdns_runtime_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct uart_port *port = platform_get_drvdata(pdev);
> + struct uart_port *port = dev_get_drvdata(dev);
> struct cdns_uart *cdns_uart = port->private_data;
>
> clk_disable(cdns_uart->uartclk);
> @@ -1441,8 +1440,7 @@ static int __maybe_unused cdns_runtime_suspend(struct device *dev)
>
> static int __maybe_unused cdns_runtime_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct uart_port *port = platform_get_drvdata(pdev);
> + struct uart_port *port = dev_get_drvdata(dev);
> struct cdns_uart *cdns_uart = port->private_data;
>
> clk_enable(cdns_uart->pclk);
>

For st-asc:

Acked-by: Patrice Chotard <[email protected]>

Thanks

2018-04-20 08:54:52

by Marc Dietrich

[permalink] [raw]
Subject: Re: [PATCH 49/61] staging: nvec: simplify getting .drvdata

Am Donnerstag, 19. April 2018, 16:06:19 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 <[email protected]>

Acked-by: Marc Dietrich <[email protected]>

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/staging/nvec/nvec.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 52054a528723..2a5e0dcf4162 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -925,8 +925,7 @@ static int tegra_nvec_remove(struct platform_device
> *pdev) static int nvec_suspend(struct device *dev)
> {
> int err;
> - struct platform_device *pdev = to_platform_device(dev);
> - struct nvec_chip *nvec = platform_get_drvdata(pdev);
> + struct nvec_chip *nvec = dev_get_drvdata(dev);
> struct nvec_msg *msg;
> char ap_suspend[] = { NVEC_SLEEP, AP_SUSPEND };
>
> @@ -946,8 +945,7 @@ static int nvec_suspend(struct device *dev)
>
> static int nvec_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct nvec_chip *nvec = platform_get_drvdata(pdev);
> + struct nvec_chip *nvec = dev_get_drvdata(dev);
>
> dev_dbg(nvec->dev, "resuming\n");
> tegra_init_i2c_slave(nvec);





2018-04-20 17:06:40

by Mark Brown

[permalink] [raw]
Subject: Applied "ASoC: atmel: simplify getting .drvdata" to the asoc tree

The patch

ASoC: atmel: simplify getting .drvdata

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From c0380478139fce887b948b35dc0dcee0b40bdf09 Mon Sep 17 00:00:00 2001
From: Wolfram Sang <[email protected]>
Date: Thu, 19 Apr 2018 16:06:31 +0200
Subject: [PATCH] ASoC: atmel: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
---
sound/soc/atmel/atmel_ssc_dai.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index 1c7af0ca98ec..d3b69682d9c2 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -1002,8 +1002,7 @@ static const struct snd_soc_component_driver atmel_ssc_component = {

static int asoc_ssc_init(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ssc_device *ssc = platform_get_drvdata(pdev);
+ struct ssc_device *ssc = dev_get_drvdata(dev);
int ret;

ret = snd_soc_register_component(dev, &atmel_ssc_component,
@@ -1033,8 +1032,7 @@ static int asoc_ssc_init(struct device *dev)

static void asoc_ssc_exit(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct ssc_device *ssc = platform_get_drvdata(pdev);
+ struct ssc_device *ssc = dev_get_drvdata(dev);

if (ssc->pdata->use_dma)
atmel_pcm_dma_platform_unregister(dev);
--
2.17.0


2018-04-20 17:09:39

by Mark Brown

[permalink] [raw]
Subject: Applied "spi: simplify getting .drvdata" to the spi tree

The patch

spi: simplify getting .drvdata

has been applied to the spi tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From e1f16b0493a01820a137ebbdd96bf695e427fabe Mon Sep 17 00:00:00 2001
From: Wolfram Sang <[email protected]>
Date: Thu, 19 Apr 2018 16:06:16 +0200
Subject: [PATCH] spi: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <[email protected]>
Acked-by: Michal Simek <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
---
drivers/spi/spi-cadence.c | 6 ++----
drivers/spi/spi-zynqmp-gqspi.c | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
index 5c9516ae4942..de394422b611 100644
--- a/drivers/spi/spi-cadence.c
+++ b/drivers/spi/spi-cadence.c
@@ -686,8 +686,7 @@ static int cdns_spi_remove(struct platform_device *pdev)
*/
static int __maybe_unused cdns_spi_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct spi_master *master = platform_get_drvdata(pdev);
+ struct spi_master *master = dev_get_drvdata(dev);

return spi_master_suspend(master);
}
@@ -702,8 +701,7 @@ static int __maybe_unused cdns_spi_suspend(struct device *dev)
*/
static int __maybe_unused cdns_spi_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct spi_master *master = platform_get_drvdata(pdev);
+ struct spi_master *master = dev_get_drvdata(dev);
struct cdns_spi *xspi = spi_master_get_devdata(master);

cdns_spi_init_hw(xspi);
diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c
index 26d1ac3bf496..cc4d31033494 100644
--- a/drivers/spi/spi-zynqmp-gqspi.c
+++ b/drivers/spi/spi-zynqmp-gqspi.c
@@ -906,8 +906,7 @@ static int zynqmp_qspi_start_transfer(struct spi_master *master,
*/
static int __maybe_unused zynqmp_qspi_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct spi_master *master = platform_get_drvdata(pdev);
+ struct spi_master *master = dev_get_drvdata(dev);

spi_master_suspend(master);

@@ -927,8 +926,7 @@ static int __maybe_unused zynqmp_qspi_suspend(struct device *dev)
*/
static int __maybe_unused zynqmp_qspi_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct spi_master *master = platform_get_drvdata(pdev);
+ struct spi_master *master = dev_get_drvdata(dev);
struct zynqmp_qspi *xqspi = spi_master_get_devdata(master);
int ret = 0;

--
2.17.0


2018-04-21 16:12:38

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 19/61] iio: common: hid-sensors: simplify getting .drvdata

On Thu, 19 Apr 2018 16:05:49 +0200
Wolfram Sang <[email protected]> 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 <[email protected]>
Applied, thanks,

Jonathan

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
> index cfb6588565ba..2ce0efd98cc0 100644
> --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
> +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
> @@ -304,8 +304,7 @@ EXPORT_SYMBOL(hid_sensor_setup_trigger);
>
> static int __maybe_unused hid_sensor_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);
>
> return _hid_sensor_power_state(attrb, false);
> @@ -313,8 +312,7 @@ static int __maybe_unused hid_sensor_suspend(struct device *dev)
>
> static int __maybe_unused hid_sensor_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);
> schedule_work(&attrb->work);
> return 0;
> @@ -322,8 +320,7 @@ static int __maybe_unused hid_sensor_resume(struct device *dev)
>
> static int __maybe_unused hid_sensor_runtime_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);
> return _hid_sensor_power_state(attrb, true);
> }


2018-04-21 16:15:45

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 48/61] staging: iio: adc: simplify getting .drvdata

On Thu, 19 Apr 2018 16:06:18 +0200
Wolfram Sang <[email protected]> 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 <[email protected]>
Applied, thanks,

Jonathan

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/staging/iio/adc/ad7606_par.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7606_par.c b/drivers/staging/iio/adc/ad7606_par.c
> index 3eb6f8f312dd..a34c2a1d5373 100644
> --- a/drivers/staging/iio/adc/ad7606_par.c
> +++ b/drivers/staging/iio/adc/ad7606_par.c
> @@ -18,8 +18,7 @@
> static int ad7606_par16_read_block(struct device *dev,
> int count, void *buf)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> struct ad7606_state *st = iio_priv(indio_dev);
>
> insw((unsigned long)st->base_address, buf, count);
> @@ -34,8 +33,7 @@ static const struct ad7606_bus_ops ad7606_par16_bops = {
> static int ad7606_par8_read_block(struct device *dev,
> int count, void *buf)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> struct ad7606_state *st = iio_priv(indio_dev);
>
> insb((unsigned long)st->base_address, buf, count * 2);


2018-04-21 16:16:50

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 18/61] iio: common: cros_ec_sensors: simplify getting .drvdata

On Thu, 19 Apr 2018 16:05:48 +0200
Wolfram Sang <[email protected]> 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 <[email protected]>
Applied, thanks.

Jonathan

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> index a620eb5ce202..3df6c0e09832 100644
> --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> @@ -448,8 +448,7 @@ EXPORT_SYMBOL_GPL(cros_ec_sensors_core_write);
>
> static int __maybe_unused cros_ec_sensors_prepare(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> struct cros_ec_sensors_core_state *st = iio_priv(indio_dev);
>
> if (st->curr_sampl_freq == 0)
> @@ -471,8 +470,7 @@ static int __maybe_unused cros_ec_sensors_prepare(struct device *dev)
>
> static void __maybe_unused cros_ec_sensors_complete(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> struct cros_ec_sensors_core_state *st = iio_priv(indio_dev);
>
> if (st->curr_sampl_freq == 0)


2018-04-21 16:27:10

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata

Hi Michal,

Thanks for the reviews!

> There are two more occurences in this gpio-zynq driver.
> zynq_gpio_resume, zynq_gpio_suspend. It wasn't detected because these
> two lines are not together. But the same change can be applied for them too.

Not really. The rule would have matched if there was just "something"
inbetween. It did not match because the "something" involves the
variable 'pdev', so we can't remove it. And just changing towards
'dev_get_drvdata' and keeping 'pdev' was not worth the hazzle in my
book. Especially since I think the code should probably get refactored.
Calling platform_get_irq() in suspend/resume paths in order to get the
irq_data looks a little expensive to me, but I haven't tested it.

Best wishes,

Wolfram

PS: Please quote only relevant parts of the message, it is a lot easier
to find comments then IMO.


Attachments:
(No filename) (875.00 B)
signature.asc (849.00 B)
Download all attachments

2018-04-21 17:06:41

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 01/61] ARM: plat-samsung: simplify getting .drvdata

On Thu, Apr 19, 2018 at 04:05:31PM +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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> arch/arm/plat-samsung/adc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>

Thanks, applied.

Best regards,
Krzysztof


2018-04-21 19:36:57

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 29/61] mtd: devices: simplify getting .drvdata

Wolfram Sang <[email protected]> writes:

> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.
>
> Signed-off-by: Wolfram Sang <[email protected]>
Acked-by: Robert Jarzmik <[email protected]>

Cheers.

--
Robert

2018-04-22 06:14:19

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 07/61] dma: simplify getting .drvdata

On Thu, Apr 19, 2018 at 04:05:37PM +0200, Wolfram Sang wrote:
> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.

Do you mind splitting this per driver please, that makes it easy to manage
for me :)

--
~Vinod

2018-04-22 06:18:44

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 09/61] dmaengine: qcom: simplify getting .drvdata

On Thu, Apr 19, 2018 at 04:05:39PM +0200, Wolfram Sang wrote:
> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.

Applied, thanks

--
~Vinod

2018-04-22 06:19:07

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 08/61] dmaengine: dw: simplify getting .drvdata

On Thu, Apr 19, 2018 at 04:05:38PM +0200, Wolfram Sang wrote:
> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.

Applied, thanks

--
~Vinod

2018-04-22 09:16:22

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 07/61] dma: simplify getting .drvdata

On Sun, Apr 22, 2018 at 11:47:33AM +0530, Vinod Koul wrote:
> On Thu, Apr 19, 2018 at 04:05:37PM +0200, Wolfram Sang wrote:
> > We should get drvdata from struct device directly. Going via
> > platform_device is an unneeded step back and forth.
>
> Do you mind splitting this per driver please, that makes it easy to manage
> for me :)

No problem, done.


Attachments:
(No filename) (367.00 B)
signature.asc (849.00 B)
Download all attachments

2018-04-22 17:16:35

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH 29/61] mtd: devices: simplify getting .drvdata

On Thu, 19 Apr 2018 16:05:59 +0200
Wolfram Sang <[email protected]> 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 <[email protected]>

Applied to mtd/next.

Thanks,

Boris

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/mtd/devices/docg3.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
> index c594fe5eac08..802d8f159e90 100644
> --- a/drivers/mtd/devices/docg3.c
> +++ b/drivers/mtd/devices/docg3.c
> @@ -1470,8 +1470,7 @@ static struct docg3 *sysfs_dev2docg3(struct device *dev,
> struct device_attribute *attr)
> {
> int floor;
> - struct platform_device *pdev = to_platform_device(dev);
> - struct mtd_info **docg3_floors = platform_get_drvdata(pdev);
> + struct mtd_info **docg3_floors = dev_get_drvdata(dev);
>
> floor = attr->attr.name[1] - '0';
> if (floor < 0 || floor >= DOC_MAX_NBFLOORS)


2018-04-22 17:30:58

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH 30/61] mtd: nand: onenand: simplify getting .drvdata

On Thu, 19 Apr 2018 16:06:00 +0200
Wolfram Sang <[email protected]> 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 <[email protected]>

Applied to nand/next.

Thanks,

Boris

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/mtd/nand/onenand/samsung.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/nand/onenand/samsung.c b/drivers/mtd/nand/onenand/samsung.c
> index 2e9d076e445a..4cce4c0311ca 100644
> --- a/drivers/mtd/nand/onenand/samsung.c
> +++ b/drivers/mtd/nand/onenand/samsung.c
> @@ -958,8 +958,7 @@ static int s3c_onenand_remove(struct platform_device *pdev)
>
> static int s3c_pm_ops_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct mtd_info *mtd = platform_get_drvdata(pdev);
> + struct mtd_info *mtd = dev_get_drvdata(dev);
> struct onenand_chip *this = mtd->priv;
>
> this->wait(mtd, FL_PM_SUSPENDED);
> @@ -968,8 +967,7 @@ static int s3c_pm_ops_suspend(struct device *dev)
>
> static int s3c_pm_ops_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct mtd_info *mtd = platform_get_drvdata(pdev);
> + struct mtd_info *mtd = dev_get_drvdata(dev);
> struct onenand_chip *this = mtd->priv;
>
> this->unlock_all(mtd);


2018-04-23 06:06:51

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata

Hi Wolfram,

On 21.4.2018 18:23, Wolfram Sang wrote:
> Hi Michal,
>
> Thanks for the reviews!
>
>> There are two more occurences in this gpio-zynq driver.
>> zynq_gpio_resume, zynq_gpio_suspend. It wasn't detected because these
>> two lines are not together. But the same change can be applied for them too.
>
> Not really. The rule would have matched if there was just "something"
> inbetween. It did not match because the "something" involves the
> variable 'pdev', so we can't remove it. And just changing towards
> 'dev_get_drvdata' and keeping 'pdev' was not worth the hazzle in my
> book. Especially since I think the code should probably get refactored.
> Calling platform_get_irq() in suspend/resume paths in order to get the
> irq_data looks a little expensive to me, but I haven't tested it.
>

ok. Thanks. I have overlooked that.

Thanks,
Michal

2018-04-23 18:28:25

by Eric Anholt

[permalink] [raw]
Subject: Re: [PATCH 16/61] gpu: drm: vc4: simplify getting .drvdata

Wolfram Sang <[email protected]> writes:

> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Applied to drm-misc-next. Thanks!


Attachments:
signature.asc (847.00 B)

2018-04-24 07:33:31

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 05/61] clk: samsung: simplify getting .drvdata

Hi,

On 2018년 04월 19일 23:05, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/clk/samsung/clk-s3c2410-dclk.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/samsung/clk-s3c2410-dclk.c b/drivers/clk/samsung/clk-s3c2410-dclk.c
> index 077df3e539a7..f41d89cef0f1 100644
> --- a/drivers/clk/samsung/clk-s3c2410-dclk.c
> +++ b/drivers/clk/samsung/clk-s3c2410-dclk.c
> @@ -219,8 +219,7 @@ static int s3c24xx_dclk1_div_notify(struct notifier_block *nb,
> #ifdef CONFIG_PM_SLEEP
> static int s3c24xx_dclk_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct s3c24xx_dclk *s3c24xx_dclk = platform_get_drvdata(pdev);
> + struct s3c24xx_dclk *s3c24xx_dclk = dev_get_drvdata(dev);
>
> s3c24xx_dclk->reg_save = readl_relaxed(s3c24xx_dclk->base);
> return 0;
> @@ -228,8 +227,7 @@ static int s3c24xx_dclk_suspend(struct device *dev)
>
> static int s3c24xx_dclk_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct s3c24xx_dclk *s3c24xx_dclk = platform_get_drvdata(pdev);
> + struct s3c24xx_dclk *s3c24xx_dclk = dev_get_drvdata(dev);
>
> writel_relaxed(s3c24xx_dclk->reg_save, s3c24xx_dclk->base);
> return 0;
>

Reviewed-by: Chanwoo Choi <[email protected]>

--
Best Regards,
Chanwoo Choi
Samsung Electronics

Subject: Re: [PATCH 57/61] video: fbdev: simplify getting .drvdata

On Thursday, April 19, 2018 04:06:27 PM 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 <[email protected]>

Patch queued for 4.18, thanks.

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


Subject: Re: [PATCH 58/61] video: fbdev: omap2: omapfb: displays: simplify getting .drvdata

On Thursday, April 19, 2018 04:06:28 PM 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 <[email protected]>

Patch queued for 4.18, thanks.

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


2018-04-24 16:10:06

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCH 37/61] perf: simplify getting .drvdata

On Thu, Apr 19, 2018 at 04:06:07PM +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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.

Thanks, Wolfram. I'll pick this up via the arm perf tree.

Will

2018-04-25 12:51:57

by Sylwester Nawrocki

[permalink] [raw]
Subject: Re: [PATCH 05/61] clk: samsung: simplify getting .drvdata

On 04/19/2018 04:05 PM, 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 <[email protected]>

Patch applied, thanks!


2018-04-25 21:20:17

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH 41/61] power: supply: simplify getting .drvdata

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 <[email protected]>
> ---

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
>


Attachments:
(No filename) (1.15 kB)
signature.asc (849.00 B)
Download all attachments

2018-04-26 19:21:21

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 20/61] input: keyboard: simplify getting .drvdata

Hi Wolfram,

On Thu, Apr 19, 2018 at 04:05:50PM +0200, Wolfram Sang wrote:
> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.

I consider the fact that platform device's driver data is accessible via
device driver data being implementation detail that may or may not change
in the future, so I'd prefer keep using the proper accessors for the
objects we are dealing with.

Thanks.

>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> 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 ++++------
> 12 files changed, 42 insertions(+), 68 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/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
> index 25d61d8d4fc4..56328ced81e2 100644
> --- a/drivers/input/keyboard/imx_keypad.c
> +++ b/drivers/input/keyboard/imx_keypad.c
> @@ -532,8 +532,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 */
> @@ -544,7 +543,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;
> @@ -552,12 +551,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 41614c185918..73ca55e4babe 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 940d38b08e6b..13578b884ace 100644
> --- a/drivers/input/keyboard/omap4-keypad.c
> +++ b/drivers/input/keyboard/omap4-keypad.c
> @@ -422,11 +422,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;
> @@ -437,10 +436,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 316414465c77..27790a8a44f5 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 53c768b95939..f439f7bd2f5f 100644
> --- a/drivers/input/keyboard/snvs_pwrkey.c
> +++ b/drivers/input/keyboard/snvs_pwrkey.c
> @@ -180,10 +180,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;
> @@ -191,10 +190,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 babcfb165e4f..3b4727e4b411 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.11.0
>

--
Dmitry

2018-04-26 20:05:37

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 20/61] input: keyboard: simplify getting .drvdata

Hi Dmitry,

> > We should get drvdata from struct device directly. Going via
> > platform_device is an unneeded step back and forth.
>
> I consider the fact that platform device's driver data is accessible via
> device driver data being implementation detail that may or may not change

Isn't it actually the other way around? platform_get_drvdata() is a
convenience function to access driver_data which is embedded in struct
device?

> in the future, so I'd prefer keep using the proper accessors for the
> objects we are dealing with.

Exactly. I'd just argue, the object we are dealing with, declared in the
PM functions, is a struct device.

Thanks for the comment,

Wolfram


Attachments:
(No filename) (706.00 B)
signature.asc (849.00 B)
Download all attachments

2018-04-26 21:27:24

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 20/61] input: keyboard: simplify getting .drvdata

On Thu, Apr 26, 2018 at 10:04:01PM +0200, Wolfram Sang wrote:
> Hi Dmitry,
>
> > > We should get drvdata from struct device directly. Going via
> > > platform_device is an unneeded step back and forth.
> >
> > I consider the fact that platform device's driver data is accessible via
> > device driver data being implementation detail that may or may not change
>
> Isn't it actually the other way around? platform_get_drvdata() is a
> convenience function to access driver_data which is embedded in struct
> device?

I guess it depends on how you read it. I always considered it separate
because none (?) of the bus implementation assert this in comments to
XXX_get_drvdata().

>
> > in the future, so I'd prefer keep using the proper accessors for the
> > objects we are dealing with.
>
> Exactly. I'd just argue, the object we are dealing with, declared in the
> PM functions, is a struct device.

No, the driver does not create a generic device, it actually creates a
platform device, or i2c client, or spi, or something else. The fact that
suspend and resume routines have generic device as their argument has
more to do with the language limitation rather than reflection of true
type of the objects we are dealing with.

Thanks.

--
Dmitry

2018-04-26 23:37:00

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH 04/61] bus: simplify getting .drvdata

On 04/19/2018 07:05 AM, 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 <[email protected]>

Looks reasonable, would you want to use dev_set_drvdata() while we are
it? That would bring more consistency given your proposed change.

Thanks!
--
--
Florian

2018-04-27 00:23:54

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH 31/61] net: dsa: simplify getting .drvdata

On 04/19/2018 07:06 AM, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.

Similar to my other comment on patch 4, would not you want to use
dev_set_drvdata() to be consistent? This would be functionally equivalent.
--
Florian

2018-04-27 10:21:56

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 20/61] input: keyboard: simplify getting .drvdata

Hi Dmitry,

> > Isn't it actually the other way around? platform_get_drvdata() is a
> > convenience function to access driver_data which is embedded in struct
> > device?
>
> I guess it depends on how you read it. I always considered it separate
> because none (?) of the bus implementation assert this in comments to
> XXX_get_drvdata().

Well, even in the case somebody will implement a custom driver_data for
platform_devices, this person will need to convert all current users to
'dev_get_drvdata(&pdev->dev);' first in order to avoid regressions, I'd
think. This is what my patch does right now (but merely for overhead
reasons). Or?

> > > in the future, so I'd prefer keep using the proper accessors for the
> > > objects we are dealing with.
> >
> > Exactly. I'd just argue, the object we are dealing with, declared in the
> > PM functions, is a struct device.
>
> No, the driver does not create a generic device, it actually creates a
> platform device, or i2c client, or spi, or something else. The fact that

True.

> suspend and resume routines have generic device as their argument has
> more to do with the language limitation rather than reflection of true
> type of the objects we are dealing with.

Ok, can be argued. I'd personally still go for the gain, but I won't
push harder than this mail.

Regards,

Wolfram


Attachments:
(No filename) (1.34 kB)
signature.asc (849.00 B)
Download all attachments

2018-04-27 13:32:00

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 03/61] auxdisplay: simplify getting .drvdata

On Thu, Apr 19, 2018 at 4:05 PM, Wolfram Sang
<[email protected]> 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 <[email protected]>

Acked-by: Linus Walleij <[email protected]>

Sorry for slow reply.

Yours,
Linus Walleij

2018-04-28 08:26:42

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH 06/61] crypto: simplify getting .drvdata

On Thu, Apr 19, 2018 at 04:05:36PM +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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/crypto/exynos-rng.c | 6 ++----
> drivers/crypto/picoxcell_crypto.c | 6 ++----
> 2 files changed, 4 insertions(+), 8 deletions(-)

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

2018-04-30 09:03:55

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata

On Thu, Apr 19, 2018 at 5:14 PM, Grygorii Strashko
<[email protected]> wrote:
> On 04/19/2018 09:05 AM, 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 <[email protected]>
>> ---
>>
>> Build tested only. buildbot is happy. Please apply individually.
>
>
> for gpio-omap.c:
> Reviewed-by: Grygorii Strashko <[email protected]>

Hm I only see the responses not the actual patch, I guess I will find it
sooner or later.

Wolfram: if I don't find it, poke me with something sharp so I get to apply it.

Yours,
Linus Walleij

2018-04-30 09:13:45

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata


> Wolfram: if I don't find it, poke me with something sharp so I get to apply it.

I just bounced it again. Otherwise, it is here, too, downloadable as
mbox: https://patchwork.kernel.org/patch/10350759/


Attachments:
(No filename) (211.00 B)
signature.asc (849.00 B)
Download all attachments

2018-04-30 09:28:54

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH 43/61] pwm: simplify getting .drvdata

On Thu, Apr 19, 2018 at 04:06:13PM +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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/pwm/pwm-atmel-tcb.c | 6 ++----
> drivers/pwm/pwm-rcar.c | 3 +--
> 2 files changed, 3 insertions(+), 6 deletions(-)

Applied, thanks.

Thierry


Attachments:
(No filename) (502.00 B)
signature.asc (849.00 B)
Download all attachments

2018-04-30 09:31:33

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata

On Mon, Apr 30, 2018 at 11:03:25AM +0200, Linus Walleij wrote:
> On Thu, Apr 19, 2018 at 5:14 PM, Grygorii Strashko
> <[email protected]> wrote:
> > On 04/19/2018 09:05 AM, 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 <[email protected]>
> >> ---
> >>
> >> Build tested only. buildbot is happy. Please apply individually.
> >
> >
> > for gpio-omap.c:
> > Reviewed-by: Grygorii Strashko <[email protected]>
>
> Hm I only see the responses not the actual patch, I guess I will find it
> sooner or later.
>
> Wolfram: if I don't find it, poke me with something sharp so I get to apply it.

I had the same problem, turned out this got classified as spam by Google
for some reason. Maybe try your spam folder?

Thierry


Attachments:
(No filename) (912.00 B)
signature.asc (849.00 B)
Download all attachments

2018-05-02 08:53:13

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH 50/61] thermal: simplify getting .drvdata

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 <[email protected]>
> ---
>
> 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 <[email protected]>

2018-05-03 12:25:37

by Heiko Stuebner

[permalink] [raw]
Subject: Re: [PATCH 50/61] thermal: simplify getting .drvdata

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 <[email protected]>
> ---
>
> 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 <[email protected]>

2018-05-03 13:20:51

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH 24/61] iommu: simplify getting .drvdata

On Thu, Apr 19, 2018 at 04:05:54PM +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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/iommu/qcom_iommu.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)

Applied, thanks.

2018-05-03 20:09:47

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH 44/61] rtc: simplify getting .drvdata

On 19/04/2018 16:06:14+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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> 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 ++++------
> 15 files changed, 71 insertions(+), 131 deletions(-)
>
Applied, thanks.

--
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

2018-05-15 09:32:53

by Sylwester Nawrocki

[permalink] [raw]
Subject: Re: [PATCH 05/61] clk: samsung: simplify getting .drvdata

On 04/19/2018 04:05 PM, 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 <[email protected]>

Acked-by: Sylwester Nawrocki <[email protected]>

It seems to be the only clk/samsung patch in the v4.18 queue, please
feel free to apply it directly.

> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/clk/samsung/clk-s3c2410-dclk.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/samsung/clk-s3c2410-dclk.c b/drivers/clk/samsung/clk-s3c2410-dclk.c
> index 077df3e539a7..f41d89cef0f1 100644
> --- a/drivers/clk/samsung/clk-s3c2410-dclk.c
> +++ b/drivers/clk/samsung/clk-s3c2410-dclk.c
> @@ -219,8 +219,7 @@ static int s3c24xx_dclk1_div_notify(struct notifier_block *nb,
> #ifdef CONFIG_PM_SLEEP
> static int s3c24xx_dclk_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct s3c24xx_dclk *s3c24xx_dclk = platform_get_drvdata(pdev);
> + struct s3c24xx_dclk *s3c24xx_dclk = dev_get_drvdata(dev);
>
> s3c24xx_dclk->reg_save = readl_relaxed(s3c24xx_dclk->base);
> return 0;
> @@ -228,8 +227,7 @@ static int s3c24xx_dclk_suspend(struct device *dev)
>
> static int s3c24xx_dclk_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct s3c24xx_dclk *s3c24xx_dclk = platform_get_drvdata(pdev);
> + struct s3c24xx_dclk *s3c24xx_dclk = dev_get_drvdata(dev);
>
> writel_relaxed(s3c24xx_dclk->reg_save, s3c24xx_dclk->base);
> return 0;

--
Regards,
Sylwester

2018-05-15 09:47:20

by Sylwester Nawrocki

[permalink] [raw]
Subject: Re: [PATCH 27/61] media: platform: s5p-mfc: simplify getting .drvdata

On 04/19/2018 04:05 PM, 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 <[email protected]>

Acked-by: Sylwester Nawrocki <[email protected]>

2018-05-15 09:48:35

by Sylwester Nawrocki

[permalink] [raw]
Subject: Re: [PATCH 26/61] media: platform: exynos4-is: simplify getting .drvdata

On 04/19/2018 04:05 PM, 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 <[email protected]>

Acked-by: Sylwester Nawrocki <[email protected]>

2018-05-15 21:04:54

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 05/61] clk: samsung: simplify getting .drvdata

Quoting Sylwester Nawrocki (2018-05-15 02:32:12)
> On 04/19/2018 04:05 PM, 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 <[email protected]>
>
> Acked-by: Sylwester Nawrocki <[email protected]>
>
> It seems to be the only clk/samsung patch in the v4.18 queue, please
> feel free to apply it directly.

Ok. I'll pick it up.

2018-05-15 21:06:15

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 05/61] clk: samsung: simplify getting .drvdata

Quoting Wolfram Sang (2018-04-19 07:05:35)
> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---

Applied to clk-next


2018-05-23 09:34:25

by Tomi Valkeinen

[permalink] [raw]
Subject: Re: [PATCH 15/61] gpu: drm: omapdrm: displays: simplify getting .drvdata

On 19/04/18 17:05, 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 <[email protected]>
> ---
>
> Build tested only. buildbot is happy. Please apply individually.
>
> drivers/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 428de90fced1..8f8573a00e07 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -412,8 +412,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 *in = ddata->in;
> u8 errors = 0;
> int r;
> @@ -444,8 +443,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 *in = ddata->in;
> u8 id1, id2, id3;
> int r;
> @@ -476,8 +474,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 *in = ddata->in;
> unsigned long t;
> int r;
> @@ -511,8 +508,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);
> @@ -526,8 +522,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 *in = ddata->in;
> unsigned long t;
> int r;
> @@ -558,8 +553,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);
>

Thanks, I have picked this up.

Tomi

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

2019-03-07 20:15:34

by Adam Ford

[permalink] [raw]
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata

On Mon, Apr 30, 2018 at 4:30 AM Thierry Reding <[email protected]> wrote:
>
> On Mon, Apr 30, 2018 at 11:03:25AM +0200, Linus Walleij wrote:
> > On Thu, Apr 19, 2018 at 5:14 PM, Grygorii Strashko
> > <[email protected]> wrote:
> > > On 04/19/2018 09:05 AM, 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 <[email protected]>
> > >> ---
> > >>
> > >> Build tested only. buildbot is happy. Please apply individually.
> > >
> > >
> > > for gpio-omap.c:
> > > Reviewed-by: Grygorii Strashko <[email protected]>
> >
> > Hm I only see the responses not the actual patch, I guess I will find it
> > sooner or later.
> >
> > Wolfram: if I don't find it, poke me with something sharp so I get to apply it.
>
> I had the same problem, turned out this got classified as spam by Google
> for some reason. Maybe try your spam folder?

It's been almost a year later, and several Linux revisions, and this
still seems stuck somewhere/somehow.

adam
>
> Thierry

2019-03-07 20:19:21

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata


> It's been almost a year later, and several Linux revisions, and this
> still seems stuck somewhere/somehow.

I wanted to respin this series once rc1 is released.


Attachments:
(No filename) (172.00 B)
signature.asc (849.00 B)
Download all attachments
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata

On 07.03.19 21:18, Wolfram Sang wrote:
>
>> It's been almost a year later, and several Linux revisions, and this
>> still seems stuck somewhere/somehow.
>
> I wanted to respin this series once rc1 is released.
>
Maybe just rebase and repost ?


--mtx

--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287

2019-03-07 20:58:54

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata

On Thu, Mar 07, 2019 at 09:53:50PM +0100, Enrico Weigelt, metux IT consult wrote:
> On 07.03.19 21:18, Wolfram Sang wrote:
> >
> >> It's been almost a year later, and several Linux revisions, and this
> >> still seems stuck somewhere/somehow.
> >
> > I wanted to respin this series once rc1 is released.
> >
> Maybe just rebase and repost ?

Then I'd miss all the new drivers which may need this fixed. Coccinelle
makes respinning a breeze, so no problem with that.


Attachments:
(No filename) (483.00 B)
signature.asc (849.00 B)
Download all attachments

2019-03-19 14:32:47

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 10/61] gpio: simplify getting .drvdata

On Thu, Mar 07, 2019 at 09:58:14PM +0100, Wolfram Sang wrote:
> On Thu, Mar 07, 2019 at 09:53:50PM +0100, Enrico Weigelt, metux IT consult wrote:
> > On 07.03.19 21:18, Wolfram Sang wrote:
> > >
> > >> It's been almost a year later, and several Linux revisions, and this
> > >> still seems stuck somewhere/somehow.
> > >
> > > I wanted to respin this series once rc1 is released.
> > >
> > Maybe just rebase and repost ?
>
> Then I'd miss all the new drivers which may need this fixed. Coccinelle
> makes respinning a breeze, so no problem with that.

Because coccinelle didn't find anything in drivers/gpio, I wondered what
case you are referring to? Invoking this (as of v5.1-rc1) gives:

$ git log --oneline --grep "simplify getting" drivers/gpio
7ddb7dce0ab6 gpio: gpio-tegra: simplify getting .driver_data
38ccad0243f9 gpio: gpio-zynq: simplify getting .driver_data
a3f4f728d3bb gpio: gpio-omap: simplify getting .driver_data
11868645c5b5 gpio: gpio-mxc: simplify getting .driver_data
ea5ec5e3aeab gpio: gpio-lynxpoint: simplify getting .driver_data
deb19ac533ac gpio: gpio-dwapb: simplify getting .driver_data


Attachments:
(No filename) (1.12 kB)
signature.asc (849.00 B)
Download all attachments