Re: [RFC] i2c: add deprecation warning for class based instantiation

2013-06-20 Thread Wolfram Sang
Hi,

> Sorry, for delayed reply - I've had problems with my e-mail.

You still have. This message has unwanted linebreaks.

> I've tested this patch on our TI K3.4 product kernel with additional
> change below:

Thanks.

> [0.662567]  (null): This adapter will soon drop class based
> instantiation of slaves
> ^ invalid adapter device name here

Good point, thanks! Will send an updated patch in a minute.

> In addition, I've found the following users of *i2c-gpio* (just FYI):

Ehrm, okay, and why exactly did you post it? :)

Regards,

   Wolfram



signature.asc
Description: Digital signature


Re: [RFC] i2c: add deprecation warning for class based instantiation

2013-06-19 Thread Grygorii Strashko

On 06/07/2013 12:09 PM, Wolfram Sang wrote:

Class based instantiation can cause huge delays when booting. This
mechanism was used when it was not possible to describe slaves on I2C
busses. We now have other mechanisms, so most embedded I2C will not need
classes and it was explicitly not recommended to use them. Add a
deprecation warning for drivers who want to disable class based in the
near future to gain boot-up time, so users relying on this technique can
switch to something better. They really should.

Signed-off-by: Wolfram Sang 
---
  drivers/i2c/busses/i2c-omap.c |2 +-
  drivers/i2c/i2c-core.c|6 ++
  include/linux/i2c.h   |1 +
  3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index e02f9e3..f06109f 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1231,7 +1231,7 @@ omap_i2c_probe(struct platform_device *pdev)
adap = &dev->adapter;
i2c_set_adapdata(adap, dev);
adap->owner = THIS_MODULE;
-   adap->class = I2C_CLASS_HWMON;
+   adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;
strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name));
adap->algo = &omap_i2c_algo;
adap->dev.parent = &pdev->dev;
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 48e31ed..47ea1f0 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -999,6 +999,12 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
return -EINVAL;
}
  
+	if (adap->class & I2C_CLASS_DEPRECATED)

+   dev_warn(&adap->dev, "This adapter will soon drop class based "
+   "instantiation of slaves\nPlease make sure all its I2C "
+   "devices are instantiated by other means.\nCheck "
+   "'Documentation/i2c/instantiating-devices' for 
details\n");
+
Seems, this need to be moved down - after res = 
device_register(&adap->dev);
- or - right before: bus_for_each_drv(&i2c_bus_type, NULL, adap, 
__process_new_adapter);




rt_mutex_init(&adap->bus_lock);
mutex_init(&adap->userspace_clients_lock);
INIT_LIST_HEAD(&adap->userspace_clients);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index e988fa9..ffab838 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -473,6 +473,7 @@ void i2c_unlock_adapter(struct i2c_adapter *);
  #define I2C_CLASS_HWMON   (1<<0)/* lm_sensors, ... */
  #define I2C_CLASS_DDC (1<<3)/* DDC bus on graphics adapters */
  #define I2C_CLASS_SPD (1<<7)/* Memory modules */
+#define I2C_CLASS_DEPRECATED   (1<<8)/* Warn users that adapter will stop 
using classes */
  
  /* Internal numbers to terminate lists */

  #define I2C_CLIENT_END0xfffeU




- grygorii
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] i2c: add deprecation warning for class based instantiation

2013-06-19 Thread Grygorii Strashko

Hi Wolfram,

On 06/19/2013 01:15 PM, Wolfram Sang wrote:

On Fri, Jun 07, 2013 at 11:09:26AM +0200, Wolfram Sang wrote:

Class based instantiation can cause huge delays when booting. This
mechanism was used when it was not possible to describe slaves on I2C
busses. We now have other mechanisms, so most embedded I2C will not need
classes and it was explicitly not recommended to use them. Add a
deprecation warning for drivers who want to disable class based in the
near future to gain boot-up time, so users relying on this technique can
switch to something better. They really should.

Signed-off-by: Wolfram Sang 

No reactions on this, pity. Deferring.


Sorry, for delayed reply - I've had problems with my e-mail.

