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

2018-04-19 Thread Viresh Kumar
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 
> ---
> 
> 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 

-- 
viresh


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

2018-04-19 Thread Viresh Kumar
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 
> ---
> 
> 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 

-- 
viresh


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

2018-04-19 Thread Darren Hart
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 

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


Re: [PATCH/RFC 0/2] regulator: bd9571mwv: Add support for toggle power switches

2018-04-19 Thread Pavel Machek
On Wed 2018-04-18 15:00:41, Mark Brown wrote:
> On Wed, Apr 18, 2018 at 03:29:36PM +0200, Geert Uytterhoeven wrote:
> 
> > Any comments/suggestions?
> 
> > In case you lost the patches from the thread:
> > https://www.spinics.net/lists/linux-renesas-soc/msg24955.html
> 
> Please don't send content free pings and please allow a reasonable time
> for review.  People get busy, go on holiday, attend conferences and so 
> on so unless there is some reason for urgency (like critical bug fixes)
> please allow at least a couple of weeks for review.  If there have been
> review comments then people may be waiting for those to be

If I follow the logs right, there was one month before ping. That
seems pretty reasonable time.

> Sending content free pings adds to the mail volume (if they are seen at
> all) which is often the problem and since they can't be reviewed

Yep, and sending content free complains about pings also adds to the
main volume :-(.

Anyway, last time I sent you a patch... you _had_ time to complain
that I'm pinging too often, but you apparently did not have time to
look at the patch. That patch would have been in time for v4.16-rc1
IIRC.

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH] mmc: renesas_sdhi_internal_dmac: add R8A77980 to whitelist

2018-04-19 Thread Wolfram Sang
On Thu, Apr 19, 2018 at 11:07:44PM +0300, Sergei Shtylyov wrote:
> I've successfully tested eMMC on R8A77980/Condor. R8A77980 has a single
> SDHI core anyway, so can't be a subject of the known RX DMA errata...

Lucky you ;)

> Signed-off-by: Sergei Shtylyov 

Reviewed-by: Wolfram Sang 



signature.asc
Description: PGP signature


[PATCH] mmc: renesas_sdhi_internal_dmac: add R8A77980 to whitelist

2018-04-19 Thread Sergei Shtylyov
I've successfully tested eMMC on R8A77980/Condor. R8A77980 has a single
SDHI core anyway, so can't be a subject of the known RX DMA errata...

Signed-off-by: Sergei Shtylyov 

---
This patch is against the 'next' branch of Ulf Hansson's 'mmc.git' repo.

 drivers/mmc/host/renesas_sdhi_internal_dmac.c |1 +
 1 file changed, 1 insertion(+)

Index: mmc/drivers/mmc/host/renesas_sdhi_internal_dmac.c
===
--- mmc.orig/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ mmc/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -276,6 +276,7 @@ static const struct soc_device_attribute
/* generic ones */
{ .soc_id = "r8a7795" },
{ .soc_id = "r8a7796" },
+   { .soc_id = "r8a77980" },
{ .soc_id = "r8a77995" },
{ /* sentinel */ }
 };


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

2018-04-19 Thread Guenter Roeck
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 

Reviewed-by: Guenter Roeck 

> ---
> 
> 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(>cdns_wdt_device)) {
>   cdns_wdt_stop(>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(>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(>xilinx_wdt_wdd))
>   xilinx_wdt_stop(>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(>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(>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(>wdd))
> -- 
> 2.11.0
> 


[PATCH v3] pinctrl: sh-pfc: r8a77970: fix pin I/O voltage control support

2018-04-19 Thread Sergei Shtylyov
I've included the pin I/O voltage control into the R8A77970 PFC driver but
it was incomplete because:
- SH_PFC_PIN_CFG_IO_VOLTAGE pin flags weren't set properly;
- sh_pfc_soc_info::ioctrl_regs wasn't set at all...

Fixes: b92ac66a1819 ("pinctrl: sh-pfc: Add R8A77970 PFC support")
Signed-off-by: Sergei Shtylyov 

---
The patch is against the 'sh-pfc' branch of Geert's 'renesas-drivers.git' repo.

Changes in version 3:
- removed IOCTRL40 from *enum* ioctrl_regs and its address from
  pinmux_ioctrl_regs[].

Changes in version 2:
- fixed the commit SHA1 in the "Fixes:" tag.

 drivers/pinctrl/sh-pfc/pfc-r8a77970.c |   32 
 1 file changed, 24 insertions(+), 8 deletions(-)

Index: renesas-drivers/drivers/pinctrl/sh-pfc/pfc-r8a77970.c
===
--- renesas-drivers.orig/drivers/pinctrl/sh-pfc/pfc-r8a77970.c
+++ renesas-drivers/drivers/pinctrl/sh-pfc/pfc-r8a77970.c
@@ -21,13 +21,15 @@
 #include "core.h"
 #include "sh_pfc.h"
 
+#define CFG_FLAGS SH_PFC_PIN_CFG_DRIVE_STRENGTH
+
 #define CPU_ALL_PORT(fn, sfx)  \
-   PORT_GP_CFG_22(0, fn, sfx, SH_PFC_PIN_CFG_DRIVE_STRENGTH),  \
-   PORT_GP_CFG_28(1, fn, sfx, SH_PFC_PIN_CFG_DRIVE_STRENGTH),  \
-   PORT_GP_CFG_17(2, fn, sfx, SH_PFC_PIN_CFG_DRIVE_STRENGTH),  \
-   PORT_GP_CFG_17(3, fn, sfx, SH_PFC_PIN_CFG_DRIVE_STRENGTH),  \
-   PORT_GP_CFG_6(4, fn, sfx, SH_PFC_PIN_CFG_DRIVE_STRENGTH),   \
-   PORT_GP_CFG_15(5, fn, sfx, SH_PFC_PIN_CFG_DRIVE_STRENGTH)
+   PORT_GP_CFG_22(0, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE), \
+   PORT_GP_CFG_28(1, fn, sfx, CFG_FLAGS),  \
+   PORT_GP_CFG_17(2, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE), \
+   PORT_GP_CFG_17(3, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE), \
+   PORT_GP_CFG_6(4,  fn, sfx, CFG_FLAGS),  \
+   PORT_GP_CFG_15(5, fn, sfx, CFG_FLAGS)
 /*
  * F_() : just information
  * FM() : macro for FN_xxx / xxx_MARK
@@ -2382,18 +2384,31 @@ static const struct pinmux_cfg_reg pinmu
{ },
 };
 
+enum ioctrl_regs {
+   IOCTRL30,
+   IOCTRL31,
+   IOCTRL32,
+};
+
+static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
+   [IOCTRL30] = { 0xe6060380 },
+   [IOCTRL31] = { 0xe6060384 },
+   [IOCTRL32] = { 0xe6060388 },
+   { /* sentinel */ },
+};
+
 static int r8a77970_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
   u32 *pocctrl)
 {
int bit = pin & 0x1f;
 
-   *pocctrl = 0xe6060380;
+   *pocctrl = pinmux_ioctrl_regs[IOCTRL30].reg;
if (pin >= RCAR_GP_PIN(0, 0) && pin <= RCAR_GP_PIN(0, 21))
return bit;
if (pin >= RCAR_GP_PIN(2, 0) && pin <= RCAR_GP_PIN(2, 9))
return bit + 22;
 
-   *pocctrl += 4;
+   *pocctrl = pinmux_ioctrl_regs[IOCTRL31].reg;
if (pin >= RCAR_GP_PIN(2, 10) && pin <= RCAR_GP_PIN(2, 16))
return bit - 10;
if (pin >= RCAR_GP_PIN(3, 0) && pin <= RCAR_GP_PIN(3, 16))
@@ -2421,6 +2436,7 @@ const struct sh_pfc_soc_info r8a77970_pi
.nr_functions = ARRAY_SIZE(pinmux_functions),
 
.cfg_regs = pinmux_config_regs,
+   .ioctrl_regs = pinmux_ioctrl_regs,
 
.pinmux_data = pinmux_data,
.pinmux_data_size = ARRAY_SIZE(pinmux_data),


[PATCH v2] pinctrl: sh-pfc: r8a77980: add pin I/O voltage control support

2018-04-19 Thread Sergei Shtylyov
Add the pin I/O voltage level control support to the R8A77980 PFC driver.

Loosely based on the original (and large) patch by Vladimir Barinov.

Signed-off-by: Vladimir Barinov 
Signed-off-by: Sergei Shtylyov 
Reviewed-by: Geert Uytterhoeven 

---
The patch is against the 'sh-pfc' branch of Geert's 'renesas-drivers.git' repo.

Changes in version 2:
- added IOCTRL33 to *enum* ioctrl_regs and its address to pinmux_ioctrl_regs[];
- fixed the subject;
- added Geert's tag.

 drivers/pinctrl/sh-pfc/pfc-r8a77980.c |   52 --
 1 file changed, 49 insertions(+), 3 deletions(-)

Index: renesas-drivers/drivers/pinctrl/sh-pfc/pfc-r8a77980.c
===
--- renesas-drivers.orig/drivers/pinctrl/sh-pfc/pfc-r8a77980.c
+++ renesas-drivers/drivers/pinctrl/sh-pfc/pfc-r8a77980.c
@@ -19,10 +19,10 @@
 #include "sh_pfc.h"
 
 #define CPU_ALL_PORT(fn, sfx)  \
-   PORT_GP_22(0, fn, sfx), \
+   PORT_GP_CFG_22(0, fn, sfx, SH_PFC_PIN_CFG_IO_VOLTAGE),  \
PORT_GP_28(1, fn, sfx), \
-   PORT_GP_30(2, fn, sfx), \
-   PORT_GP_17(3, fn, sfx), \
+   PORT_GP_CFG_30(2, fn, sfx, SH_PFC_PIN_CFG_IO_VOLTAGE),  \
+   PORT_GP_CFG_17(3, fn, sfx, SH_PFC_PIN_CFG_IO_VOLTAGE), \
PORT_GP_25(4, fn, sfx), \
PORT_GP_15(5, fn, sfx)
 
@@ -2779,8 +2779,53 @@ static const struct pinmux_cfg_reg pinmu
{ },
 };
 
+enum ioctrl_regs {
+   IOCTRL30,
+   IOCTRL31,
+   IOCTRL32,
+   IOCTRL33,
+};
+
+static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
+   [IOCTRL30] = { 0xe6060380, },
+   [IOCTRL31] = { 0xe6060384, },
+   [IOCTRL32] = { 0xe6060388, },
+   [IOCTRL33] = { 0xe606038c, },
+   { /* sentinel */ },
+};
+
+static int r8a77980_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
+  u32 *pocctrl)
+{
+   int bit = pin & 0x1f;
+
+   *pocctrl = pinmux_ioctrl_regs[IOCTRL30].reg;
+   if (pin >= RCAR_GP_PIN(0, 0) && pin <= RCAR_GP_PIN(0, 21))
+   return bit;
+   else if (pin >= RCAR_GP_PIN(2, 0) && pin <= RCAR_GP_PIN(2, 9))
+   return bit + 22;
+
+   *pocctrl = pinmux_ioctrl_regs[IOCTRL31].reg;
+   if (pin >= RCAR_GP_PIN(2, 10) && pin <= RCAR_GP_PIN(2, 16))
+   return bit - 10;
+   if ((pin >= RCAR_GP_PIN(2, 17) && pin <= RCAR_GP_PIN(2, 24)) ||
+   (pin >= RCAR_GP_PIN(3,  0) && pin <= RCAR_GP_PIN(3, 16)))
+   return bit + 7;
+
+   *pocctrl = pinmux_ioctrl_regs[IOCTRL32].reg;
+   if (pin >= RCAR_GP_PIN(2, 25) && pin <= RCAR_GP_PIN(2, 29))
+   return pin - 25;
+
+   return -EINVAL;
+}
+
+static const struct sh_pfc_soc_operations pinmux_ops = {
+   .pin_to_pocctrl = r8a77980_pin_to_pocctrl,
+};
+
 const struct sh_pfc_soc_info r8a77980_pinmux_info = {
.name = "r8a77980_pfc",
+   .ops = _ops,
.unlock_reg = 0xe606, /* PMMR */
 
.function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
@@ -2793,6 +2838,7 @@ const struct sh_pfc_soc_info r8a77980_pi
.nr_functions = ARRAY_SIZE(pinmux_functions),
 
.cfg_regs = pinmux_config_regs,
+   .ioctrl_regs = pinmux_ioctrl_regs,
 
.pinmux_data = pinmux_data,
.pinmux_data_size = ARRAY_SIZE(pinmux_data),


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

2018-04-19 Thread Uwe Kleine-König
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 
> ---
> 
> 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 

Thanks Wolfram for going through this
Uwe


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


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

2018-04-19 Thread Sergei Shtylyov
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 
[...]

MBR, Sergei


Re: [PATCH v2] pinctrl: sh-pfc: r8a77970: fix pin I/O voltage control support

2018-04-19 Thread Sergei Shtylyov
On 04/19/2018 04:06 PM, Geert Uytterhoeven wrote:

>> I've included the pin I/O voltage control into the R8A77970 PFC driver but
>> it was incomplete because:
>> - SH_PFC_PIN_CFG_IO_VOLTAGE pin flags weren't set properly;
>> - sh_pfc_soc_info::ioctrl_regs wasn't set at all...
> 
> Thanks for your patch!
> 
>> Fixes: b92ac66a1819 ("pinctrl: sh-pfc: Add R8A77970 PFC support")
>> Signed-off-by: Sergei Shtylyov 
> 
> Reviewed-by: Geert Uytterhoeven 
> 
> Minor nit below...

   Not sure which of your multiple comments was this nit... :-)

