All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] i2c: designware: Post-slave mode support patches
@ 2017-06-28 14:23 Jarkko Nikula
  2017-06-28 14:23 ` [PATCH 1/2] i2c: designware: Make HW init functions static Jarkko Nikula
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Jarkko Nikula @ 2017-06-28 14:23 UTC (permalink / raw)
  To: linux-i2c
  Cc: Luis Oliveira, Wolfram Sang, Andy Shevchenko, Mika Westerberg,
	Jarkko Nikula

Hi Luis

I noticed couple minor things after review. Here are patches.

Jarkko Nikula (2):
  i2c: designware: Make HW init functions static
  i2c: designware: Let slave adapter support be optional

 drivers/i2c/busses/Kconfig                 | 1 -
 drivers/i2c/busses/i2c-designware-core.h   | 6 ++++--
 drivers/i2c/busses/i2c-designware-master.c | 7 +++----
 drivers/i2c/busses/i2c-designware-slave.c  | 3 +--
 4 files changed, 8 insertions(+), 9 deletions(-)

-- 
2.11.0

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

* [PATCH 1/2] i2c: designware: Make HW init functions static
  2017-06-28 14:23 [PATCH 0/2] i2c: designware: Post-slave mode support patches Jarkko Nikula
@ 2017-06-28 14:23 ` Jarkko Nikula
  2017-07-04 14:13   ` Wolfram Sang
  2017-06-28 14:23 ` [PATCH 2/2] i2c: designware: Let slave adapter support be optional Jarkko Nikula
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Jarkko Nikula @ 2017-06-28 14:23 UTC (permalink / raw)
  To: linux-i2c
  Cc: Luis Oliveira, Wolfram Sang, Andy Shevchenko, Mika Westerberg,
	Jarkko Nikula

Recent i2c-designware slave support patches use master or slave HW init
functions through the function pointer so we can declare them static.

While at it, rename i2c_dw_init() as i2c_dw_init_master().

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/i2c/busses/i2c-designware-core.h   | 2 --
 drivers/i2c/busses/i2c-designware-master.c | 7 +++----
 drivers/i2c/busses/i2c-designware-slave.c  | 3 +--
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 7bfbcc62f6c5..a403dcdfca4b 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -306,8 +306,6 @@ int i2c_dw_handle_tx_abort(struct dw_i2c_dev *dev);
 u32 i2c_dw_func(struct i2c_adapter *adap);
 void i2c_dw_disable(struct dw_i2c_dev *dev);
 void i2c_dw_disable_int(struct dw_i2c_dev *dev);
-int i2c_dw_init(struct dw_i2c_dev *dev);
-int i2c_dw_init_slave(struct dw_i2c_dev *dev);
 
 extern u32 i2c_dw_read_comp_param(struct dw_i2c_dev *dev);
 extern int i2c_dw_probe(struct dw_i2c_dev *dev);
diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index eefc4db1ee3e..418c233075d3 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -51,7 +51,7 @@ static void i2c_dw_configure_fifo_master(struct dw_i2c_dev *dev)
  * This function is called during I2C init function, and in case of timeout at
  * run time.
  */
