2014-02-10 10:10:44

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 00/17] i2c: deprecate class based instantiation for embedded I2C drivers

With I2C, class based instantiation means if a master driver has e.g.
I2C_CLASS_HWMON set, all slave drivers with this class will try to probe a
device using an array of possible addresses and some heuristics. That creates
traffic and needs time, even when nothing is connected. This mechanism is
needed when you do not have another method to describe the slaves. Embedded I2C
drivers do not need class based instantiation, since there is i2c_board_info or
devicetree description. Some drivers have the class flags set, though, and it
has spread further over the years. We can't remove the flags directly, because
there might be users out there relying on this feature. So, we add a
deprecation warning if a device is instantiated via class attributes. After
giving some time to switch over, we can then finally remove the class flags and
gain boot time.

Patch 1 adds some missing documentation. Patch 2 adds the deprecation feature.
Patches 3+4 are tested on hardware I need. Patches 5-17 are suggestions for
drivers I think could benefit from that. For those, acks are needed before I
will apply them to my tree. If you use a different driver which can also
benefit from this, just send a patch adding the new DEPRECATED flag.

The series can also be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/deprecated_class

Thanks,

Wolfram


Wolfram Sang (17):
Documentation: i2c: describe devicetree method for instantiating
devices
i2c: add deprecation warning for class based instantiation
i2c: i2c-omap: deprecate class based instantiation
i2c: i2c-at91: deprecate class based instantiation
i2c: i2c-bcm2835: deprecate class based instantiation
i2c: i2c-bfin-twi: deprecate class based instantiation
i2c: i2c-davinci: deprecate class based instantiation
i2c: i2c-designware-platdrv: deprecate class based instantiation
i2c: i2c-mv64xxx: deprecate class based instantiation
i2c: i2c-nomadik: deprecate class based instantiation
i2c: i2c-ocores: deprecate class based instantiation
i2c: i2c-rcar: deprecate class based instantiation
i2c: i2c-s3c2410: deprecate class based instantiation
i2c: i2c-sirf: deprecate class based instantiation
i2c: i2c-stu300: deprecate class based instantiation
i2c: i2c-tegra: deprecate class based instantiation
i2c: i2c-xiic: deprecate class based instantiation

Documentation/i2c/instantiating-devices | 34 +++++++++++++++++++++++++++--
drivers/i2c/busses/i2c-at91.c | 2 +-
drivers/i2c/busses/i2c-bcm2835.c | 2 +-
drivers/i2c/busses/i2c-bfin-twi.c | 2 +-
drivers/i2c/busses/i2c-davinci.c | 2 +-
drivers/i2c/busses/i2c-designware-platdrv.c | 2 +-
drivers/i2c/busses/i2c-mv64xxx.c | 2 +-
drivers/i2c/busses/i2c-nomadik.c | 2 +-
drivers/i2c/busses/i2c-ocores.c | 2 +-
drivers/i2c/busses/i2c-omap.c | 2 +-
drivers/i2c/busses/i2c-rcar.c | 2 +-
drivers/i2c/busses/i2c-s3c2410.c | 2 +-
drivers/i2c/busses/i2c-sirf.c | 2 +-
drivers/i2c/busses/i2c-stu300.c | 2 +-
drivers/i2c/busses/i2c-tegra.c | 2 +-
drivers/i2c/busses/i2c-xiic.c | 2 +-
drivers/i2c/i2c-core.c | 7 ++++++
include/linux/i2c.h | 1 +
18 files changed, 55 insertions(+), 17 deletions(-)

--
1.8.5.1


2014-02-10 10:04:42

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 09/17] i2c: i2c-mv64xxx: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

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

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-mv64xxx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 8be7e42..05801c6 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -851,7 +851,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
drv_data->adapter.dev.parent = &pd->dev;
drv_data->adapter.algo = &mv64xxx_i2c_algo;
drv_data->adapter.owner = THIS_MODULE;
- drv_data->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
+ drv_data->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED;
drv_data->adapter.nr = pd->id;
drv_data->adapter.dev.of_node = pd->dev.of_node;
platform_set_drvdata(pd, drv_data);
--
1.8.5.1

2014-02-10 10:04:40

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 07/17] i2c: i2c-davinci: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