>> --- renesas-drivers.orig/drivers/pinctrl/sh-pfc/pfc-r8a77970.c
>> +++ renesas-drivers/drivers/pinctrl/sh-pfc/pfc-r8a77970.c
> 
>> @@ -2382,18 +2384,33 @@ static const struct pinmux_cfg_reg pinmu
>> { },
>>  };
>>
>> +enum ioctrl_regs {
>> +   IOCTRL30,
>> +   IOCTRL31,
>> +   IOCTRL32,
>> +   IOCTRL40,
> 
> Note for the future: unlike all other current pocctrl handling, IOCTRL32
> is used to select between 2.5V and 3.3V (instead of 1.8V and 3.3V).

   It also controls a group of pins instead of the individual pins, doesn't it?

> Handling that will require changes to the r8a77980_pin_to_pocctrl()

   I'm afraid we'd need a new method, other than pin_to_pocctrl...

> interface (add two output parameters returning supported voltages?).
> 
>> +   IOCTRL40,
> 
> That's TDSEL, and thus not related to I/O voltage.

   It's still an IOCTRL register, no?

> But I agree it should be saved during suspend/resume. ;-)

   You mean we shouldn't use the sh_pfc_soc_info::ioctrl_regs mechanism for it?

> Gr{oetje,eeting}s,
> 
> Geert

MBR, Sergei


Re: [PATCH v2] pinctrl: sh-pfc: r8a77970: fix pin I/O voltage control support

2018-04-19 Thread Sergei Shtylyov
On 04/19/2018 04:06 PM, Geert Uytterhoeven wrote:

>> I've included the pin I/O voltage control into the R8A77970 PFC driver but
>> it was incomplete because:
>> - SH_PFC_PIN_CFG_IO_VOLTAGE pin flags weren't set properly;
>> - sh_pfc_soc_info::ioctrl_regs wasn't set at all...
> 
> Thanks for your patch!
> 
>> Fixes: b92ac66a1819 ("pinctrl: sh-pfc: Add R8A77970 PFC support")
>> Signed-off-by: Sergei Shtylyov 
> 
> Reviewed-by: Geert Uytterhoeven 
> 
> Minor nit below...

   Not sure which of your multiple comments was this nit... :-)

>> --- renesas-drivers.orig/drivers/pinctrl/sh-pfc/pfc-r8a77970.c
>> +++ renesas-drivers/drivers/pinctrl/sh-pfc/pfc-r8a77970.c
> 
>> @@ -2382,18 +2384,33 @@ static const struct pinmux_cfg_reg pinmu
>> { },
>>  };
>>
>> +enum ioctrl_regs {
>> +   IOCTRL30,
>> +   IOCTRL31,
>> +   IOCTRL32,
>> +   IOCTRL40,
> 
> Note for the future: unlike all other current pocctrl handling, IOCTRL32
> is used to select between 2.5V and 3.3V (instead of 1.8V and 3.3V).

   It also controls a group of pins instead of the individual pins, isn't it?

> Handling that will require changes to the r8a77980_pin_to_pocctrl()

   I'm afraid we'd need a new method, other than pin_to_pocctrl...

> interface (add two output parameters returning supported voltages?).
> 
>> +   IOCTRL40,
> 
> That's TDSEL, and thus not related to I/O voltage.

   It's still an IOCTRL register, no?

> But I agree it should be saved during suspend/resume. ;-)

   You mean we shouldn't use the sh_pfc_soc_info::ioctrl_regs mechanism for it?

> Gr{oetje,eeting}s,
> 
> Geert

MBR, Sergei


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

2018-04-19 Thread Sinan Kaya
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 
> ---
> 
> 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 

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


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

2018-04-19 Thread Grygorii Strashko



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

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


for gpio-omap.c:
Reviewed-by: Grygorii Strashko 


  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= >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= >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 

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

2018-04-19 Thread Grygorii Strashko



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

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


Reviewed-by: Grygorii Strashko 

--
regards,
-grygorii


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

