From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-omap@vger.kernel.org
Subject: Re: [RFC] i2c: add deprecation warning for class based instantiation
Date: Wed, 19 Jun 2013 21:22:00 +0300 [thread overview]
Message-ID: <51C1F6C8.30302@ti.com> (raw)
In-Reply-To: <1370596166-12404-1-git-send-email-wsa@the-dreams.de>
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 <wsa@the-dreams.de>
> ---
> 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_END 0xfffeU
- grygorii
WARNING: multiple messages have this Message-ID (diff)
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: <linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-omap@vger.kernel.org>
Subject: Re: [RFC] i2c: add deprecation warning for class based instantiation
Date: Wed, 19 Jun 2013 21:22:00 +0300 [thread overview]
Message-ID: <51C1F6C8.30302@ti.com> (raw)
In-Reply-To: <1370596166-12404-1-git-send-email-wsa@the-dreams.de>
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 <wsa@the-dreams.de>
> ---
> 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_END 0xfffeU
- grygorii
next prev parent reply other threads:[~2013-06-19 18:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-04 17:33 [PATCH] i2c: Let users disable "Probe an I2C bus for certain devices" Grygorii Strashko
2013-06-04 17:33 ` Grygorii Strashko
[not found] ` <1370367222-19353-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2013-06-04 17:49 ` Wolfram Sang
2013-06-04 17:49 ` Wolfram Sang
2013-06-05 16:13 ` Grygorii Strashko
2013-06-05 16:13 ` Grygorii Strashko
2013-06-07 9:06 ` Wolfram Sang
2013-06-07 9:09 ` [RFC] i2c: add deprecation warning for class based instantiation Wolfram Sang
[not found] ` <1370596166-12404-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-06-19 10:15 ` Wolfram Sang
2013-06-19 10:15 ` Wolfram Sang
2013-06-19 18:21 ` Grygorii Strashko
2013-06-19 18:21 ` Grygorii Strashko
2013-06-20 18:37 ` Wolfram Sang
2013-06-19 18:22 ` Grygorii Strashko [this message]
2013-06-19 18:22 ` Grygorii Strashko
2013-06-19 18:22 ` [RFC 1/2] i2c: omap: drop class based instantiation of slaves Grygorii Strashko
2013-06-19 18:22 ` Grygorii Strashko
2013-06-19 18:22 ` [RFC 2/2] i2c: gpio: " Grygorii Strashko
2013-06-19 18:22 ` Grygorii Strashko
2013-06-07 10:10 ` [PATCH] i2c: Let users disable "Probe an I2C bus for certain devices" Grygorii Strashko
2013-06-07 10:10 ` Grygorii Strashko
[not found] ` <51B1B19E.1050200-l0cyMroinI0@public.gmane.org>
2013-06-07 21:28 ` Wolfram Sang
2013-06-07 21:28 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51C1F6C8.30302@ti.com \
--to=grygorii.strashko@ti.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.