Signed-off-by: Wolfram Sang <[email protected]>
Cc: Sekhar Nori <[email protected]>
Cc: Kevin Hilman <[email protected]>
---

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-davinci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index af0b583..389bc68 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -712,7 +712,7 @@ static int davinci_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, "DaVinci I2C adapter", sizeof(adap->name));
adap->algo = &i2c_davinci_algo;
adap->dev.parent = &pdev->dev;
--
1.8.5.1

2014-02-10 10:04:53

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 14/17] i2c: i2c-sirf: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

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

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-sirf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index 6784f7f..8e3be7e 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -312,7 +312,7 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev)
goto out;
}
adap = &siic->adapter;
- adap->class = I2C_CLASS_HWMON;
+ adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;

mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
siic->base = devm_ioremap_resource(&pdev->dev, mem_res);
--
1.8.5.1

2014-02-10 10:04:55

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 16/17] i2c: i2c-tegra: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

Signed-off-by: Wolfram Sang <[email protected]>
Cc: Laxman Dewangan <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Thierry Reding <[email protected]>
---

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-tegra.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index e661ede..a9adbbe 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -787,7 +787,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)

i2c_set_adapdata(&i2c_dev->adapter, i2c_dev);
i2c_dev->adapter.owner = THIS_MODULE;
- i2c_dev->adapter.class = I2C_CLASS_HWMON;
+ i2c_dev->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;
strlcpy(i2c_dev->adapter.name, "Tegra I2C adapter",
sizeof(i2c_dev->adapter.name));
i2c_dev->adapter.algo = &tegra_i2c_algo;
--
1.8.5.1

2014-02-10 10:04:50

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 15/17] i2c: i2c-stu300: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

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

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-stu300.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 04a17b9..d381af9 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -911,7 +911,7 @@ static int stu300_probe(struct platform_device *pdev)
adap = &dev->adapter;
adap->owner = THIS_MODULE;
/* DDC class but actually often used for more generic I2C */
- adap->class = I2C_CLASS_DDC;
+ adap->class = I2C_CLASS_DDC | I2C_CLASS_DEPRECATED;
strlcpy(adap->name, "ST Microelectronics DDC I2C adapter",
sizeof(adap->name));
adap->nr = bus_nr;
--
1.8.5.1

2014-02-10 10:05:47

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 17/17] i2c: i2c-xiic: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

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

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-xiic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index fc2716a..6bda167 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -682,7 +682,7 @@ static const struct i2c_algorithm xiic_algorithm = {
static struct i2c_adapter xiic_adapter = {
.owner = THIS_MODULE,
.name = DRIVER_NAME,
- .class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
+ .class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED,
.algo = &xiic_algorithm,
};

--
1.8.5.1

2014-02-10 10:04:47

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 13/17] i2c: i2c-s3c2410: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

Signed-off-by: Wolfram Sang <[email protected]>
Cc: Ben Dooks <[email protected]>
Cc: Kukjin Kim <[email protected]>
---

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-s3c2410.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index bf8fb94..4a623e0 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1062,7 +1062,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
i2c->adap.owner = THIS_MODULE;
i2c->adap.algo = &s3c24xx_i2c_algorithm;
i2c->adap.retries = 2;
- i2c->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
+ i2c->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED;
i2c->tx_setup = 50;

init_waitqueue_head(&i2c->wait);
--
1.8.5.1

2014-02-10 10:07:18

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 12/17] i2c: i2c-rcar: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

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

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-rcar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 2c2fd7c..a4951de 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -691,7 +691,7 @@ static int rcar_i2c_probe(struct platform_device *pdev)
adap = &priv->adap;
adap->nr = pdev->id;
adap->algo = &rcar_i2c_algo;
- adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
+ adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED;
adap->retries = 3;
adap->dev.parent = dev;
adap->dev.of_node = dev->of_node;
--
1.8.5.1

2014-02-10 10:07:59

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 11/17] i2c: i2c-ocores: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

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

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-ocores.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index c61f37a..f49fe26 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -247,7 +247,7 @@ static const struct i2c_algorithm ocores_algorithm = {
static struct i2c_adapter ocores_adapter = {
.owner = THIS_MODULE,
.name = "i2c-ocores",
- .class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
+ .class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED,
.algo = &ocores_algorithm,
};

--
1.8.5.1

2014-02-10 10:04:36

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 01/17] Documentation: i2c: describe devicetree method for instantiating devices

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