I've tested this patch on our TI K3.4 product kernel with additional 
change below:

diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index c0330a4..442101d 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -186,7 +186,7 @@ static int __devinit i2c_gpio_probe(struct 
platform_device *pdev)

adap->owner = THIS_MODULE;
snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
adap->algo_data = bit_data;
-   adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
+   adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD | 
I2C_CLASS_DEPRECATED;

adap->dev.parent = &pdev->dev;
adap->dev.of_node = pdev->dev.of_node;

It works fine, in general - see my minor comment inline.
[0.662536] omap_i2c omap_i2c.2: bus 2 rev2.4.0 at 400 kHz
[0.662567]  (null): This adapter will soon drop class based 
instantiation of slaves

^ invalid adapter device name here
[0.662567] Please make sure all its I2C devices are instantiated by 
other means.

[0.662567] Check 'Documentation/i2c/instantiating-devices' for details

Also tested on Linux master - OMAP4 SDP board.

In addition, I've found the following users of *i2c-gpio* (just FYI):
./arch/powerpc/boot/dts/wii.dts:compatible = "i2c-gpio";
./arch/mips/alchemy/board-gpr.c:.name= "i2c-gpio",
./arch/mips/ath79/mach-pb44.c:.name= "i2c-gpio",
./arch/avr32/boards/merisc/setup.c:.name= "i2c-gpio",
./arch/avr32/boards/atngw100/setup.c:.name= "i2c-gpio",
./arch/avr32/boards/hammerhead/setup.c:.name= "i2c-gpio",
./arch/avr32/boards/mimc200/setup.c:.name= "i2c-gpio",
./arch/blackfin/mach-bf533/boards/blackstamp.c:.name= 
"i2c-gpio",

./arch/blackfin/mach-bf533/boards/ezkit.c:.name= "i2c-gpio",
./arch/blackfin/mach-bf533/boards/stamp.c:.name= "i2c-gpio",
./arch/blackfin/mach-bf561/boards/ezkit.c:.name= "i2c-gpio",
./arch/arm/mach-ep93xx/core.c:.name= "i2c-gpio",
./arch/arm/mach-shmobile/board-armadillo800eva.c:.name = "i2c-gpio",
./arch/arm/mach-pxa/viper.c:.name= "i2c-gpio",
./arch/arm/mach-pxa/viper.c:tpm_device = 
platform_device_alloc("i2c-gpio", 2);