2018-04-19 Thread Miguel Ojeda
[CC'ing Linus W.]

On Thu, Apr 19, 2018 at 4: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 

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
>


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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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(>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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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

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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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(>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, );
@@ -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



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

2018-04-19 Thread Wolfram Sang
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  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
-   >dev
+   d
...>

ptr =
-   platform_get_drvdata(pdev)
+   dev_get_drvdata(d)

<... when != 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 ++---
 

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

2018-04-19 Thread 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 
---

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 = >vblank_ctrl;
-- 
2.11.0



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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= >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= >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 

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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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(>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(>lock);
-- 
2.11.0



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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(_dev->mutex);
@@ -198,7 +197,7 @@ static int ep93xx_keypad_suspend(struct device *dev)
 
mutex_unlock(_dev->mutex);
 
-   if (device_may_wakeup(>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(>dev))
+   if (device_may_wakeup(dev))
disable_irq_wake(keypad->irq);
 
mutex_lock(_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(_dev->mutex);
 
-   if (device_may_wakeup(>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(>dev))
+   if (device_may_wakeup(dev))
disable_irq_wake(kbd->irq);
 
mutex_lock(_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(>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;
 

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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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(>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(>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(>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 

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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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 = >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 = >ccdc;
 
/* if streaming has not started we don't care */
-- 
2.11.0



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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(>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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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(>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(>mutex);
-- 
2.11.0



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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(_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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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, _pmu->supported_cpus);
 }
-- 
2.11.0



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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 == _attr_performance_level.attr)
-- 
2.11.0



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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(_pdata->platform_state_mutex);
-- 
2.11.0



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

2018-04-19 Thread 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 
---

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;
 

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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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 = _pwm->chip;
 
return >pwms[0];
-- 
2.11.0



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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(>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(>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



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

2018-04-19 Thread 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 
---

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 = >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 = >lbc->bank[priv->bank];
unsigned long val;
-- 
2.11.0



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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(_uart_uart_driver, >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(_uart_uart_driver, >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(_uart_uart_driver, >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 = >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 = >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(_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(_uart_driver, port);
 }
diff 

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

2018-04-19 Thread 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 
---

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(>cdns_wdt_device)) {
cdns_wdt_stop(>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(>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(>xilinx_wdt_wdd))
xilinx_wdt_stop(>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(>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(>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(>wdd))
-- 
2.11.0



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

2018-04-19 Thread 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 
---

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(>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(>lock);
-- 
2.11.0



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

2018-04-19 Thread 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 
---

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



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

2018-04-19 Thread 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 
---

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, _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



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

2018-04-19 Thread 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 
---

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



Re: [PATCH v2 1/2] pinctrl: sh-pfc: Add r8a77470 PFC support

2018-04-19 Thread Geert Uytterhoeven
Hi Biju,

On Thu, Apr 19, 2018 at 3:48 PM, Biju Das  wrote:
>> On Tue, Apr 17, 2018 at 11:07 AM, Biju Das 
>> wrote:
>> >> Subject: Re: [PATCH v2 1/2] pinctrl: sh-pfc: Add r8a77470 PFC support
>> >> On Wed, Apr 4, 2018 at 5:22 PM, Biju Das 
>> wrote:
>> >> > Add PFC support for the R8A77470 SoC including pin groups for some
>> >> > on-chip devices such as SCIF, AVB and MMC.
>> >> >
>> >> > Signed-off-by: Biju Das 
>> >> > Reviewed-by: Fabrizio Castro 
>>
>> >> > --- /dev/null
>> >> > +++ b/drivers/pinctrl/sh-pfc/pfc-r8a77470.c
>>
>> >> > +/* - AVB
>> >> > +--
>> >> > +-- */ static const
>> >> unsigned int avb_link_pins[] = {
>> >> > +   RCAR_GP_PIN(5, 14),
>> >> > +};
>> >> > +static const unsigned int avb_link_mux[] = {
>> >> > +   AVB_LINK_MARK,
>> >> > +};
>> >> > +static const unsigned int avb_magic_pins[] = {
>> >> > +   RCAR_GP_PIN(5, 15),
>> >> > +};
>> >> > +static const unsigned int avb_magic_mux[] = {
>> >> > +   AVB_MAGIC_MARK,
>> >> > +};
>> >> > +static const unsigned int avb_phy_int_pins[] = {
>> >> > +   RCAR_GP_PIN(5, 16),
>> >> > +};
>> >> > +static const unsigned int avb_phy_int_mux[] = {
>> >> > +   AVB_PHY_INT_MARK,
>> >> > +};
>> >> > +static const unsigned int avb_mdio_pins[] = {
>> >> > +   RCAR_GP_PIN(5, 12), RCAR_GP_PIN(5, 13), }; static const
>> >> > +unsigned int avb_mdio_mux[] = {
>> >> > +   AVB_MDC_MARK, AVB_MDIO_MARK, }; static const unsigned int
>> >> > +avb_mii_pins[] = {
>> >> > +   RCAR_GP_PIN(3, 14), RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16),
>> >> > +   RCAR_GP_PIN(3, 27),
>> >> > +
>> >> > +   RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 4),
>> >> > +   RCAR_GP_PIN(3, 5),
>> >> > +
>> >> > +   RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 0), RCAR_GP_PIN(3, 1),
>> >> > +   RCAR_GP_PIN(5, 17), RCAR_GP_PIN(3, 13), RCAR_GP_PIN(5, 23),
>> >> > +   RCAR_GP_PIN(3, 12),
>> >> > +};
>> >> > +static const unsigned int avb_mii_mux[] = {
>> >> > +   AVB_TXD0_MARK, AVB_TXD1_MARK, AVB_TXD2_MARK,
>> >> > +   AVB_TXD3_MARK,
>> >> > +
>> >> > +   AVB_RXD0_MARK, AVB_RXD1_MARK, AVB_RXD2_MARK,
>> >> > +   AVB_RXD3_MARK,
>> >> > +
>> >> > +   AVB_RX_ER_MARK, AVB_RX_CLK_MARK, AVB_RX_DV_MARK,
>> >> > +   AVB_CRS_MARK, AVB_TX_EN_MARK, AVB_TX_ER_MARK,
>> >> > +   AVB_TX_CLK_MARK,
>> >>
>> >> You forgot AVB_COL, which is GP5_18?
>> >
>> > GP5_18 is shred between the signals AVB_COL and VI0_CLK. As per the
>> > RZ/G1C board schematic /hardware user guide Ethernet Phy collision
>> > pin(AVB_COL) pin  is not populated on this board by default. It is 
>> > populated
>> only for Video Input Channel0 pixel clock.
>> >
>> > Since it is initial submission, I thought of adding only board
>> > specific pins first and later add this collision pin alone as a
>> > separate pin entry  in the avb group. That way we can support existing
>> board as well as any future RZ/G1C board which populates this pin. Are you
>> ok for this approach?
>>
>> Oops. That means our grouping is suboptimal. Perhaps we should revisit (for
>> all SoCs, while keeping backwards compatibility)?
>>
>> After reading some wikipedia, I came up with:
>>
>> mii_tx
>> mii_tx_er (optional)
>> mii_rx
>> mii_col_crs (optional, half duplex)
>>
>> However, given your board uses AVB_CRS without AVB_COL, that would still
>> not be sufficient, so the last group should be split to cover your use case?
>
> Ok I agree to your point. What about splitting the last group " mii_col_crs"  
> to "mii_col" and  "mii_crs" as separate groups .
> Since this pins are only meaning full in half duplex 
> mode(https://en.wikipedia.org/wiki/Media-independent_interface)

Sounds fine to me.
As COL and CRS are the same for MII and GMII, they can just be named
avb_col_pins resp. avb_crs_pins.

BTW, Sergei, what's your opinion?

>> BTW, how does it work with AVB_COL not wired to anything by default, and
>> thus floating? Do you enable pull-up/down for that pin in the PFC, or is the
>> pin just ignored in full-duplex mode?
>
> Since it is unwired, the pin is in GPIO mode, high impedance state(ZU) with 
> initial state is pull-up "on" in the PFC.

OK. But as soon as the VIN is used, it will no longer be configured as GPIO...

>> >> > +};
>> >> > +static const unsigned int avb_gmii_pins[] = {
>> >> > +   RCAR_GP_PIN(3, 14), RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16),
>> >> > +   RCAR_GP_PIN(3, 27), RCAR_GP_PIN(3, 28), RCAR_GP_PIN(3, 29),
>> >> > +   RCAR_GP_PIN(4, 0), RCAR_GP_PIN(5, 22),
>> >> > +
>> >> > +   RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 4),
>> >> > +   RCAR_GP_PIN(3, 5), RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
>> >> > +   RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
>> >> > +
>> >> > +   RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 0), RCAR_GP_PIN(3, 1),

RE: [PATCH v2 1/2] pinctrl: sh-pfc: Add r8a77470 PFC support

2018-04-19 Thread Biju Das
Hi Geert,

Thanks for the comment.

> Subject: Re: [PATCH v2 1/2] pinctrl: sh-pfc: Add r8a77470 PFC support
>
> Hi Biju,
>
> + Sergei
>
> On Tue, Apr 17, 2018 at 11:07 AM, Biju Das 
> wrote:
> >> Subject: Re: [PATCH v2 1/2] pinctrl: sh-pfc: Add r8a77470 PFC support
> >> On Wed, Apr 4, 2018 at 5:22 PM, Biju Das 
> wrote:
> >> > Add PFC support for the R8A77470 SoC including pin groups for some
> >> > on-chip devices such as SCIF, AVB and MMC.
> >> >
> >> > Signed-off-by: Biju Das 
> >> > Reviewed-by: Fabrizio Castro 
>
> >> > --- /dev/null
> >> > +++ b/drivers/pinctrl/sh-pfc/pfc-r8a77470.c
>
> >> > +/* - AVB
> >> > +--
> >> > +-- */ static const
> >> unsigned int avb_link_pins[] = {
> >> > +   RCAR_GP_PIN(5, 14),
> >> > +};
> >> > +static const unsigned int avb_link_mux[] = {
> >> > +   AVB_LINK_MARK,
> >> > +};
> >> > +static const unsigned int avb_magic_pins[] = {
> >> > +   RCAR_GP_PIN(5, 15),
> >> > +};
> >> > +static const unsigned int avb_magic_mux[] = {
> >> > +   AVB_MAGIC_MARK,
> >> > +};
> >> > +static const unsigned int avb_phy_int_pins[] = {
> >> > +   RCAR_GP_PIN(5, 16),
> >> > +};
> >> > +static const unsigned int avb_phy_int_mux[] = {
> >> > +   AVB_PHY_INT_MARK,
> >> > +};
> >> > +static const unsigned int avb_mdio_pins[] = {
> >> > +   RCAR_GP_PIN(5, 12), RCAR_GP_PIN(5, 13), }; static const
> >> > +unsigned int avb_mdio_mux[] = {
> >> > +   AVB_MDC_MARK, AVB_MDIO_MARK, }; static const unsigned int
> >> > +avb_mii_pins[] = {
> >> > +   RCAR_GP_PIN(3, 14), RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16),
> >> > +   RCAR_GP_PIN(3, 27),
> >> > +
> >> > +   RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 4),
> >> > +   RCAR_GP_PIN(3, 5),
> >> > +
> >> > +   RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 0), RCAR_GP_PIN(3, 1),
> >> > +   RCAR_GP_PIN(5, 17), RCAR_GP_PIN(3, 13), RCAR_GP_PIN(5, 23),
> >> > +   RCAR_GP_PIN(3, 12),
> >> > +};
> >> > +static const unsigned int avb_mii_mux[] = {
> >> > +   AVB_TXD0_MARK, AVB_TXD1_MARK, AVB_TXD2_MARK,
> >> > +   AVB_TXD3_MARK,
> >> > +
> >> > +   AVB_RXD0_MARK, AVB_RXD1_MARK, AVB_RXD2_MARK,
> >> > +   AVB_RXD3_MARK,
> >> > +
> >> > +   AVB_RX_ER_MARK, AVB_RX_CLK_MARK, AVB_RX_DV_MARK,
> >> > +   AVB_CRS_MARK, AVB_TX_EN_MARK, AVB_TX_ER_MARK,
> >> > +   AVB_TX_CLK_MARK,
> >>
> >> You forgot AVB_COL, which is GP5_18?
> >
> > GP5_18 is shred between the signals AVB_COL and VI0_CLK. As per the
> > RZ/G1C board schematic /hardware user guide Ethernet Phy collision
> > pin(AVB_COL) pin  is not populated on this board by default. It is populated
> only for Video Input Channel0 pixel clock.
> >
> > Since it is initial submission, I thought of adding only board
> > specific pins first and later add this collision pin alone as a
> > separate pin entry  in the avb group. That way we can support existing
> board as well as any future RZ/G1C board which populates this pin. Are you
> ok for this approach?
>
> Oops. That means our grouping is suboptimal. Perhaps we should revisit (for
> all SoCs, while keeping backwards compatibility)?
>
> After reading some wikipedia, I came up with:
>
> mii_tx
> mii_tx_er (optional)
> mii_rx
> mii_col_crs (optional, half duplex)
>
> However, given your board uses AVB_CRS without AVB_COL, that would still
> not be sufficient, so the last group should be split to cover your use case?

Ok I agree to your point. What about splitting the last group " mii_col_crs"  
to "mii_col" and  "mii_crs" as separate groups .
Since this pins are only meaning full in half duplex 
mode(https://en.wikipedia.org/wiki/Media-independent_interface)

> BTW, how does it work with AVB_COL not wired to anything by default, and
> thus floating? Do you enable pull-up/down for that pin in the PFC, or is the
> pin just ignored in full-duplex mode?

Since it is unwired, the pin is in GPIO mode, high impedance state(ZU) with 
initial state is pull-up "on" in the PFC.

> >> > +};
> >> > +static const unsigned int avb_gmii_pins[] = {
> >> > +   RCAR_GP_PIN(3, 14), RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16),
> >> > +   RCAR_GP_PIN(3, 27), RCAR_GP_PIN(3, 28), RCAR_GP_PIN(3, 29),
> >> > +   RCAR_GP_PIN(4, 0), RCAR_GP_PIN(5, 22),
> >> > +
> >> > +   RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 4),
> >> > +   RCAR_GP_PIN(3, 5), RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
> >> > +   RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
> >> > +
> >> > +   RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 0), RCAR_GP_PIN(3, 1),
> >> > +   RCAR_GP_PIN(5, 17), RCAR_GP_PIN(4, 1), RCAR_GP_PIN(3, 11),
> >> > +   RCAR_GP_PIN(3, 13), RCAR_GP_PIN(5, 23), RCAR_GP_PIN(3, 12),
> >> > +}; static const unsigned int avb_gmii_mux[] = {
> >> > +   AVB_TXD0_MARK, AVB_TXD1_MARK, AVB_TXD2_MARK,
> >> > +   AVB_TXD3_MARK, 

Re: [PATCH v3 0/5] mmc: renesas_sdhi_internal_dmac: DMA handling fixes

2018-04-19 Thread Ulf Hansson
On 18 April 2018 at 20:20, Wolfram Sang
 wrote:
> I have collected the patches floating around for renesas_sdhi_internal_dmac 
> and
> grouped them to avoid dependency issues.
>
> Regarding stable: I think patch 1 is clearly for stable. Patch 3 maybe, but it
> needs patch 2 which is not. Not sure if it is worth the hazzle. Patches 4 & 5
> are not for stable.
>

Patch 1 applied for fixes (added a stable tag) and the rest applied
for next. Please tell if you want me to change something in regards to
this.

Kind regards
Uffe

> Changes since v2:
> * fixed checkpatch issues (Thanks Sergei!)
> * rebased to mmc/next
>
> Changes since v1:
> * patch 1: drop superfluous NULL check on soc->date
>(Thanks Geert!)
> * patches 2,3,5: added Simon's tag
>
> Kind regards,
>
>Wolfram
>
>
> Masaharu Hayakawa (1):
>   mmc: renesas_sdhi: Fix alignment check of sg buffer
>
> Niklas Söderlund (1):
>   mmc: renesas_sdhi: use helpers to access struct scatterlist members
>
> Wolfram Sang (3):
>   mmc: renesas_sdhi_internal_dmac: limit DMA RX for old SoCs
>   mmc: renesas_sdhi_internal_dmac: use more generic whitelisting
>   mmc: renesas_sdhi_internal_dmac: remove superfluous WARN
>
>  drivers/mmc/host/renesas_sdhi_internal_dmac.c | 64 
> +++
>  1 file changed, 45 insertions(+), 19 deletions(-)
>
> --
> 2.11.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] DT: mmc: tmio_mmc: document R8A77980 bindings

2018-04-19 Thread Ulf Hansson
On 16 April 2018 at 20:30, Sergei Shtylyov
 wrote:
> Document the R-Car V3H (R8A77980) SoC in the Renesas SDHI bindings.
>
> Signed-off-by: Sergei Shtylyov 

Thanks, applied for next!

Kind regards
Uffe

>
> ---
> This patch is against the 'next' branch of Ulf Hansson's 'mmc.git' repo.
>
>  Documentation/devicetree/bindings/mmc/tmio_mmc.txt |1 +
>  1 file changed, 1 insertion(+)
>
> Index: mmc/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> ===
> --- mmc.orig/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> +++ mmc/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> @@ -26,6 +26,7 @@ Required properties:
> "renesas,sdhi-r8a7794" - SDHI IP on R8A7794 SoC
> "renesas,sdhi-r8a7795" - SDHI IP on R8A7795 SoC
> "renesas,sdhi-r8a7796" - SDHI IP on R8A7796 SoC
> +   "renesas,sdhi-r8a77980" - SDHI IP on R8A77980 SoC
> "renesas,sdhi-r8a77995" - SDHI IP on R8A77995 SoC
> "renesas,sdhi-shmobile" - a generic sh-mobile SDHI controller
> "renesas,rcar-gen1-sdhi" - a generic R-Car Gen1 SDHI 
> controller


Re: [PATCH v2] pinctrl: sh-pfc: r8a77970: fix pin I/O voltage control support

2018-04-19 Thread Geert Uytterhoeven
Hi Sergei,

On Wed, Apr 18, 2018 at 10:26 PM, Sergei Shtylyov
 wrote:
> I've included the pin I/O voltage control into the R8A77970 PFC driver but
> it was incomplete because:
> - SH_PFC_PIN_CFG_IO_VOLTAGE pin flags weren't set properly;
> - sh_pfc_soc_info::ioctrl_regs wasn't set at all...

Thanks for your patch!

> Fixes: b92ac66a1819 ("pinctrl: sh-pfc: Add R8A77970 PFC support")
> Signed-off-by: Sergei Shtylyov 

Reviewed-by: Geert Uytterhoeven 

Minor nit below...

> --- renesas-drivers.orig/drivers/pinctrl/sh-pfc/pfc-r8a77970.c
> +++ renesas-drivers/drivers/pinctrl/sh-pfc/pfc-r8a77970.c

> @@ -2382,18 +2384,33 @@ static const struct pinmux_cfg_reg pinmu
> { },
>  };
>
> +enum ioctrl_regs {
> +   IOCTRL30,
> +   IOCTRL31,
> +   IOCTRL32,
> +   IOCTRL40,

Note for the future: unlike all other current pocctrl handling, IOCTRL32
is used to select between 2.5V and 3.3V (instead of 1.8V and 3.3V).
Handling that will require changes to the r8a77980_pin_to_pocctrl()
interface (add two output parameters returning supported voltages?).

> +   IOCTRL40,

That's TDSEL, and thus not related to I/O voltage.
But I agree it should be saved during suspend/resume. ;-)

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] pinctrl: sh-pfc: r8a77970: add pin I/O voltage control

2018-04-19 Thread Geert Uytterhoeven
Hi Sergei,

On Fri, Apr 13, 2018 at 8:29 PM, Sergei Shtylyov
 wrote:
> Add the pin I/O voltage level control to the R8A77980 PFC driver.
>
> Loosely based on the original (and large) patch by Vladimir Barinov.
>
> Signed-off-by: Vladimir Barinov 
> Signed-off-by: Sergei Shtylyov 

Thanks for your patch!

> --- renesas-drivers.orig/drivers/pinctrl/sh-pfc/pfc-r8a77980.c
> +++ renesas-drivers/drivers/pinctrl/sh-pfc/pfc-r8a77980.c

> @@ -2779,8 +2779,51 @@ static const struct pinmux_cfg_reg pinmu
> { },
>  };
>
> +enum ioctrl_regs {
> +   IOCTRL30,
> +   IOCTRL31,
> +   IOCTRL32,
> +};
> +
> +static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
> +   [IOCTRL30] = { 0xe6060380, },
> +   [IOCTRL31] = { 0xe6060384, },
> +   [IOCTRL32] = { 0xe6060388, },

I'd add IOCTRL33, so it is saved/restored during system suspend/resume.
You never know what U-Boot wrote to it, which is skipped on system resume.

Note for the future: unlike all other current pocctrl handling, IOCTRL33
is used to select between 2.5V and 3.3V (instead of 1.8V and 3.3V.
Handling that will require changes to the r8a77980_pin_to_pocctrl()
interface (add two output parameters returning supported voltages?).

With IOCTRL33 added:
Reviewed-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH v8 2/2] drm: bridge: Add thc63lvd1024 LVDS decoder driver

2018-04-19 Thread jacopo mondi
Hi Vladimir,

On Thu, Apr 19, 2018 at 02:18:30PM +0300, Vladimir Zapolskiy wrote:
> Hi Jacopo,
>
> On 04/10/2018 01:53 PM, Jacopo Mondi wrote:
> > Add DRM bridge driver for Thine THC63LVD1024 LVDS to digital parallel
> > output converter.
> >
> > Signed-off-by: Jacopo Mondi 
> > Reviewed-by: Andrzej Hajda 
> > Reviewed-by: Niklas Söderlund 
>
> Reviewed-by: Vladimir Zapolskiy 
>

Thanks. FYI I sent v9 yesterday with a minimal change compared to v8.

> Generally I have only one pretty ignorable comment.
>
> > +
> > +enum thc63_ports {
> > +   THC63_LVDS_IN0,
> > +   THC63_LVDS_IN1,
> > +   THC63_RGB_OUT0,
> > +   THC63_RGB_OUT1,
> > +};
> > +
>
> The driver uses only THC63_RGB_OUT0 value, or port@2, and MODE{0,1,2} IC
> configuration is ignored.
>
> I don't know if right from the beginning it would be better to support
> dual-out modes, preferably both single-in and dual-in ones. Will it
> impact port enumeration?

The bindings have been designed to support dual in/out modes, as you
can see there are 4 possible ports described there:

Required video port nodes:
- port@0: First LVDS input port
- port@2: First digital CMOS/TTL parallel output

Optional video port nodes:
- port@1: Second LVDS input port
- port@3: Second digital CMOS/TTL parallel output

Future extension should not require changing the port enumeration,
just add a property to specify the selected mode.

>
> I do understand that the extension is possible, and likely only hardware
> accessibility postpones it.

Yes, hardware on one side, but also what I think is a shortcoming of
DRM (which exists in other sub-systems, say v4l2) that matches devices
on their OF device nodes and makes cumbersome handling drivers wanting
to register on 'port' nodes instead, as it would happen if you have 2
input endpoints.

See my [1] note here: https://lkml.org/lkml/2018/3/9/422
And this reply to Archit's comment which has been left floating as it
is not a real issue (yet): https://lkml.org/lkml/2018/3/10/214

Thanks
   j

>
> --
> With best wishes,
> Vladimir


signature.asc
Description: PGP signature


Re: [PATCH v8 2/2] drm: bridge: Add thc63lvd1024 LVDS decoder driver

2018-04-19 Thread Vladimir Zapolskiy
Hi Jacopo,

On 04/10/2018 01:53 PM, Jacopo Mondi wrote:
> Add DRM bridge driver for Thine THC63LVD1024 LVDS to digital parallel
> output converter.
> 
> Signed-off-by: Jacopo Mondi 
> Reviewed-by: Andrzej Hajda 
> Reviewed-by: Niklas Söderlund 

Reviewed-by: Vladimir Zapolskiy 

Generally I have only one pretty ignorable comment.

> +
> +enum thc63_ports {
> + THC63_LVDS_IN0,
> + THC63_LVDS_IN1,
> + THC63_RGB_OUT0,
> + THC63_RGB_OUT1,
> +};
> +

The driver uses only THC63_RGB_OUT0 value, or port@2, and MODE{0,1,2} IC
configuration is ignored.

I don't know if right from the beginning it would be better to support
dual-out modes, preferably both single-in and dual-in ones. Will it
impact port enumeration?

I do understand that the extension is possible, and likely only hardware
accessibility postpones it.

--
With best wishes,
Vladimir


Re: [PATCH v8 1/2] dt-bindings: display: bridge: Document THC63LVD1024 LVDS decoder

2018-04-19 Thread jacopo mondi
On Thu, Apr 19, 2018 at 12:44:32PM +0300, Vladimir Zapolskiy wrote:
Hi Vladimir,

> Hi Jacopo, Laurent,
>
> On 04/10/2018 01:53 PM, Jacopo Mondi wrote:
> > Document Thine THC63LVD1024 LVDS decoder device tree bindings.
> >
> > Signed-off-by: Jacopo Mondi 
> > Reviewed-by: Andrzej Hajda 
> > Reviewed-by: Niklas Söderlund 
> > Reviewed-by: Laurent Pinchart 
>
> Reviewed-by: Vladimir Zapolskiy 
>
> > ---
> >  .../bindings/display/bridge/thine,thc63lvd1024.txt | 60 
> > ++
> >  1 file changed, 60 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt 
> > b/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
> > new file mode 100644
> > index 000..0b23e70
> > --- /dev/null
> > +++ 
> > b/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
> > @@ -0,0 +1,60 @@
> > +Thine Electronics THC63LVD1024 LVDS decoder
> > +---
> > +
> > +The THC63LVD1024 is a dual link LVDS receiver designed to convert LVDS 
> > streams
> > +to parallel data outputs. The chip supports single/dual input/output modes,
> > +handling up to two LVDS input streams and up to two digital CMOS/TTL 
> > outputs.
> > +
> > +Single or dual operation mode, output data mapping and DDR output modes are
> > +configured through input signals and the chip does not expose any control 
> > bus.
> > +
> > +Required properties:
> > +- compatible: Shall be "thine,thc63lvd1024"
> > +- vcc-supply: Power supply for TTL output, TTL CLOCKOUT signal, LVDS input,
> > +  PPL and digital circuitry
> > +
> > +Optional properties:
> > +- powerdown-gpios: Power down GPIO signal, pin name "/PDWN". Active low
>
> Thank you for the change.
>
> I would suggest to rename 'pwdn-gpios' property of THC63LVDM83D as well,
> as far as I understand it is only described in DT bindings documentation,
> and the property is unused in the driver or board DTS files at the moment.

Thanks for the suggestion, I'll do that!

>
> > +- oe-gpios: Output enable GPIO signal, pin name "OE". Active high
>
> Okay :)

Yeah, please see Rob's and Laurent's reply to v7, where I renamed this
to 'enable'.

Thanks
   j
>
> --
> With best wishes,
> Vladimir


signature.asc
Description: PGP signature


Re: [PATCH v8 1/2] dt-bindings: display: bridge: Document THC63LVD1024 LVDS decoder

2018-04-19 Thread Vladimir Zapolskiy
Hi Jacopo,

On 04/19/2018 12:48 PM, Vladimir Zapolskiy wrote:
> Hi Jacopo,
> 
> On 04/19/2018 12:44 PM, Vladimir Zapolskiy wrote:
>> Hi Jacopo, Laurent,
>>
>> On 04/10/2018 01:53 PM, Jacopo Mondi wrote:
>>> Document Thine THC63LVD1024 LVDS decoder device tree bindings.
>>>
>>> Signed-off-by: Jacopo Mondi 
>>> Reviewed-by: Andrzej Hajda 
>>> Reviewed-by: Niklas Söderlund 
>>> Reviewed-by: Laurent Pinchart 
>>
>> Reviewed-by: Vladimir Zapolskiy 
>>
>>> ---

[snip]

>>> +Optional properties:
>>> +- powerdown-gpios: Power down GPIO signal, pin name "/PDWN". Active low
>>
> 
> sorry for a follow-up, I've just noticed it, could you please double check
> spelling PDWN vs PWDN? Thank you in advance.
> 

please ignore it, I did it myself and the datasheet describes pin as /PDWN,
I won't exclude a typo in the datasheet though...

--
With best wishes,
Vladimir


RE: [PATCH v3] gpio: dwapb: Add support for 1 interrupt per port A GPIO

2018-04-19 Thread Phil Edworthy
Hi Hoan

On 18 April 2018 08:03 Hoan Tran wrote:
> On Fri, Apr 13, 2018 at 9:47 AM, Phil Edworthy wrote:
> > On 13 April 2018 17:37 Hoan Tran wrote:
> >> On Fri, Apr 13, 2018 at 1:51 AM, Phil Edworthy wrote:
> >> > The DesignWare GPIO IP can be configured for either 1 interrupt or
> >> > 1 per GPIO in port A, but the driver currently only supports 1 interrupt.
> >> > See the DesignWare DW_apb_gpio Databook description of the
> >> > 'GPIO_INTR_IO' parameter.
> >> >
> >> > This change allows the driver to work with up to 32 interrupts, it
> >> > will get as many interrupts as specified in the DT 'interrupts' property.
> >> > It doesn't do anything clever with the different interrupts, it
> >> > just calls the same handler used for single interrupt hardware.
> >> >
> >> > Signed-off-by: Phil Edworthy 
> >> > ---
> >> > One point to mention is that I have made it possible for users to
> >> > have unconncted interrupts by specifying holes in the list of interrupts.
> >> > This is done by supporting the interrupts-extended DT prop.
> >> > However, I have no use for this and had to hack some test case for this.
> >> > Perhaps the driver should support 1 interrupt or all GPIOa as interrupts?
> >> >
> >> > v3:
> >> >  - Rolled mfd: intel_quark_i2c_gpio fix into this patch to avoid
> >> > bisect problems
> >> > v2:
> >> >  - Replaced interrupt-mask DT prop with support for the interrupts-
> >> extended
> >> >prop. This means replacing the call to irq_of_parse_and_map() with
> calls
> >> >to of_irq_parse_one() and irq_create_of_mapping().
> >> >
> >> > Note: There are a few *code* lines over 80 chars, but this is just
> guidance,
> >> >right? Especially as there are already some lines over 80 chars.
> >> > ---
> > [snip]
> >
> >> > -   if (has_acpi_companion(dev) && pp->idx == 0)
> >> > -   pp->irq = 
> >> > platform_get_irq(to_platform_device(dev), 0);
> >> > +   if (has_acpi_companion(dev) && pp->idx == 0) {
> >> > +   pp->irq[0] = 
> >> > platform_get_irq(to_platform_device(dev),
> 0);
> >> > +   if (pp->irq[0])
> >> > +   pp->has_irq = true;
> >> > +   }
> >>
> >> It doesn't work for ACPI. Could you do the same logic for ACPI?
> > I don’t have access to any device that was baked (i.e. fabbed) with
> > multiple output interrupts from the Synopsys GPIO blocks and use ACPI.
> > I don't know if any such device exists.
> 
> Below code is tested on X-Gene system which supports 1 interrupt per GPIO
> on Port A. You can update it into your patch.
> 
> -   if (has_acpi_companion(dev) && pp->idx == 0)
> -   pp->irq = platform_get_irq(to_platform_device(dev), 
> 0);
> +   if (has_acpi_companion(dev) && pp->idx == 0) {
> +   unsigned int j;
> +   for (j = 0; j < pp->ngpio; j++) {
> +   pp->irq[j] =
> platform_get_irq(to_platform_device(dev), j);
> +   if (pp->irq[j])
> +   pp->has_irq = true;
> +   }
> +   }
Since I've already got some reviewed-by and acks for v4, I'll leave it to Linus
to decide if he wants me to roll your changes into this patch or for you to
submit a separate patch.

Thanks
Phil


> >> > pp->irq_shared  = false;
> >> > pp->gpio_base   = -1;
> >> > diff --git a/drivers/mfd/intel_quark_i2c_gpio.c
> >> > b/drivers/mfd/intel_quark_i2c_gpio.c
> >> > index 90e35de..5bddb84 100644
> >> > --- a/drivers/mfd/intel_quark_i2c_gpio.c
> >> > +++ b/drivers/mfd/intel_quark_i2c_gpio.c
> >> > @@ -233,7 +233,8 @@ static int intel_quark_gpio_setup(struct
> >> > pci_dev
> >> *pdev, struct mfd_cell *cell)
> >> > pdata->properties->idx  = 0;
> >> > pdata->properties->ngpio= INTEL_QUARK_MFD_NGPIO;
> >> > pdata->properties->gpio_base=
> INTEL_QUARK_MFD_GPIO_BASE;
> >> > -   pdata->properties->irq  = pdev->irq;
> >> > +   pdata->properties->irq[0]   = pdev->irq;
> >> > +   pdata->properties->has_irq  = true;
> >> > pdata->properties->irq_shared   = true;
> >> >
> >> > cell->platform_data = pdata; diff --git
> >> > a/include/linux/platform_data/gpio-dwapb.h
> >> > b/include/linux/platform_data/gpio-dwapb.h
> >> > index 2dc7f4a..5a52d69 100644
> >> > --- a/include/linux/platform_data/gpio-dwapb.h
> >> > +++ b/include/linux/platform_data/gpio-dwapb.h
> >> > @@ -19,7 +19,8 @@ struct dwapb_port_property {
> >> > unsigned intidx;
> >> > unsigned intngpio;
> >> > unsigned intgpio_base;
> >> > -   unsigned intirq;
> >> > +   unsigned intirq[32];
> >> > +   boolhas_irq;
> >> > boolirq_shared;
> >> >  };
> >> >
> >> > --
> >> > 2.7.4
> >> >


Re: [PATCH V5] PCI: rcar: Use runtime PM to control controller clock

2018-04-19 Thread Geert Uytterhoeven
Hi Marek,

On Tue, Apr 10, 2018 at 6:17 PM, Marek Vasut  wrote:
> On 04/10/2018 05:28 PM, Geert Uytterhoeven wrote:
> The pairing looks as follows:
>
> .- rcar_pcie_parse_request_of_pci_ranges()
> |  (pm_runtime_enable is here)
> | .- pm_runtime_get_sync()
> | | .- rcar_pcie_get_resources()

 rcar_pcie_get_resources() is called  while the device is 
 runtime-enabled/resumed
>>>
>>> Because something may access the device, yes.
>>>
> | | |
> | | '- pm_runtime_put()
> | '- pm_runtime_disable() + pci_free_resource_list()

 pci_free_resource_list() is called while the device is runtime-disabled.
>>>
>>> Because nothing will access the device.
>>>
> '- pci_free_host_bridge()
>
> It looks symmetric to me ...

 rcar_pcie_get_resources() is called while the device is
 runtime-enabled/resumed,
 pci_free_resource_list() is called while the device is runtime-disabled.
>>>
>>> At this point, I think I'd rather see a diff of changes which you have
>>> in mind rather than this endless discussion. Can you provide one against
>>> this patch ?
>>
>> My final comment:
>>
>> If the steps during probing are A..Z, cleanup and removal should undo them
>> in reverse order (Z..A), unless there's a very good reason not to do so.
>
> I spent extra time going through the probe function and I just don't see
> how it is not done in the exact reverse, I checked every single goto
> statement in probe.
>
> I noticed this though:
>
 rcar_pcie_get_resources() is called while the device is
 runtime-enabled/resumed,
 pci_free_resource_list() is called while the device is runtime-disabled.
>
> rcar_pcie_get_resources() is NOT a pair function for
> pci_free_resource_list() . rcar_pcie_parse_request_of_pci_ranges() is a
> pair function for pci_free_resource_list().
>
> rcar_pcie_parse_request_of_pci_ranges() calls
> of_pci_get_host_bridge_resources() internally, so every single function
> called after successful call of rcar_pcie_parse_request_of_pci_ranges()
> must call pci_free_resource_list().
>
> Both of_pci_get_host_bridge_resources() and pci_free_resource_list() are
> called with runtime PM disabled.
>
> The naming of the functions is confusing though.

You are right, your changes are correct, and the naming of these functions
is confusing. Perhaps it should be changed, to avoid misleading the (not so)
casual reviewer?

Reviewed-by: Geert Uytterhoeven 

BTW, while diving deeper, I noticed a few other pre-existing issues in error
handling:

1. If anything fails after rcar_pcie_get_resources(), the bus clock is never
   disabled,
2. The error path of rcar_pcie_enable_msi() does not call
   irq_dispose_mapping() before irq_domain_remove(),
3. If rcar_pcie_enable() fails, none of the setup done in
   rcar_pcie_enable_msi() is reverted.
   Apart from the IRQ domain handling in 2, that includes freeing msi->pages
   (should this be allocated using the DMA API?), and undoing the related HW
   setup, to prevent the HW from scribbling the former MSI page in the future.

Care to fix these, too?
Thanks!

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH v8 1/2] dt-bindings: display: bridge: Document THC63LVD1024 LVDS decoder

2018-04-19 Thread Vladimir Zapolskiy
Hi Jacopo,

On 04/19/2018 12:44 PM, Vladimir Zapolskiy wrote:
> Hi Jacopo, Laurent,
> 
> On 04/10/2018 01:53 PM, Jacopo Mondi wrote:
>> Document Thine THC63LVD1024 LVDS decoder device tree bindings.
>>
>> Signed-off-by: Jacopo Mondi 
>> Reviewed-by: Andrzej Hajda 
>> Reviewed-by: Niklas Söderlund 
>> Reviewed-by: Laurent Pinchart 
> 
> Reviewed-by: Vladimir Zapolskiy 
> 
>> ---
>>  .../bindings/display/bridge/thine,thc63lvd1024.txt | 60 
>> ++
>>  1 file changed, 60 insertions(+)
>>  create mode 100644 
>> Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt 
>> b/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
>> new file mode 100644
>> index 000..0b23e70
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
>> @@ -0,0 +1,60 @@
>> +Thine Electronics THC63LVD1024 LVDS decoder
>> +---
>> +
>> +The THC63LVD1024 is a dual link LVDS receiver designed to convert LVDS 
>> streams
>> +to parallel data outputs. The chip supports single/dual input/output modes,
>> +handling up to two LVDS input streams and up to two digital CMOS/TTL 
>> outputs.
>> +
>> +Single or dual operation mode, output data mapping and DDR output modes are
>> +configured through input signals and the chip does not expose any control 
>> bus.
>> +
>> +Required properties:
>> +- compatible: Shall be "thine,thc63lvd1024"
>> +- vcc-supply: Power supply for TTL output, TTL CLOCKOUT signal, LVDS input,
>> +  PPL and digital circuitry
>> +
>> +Optional properties:
>> +- powerdown-gpios: Power down GPIO signal, pin name "/PDWN". Active low
> 

sorry for a follow-up, I've just noticed it, could you please double check
spelling PDWN vs PWDN? Thank you in advance.

--
With best wishes,
Vladimir


Re: [PATCH v8 1/2] dt-bindings: display: bridge: Document THC63LVD1024 LVDS decoder

2018-04-19 Thread Vladimir Zapolskiy
Hi Jacopo, Laurent,

On 04/10/2018 01:53 PM, Jacopo Mondi wrote:
> Document Thine THC63LVD1024 LVDS decoder device tree bindings.
> 
> Signed-off-by: Jacopo Mondi 
> Reviewed-by: Andrzej Hajda 
> Reviewed-by: Niklas Söderlund 
> Reviewed-by: Laurent Pinchart 

Reviewed-by: Vladimir Zapolskiy 

> ---
>  .../bindings/display/bridge/thine,thc63lvd1024.txt | 60 
> ++
>  1 file changed, 60 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt 
> b/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
> new file mode 100644
> index 000..0b23e70
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
> @@ -0,0 +1,60 @@
> +Thine Electronics THC63LVD1024 LVDS decoder
> +---
> +
> +The THC63LVD1024 is a dual link LVDS receiver designed to convert LVDS 
> streams
> +to parallel data outputs. The chip supports single/dual input/output modes,
> +handling up to two LVDS input streams and up to two digital CMOS/TTL outputs.
> +
> +Single or dual operation mode, output data mapping and DDR output modes are
> +configured through input signals and the chip does not expose any control 
> bus.
> +
> +Required properties:
> +- compatible: Shall be "thine,thc63lvd1024"
> +- vcc-supply: Power supply for TTL output, TTL CLOCKOUT signal, LVDS input,
> +  PPL and digital circuitry
> +
> +Optional properties:
> +- powerdown-gpios: Power down GPIO signal, pin name "/PDWN". Active low

Thank you for the change.

I would suggest to rename 'pwdn-gpios' property of THC63LVDM83D as well,
as far as I understand it is only described in DT bindings documentation,
and the property is unused in the driver or board DTS files at the moment.

> +- oe-gpios: Output enable GPIO signal, pin name "OE". Active high

Okay :)

--
With best wishes,
Vladimir


[PATCH 0/8] drm: bridge: Add support for static image formats

2018-04-19 Thread Jacopo Mondi
Hello DRM list,
  cc media-list for the mbus format extension
  cc renesas-soc and devicetree for Eagle DTS patch

This series adds support for static image formats to DRM bridges, mimicking
what display_info.bus_formats represents for DRM connectors.

The main use case of this series is the R-Car DU LVDS encoder. This component
can output LVDS streams compatible with JEIDA or SPWG specification, and so far
it has only been possible to decide which one to output if the next component
in the DRM pipeline was a panel, equipped with a DRM connector where to inspect
the accepted input image format from.

With the introduction of the transparent THC63LVD1024 LVDS decoder driver, the
next component in the pipeline is now a bridge, and the DU LVDS encoder needs
to inspect which media bus image formats it accepts and set its LVDS output
mode accordingly.

The series implements -static- image format supports for bridges. As a result
of the discussion on Peter Rosin's patch series:
[PATCH v2 0/5] allow override of bus format in bridges
https://lkml.org/lkml/2018/3/26/610
my understanding is that the accepted image formats can be 'dynamic' (or
'atomic') if depends on the configured DRM mode, or 'static' as in the
THC63LVD1024 case, where an external pin configuration decides which LVDS
mapping mode the encoder accepts (which implies it comes from DT, as in Peter's
use case).

For dynamic formats Daniel already suggested a possible implementation:
https://lkml.org/lkml/2018/3/28/57
while for static image formats I am proposing an implementation that
copies what we have for connectors at the moment.

One more detail: the DU LVDS encoder supports 'mirroring' of LVDS modes, and
that was handled through a set of flags (DRM_BUS_FLAG_DATA_*) defined for
connectors only, and added for that specific purpose, if I got this right.
Instead of replicating the same flags for bridges, or moving them to some shared
header which I had trouble to identify, I have introduced the _LE version of
mbus formats used to describe LVDS streams. While 'little endian' is not
*technically* exact for those mirrored formats, it is my opinion they represent
a good description anyhow of the reversed component ordering.

As a result, the connector specific DRM_BUS_FLAG_DATA_* have been removed as
all their user have been ported to use the new _LE formats.

The series depends on THC63LVD1024 support, implemented by the following
in-review series:
 [PATCH v9 0/2] drm: Add Thine THC63LVD1024 LVDS decoder bridge
 [PATCH v3 0/5] V3M-Eagle HDMI output enablement

available for the interested at:
git://jmondi.org/linux lvds-bridge/linus-master/v9-eagle-v3

Thanks for comments
   j

Jacopo Mondi (8):
  drm: bridge: Add support for static image formats
  dt-bindings: display: bridge: thc63lvd1024: Add lvds map property
  drm: bridge: thc63lvd1024: Add support for LVDS mode map
  arm64: dts: renesas: eagle: Add thc63 LVDS map
  media: Add LE version of RGB LVDS formats
  drm: rcar-du: rcar-lvds: Add bridge format support
  drm: panel: Use _LE LVDS formats for data mirroring
  drm: connector: Remove DRM_BUS_FLAG_DATA_* flags

 .../bindings/display/bridge/thine,thc63lvd1024.txt |   3 +
 Documentation/media/uapi/v4l/subdev-formats.rst| 174 +
 arch/arm64/boot/dts/renesas/r8a77970-eagle.dts |   1 +
 drivers/gpu/drm/bridge/thc63lvd1024.c  |  41 +
 drivers/gpu/drm/drm_bridge.c   |  30 
 drivers/gpu/drm/panel/panel-lvds.c |  21 +--
 drivers/gpu/drm/rcar-du/rcar_lvds.c|  64 +---
 include/drm/drm_bridge.h   |   8 +
 include/drm/drm_connector.h|   4 -
 include/uapi/linux/media-bus-format.h  |   5 +-
 10 files changed, 317 insertions(+), 34 deletions(-)

--
2.7.4



[PATCH 4/8] arm64: dts: renesas: eagle: Add thc63 LVDS map

2018-04-19 Thread Jacopo Mondi
Add LVDS map mode description property to THC63LVD1024 LVDS decoder in
R-Car V3M-Eagle board device tree.

Signed-off-by: Jacopo Mondi 
---
 arch/arm64/boot/dts/renesas/r8a77970-eagle.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts 
b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
index ebfbb51..2609fa3 100644
--- a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
+++ b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
@@ -56,6 +56,7 @@
compatible = "thine,thc63lvd1024";
 
vcc-supply = <>;
+   thine,map = <1>;
 
ports {
#address-cells = <1>;
-- 
2.7.4



[PATCH 1/8] drm: bridge: Add support for static image formats

2018-04-19 Thread Jacopo Mondi
Add support for storing image format information in DRM bridges with
associated helper function.

This patch replicates for bridges what 'drm_display_info_set_bus_formats()'
is for connectors.

Signed-off-by: Jacopo Mondi 
---
 drivers/gpu/drm/drm_bridge.c | 30 ++
 include/drm/drm_bridge.h |  8 
 2 files changed, 38 insertions(+)

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 1638bfe..e2ad098 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -157,6 +157,36 @@ void drm_bridge_detach(struct drm_bridge *bridge)
 }
 
 /**
+ * drm_bridge_set_bus_formats() - set bridge supported image formats
+ * @bridge: the bridge to set image formats in
+ * @formats: array of MEDIA_BUS_FMT\_ supported image formats
+ * @num_formats: number of elements in the @formats array
+ *
+ * Store a list of supported image formats in a bridge.
+ * See MEDIA_BUS_FMT_* definitions in include/uapi/linux/media-bus-format.h for
+ * a full list of available formats.
+ */
+int drm_bridge_set_bus_formats(struct drm_bridge *bridge, const u32 *formats,
+  unsigned int num_formats)
+{
+   u32 *fmts;
+
+   if (!formats || !num_formats)
+   return -EINVAL;
+
+   fmts = kmemdup(formats, sizeof(*formats) * num_formats, GFP_KERNEL);
+   if (!fmts)
+   return -ENOMEM;
+
+   kfree(bridge->bus_formats);
+   bridge->bus_formats = fmts;
+   bridge->num_bus_formats = num_formats;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_bridge_set_bus_formats);
+
+/**
  * DOC: bridge callbacks
  *
  * The _bridge_funcs ops are populated by the bridge driver. The DRM
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 3270fec..6b3648c 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -258,6 +258,9 @@ struct drm_bridge_timings {
  * @encoder: encoder to which this bridge is connected
  * @next: the next bridge in the encoder chain
  * @of_node: device node pointer to the bridge
+ * @bus_formats: wire image formats. Array of @num_bus_formats MEDIA_BUS_FMT\_
+ * elements
+ * @num_bus_formats: size of @bus_formats array
  * @list: to keep track of all added bridges
  * @timings: the timing specification for the bridge, if any (may
  * be NULL)
@@ -271,6 +274,9 @@ struct drm_bridge {
 #ifdef CONFIG_OF
struct device_node *of_node;
 #endif
+   const u32 *bus_formats;
+   unsigned int num_bus_formats;
+
struct list_head list;
const struct drm_bridge_timings *timings;
 
@@ -296,6 +302,8 @@ void drm_bridge_mode_set(struct drm_bridge *bridge,
struct drm_display_mode *adjusted_mode);
 void drm_bridge_pre_enable(struct drm_bridge *bridge);
 void drm_bridge_enable(struct drm_bridge *bridge);
+int drm_bridge_set_bus_formats(struct drm_bridge *bridge, const u32 *fmts,
+  unsigned int num_fmts);
 
 #ifdef CONFIG_DRM_PANEL_BRIDGE
 struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel,
-- 
2.7.4



[PATCH 2/8] dt-bindings: display: bridge: thc63lvd1024: Add lvds map property

2018-04-19 Thread Jacopo Mondi
The THC63LVD1024 LVDS to RGB bridge supports two different input mapping
modes, selectable by means of an external pin.

Describe the LVDS mode map through a newly defined mandatory property in
device tree bindings.

Signed-off-by: Jacopo Mondi 
---
 .../devicetree/bindings/display/bridge/thine,thc63lvd1024.txt  | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt 
b/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
index 37f0c04..0937595 100644
--- a/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
+++ b/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
@@ -12,6 +12,8 @@ Required properties:
 - compatible: Shall be "thine,thc63lvd1024"
 - vcc-supply: Power supply for TTL output, TTL CLOCKOUT signal, LVDS input,
   PPL and digital circuitry
+- thine,map: LVDS mapping mode selection signal, pin name "MAP". Shall be <1>
+  for mapping mode 1, <0> for mapping mode 2
 
 Optional properties:
 - powerdown-gpios: Power down GPIO signal, pin name "/PDWN". Active low
@@ -36,6 +38,7 @@ Example:
 
vcc-supply = <_lvds_vcc>;
powerdown-gpios = < 15 GPIO_ACTIVE_LOW>;
+   thine,map = <1>;
 
ports {
#address-cells = <1>;
-- 
2.7.4



[PATCH 3/8] drm: bridge: thc63lvd1024: Add support for LVDS mode map

2018-04-19 Thread Jacopo Mondi
The THC63LVD1024 LVDS to RGB bridge supports two different LVDS mapping
modes, selectable by means of an external pin.

Add support for configurable LVDS input mapping modes, using the newly
introduced support for bridge input image formats.

Signed-off-by: Jacopo Mondi 
---
 drivers/gpu/drm/bridge/thc63lvd1024.c | 41 +++
 1 file changed, 41 insertions(+)

diff --git a/drivers/gpu/drm/bridge/thc63lvd1024.c 
b/drivers/gpu/drm/bridge/thc63lvd1024.c
index 48527f8..a3071a1 100644
--- a/drivers/gpu/drm/bridge/thc63lvd1024.c
+++ b/drivers/gpu/drm/bridge/thc63lvd1024.c
@@ -10,9 +10,15 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
+enum thc63_lvds_mapping_mode {
+   THC63_LVDS_MAP_MODE2,
+   THC63_LVDS_MAP_MODE1,
+};
+
 enum thc63_ports {
THC63_LVDS_IN0,
THC63_LVDS_IN1,
@@ -116,6 +122,37 @@ static int thc63_parse_dt(struct thc63_dev *thc63)
return 0;
 }
 
+static int thc63_set_bus_fmt(struct thc63_dev *thc63)
+{
+   u32 bus_fmt;
+   u32 map;
+   int ret;
+
+   ret = of_property_read_u32(thc63->dev->of_node, "thine,map", );
+   if (ret) {
+   dev_err(thc63->dev,
+   "Unable to parse property \"thine,map\": %d\n", ret);
+   return ret;
+   }
+
+   switch (map) {
+   case THC63_LVDS_MAP_MODE1:
+   bus_fmt = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
+   break;
+   case THC63_LVDS_MAP_MODE2:
+   bus_fmt = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
+   break;
+   default:
+   dev_err(thc63->dev,
+   "Invalid value for property \"thine,map\": %u\n", map);
+   return -EINVAL;
+   }
+
+   drm_bridge_set_bus_formats(>bridge, _fmt, 1);
+
+   return 0;
+}
+
 static int thc63_gpio_init(struct thc63_dev *thc63)
 {
thc63->oe = devm_gpiod_get_optional(thc63->dev, "oe", GPIOD_OUT_LOW);
@@ -166,6 +203,10 @@ static int thc63_probe(struct platform_device *pdev)
if (ret)
return ret;
 
+   ret = thc63_set_bus_fmt(thc63);
+   if (ret)
+   return ret;
+
thc63->bridge.driver_private = thc63;
thc63->bridge.of_node = pdev->dev.of_node;
thc63->bridge.funcs = _bridge_func;
-- 
2.7.4



[PATCH 6/8] drm: rcar-du: rcar-lvds: Add bridge format support

2018-04-19 Thread Jacopo Mondi
With the introduction of static input image format enumeration in DRM
bridges, add support to retrieve the format in rcar-lvds LVDS encoder
from both panel or bridge, to set the desired LVDS mode.

Do not rely on 'DRM_BUS_FLAG_DATA_LSB_TO_MSB' flag to mirror the LVDS
format, as it is only defined for drm connectors, but use the newly
introduced _LE version of LVDS mbus image formats.

Signed-off-by: Jacopo Mondi 
---
 drivers/gpu/drm/rcar-du/rcar_lvds.c | 64 +
 1 file changed, 44 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c 
b/drivers/gpu/drm/rcar-du/rcar_lvds.c
index 3d2d3bb..2fa875f 100644
--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
+++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
@@ -280,41 +280,65 @@ static bool rcar_lvds_mode_fixup(struct drm_bridge 
*bridge,
return true;
 }
 
-static void rcar_lvds_get_lvds_mode(struct rcar_lvds *lvds)
+static int rcar_lvds_get_lvds_mode_from_connector(struct rcar_lvds *lvds,
+ unsigned int *bus_fmt)
 {
struct drm_display_info *info = >connector.display_info;
-   enum rcar_lvds_mode mode;
-
-   /*
-* There is no API yet to retrieve LVDS mode from a bridge, only panels
-* are supported.
-*/
-   if (!lvds->panel)
-   return;
 
if (!info->num_bus_formats || !info->bus_formats) {
dev_err(lvds->dev, "no LVDS bus format reported\n");
-   return;
+   return -EINVAL;
+   }
+
+   *bus_fmt = info->bus_formats[0];
+
+   return 0;
+}
+
+static int rcar_lvds_get_lvds_mode_from_bridge(struct rcar_lvds *lvds,
+  unsigned int *bus_fmt)
+{
+   if (!lvds->next_bridge->num_bus_formats ||
+   !lvds->next_bridge->bus_formats) {
+   dev_err(lvds->dev, "no LVDS bus format reported\n");
+   return -EINVAL;
}
 
-   switch (info->bus_formats[0]) {
+   *bus_fmt = lvds->next_bridge->bus_formats[0];
+
+   return 0;
+}
+
+static void rcar_lvds_get_lvds_mode(struct rcar_lvds *lvds)
+{
+   unsigned int bus_fmt;
+   int ret;
+
+   if (lvds->panel)
+   ret = rcar_lvds_get_lvds_mode_from_connector(lvds, _fmt);
+   else
+   ret = rcar_lvds_get_lvds_mode_from_bridge(lvds, _fmt);
+   if (ret)
+   return;
+
+   switch (bus_fmt) {
+   case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG_LE:
+   case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA_LE:
+   lvds->mode |= RCAR_LVDS_MODE_MIRROR;
case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:
case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA:
-   mode = RCAR_LVDS_MODE_JEIDA;
+   lvds->mode = RCAR_LVDS_MODE_JEIDA;
break;
+
+   case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG_LE:
+   lvds->mode |= RCAR_LVDS_MODE_MIRROR;
case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG:
-   mode = RCAR_LVDS_MODE_VESA;
+   lvds->mode = RCAR_LVDS_MODE_VESA;
break;
default:
dev_err(lvds->dev, "unsupported LVDS bus format 0x%04x\n",
-   info->bus_formats[0]);
-   return;
+   bus_fmt);
}
-
-   if (info->bus_flags & DRM_BUS_FLAG_DATA_LSB_TO_MSB)
-   mode |= RCAR_LVDS_MODE_MIRROR;
-
-   lvds->mode = mode;
 }
 
 static void rcar_lvds_mode_set(struct drm_bridge *bridge,
-- 
2.7.4



[PATCH 5/8] media: Add LE version of RGB LVDS formats

2018-04-19 Thread Jacopo Mondi
Some LVDS controller can output swapped versions of LVDS RGB formats.
Define and document them in the list of supported media bus formats

Signed-off-by: Jacopo Mondi 
---
 Documentation/media/uapi/v4l/subdev-formats.rst | 174 
 include/uapi/linux/media-bus-format.h   |   5 +-
 2 files changed, 178 insertions(+), 1 deletion(-)

diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst 
b/Documentation/media/uapi/v4l/subdev-formats.rst
index 9fcabe7..9a5263c 100644
--- a/Documentation/media/uapi/v4l/subdev-formats.rst
+++ b/Documentation/media/uapi/v4l/subdev-formats.rst
@@ -1669,6 +1669,64 @@ JEIDA defined bit mapping will be named
   - b\ :sub:`2`
   - g\ :sub:`1`
   - r\ :sub:`0`
+* .. _MEDIA-BUS-FMT-RGB666-1X7X3-SPWG_LE:
+
+  - MEDIA_BUS_FMT_RGB666_1X7X3_SPWG_LE
+  - 0x101b
+  - 0
+  -
+  -
+  - b\ :sub:`2`
+  - g\ :sub:`1`
+  - r\ :sub:`0`
+* -
+  -
+  - 1
+  -
+  -
+  - b\ :sub:`3`
+  - g\ :sub:`2`
+  - r\ :sub:`1`
+* -
+  -
+  - 2
+  -
+  -
+  - b\ :sub:`4`
+  - g\ :sub:`3`
+  - r\ :sub:`2`
+* -
+  -
+  - 3
+  -
+  -
+  - b\ :sub:`5`
+  - g\ :sub:`4`
+  - r\ :sub:`3`
+* -
+  -
+  - 4
+  -
+  -
+  - d
+  - g\ :sub:`5`
+  - r\ :sub:`4`
+* -
+  -
+  - 5
+  -
+  -
+  - d
+  - b\ :sub:`0`
+  - r\ :sub:`5`
+* -
+  -
+  - 6
+  -
+  -
+  - d
+  - b\ :sub:`1`
+  - g\ :sub:`0`
 * .. _MEDIA-BUS-FMT-RGB888-1X7X4-SPWG:
 
   - MEDIA_BUS_FMT_RGB888_1X7X4_SPWG
@@ -1727,6 +1785,64 @@ JEIDA defined bit mapping will be named
   - b\ :sub:`2`
   - g\ :sub:`1`
   - r\ :sub:`0`
+* .. _MEDIA-BUS-FMT-RGB888-1X7X4-SPWG_LE:
+
+  - MEDIA_BUS_FMT_RGB888_1X7X4_SPWG_LE
+  - 0x101c
+  - 0
+  -
+  - r\ :sub:`6`
+  - b\ :sub:`2`
+  - g\ :sub:`1`
+  - r\ :sub:`0`
+* -
+  -
+  - 1
+  -
+  - r\ :sub:`7`
+  - b\ :sub:`3`
+  - g\ :sub:`2`
+  - r\ :sub:`1`
+* -
+  -
+  - 2
+  -
+  - g\ :sub:`6`
+  - b\ :sub:`4`
+  - g\ :sub:`3`
+  - r\ :sub:`2`
+* -
+  -
+  - 3
+  -
+  - g\ :sub:`7`
+  - b\ :sub:`5`
+  - g\ :sub:`4`
+  - r\ :sub:`3`
+* -
+  -
+  - 4
+  -
+  - b\ :sub:`6`
+  - d
+  - g\ :sub:`5`
+  - r\ :sub:`4`
+* -
+  -
+  - 5
+  -
+  - b\ :sub:`7`
+  - d
+  - b\ :sub:`0`
+  - r\ :sub:`5`
+* -
+  -
+  - 6
+  -
+  - d
+  - d
+  - b\ :sub:`1`
+  - g\ :sub:`0`
 * .. _MEDIA-BUS-FMT-RGB888-1X7X4-JEIDA:
 
   - MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA
@@ -1785,6 +1901,64 @@ JEIDA defined bit mapping will be named
   - b\ :sub:`4`
   - g\ :sub:`3`
   - r\ :sub:`2`
+* .. _MEDIA-BUS-FMT-RGB888-1X7X4-JEIDA_LE:
+
+  - MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA_LE
+  - 0x101d
+  - 0
+  -
+  - r\ :sub:`0`
+  - b\ :sub:`4`
+  - g\ :sub:`3`
+  - r\ :sub:`2`
+* -
+  -
+  - 1
+  -
+  - r\ :sub:`1`
+  - b\ :sub:`5`
+  - g\ :sub:`4`
+  - r\ :sub:`3`
+* -
+  -
+  - 2
+  -
+  - g\ :sub:`0`
+  - b\ :sub:`6`
+  - g\ :sub:`5`
+  - r\ :sub:`4`
+* -
+  -
+  - 3
+  -
+  - g\ :sub:`1`
+  - b\ :sub:`7`
+  - g\ :sub:`6`
+  - r\ :sub:`5`
+* -
+  -
+  - 4
+  -
+  - b\ :sub:`0`
+  - d
+  - g\ :sub:`7`
+  - r\ :sub:`6`
+* -
+  -
+  - 5
+  -
+  - b\ :sub:`1`
+  - d
+  - b\ :sub:`2`
+  - r\ :sub:`7`
+* -
+  -
+  - 6
+  -
+  - d
+  - d
+  - b\ :sub:`3`
+  - g\ :sub:`2`
 
 .. raw:: latex
 
diff --git a/include/uapi/linux/media-bus-format.h 
b/include/uapi/linux/media-bus-format.h
index 9e35117..5bea7c0 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -34,7 +34,7 @@
 
 #define MEDIA_BUS_FMT_FIXED0x0001
 
-/* RGB - next is   0x101b */
+/* RGB - next is   0x101f */
 #define MEDIA_BUS_FMT_RGB444_1X12  0x1016
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE  0x1001
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE  0x1002
@@ -49,13 +49,16 @@
 #define MEDIA_BUS_FMT_RBG888_1X24  0x100e
 #define MEDIA_BUS_FMT_RGB666_1X24_CPADHI   0x1015
 #define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG0x1010
+#define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG_LE 0x101b
 #define MEDIA_BUS_FMT_BGR888_1X24  0x1013
 #define MEDIA_BUS_FMT_GBR888_1X24  0x1014
 #define MEDIA_BUS_FMT_RGB888_1X24  0x100a
 #define MEDIA_BUS_FMT_RGB888_2X12_BE   0x100b
 #define MEDIA_BUS_FMT_RGB888_2X12_LE   0x100c
 #define MEDIA_BUS_FMT_RGB888_1X7X4_SPWG0x1011
+#define 

[PATCH 7/8] drm: panel: Use _LE LVDS formats for data mirroring

2018-04-19 Thread Jacopo Mondi
As now both bridges and panels report supported image formats,
use the newly introduced _LE version of LVDS media bus formats in place
of the DRM_BUS_FLAG_DATA_ flags defined in drm_connector.h

Signed-off-by: Jacopo Mondi 
---
 drivers/gpu/drm/panel/panel-lvds.c | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c 
b/drivers/gpu/drm/panel/panel-lvds.c
index 5185819..ac03eab 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -37,7 +37,6 @@ struct panel_lvds {
unsigned int height;
struct videomode video_mode;
unsigned int bus_format;
-   bool data_mirror;
 
struct backlight_device *backlight;
struct regulator *supply;
@@ -129,9 +128,6 @@ static int panel_lvds_get_modes(struct drm_panel *panel)
connector->display_info.height_mm = lvds->height;
drm_display_info_set_bus_formats(>display_info,
 >bus_format, 1);
-   connector->display_info.bus_flags = lvds->data_mirror
- ? DRM_BUS_FLAG_DATA_LSB_TO_MSB
- : DRM_BUS_FLAG_DATA_MSB_TO_LSB;
 
return 1;
 }
@@ -149,6 +145,7 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)
struct device_node *np = lvds->dev->of_node;
struct display_timing timing;
const char *mapping;
+   bool data_mirror;
int ret;
 
ret = of_get_display_timing(np, "panel-timing", );
@@ -179,20 +176,26 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)
return -ENODEV;
}
 
+   data_mirror = of_property_read_bool(np, "data-mirror");
+
if (!strcmp(mapping, "jeida-18")) {
-   lvds->bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG;
+   lvds->bus_format = data_mirror ?
+  MEDIA_BUS_FMT_RGB666_1X7X3_SPWG_LE :
+  MEDIA_BUS_FMT_RGB666_1X7X3_SPWG;
} else if (!strcmp(mapping, "jeida-24")) {
-   lvds->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
+   lvds->bus_format = data_mirror ?
+  MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA_LE :
+  MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
} else if (!strcmp(mapping, "vesa-24")) {
-   lvds->bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
+   lvds->bus_format = data_mirror ?
+  MEDIA_BUS_FMT_RGB888_1X7X4_SPWG_LE :
+  MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
} else {
dev_err(lvds->dev, "%pOF: invalid or missing %s DT property\n",
np, "data-mapping");
return -EINVAL;
}
 
-   lvds->data_mirror = of_property_read_bool(np, "data-mirror");
-
return 0;
 }
 
-- 
2.7.4



  1   2   >