Documentation/i2c/instantiating-devices | 34 +++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/Documentation/i2c/instantiating-devices b/Documentation/i2c/instantiating-devices
index c70e7a7..6df095a 100644
--- a/Documentation/i2c/instantiating-devices
+++ b/Documentation/i2c/instantiating-devices
@@ -8,8 +8,8 @@ reason, the kernel code must instantiate I2C devices explicitly. There are
several ways to achieve this, depending on the context and requirements.


-Method 1: Declare the I2C devices by bus number
------------------------------------------------
+Method 1a: Declare the I2C devices by bus number
+------------------------------------------------

This method is appropriate when the I2C bus is a system bus as is the case
for many embedded systems. On such systems, each I2C bus has a number
@@ -51,6 +51,36 @@ The devices will be automatically unbound and destroyed when the I2C bus
they sit on goes away (if ever.)


+Method 1b: Declare the I2C devices via devicetree
+-------------------------------------------------
+
+This method has the same implications as method 1a. The declaration of I2C
+devices is here done via devicetree as subnodes of the master controller.
+
+Example:
+
+ i2c1: i2c@400a0000 {
+ /* ... master properties skipped ... */
+ clock-frequency = <100000>;
+
+ flash@50 {
+ compatible = "atmel,24c256";
+ reg = <0x50>;
+ };
+
+ pca9532: gpio@60 {
+ compatible = "nxp,pca9532";
+ gpio-controller;
+ #gpio-cells = <2>;
+ reg = <0x60>;
+ };
+ };
+
+Here, two devices are attached to the bus using a speed of 100kHz. For
+additional properties which might be needed to set up the device, please refer
+to its devicetree documentation in Documentation/devicetree/bindings/.
+
+
Method 2: Instantiate the devices explicitly
--------------------------------------------

--
1.8.5.1

2014-02-10 10:08:31

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 10/17] i2c: i2c-nomadik: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

Signed-off-by: Wolfram Sang <[email protected]>
Cc: Alessandro Rubini <[email protected]>
Cc: Linus Walleij <[email protected]>
---

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-nomadik.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 8bf9ac0..e3777ac 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -1019,7 +1019,7 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
adap->dev.of_node = np;
adap->dev.parent = &adev->dev;
adap->owner = THIS_MODULE;
- adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
+ adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED;
adap->algo = &nmk_i2c_algo;
adap->timeout = msecs_to_jiffies(pdata->timeout);
snprintf(adap->name, sizeof(adap->name),
--
1.8.5.1

2014-02-10 10:08:29

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 08/17] i2c: i2c-designware-platdrv: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

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

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-designware-platdrv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index d0bdac0..d348940 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -195,7 +195,7 @@ static int dw_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, "Synopsys DesignWare I2C adapter",
sizeof(adap->name));
adap->algo = &i2c_dw_algo;
--
1.8.5.1

2014-02-10 10:04:34

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 03/17] i2c: i2c-omap: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

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

drivers/i2c/busses/i2c-omap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 90dcc2e..8e29004 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1238,7 +1238,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;
--
1.8.5.1

2014-02-10 10:09:23

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 06/17] i2c: i2c-bfin-twi: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

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

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-bfin-twi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index 3b9bd9a..c75f0e9 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -669,7 +669,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name));
p_adap->algo = &bfin_twi_algorithm;
p_adap->algo_data = iface;
- p_adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
+ p_adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED;
p_adap->dev.parent = &pdev->dev;
p_adap->timeout = 5 * HZ;
p_adap->retries = 3;
--
1.8.5.1

2014-02-10 10:04:32

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 02/17] i2c: add deprecation warning for class based instantiation

Class based instantiation can cause noticeable delays when booting. This
mechanism is used when it is not possible to describe slaves on I2C
busses. As we do have other mechanisms, most embedded I2C will not need
classes and for embedded it is explicitly not recommended to use them. Add
a deprecation warning for drivers which want to disable class based
instantiation 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 <[email protected]>
Cc: Jean Delvare <[email protected]>
Cc: [email protected]
---