-int i2c_dw_init(struct dw_i2c_dev *dev)
+static int i2c_dw_init_master(struct dw_i2c_dev *dev)
 {
 	u32 hcnt, lcnt;
 	u32 reg, comp_param1;
@@ -171,7 +171,6 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(i2c_dw_init);
 
 static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
 {
@@ -444,7 +443,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 	if (!wait_for_completion_timeout(&dev->cmd_complete, adap->timeout)) {
 		dev_err(dev->dev, "controller timed out\n");
 		/* i2c_dw_init implicitly disables the adapter */
-		i2c_dw_init(dev);
+		i2c_dw_init_master(dev);
 		ret = -ETIMEDOUT;
 		goto done;
 	}
@@ -622,7 +621,7 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
 
 	init_completion(&dev->cmd_complete);
 
-	dev->init = i2c_dw_init;
+	dev->init = i2c_dw_init_master;
 	dev->disable = i2c_dw_disable;
 	dev->disable_int = i2c_dw_disable_int;
 
diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c
index 4012c74e9785..1b82a8611eb5 100644
--- a/drivers/i2c/busses/i2c-designware-slave.c
+++ b/drivers/i2c/busses/i2c-designware-slave.c
@@ -49,7 +49,7 @@ static void i2c_dw_configure_fifo_slave(struct dw_i2c_dev *dev)
  * This function is called during I2C init function, and in case of timeout at
  * run time.
  */
-int i2c_dw_init_slave(struct dw_i2c_dev *dev)
+static int i2c_dw_init_slave(struct dw_i2c_dev *dev)
 {
 	u32 sda_falling_time, scl_falling_time;
 	u32 reg, comp_param1;
@@ -168,7 +168,6 @@ int i2c_dw_init_slave(struct dw_i2c_dev *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(i2c_dw_init_slave);
 
 static int i2c_dw_reg_slave(struct i2c_client *slave)
 {
-- 
2.11.0

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

* [PATCH 2/2] i2c: designware: Let slave adapter support be optional
  2017-06-28 14:23 [PATCH 0/2] i2c: designware: Post-slave mode support patches Jarkko Nikula
  2017-06-28 14:23 ` [PATCH 1/2] i2c: designware: Make HW init functions static Jarkko Nikula
@ 2017-06-28 14:23 ` Jarkko Nikula
  2017-07-04 14:14   ` Wolfram Sang
  2017-06-29 10:40 ` [PATCH 0/2] i2c: designware: Post-slave mode support patches Andy Shevchenko
  2017-06-29 14:00 ` Luis Oliveira
  3 siblings, 1 reply; 7+ messages in thread
From: Jarkko Nikula @ 2017-06-28 14:23 UTC (permalink / raw)
  To: linux-i2c
  Cc: Luis Oliveira, Wolfram Sang, Andy Shevchenko, Mika Westerberg,
	Jarkko Nikula

Only certain system configurations may use the I2C slave mode so let the
support be optional. This allow reducing module size if needed:

   text    data     bss     dec     hex filename
  10328    1336      16   11680    2da0 drivers/i2c/busses/i2c-designware-core.ko
   7222    1136       8    8366    20ae drivers/i2c/busses/i2c-designware-core.ko

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/i2c/busses/Kconfig               | 1 -
 drivers/i2c/busses/i2c-designware-core.h | 4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index c98c8e51c448..1006b230b236 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -483,7 +483,6 @@ config I2C_DESIGNWARE_CORE
 config I2C_DESIGNWARE_PLATFORM
 	tristate "Synopsys DesignWare Platform"
 	select I2C_DESIGNWARE_CORE
-	select I2C_DESIGNWARE_SLAVE
 	depends on (ACPI && COMMON_CLK) || !ACPI
 	help
 	  If you say yes to this option, support will be included for the
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index a403dcdfca4b..9fee4c054d3d 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -309,7 +309,11 @@ void i2c_dw_disable_int(struct dw_i2c_dev *dev);
 
 extern u32 i2c_dw_read_comp_param(struct dw_i2c_dev *dev);
 extern int i2c_dw_probe(struct dw_i2c_dev *dev);
+#if IS_ENABLED(CONFIG_I2C_DESIGNWARE_SLAVE)
 extern int i2c_dw_probe_slave(struct dw_i2c_dev *dev);
+#else
+static inline int i2c_dw_probe_slave(struct dw_i2c_dev *dev) { return -EINVAL; }
+#endif
 
 #if IS_ENABLED(CONFIG_I2C_DESIGNWARE_BAYTRAIL)
 extern int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev);
-- 
2.11.0

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

* Re: [PATCH 0/2] i2c: designware: Post-slave mode support patches
  2017-06-28 14:23 [PATCH 0/2] i2c: designware: Post-slave mode support patches Jarkko Nikula
  2017-06-28 14:23 ` [PATCH 1/2] i2c: designware: Make HW init functions static Jarkko Nikula
  2017-06-28 14:23 ` [PATCH 2/2] i2c: designware: Let slave adapter support be optional Jarkko Nikula
@ 2017-06-29 10:40 ` Andy Shevchenko
  2017-06-29 14:00 ` Luis Oliveira
  3 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2017-06-29 10:40 UTC (permalink / raw)
  To: Jarkko Nikula, linux-i2c; +Cc: Luis Oliveira, Wolfram Sang, Mika Westerberg

On Wed, 2017-06-28 at 17:23 +0300, Jarkko Nikula wrote:
> Hi Luis
> 
> I noticed couple minor things after review. Here are patches.
> 

I like the series, esp. patch 1.

Reviewed-and-acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.co
m>


> Jarkko Nikula (2):
>   i2c: designware: Make HW init functions static
>   i2c: designware: Let slave adapter support be optional
> 
>  drivers/i2c/busses/Kconfig                 | 1 -
>  drivers/i2c/busses/i2c-designware-core.h   | 6 ++++--
>  drivers/i2c/busses/i2c-designware-master.c | 7 +++----
>  drivers/i2c/busses/i2c-designware-slave.c  | 3 +--
>  4 files changed, 8 insertions(+), 9 deletions(-)
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

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

* Re: [PATCH 0/2] i2c: designware: Post-slave mode support patches
  2017-06-28 14:23 [PATCH 0/2] i2c: designware: Post-slave mode support patches Jarkko Nikula
                   ` (2 preceding siblings ...)
  2017-06-29 10:40 ` [PATCH 0/2] i2c: designware: Post-slave mode support patches Andy Shevchenko
@ 2017-06-29 14:00 ` Luis Oliveira
  3 siblings, 0 replies; 7+ messages in thread
From: Luis Oliveira @ 2017-06-29 14:00 UTC (permalink / raw)
  To: Jarkko Nikula, linux-i2c
  Cc: Luis Oliveira, Wolfram Sang, Andy Shevchenko, Mika Westerberg

On 28-Jun-17 15:23, Jarkko Nikula wrote:
> Hi Luis
> 
> I noticed couple minor things after review. Here are patches.
> 
Hi Jarkko, thank you. Just tested them and everything works as expected.

> Jarkko Nikula (2):
>   i2c: designware: Make HW init functions static
>   i2c: designware: Let slave adapter support be optional
> 
>  drivers/i2c/busses/Kconfig                 | 1 -
>  drivers/i2c/busses/i2c-designware-core.h   | 6 ++++--
>  drivers/i2c/busses/i2c-designware-master.c | 7 +++----
>  drivers/i2c/busses/i2c-designware-slave.c  | 3 +--
>  4 files changed, 8 insertions(+), 9 deletions(-)
> 
Tested-by: Luis Oliveira <lolivei@synopsys.com>

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

* Re: [PATCH 1/2] i2c: designware: Make HW init functions static
  2017-06-28 14:23 ` [PATCH 1/2] i2c: designware: Make HW init functions static Jarkko Nikula
@ 2017-07-04 14:13   ` Wolfram Sang
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2017-07-04 14:13 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i2c, Luis Oliveira, Andy Shevchenko, Mika Westerberg

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

On Wed, Jun 28, 2017 at 05:23:28PM +0300, Jarkko Nikula wrote:
> Recent i2c-designware slave support patches use master or slave HW init
> functions through the function pointer so we can declare them static.
> 
> While at it, rename i2c_dw_init() as i2c_dw_init_master().
> 
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> ---
>  drivers/i2c/busses/i2c-designware-core.h   | 2 --

Applied to for-next (for this merge window), so we have slave support
immediately as proper as possible, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 2/2] i2c: designware: Let slave adapter support be optional
  2017-06-28 14:23 ` [PATCH 2/2] i2c: designware: Let slave adapter support be optional Jarkko Nikula
@ 2017-07-04 14:14   ` Wolfram Sang
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2017-07-04 14:14 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i2c, Luis Oliveira, Andy Shevchenko, Mika Westerberg

[-- Attachment #1: Type: text/plain, Size: 620 bytes --]

On Wed, Jun 28, 2017 at 05:23:29PM +0300, Jarkko Nikula wrote:
> Only certain system configurations may use the I2C slave mode so let the
> support be optional. This allow reducing module size if needed:
> 
>    text    data     bss     dec     hex filename
>   10328    1336      16   11680    2da0 drivers/i2c/busses/i2c-designware-core.ko
>    7222    1136       8    8366    20ae drivers/i2c/busses/i2c-designware-core.ko
> 
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

Applied to for-next (for this merge window), so we have slave support
immediately as proper as possible, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-07-04 14:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28 14:23 [PATCH 0/2] i2c: designware: Post-slave mode support patches Jarkko Nikula
2017-06-28 14:23 ` [PATCH 1/2] i2c: designware: Make HW init functions static Jarkko Nikula
2017-07-04 14:13   ` Wolfram Sang
2017-06-28 14:23 ` [PATCH 2/2] i2c: designware: Let slave adapter support be optional Jarkko Nikula
2017-07-04 14:14   ` Wolfram Sang
2017-06-29 10:40 ` [PATCH 0/2] i2c: designware: Post-slave mode support patches Andy Shevchenko
2017-06-29 14:00 ` Luis Oliveira

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.