* [PATCH 00/61] tree-wide: simplify getting .drvdata @ 2018-04-19 14:05 Wolfram Sang 2018-04-19 14:05 ` [PATCH 10/61] gpio: " Wolfram Sang ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Wolfram Sang @ 2018-04-19 14:05 UTC (permalink / raw) To: linux-kernel Cc: linux-ide, alsa-devel, linux-iio, kernel-janitors, linux-fbdev, dri-devel, platform-driver-x86, Wolfram Sang, linux-mtd, linux-clk, ac100, devel, linux-samsung-soc, linux-rockchip, linux-serial, linux-input, linux-media, linux-pwm, linux-watchdog, linux-pm, linux-arm-msm, acpi4asus-user, greybus-dev, linux-mediatek, linux-tegra, linux-omap, linux-soc, linux-arm-kernel I got tired of fixing this in Renesas drivers manually, so I took the big hammer. Remove this cumbersome code pattern which got copy-pasted too much already: - struct platform_device *pdev = to_platform_device(dev); - struct ep93xx_keypad *keypad = platform_get_drvdata(pdev); + struct ep93xx_keypad *keypad = dev_get_drvdata(dev); I send this out as one patch per directory per subsystem. I think they should be applied individually. If you prefer a broken out series per subsystem, I can provide this as well. Just mail me. A branch (tested by buildbot; only with all commits squashed into one commit before) can be found here: git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git coccinelle/get_drvdata Open for other comments, suggestions, too, of course. Here is the cocci-script I created (after <n> iterations by manually checking samples): @@ struct device* d; identifier pdev; expression *ptr; @@ ( - struct platform_device *pdev = to_platform_device(d); | - struct platform_device *pdev; ... - pdev = to_platform_device(d); ) <... when != pdev - &pdev->dev + d ...> ptr = - platform_get_drvdata(pdev) + dev_get_drvdata(d) <... when != pdev - &pdev->dev + d ...> Kind regards, Wolfram Wolfram Sang (61): ARM: plat-samsung: simplify getting .drvdata ata: simplify getting .drvdata auxdisplay: simplify getting .drvdata bus: simplify getting .drvdata clk: samsung: simplify getting .drvdata crypto: simplify getting .drvdata dma: simplify getting .drvdata dmaengine: dw: simplify getting .drvdata dmaengine: qcom: simplify getting .drvdata gpio: simplify getting .drvdata gpu: drm: msm: simplify getting .drvdata gpu: drm: msm: adreno: simplify getting .drvdata gpu: drm: msm: disp: mdp5: simplify getting .drvdata gpu: drm: msm: dsi: simplify getting .drvdata gpu: drm: omapdrm: displays: simplify getting .drvdata gpu: drm: vc4: simplify getting .drvdata hid: simplify getting .drvdata iio: common: cros_ec_sensors: simplify getting .drvdata iio: common: hid-sensors: simplify getting .drvdata input: keyboard: simplify getting .drvdata input: misc: simplify getting .drvdata input: mouse: simplify getting .drvdata input: touchscreen: simplify getting .drvdata iommu: simplify getting .drvdata media: platform: am437x: simplify getting .drvdata media: platform: exynos4-is: simplify getting .drvdata media: platform: s5p-mfc: simplify getting .drvdata mmc: host: simplify getting .drvdata mtd: devices: simplify getting .drvdata mtd: nand: onenand: simplify getting .drvdata net: dsa: simplify getting .drvdata net: ethernet: cadence: simplify getting .drvdata net: ethernet: davicom: simplify getting .drvdata net: ethernet: smsc: simplify getting .drvdata net: ethernet: ti: simplify getting .drvdata net: ethernet: wiznet: simplify getting .drvdata perf: simplify getting .drvdata pinctrl: simplify getting .drvdata pinctrl: intel: simplify getting .drvdata platform: x86: simplify getting .drvdata power: supply: simplify getting .drvdata ptp: simplify getting .drvdata pwm: simplify getting .drvdata rtc: simplify getting .drvdata slimbus: simplify getting .drvdata spi: simplify getting .drvdata staging: greybus: simplify getting .drvdata staging: iio: adc: simplify getting .drvdata staging: nvec: simplify getting .drvdata thermal: simplify getting .drvdata thermal: int340x_thermal: simplify getting .drvdata thermal: st: simplify getting .drvdata tty: serial: simplify getting .drvdata uio: simplify getting .drvdata usb: mtu3: simplify getting .drvdata usb: phy: simplify getting .drvdata video: fbdev: simplify getting .drvdata video: fbdev: omap2: omapfb: displays: simplify getting .drvdata watchdog: simplify getting .drvdata net: dsa: simplify getting .drvdata ASoC: atmel: simplify getting .drvdata arch/arm/plat-samsung/adc.c | 3 +- drivers/ata/pata_samsung_cf.c | 8 ++--- drivers/auxdisplay/arm-charlcd.c | 6 ++-- drivers/bus/brcmstb_gisb.c | 12 +++---- drivers/clk/samsung/clk-s3c2410-dclk.c | 6 ++-- drivers/crypto/exynos-rng.c | 6 ++-- drivers/crypto/picoxcell_crypto.c | 6 ++-- drivers/dma/at_hdmac.c | 9 ++--- drivers/dma/at_xdmac.c | 9 ++--- drivers/dma/dw/platform.c | 6 ++-- drivers/dma/fsldma.c | 6 ++-- drivers/dma/idma64.c | 6 ++-- drivers/dma/qcom/hidma.c | 3 +- drivers/dma/qcom/hidma_mgmt_sys.c | 6 ++-- drivers/dma/ste_dma40.c | 12 +++---- drivers/dma/txx9dmac.c | 8 ++--- drivers/gpio/gpio-dwapb.c | 6 ++-- drivers/gpio/gpio-lynxpoint.c | 3 +- drivers/gpio/gpio-omap.c | 12 +++---- drivers/gpio/gpio-tegra.c | 6 ++-- drivers/gpio/gpio-zynq.c | 6 ++-- drivers/gpu/drm/msm/adreno/adreno_device.c | 6 ++-- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 ++-- drivers/gpu/drm/msm/dsi/dsi_host.c | 6 ++-- drivers/gpu/drm/msm/msm_drv.c | 3 +- drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 18 ++++------ drivers/gpu/drm/vc4/vc4_drv.c | 3 +- drivers/hid/hid-sensor-custom.c | 12 +++---- .../common/cros_ec_sensors/cros_ec_sensors_core.c | 6 ++-- .../iio/common/hid-sensors/hid-sensor-trigger.c | 9 ++--- drivers/input/keyboard/ep93xx_keypad.c | 10 +++--- drivers/input/keyboard/imx_keypad.c | 10 +++--- drivers/input/keyboard/lpc32xx-keys.c | 6 ++-- drivers/input/keyboard/matrix_keypad.c | 10 +++--- drivers/input/keyboard/omap4-keypad.c | 10 +++--- drivers/input/keyboard/pmic8xxx-keypad.c | 6 ++-- drivers/input/keyboard/pxa27x_keypad.c | 10 +++--- drivers/input/keyboard/samsung-keypad.c | 12 +++---- drivers/input/keyboard/snvs_pwrkey.c | 10 +++--- drivers/input/keyboard/spear-keyboard.c | 10 +++--- drivers/input/keyboard/st-keyscan.c | 6 ++-- drivers/input/keyboard/tegra-kbc.c | 10 +++--- drivers/input/misc/max77693-haptic.c | 6 ++-- drivers/input/misc/max8997_haptic.c | 3 +- drivers/input/misc/palmas-pwrbutton.c | 6 ++-- drivers/input/misc/regulator-haptic.c | 6 ++-- drivers/input/misc/twl4030-vibra.c | 3 +- drivers/input/misc/twl6040-vibra.c | 3 +- drivers/input/mouse/navpoint.c | 6 ++-- drivers/input/touchscreen/imx6ul_tsc.c | 6 ++-- drivers/iommu/qcom_iommu.c | 6 ++-- drivers/media/platform/am437x/am437x-vpfe.c | 6 ++-- drivers/media/platform/exynos4-is/media-dev.c | 6 ++-- drivers/media/platform/exynos4-is/mipi-csis.c | 6 ++-- drivers/media/platform/s5p-mfc/s5p_mfc.c | 6 ++-- drivers/mmc/host/davinci_mmc.c | 6 ++-- drivers/mmc/host/sdhci-of-arasan.c | 6 ++-- drivers/mmc/host/wmt-sdmmc.c | 6 ++-- drivers/mtd/devices/docg3.c | 3 +- drivers/mtd/nand/onenand/samsung.c | 6 ++-- drivers/net/dsa/bcm_sf2.c | 6 ++-- drivers/net/dsa/qca8k.c | 6 ++-- drivers/net/ethernet/cadence/macb_main.c | 6 ++-- drivers/net/ethernet/davicom/dm9000.c | 6 ++-- drivers/net/ethernet/smsc/smc91x.c | 3 +- drivers/net/ethernet/ti/cpsw.c | 6 ++-- drivers/net/ethernet/ti/davinci_emac.c | 6 ++-- drivers/net/ethernet/wiznet/w5300.c | 6 ++-- drivers/perf/arm_spe_pmu.c | 6 ++-- drivers/pinctrl/intel/pinctrl-baytrail.c | 6 ++-- drivers/pinctrl/intel/pinctrl-cherryview.c | 6 ++-- drivers/pinctrl/intel/pinctrl-intel.c | 6 ++-- drivers/pinctrl/pinctrl-amd.c | 6 ++-- drivers/pinctrl/pinctrl-at91-pio4.c | 6 ++-- drivers/platform/x86/asus-laptop.c | 3 +- drivers/platform/x86/asus-wmi.c | 3 +- drivers/platform/x86/samsung-laptop.c | 3 +- drivers/power/supply/gpio-charger.c | 3 +- drivers/ptp/ptp_dte.c | 6 ++-- drivers/pwm/pwm-atmel-tcb.c | 6 ++-- drivers/pwm/pwm-rcar.c | 3 +- drivers/rtc/rtc-bq4802.c | 6 ++-- drivers/rtc/rtc-ds1216.c | 6 ++-- drivers/rtc/rtc-ds1511.c | 9 ++--- drivers/rtc/rtc-ds1553.c | 15 +++----- drivers/rtc/rtc-ds1685.c | 21 ++++------- drivers/rtc/rtc-ds1742.c | 6 ++-- drivers/rtc/rtc-lpc32xx.c | 16 ++++----- drivers/rtc/rtc-m48t59.c | 41 +++++++++------------- drivers/rtc/rtc-mv.c | 3 +- drivers/rtc/rtc-mxc.c | 21 ++++------- drivers/rtc/rtc-pcap.c | 15 +++----- drivers/rtc/rtc-sh.c | 15 +++----- drivers/rtc/rtc-stk17ta8.c | 15 +++----- drivers/rtc/rtc-test.c | 3 +- drivers/rtc/rtc-zynqmp.c | 10 +++--- drivers/slimbus/qcom-ctrl.c | 6 ++-- drivers/spi/spi-cadence.c | 6 ++-- drivers/spi/spi-zynqmp-gqspi.c | 6 ++-- drivers/staging/greybus/arche-platform.c | 3 +- drivers/staging/iio/adc/ad7606_par.c | 6 ++-- drivers/staging/nvec/nvec.c | 6 ++-- drivers/thermal/int340x_thermal/int3400_thermal.c | 9 ++--- drivers/thermal/rockchip_thermal.c | 8 ++--- drivers/thermal/spear_thermal.c | 8 ++--- drivers/thermal/st/st_thermal.c | 6 ++-- drivers/thermal/zx2967_thermal.c | 6 ++-- drivers/tty/serial/imx.c | 18 ++++------ drivers/tty/serial/qcom_geni_serial.c | 6 ++-- drivers/tty/serial/st-asc.c | 6 ++-- drivers/tty/serial/xilinx_uartps.c | 6 ++-- drivers/uio/uio_fsl_elbc_gpcm.c | 6 ++-- drivers/usb/mtu3/mtu3_plat.c | 6 ++-- drivers/usb/phy/phy-am335x.c | 6 ++-- drivers/video/fbdev/auo_k190x.c | 12 +++---- .../fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 18 ++++------ drivers/video/fbdev/sh_mobile_lcdcfb.c | 6 ++-- drivers/video/fbdev/sh_mobile_meram.c | 6 ++-- drivers/watchdog/cadence_wdt.c | 6 ++-- drivers/watchdog/of_xilinx_wdt.c | 6 ++-- drivers/watchdog/wdat_wdt.c | 6 ++-- net/dsa/legacy.c | 6 ++-- sound/soc/atmel/atmel_ssc_dai.c | 6 ++-- 123 files changed, 319 insertions(+), 607 deletions(-) -- 2.11.0 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 10/61] gpio: simplify getting .drvdata 2018-04-19 14:05 [PATCH 00/61] tree-wide: simplify getting .drvdata Wolfram Sang @ 2018-04-19 14:05 ` Wolfram Sang 2018-04-19 15:14 ` Grygorii Strashko 2018-04-20 7:20 ` Michal Simek 2018-04-19 14:06 ` [PATCH 38/61] pinctrl: " Wolfram Sang 2018-04-19 14:06 ` [PATCH 39/61] pinctrl: intel: " Wolfram Sang 2 siblings, 2 replies; 16+ messages in thread From: Wolfram Sang @ 2018-04-19 14:05 UTC (permalink / raw) To: linux-kernel Cc: Grygorii Strashko, Kevin Hilman, Linus Walleij, Hoan Tran, kernel-janitors, Michal Simek, Jonathan Hunter, linux-renesas-soc, Wolfram Sang, Thierry Reding, linux-gpio, Santosh Shilimkar, linux-tegra, linux-omap, linux-arm-kernel We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- Build tested only. buildbot is happy. Please apply individually. drivers/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 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2018-04-19 14:05 ` [PATCH 10/61] gpio: " Wolfram Sang @ 2018-04-19 15:14 ` Grygorii Strashko 2018-04-30 9:03 ` Linus Walleij 2018-04-20 7:20 ` Michal Simek 1 sibling, 1 reply; 16+ messages in thread From: Grygorii Strashko @ 2018-04-19 15:14 UTC (permalink / raw) To: Wolfram Sang, linux-kernel Cc: linux-renesas-soc, kernel-janitors, Hoan Tran, Linus Walleij, Santosh Shilimkar, Kevin Hilman, Thierry Reding, Jonathan Hunter, Michal Simek, linux-gpio, linux-omap, linux-tegra, linux-arm-kernel 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 <wsa+renesas@sang-engineering.com> > --- > > Build tested only. buildbot is happy. Please apply individually. for gpio-omap.c: Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> > > 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 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2018-04-19 15:14 ` Grygorii Strashko @ 2018-04-30 9:03 ` Linus Walleij 2018-04-30 9:12 ` Wolfram Sang 2018-04-30 9:29 ` Thierry Reding 0 siblings, 2 replies; 16+ messages in thread From: Linus Walleij @ 2018-04-30 9:03 UTC (permalink / raw) To: Grygorii Strashko Cc: Wolfram Sang, linux-kernel@vger.kernel.org, Linux-Renesas, kernel-janitors, Hoan Tran, Santosh Shilimkar, Kevin Hilman, Thierry Reding, Jonathan Hunter, Michal Simek, open list:GPIO SUBSYSTEM, Linux-OMAP, linux-tegra, Linux ARM On Thu, Apr 19, 2018 at 5:14 PM, Grygorii Strashko <grygorii.strashko@ti.com> 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 <wsa+renesas@sang-engineering.com> >> --- >> >> Build tested only. buildbot is happy. Please apply individually. > > > for gpio-omap.c: > Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> 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 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2018-04-30 9:03 ` Linus Walleij @ 2018-04-30 9:12 ` Wolfram Sang 2018-04-30 9:29 ` Thierry Reding 1 sibling, 0 replies; 16+ messages in thread From: Wolfram Sang @ 2018-04-30 9:12 UTC (permalink / raw) To: Linus Walleij Cc: Grygorii Strashko, Wolfram Sang, linux-kernel@vger.kernel.org, Linux-Renesas, kernel-janitors, Hoan Tran, Santosh Shilimkar, Kevin Hilman, Thierry Reding, Jonathan Hunter, Michal Simek, open list:GPIO SUBSYSTEM, Linux-OMAP, linux-tegra, Linux ARM [-- Attachment #1: Type: text/plain, Size: 205 bytes --] > 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/ [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2018-04-30 9:03 ` Linus Walleij 2018-04-30 9:12 ` Wolfram Sang @ 2018-04-30 9:29 ` Thierry Reding 2019-03-07 20:13 ` Adam Ford 1 sibling, 1 reply; 16+ messages in thread From: Thierry Reding @ 2018-04-30 9:29 UTC (permalink / raw) To: Linus Walleij Cc: Grygorii Strashko, Wolfram Sang, linux-kernel@vger.kernel.org, Linux-Renesas, kernel-janitors, Hoan Tran, Santosh Shilimkar, Kevin Hilman, Jonathan Hunter, Michal Simek, open list:GPIO SUBSYSTEM, Linux-OMAP, linux-tegra, Linux ARM [-- Attachment #1: Type: text/plain, Size: 912 bytes --] On Mon, Apr 30, 2018 at 11:03:25AM +0200, Linus Walleij wrote: > On Thu, Apr 19, 2018 at 5:14 PM, Grygorii Strashko > <grygorii.strashko@ti.com> 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 <wsa+renesas@sang-engineering.com> > >> --- > >> > >> Build tested only. buildbot is happy. Please apply individually. > > > > > > for gpio-omap.c: > > Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> > > 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 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2018-04-30 9:29 ` Thierry Reding @ 2019-03-07 20:13 ` Adam Ford 2019-03-07 20:18 ` Wolfram Sang 0 siblings, 1 reply; 16+ messages in thread From: Adam Ford @ 2019-03-07 20:13 UTC (permalink / raw) To: Thierry Reding Cc: Linus Walleij, Grygorii Strashko, Wolfram Sang, linux-kernel@vger.kernel.org, Linux-Renesas, kernel-janitors, Hoan Tran, Santosh Shilimkar, Kevin Hilman, Jonathan Hunter, Michal Simek, open list:GPIO SUBSYSTEM, Linux-OMAP, linux-tegra, Linux ARM On Mon, Apr 30, 2018 at 4:30 AM Thierry Reding <thierry.reding@gmail.com> 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 > > <grygorii.strashko@ti.com> 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 <wsa+renesas@sang-engineering.com> > > >> --- > > >> > > >> Build tested only. buildbot is happy. Please apply individually. > > > > > > > > > for gpio-omap.c: > > > Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> > > > > 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 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2019-03-07 20:13 ` Adam Ford @ 2019-03-07 20:18 ` Wolfram Sang 2019-03-07 20:53 ` Enrico Weigelt, metux IT consult 0 siblings, 1 reply; 16+ messages in thread From: Wolfram Sang @ 2019-03-07 20:18 UTC (permalink / raw) To: Adam Ford Cc: Thierry Reding, Linus Walleij, Grygorii Strashko, Wolfram Sang, linux-kernel@vger.kernel.org, Linux-Renesas, kernel-janitors, Hoan Tran, Santosh Shilimkar, Kevin Hilman, Jonathan Hunter, Michal Simek, open list:GPIO SUBSYSTEM, Linux-OMAP, linux-tegra, Linux ARM [-- Attachment #1: Type: text/plain, Size: 166 bytes --] > 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. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2019-03-07 20:18 ` Wolfram Sang @ 2019-03-07 20:53 ` Enrico Weigelt, metux IT consult 2019-03-07 20:58 ` Wolfram Sang 0 siblings, 1 reply; 16+ messages in thread From: Enrico Weigelt, metux IT consult @ 2019-03-07 20:53 UTC (permalink / raw) To: Wolfram Sang, Adam Ford Cc: Grygorii Strashko, Kevin Hilman, Linus Walleij, Hoan Tran, kernel-janitors, linux-kernel@vger.kernel.org, Jonathan Hunter, Linux-Renesas, Wolfram Sang, Thierry Reding, open list:GPIO SUBSYSTEM, Santosh Shilimkar, linux-tegra, Linux-OMAP, Michal Simek, Linux ARM 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 info@metux.net -- +49-151-27565287 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2019-03-07 20:53 ` Enrico Weigelt, metux IT consult @ 2019-03-07 20:58 ` Wolfram Sang 2019-03-19 14:31 ` Wolfram Sang 0 siblings, 1 reply; 16+ messages in thread From: Wolfram Sang @ 2019-03-07 20:58 UTC (permalink / raw) To: Enrico Weigelt, metux IT consult Cc: Adam Ford, Thierry Reding, Linus Walleij, Grygorii Strashko, Wolfram Sang, linux-kernel@vger.kernel.org, Linux-Renesas, kernel-janitors, Hoan Tran, Santosh Shilimkar, Kevin Hilman, Jonathan Hunter, Michal Simek, open list:GPIO SUBSYSTEM, Linux-OMAP, linux-tegra, Linux ARM [-- Attachment #1: Type: text/plain, Size: 483 bytes --] 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. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2019-03-07 20:58 ` Wolfram Sang @ 2019-03-19 14:31 ` Wolfram Sang 0 siblings, 0 replies; 16+ messages in thread From: Wolfram Sang @ 2019-03-19 14:31 UTC (permalink / raw) To: Enrico Weigelt, metux IT consult Cc: Adam Ford, Thierry Reding, Linus Walleij, Grygorii Strashko, Wolfram Sang, linux-kernel@vger.kernel.org, Linux-Renesas, kernel-janitors, Hoan Tran, Santosh Shilimkar, Kevin Hilman, Jonathan Hunter, Michal Simek, open list:GPIO SUBSYSTEM, Linux-OMAP, linux-tegra, Linux ARM [-- Attachment #1: Type: text/plain, Size: 1146 bytes --] 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 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2018-04-19 14:05 ` [PATCH 10/61] gpio: " Wolfram Sang 2018-04-19 15:14 ` Grygorii Strashko @ 2018-04-20 7:20 ` Michal Simek 2018-04-21 16:23 ` Wolfram Sang 1 sibling, 1 reply; 16+ messages in thread From: Michal Simek @ 2018-04-20 7:20 UTC (permalink / raw) To: Wolfram Sang, linux-kernel Cc: linux-renesas-soc, kernel-janitors, Hoan Tran, Linus Walleij, Grygorii Strashko, Santosh Shilimkar, Kevin Hilman, Thierry Reding, Jonathan Hunter, Michal Simek, linux-gpio, linux-omap, linux-tegra, linux-arm-kernel 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 <wsa+renesas@sang-engineering.com> > --- > > 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 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2018-04-20 7:20 ` Michal Simek @ 2018-04-21 16:23 ` Wolfram Sang 2018-04-23 6:04 ` Michal Simek 0 siblings, 1 reply; 16+ messages in thread From: Wolfram Sang @ 2018-04-21 16:23 UTC (permalink / raw) To: Michal Simek Cc: Wolfram Sang, linux-kernel, linux-renesas-soc, kernel-janitors, Hoan Tran, Linus Walleij, Grygorii Strashko, Santosh Shilimkar, Kevin Hilman, Thierry Reding, Jonathan Hunter, linux-gpio, linux-omap, linux-tegra, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 852 bytes --] 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. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 10/61] gpio: simplify getting .drvdata 2018-04-21 16:23 ` Wolfram Sang @ 2018-04-23 6:04 ` Michal Simek 0 siblings, 0 replies; 16+ messages in thread From: Michal Simek @ 2018-04-23 6:04 UTC (permalink / raw) To: Wolfram Sang, Michal Simek Cc: Wolfram Sang, linux-kernel, linux-renesas-soc, kernel-janitors, Hoan Tran, Linus Walleij, Grygorii Strashko, Santosh Shilimkar, Kevin Hilman, Thierry Reding, Jonathan Hunter, linux-gpio, linux-omap, linux-tegra, linux-arm-kernel 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 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 38/61] pinctrl: simplify getting .drvdata 2018-04-19 14:05 [PATCH 00/61] tree-wide: simplify getting .drvdata Wolfram Sang 2018-04-19 14:05 ` [PATCH 10/61] gpio: " Wolfram Sang @ 2018-04-19 14:06 ` Wolfram Sang 2018-04-19 14:06 ` [PATCH 39/61] pinctrl: intel: " Wolfram Sang 2 siblings, 0 replies; 16+ messages in thread From: Wolfram Sang @ 2018-04-19 14:06 UTC (permalink / raw) To: linux-kernel Cc: linux-renesas-soc, kernel-janitors, Wolfram Sang, Linus Walleij, Ludovic Desroches, Nicolas Ferre, Alexandre Belloni, linux-gpio, linux-arm-kernel We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- Build tested only. buildbot is happy. Please apply individually. drivers/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 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 39/61] pinctrl: intel: simplify getting .drvdata 2018-04-19 14:05 [PATCH 00/61] tree-wide: simplify getting .drvdata Wolfram Sang 2018-04-19 14:05 ` [PATCH 10/61] gpio: " Wolfram Sang 2018-04-19 14:06 ` [PATCH 38/61] pinctrl: " Wolfram Sang @ 2018-04-19 14:06 ` Wolfram Sang 2 siblings, 0 replies; 16+ messages in thread From: Wolfram Sang @ 2018-04-19 14:06 UTC (permalink / raw) To: linux-kernel Cc: linux-renesas-soc, kernel-janitors, Wolfram Sang, Mika Westerberg, Heikki Krogerus, Linus Walleij, linux-gpio We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- Build tested only. buildbot is happy. Please apply individually. drivers/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 ^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2019-03-19 14:31 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-04-19 14:05 [PATCH 00/61] tree-wide: simplify getting .drvdata Wolfram Sang 2018-04-19 14:05 ` [PATCH 10/61] gpio: " Wolfram Sang 2018-04-19 15:14 ` Grygorii Strashko 2018-04-30 9:03 ` Linus Walleij 2018-04-30 9:12 ` Wolfram Sang 2018-04-30 9:29 ` Thierry Reding 2019-03-07 20:13 ` Adam Ford 2019-03-07 20:18 ` Wolfram Sang 2019-03-07 20:53 ` Enrico Weigelt, metux IT consult 2019-03-07 20:58 ` Wolfram Sang 2019-03-19 14:31 ` Wolfram Sang 2018-04-20 7:20 ` Michal Simek 2018-04-21 16:23 ` Wolfram Sang 2018-04-23 6:04 ` Michal Simek 2018-04-19 14:06 ` [PATCH 38/61] pinctrl: " Wolfram Sang 2018-04-19 14:06 ` [PATCH 39/61] pinctrl: intel: " Wolfram Sang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).