drivers/i2c/i2c-core.c | 7 +++++++
include/linux/i2c.h | 1 +
2 files changed, 8 insertions(+)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index d74c0b3..42fcc59 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1935,6 +1935,13 @@ static int i2c_detect_address(struct i2c_client *temp_client,
struct i2c_client *client;

/* Detection succeeded, instantiate the device */
+ if (adapter->class & I2C_CLASS_DEPRECATED)
+ dev_warn(&adapter->dev,
+ "This adapter will soon drop class based instantiation of devices. "
+ "Please make sure client 0x%02x gets instantiated by other means. "
+ "Check 'Documentation/i2c/instantiating-devices' for details.\n",
+ info.addr);
+
dev_dbg(&adapter->dev, "Creating %s at 0x%02x\n",
info.type, info.addr);
client = i2c_new_device(adapter, &info);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index d9c8dbd3..b9e1707 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.8.5.1

2014-02-10 10:09:42

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 05/17] i2c: i2c-bcm2835: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

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

This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.

drivers/i2c/busses/i2c-bcm2835.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index 77df97b..6722808 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -295,7 +295,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
adap = &i2c_dev->adapter;
i2c_set_adapdata(adap, i2c_dev);
adap->owner = THIS_MODULE;
- adap->class = I2C_CLASS_HWMON;
+ adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;
strlcpy(adap->name, "bcm2835 I2C adapter", sizeof(adap->name));
adap->algo = &bcm2835_i2c_algo;
adap->dev.parent = &pdev->dev;
--
1.8.5.1

2014-02-10 10:10:26

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 04/17] i2c: i2c-at91: deprecate class based instantiation

Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.

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

drivers/i2c/busses/i2c-at91.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 8edba9d..4babcdb 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -759,7 +759,7 @@ static int at91_twi_probe(struct platform_device *pdev)
snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91");
i2c_set_adapdata(&dev->adapter, dev);
dev->adapter.owner = THIS_MODULE;
- dev->adapter.class = I2C_CLASS_HWMON;
+ dev->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;
dev->adapter.algo = &at91_twi_algorithm;
dev->adapter.dev.parent = dev->dev;
dev->adapter.nr = pdev->id;
--
1.8.5.1

2014-02-10 10:14:59

by Peter Korsgaard

[permalink] [raw]
Subject: Re: [PATCH 11/17] i2c: i2c-ocores: deprecate class based instantiation

>>>>> "Wolfram" == Wolfram Sang <[email protected]> writes:

> Warn users that class based instantiation is going away soon in favour
> of more robust probing and faster bootup times.

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

> This patch is a suggestion. Looking for an ack by someone who actually uses
> the driver.

It's been some time since I last used it, but I never needed the class
based probing, so:

Acked-by: Peter Korsgaard <[email protected]>

--
Bye, Peter Korsgaard

2014-02-10 16:47:06

by Stephen Warren

[permalink] [raw]
Subject: Re: [PATCH 16/17] i2c: i2c-tegra: deprecate class based instantiation

On 02/10/2014 03:04 AM, Wolfram Sang wrote:
> Warn users that class based instantiation is going away soon in favour
> of more robust probing and faster bootup times.

Acked-by: Stephen Warren <[email protected]>

2014-02-10 18:21:22

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 01/17] Documentation: i2c: describe devicetree method for instantiating devices

Quoting Wolfram Sang <[email protected]>:

> Signed-off-by: Wolfram Sang <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
>
> Documentation/i2c/instantiating-devices | 34
> +++++++++++++++++++++++++++++++--
> 1 file changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/i2c/instantiating-devices
> b/Documentation/i2c/instantiating-devices
> index c70e7a7..6df095a 100644
> --- a/Documentation/i2c/instantiating-devices
> +++ b/Documentation/i2c/instantiating-devices
> @@ -8,8 +8,8 @@ reason, the kernel code must instantiate I2C devices
> explicitly. There are
> several ways to achieve this, depending on the context and requirements.
>
>
> -Method 1: Declare the I2C devices by bus number
> ------------------------------------------------
> +Method 1a: Declare the I2C devices by bus number
> +------------------------------------------------
>
> This method is appropriate when the I2C bus is a system bus as is the case
> for many embedded systems. On such systems, each I2C bus has a number
> @@ -51,6 +51,36 @@ The devices will be automatically unbound and
> destroyed when the I2C bus
> they sit on goes away (if ever.)
>
>
> +Method 1b: Declare the I2C devices via devicetree
> +-------------------------------------------------
> +

Hi Wolfram,