./arch/arm/mach-pxa/palmz72.c:.name= "i2c-gpio",
./arch/arm/boot/dts/at91sam9g45.dtsi:compatible = "i2c-gpio";
./arch/arm/boot/dts/at91sam9263.dtsi:compatible = "i2c-gpio";
./arch/arm/boot/dts/at91sam9x5.dtsi:compatible = "i2c-gpio";
./arch/arm/boot/dts/at91sam9x5.dtsi:compatible = "i2c-gpio";
./arch/arm/boot/dts/at91sam9x5.dtsi:compatible = "i2c-gpio";
./arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi:i2c-gpio@0 {
./arch/arm/boot/dts/ste-nomadik-stn8815.dtsi:compatible = 
"i2c-gpio";
./arch/arm/boot/dts/ste-nomadik-stn8815.dtsi:compatible = 
"i2c-gpio";
./arch/arm/boot/dts/ste-nomadik-stn8815.dtsi:compatible = 
"i2c-gpio";

./arch/arm/boot/dts/at91sam9260.dtsi:compatible = "i2c-gpio";
./arch/arm/boot/dts/at91rm9200.dtsi:compatible = "i2c-gpio";
./arch/arm/boot/dts/at91sam9n12.dtsi:compatible = "i2c-gpio";
./arch/arm/mach-ks8695/board-acs5k.c:.name= "i2c-gpio",
./arch/arm/mach-s5pv210/mach-goni.c:.name= "i2c-gpio",
./arch/arm/mach-s5pv210/mach-goni.c:.name= "i2c-gpio",
./arch/arm/mach-s5pv210/mach-aquila.c:.name= "i2c-gpio",
./arch/arm/mach-s5pv210/mach-aquila.c:.name= "i2c-gpio",
./arch/arm/mach-sa1100/simpad.c:.name = "i2c-gpio",
./arch/arm/mach-exynos/mach-universal_c210.c:.name= "i2c-gpio",
./arch/arm/mach-exynos/mach-nuri.c:.name= "i2c-gpio",
./arch/arm/mach-at91/at91sam9263_devices.c:.name= 
"i2c-gpio",
./arch/arm/mach-at91/at91sam9261_devices.c:.name= 
"i2c-gpio",
./arch/arm/mach-at91/at91sam9g45_devices.c:.name= 
"i2c-gpio",
./arch/arm/mach-at91/at91sam9g45_devices.c:.name= 
"i2c-gpio",

./arch/arm/mach-at91/at91rm9200_devices.c:.name= "i2c-gpio",
./arch/arm/mach-at91/at91sam9260_devices.c:.name= 
"i2c-gpio",

./arch/arm/mach-at91/at91sam9rl_de

Re: [RFC] i2c: add deprecation warning for class based instantiation

2013-06-19 Thread Wolfram Sang
On Fri, Jun 07, 2013 at 11:09:26AM +0200, Wolfram Sang wrote:
> Class based instantiation can cause huge delays when booting. This
> mechanism was used when it was not possible to describe slaves on I2C
> busses. We now have other mechanisms, so most embedded I2C will not need
> classes and it was explicitly not recommended to use them. Add a
> deprecation warning for drivers who want to disable class based in the
> near future to gain boot-up time, so users relying on this technique can
> switch to something better. They really should.
> 
> Signed-off-by: Wolfram Sang 

No reactions on this, pity. Deferring.



signature.asc
Description: Digital signature


[RFC] i2c: add deprecation warning for class based instantiation

2013-06-07 Thread Wolfram Sang
Class based instantiation can cause huge delays when booting. This
mechanism was used when it was not possible to describe slaves on I2C
busses. We now have other mechanisms, so most embedded I2C will not need
classes and it was explicitly not recommended to use them. Add a
deprecation warning for drivers who want to disable class based in the
near future to gain boot-up time, so users relying on this technique can
switch to something better. They really should.

Signed-off-by: Wolfram Sang 
---
 drivers/i2c/busses/i2c-omap.c |2 +-
 drivers/i2c/i2c-core.c|6 ++
 include/linux/i2c.h   |1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index e02f9e3..f06109f 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1231,7 +1231,7 @@ omap_i2c_probe(struct platform_device *pdev)
adap = &dev->adapter;
i2c_set_adapdata(adap, dev);
adap->owner = THIS_MODULE;
-   adap->class = I2C_CLASS_HWMON;
+   adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;
strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name));
adap->algo = &omap_i2c_algo;
adap->dev.parent = &pdev->dev;
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 48e31ed..47ea1f0 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -999,6 +999,12 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
return -EINVAL;
}
 
+   if (adap->class & I2C_CLASS_DEPRECATED)
+   dev_warn(&adap->dev, "This adapter will soon drop class based "
+   "instantiation of slaves\nPlease make sure all its I2C "
+   "devices are instantiated by other means.\nCheck "
+   "'Documentation/i2c/instantiating-devices' for 
details\n");
+
rt_mutex_init(&adap->bus_lock);
mutex_init(&adap->userspace_clients_lock);
INIT_LIST_HEAD(&adap->userspace_clients);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index e988fa9..ffab838 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -473,6 +473,7 @@ void i2c_unlock_adapter(struct i2c_adapter *);
 #define I2C_CLASS_HWMON(1<<0)  /* lm_sensors, ... */
 #define I2C_CLASS_DDC  (1<<3)  /* DDC bus on graphics adapters */
 #define I2C_CLASS_SPD  (1<<7)  /* Memory modules */
+#define I2C_CLASS_DEPRECATED   (1<<8)  /* Warn users that adapter will stop 
using classes */
 
 /* Internal numbers to terminate lists */
 #define I2C_CLIENT_END 0xfffeU
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html