There is now also a means to instantiate I2C devices through
ACPI. This is documented in Documentation/acpi/enumeration.txt.

Might be worthwhile to reference it from instantiating-devices.
I guess that would be a separate patch though.

Thanks,
Guenter

2014-02-11 09:03:05

by Sonic Zhang

[permalink] [raw]
Subject: Re: [PATCH 06/17] i2c: i2c-bfin-twi: deprecate class based instantiation

Acked-by: Sonic Zhang <[email protected]>

On Mon, Feb 10, 2014 at 6:04 PM, Wolfram Sang <[email protected]> wrote:
> Warn users that class based instantiation is going away soon in favour
> of more robust probing and faster bootup times.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> Cc: Sonic Zhang <[email protected]>
> ---
>
> This patch is a suggestion. Looking for an ack by someone who actually uses
> the driver.
>
> drivers/i2c/busses/i2c-bfin-twi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
> index 3b9bd9a..c75f0e9 100644
> --- a/drivers/i2c/busses/i2c-bfin-twi.c
> +++ b/drivers/i2c/busses/i2c-bfin-twi.c
> @@ -669,7 +669,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
> strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name));
> p_adap->algo = &bfin_twi_algorithm;
> p_adap->algo_data = iface;
> - p_adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
> + p_adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED;
> p_adap->dev.parent = &pdev->dev;
> p_adap->timeout = 5 * HZ;
> p_adap->retries = 3;
> --
> 1.8.5.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2014-02-11 13:33:42

by Ludovic Desroches

[permalink] [raw]
Subject: Re: [PATCH 04/17] i2c: i2c-at91: deprecate class based instantiation

On Mon, Feb 10, 2014 at 11:03:58AM +0100, Wolfram Sang wrote:
> Warn users that class based instantiation is going away soon in favour
> of more robust probing and faster bootup times.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> Cc: Ludovic Desroches <[email protected]>

Acked-by: Ludovic Desroches <[email protected]>

Thanks

> ---
>
> drivers/i2c/busses/i2c-at91.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index 8edba9d..4babcdb 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -759,7 +759,7 @@ static int at91_twi_probe(struct platform_device *pdev)
> snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91");
> i2c_set_adapdata(&dev->adapter, dev);
> dev->adapter.owner = THIS_MODULE;
> - dev->adapter.class = I2C_CLASS_HWMON;
> + dev->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;
> dev->adapter.algo = &at91_twi_algorithm;
> dev->adapter.dev.parent = dev->dev;
> dev->adapter.nr = pdev->id;
> --
> 1.8.5.1
>

2014-02-12 15:15:52

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 01/17] Documentation: i2c: describe devicetree method for instantiating devices


> There is now also a means to instantiate I2C devices through
> ACPI. This is documented in Documentation/acpi/enumeration.txt.
>
> Might be worthwhile to reference it from instantiating-devices.
> I guess that would be a separate patch though.

Yes, it would. Thanks for the pointer!


Attachments:
(No filename) (289.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2014-02-12 16:22:25

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 15/17] i2c: i2c-stu300: deprecate class based instantiation

On Mon, Feb 10, 2014 at 11:04 AM, Wolfram Sang <[email protected]> wrote:

> Warn users that class based instantiation is going away soon in favour
> of more robust probing and faster bootup times.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> Cc: Linus Walleij <[email protected]>
> ---
>
> This patch is a suggestion. Looking for an ack by someone who actually uses
> the driver.

Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2014-02-12 16:24:44

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 10/17] i2c: i2c-nomadik: deprecate class based instantiation

On Mon, Feb 10, 2014 at 11:04 AM, Wolfram Sang <[email protected]> wrote:

> Warn users that class based instantiation is going away soon in favour
> of more robust probing and faster bootup times.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> Cc: Alessandro Rubini <[email protected]>
> Cc: Linus Walleij <[email protected]>
> ---
>
> This patch is a suggestion. Looking for an ack by someone who actually uses
> the driver.

Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2014-02-15 14:48:36

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 01/17] Documentation: i2c: describe devicetree method for instantiating devices

On Mon, Feb 10, 2014 at 11:03:55AM +0100, Wolfram Sang wrote:
> Signed-off-by: Wolfram Sang <[email protected]>
> Cc: [email protected]
> Cc: [email protected]

Applied to for-current, thanks!


Attachments:
(No filename) (222.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments