* [PATCH] Platform: x86: chromeos_laptop: make dmi_check_callback return 1
@ 2013-02-27 2:55 Axel Lin
2013-02-27 4:17 ` Benson Leung
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2013-02-27 2:55 UTC (permalink / raw)
To: Matthew Garrett; +Cc: Benson Leung, Yufeng Shen, platform-driver-x86
We only care about if there is any successful match from the dmi table
or no match at all, we can make dmi_check_system return immediately if
we have a successful match instead of iterate thorough the whole table.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/platform/x86/chromeos_laptop.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/platform/x86/chromeos_laptop.c b/drivers/platform/x86/chromeos_laptop.c
index 93d6680..b6018d4 100644
--- a/drivers/platform/x86/chromeos_laptop.c
+++ b/drivers/platform/x86/chromeos_laptop.c
@@ -207,7 +207,7 @@ static int __init setup_cyapa_smbus_tp(const struct dmi_system_id *id)
{
/* add cyapa touchpad on smbus */
tp = add_smbus_device("trackpad", &cyapa_device);
- return 0;
+ return 1;
}
static int __init setup_atmel_224s_tp(const struct dmi_system_id *id)
@@ -219,7 +219,7 @@ static int __init setup_atmel_224s_tp(const struct dmi_system_id *id)
/* add atmel mxt touchpad on VGA DDC GMBus */
tp = add_probed_i2c_device("trackpad", I2C_ADAPTER_VGADDC,
&atmel_224s_tp_device, addr_list);
- return 0;
+ return 1;
}
static int __init setup_atmel_1664s_ts(const struct dmi_system_id *id)
@@ -231,7 +231,7 @@ static int __init setup_atmel_1664s_ts(const struct dmi_system_id *id)
/* add atmel mxt touch device on PANEL GMBus */
ts = add_probed_i2c_device("touchscreen", I2C_ADAPTER_PANEL,
&atmel_1664s_device, addr_list);
- return 0;
+ return 1;
}
@@ -239,7 +239,7 @@ static int __init setup_isl29018_als(const struct dmi_system_id *id)
{
/* add isl29018 light sensor */
als = add_smbus_device("lightsensor", &isl_als_device);
- return 0;
+ return 1;
}
static int __init setup_isl29023_als(const struct dmi_system_id *id)
@@ -247,21 +247,21 @@ static int __init setup_isl29023_als(const struct dmi_system_id *id)
/* add isl29023 light sensor on Panel GMBus */
als = add_i2c_device("lightsensor", I2C_ADAPTER_PANEL,
&isl_als_device);
- return 0;
+ return 1;
}
static int __init setup_tsl2583_als(const struct dmi_system_id *id)
{
/* add tsl2583 light sensor on smbus */
als = add_smbus_device(NULL, &tsl2583_als_device);
- return 0;
+ return 1;
}
static int __init setup_tsl2563_als(const struct dmi_system_id *id)
{
/* add tsl2563 light sensor on smbus */
als = add_smbus_device(NULL, &tsl2563_als_device);
- return 0;
+ return 1;
}
static struct dmi_system_id __initdata chromeos_laptop_dmi_table[] = {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Platform: x86: chromeos_laptop: make dmi_check_callback return 1
2013-02-27 2:55 [PATCH] Platform: x86: chromeos_laptop: make dmi_check_callback return 1 Axel Lin
@ 2013-02-27 4:17 ` Benson Leung
0 siblings, 0 replies; 2+ messages in thread
From: Benson Leung @ 2013-02-27 4:17 UTC (permalink / raw)
To: Axel Lin
Cc: Matthew Garrett, Yufeng Shen, platform-driver-x86@vger.kernel.org
Actually, the way that this table is set up currently, we rely on the
possibility of multiple matches, so it is necessary to go through the
whole thing.
Look carefully at the chromeos_laptop_dmi_table. You'll see that
boards like Link and Lumpy show up multiple times in the table to
instantiate different devices.
Returning 1 will simply stop on the first device it finds in the list.
Benson
On Tue, Feb 26, 2013 at 6:55 PM, Axel Lin <axel.lin@ingics.com> wrote:
> We only care about if there is any successful match from the dmi table
> or no match at all, we can make dmi_check_system return immediately if
> we have a successful match instead of iterate thorough the whole table.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/platform/x86/chromeos_laptop.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/platform/x86/chromeos_laptop.c b/drivers/platform/x86/chromeos_laptop.c
> index 93d6680..b6018d4 100644
> --- a/drivers/platform/x86/chromeos_laptop.c
> +++ b/drivers/platform/x86/chromeos_laptop.c
> @@ -207,7 +207,7 @@ static int __init setup_cyapa_smbus_tp(const struct dmi_system_id *id)
> {
> /* add cyapa touchpad on smbus */
> tp = add_smbus_device("trackpad", &cyapa_device);
> - return 0;
> + return 1;
> }
>
> static int __init setup_atmel_224s_tp(const struct dmi_system_id *id)
> @@ -219,7 +219,7 @@ static int __init setup_atmel_224s_tp(const struct dmi_system_id *id)
> /* add atmel mxt touchpad on VGA DDC GMBus */
> tp = add_probed_i2c_device("trackpad", I2C_ADAPTER_VGADDC,
> &atmel_224s_tp_device, addr_list);
> - return 0;
> + return 1;
> }
>
> static int __init setup_atmel_1664s_ts(const struct dmi_system_id *id)
> @@ -231,7 +231,7 @@ static int __init setup_atmel_1664s_ts(const struct dmi_system_id *id)
> /* add atmel mxt touch device on PANEL GMBus */
> ts = add_probed_i2c_device("touchscreen", I2C_ADAPTER_PANEL,
> &atmel_1664s_device, addr_list);
> - return 0;
> + return 1;
> }
>
>
> @@ -239,7 +239,7 @@ static int __init setup_isl29018_als(const struct dmi_system_id *id)
> {
> /* add isl29018 light sensor */
> als = add_smbus_device("lightsensor", &isl_als_device);
> - return 0;
> + return 1;
> }
>
> static int __init setup_isl29023_als(const struct dmi_system_id *id)
> @@ -247,21 +247,21 @@ static int __init setup_isl29023_als(const struct dmi_system_id *id)
> /* add isl29023 light sensor on Panel GMBus */
> als = add_i2c_device("lightsensor", I2C_ADAPTER_PANEL,
> &isl_als_device);
> - return 0;
> + return 1;
> }
>
> static int __init setup_tsl2583_als(const struct dmi_system_id *id)
> {
> /* add tsl2583 light sensor on smbus */
> als = add_smbus_device(NULL, &tsl2583_als_device);
> - return 0;
> + return 1;
> }
>
> static int __init setup_tsl2563_als(const struct dmi_system_id *id)
> {
> /* add tsl2563 light sensor on smbus */
> als = add_smbus_device(NULL, &tsl2563_als_device);
> - return 0;
> + return 1;
> }
>
> static struct dmi_system_id __initdata chromeos_laptop_dmi_table[] = {
> --
> 1.7.9.5
>
>
>
--
Benson Leung
Software Engineer, Chrom* OS
bleung@chromium.org
On Tue, Feb 26, 2013 at 6:55 PM, Axel Lin <axel.lin@ingics.com> wrote:
> We only care about if there is any successful match from the dmi table
> or no match at all, we can make dmi_check_system return immediately if
> we have a successful match instead of iterate thorough the whole table.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/platform/x86/chromeos_laptop.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/platform/x86/chromeos_laptop.c b/drivers/platform/x86/chromeos_laptop.c
> index 93d6680..b6018d4 100644
> --- a/drivers/platform/x86/chromeos_laptop.c
> +++ b/drivers/platform/x86/chromeos_laptop.c
> @@ -207,7 +207,7 @@ static int __init setup_cyapa_smbus_tp(const struct dmi_system_id *id)
> {
> /* add cyapa touchpad on smbus */
> tp = add_smbus_device("trackpad", &cyapa_device);
> - return 0;
> + return 1;
> }
>
> static int __init setup_atmel_224s_tp(const struct dmi_system_id *id)
> @@ -219,7 +219,7 @@ static int __init setup_atmel_224s_tp(const struct dmi_system_id *id)
> /* add atmel mxt touchpad on VGA DDC GMBus */
> tp = add_probed_i2c_device("trackpad", I2C_ADAPTER_VGADDC,
> &atmel_224s_tp_device, addr_list);
> - return 0;
> + return 1;
> }
>
> static int __init setup_atmel_1664s_ts(const struct dmi_system_id *id)
> @@ -231,7 +231,7 @@ static int __init setup_atmel_1664s_ts(const struct dmi_system_id *id)
> /* add atmel mxt touch device on PANEL GMBus */
> ts = add_probed_i2c_device("touchscreen", I2C_ADAPTER_PANEL,
> &atmel_1664s_device, addr_list);
> - return 0;
> + return 1;
> }
>
>
> @@ -239,7 +239,7 @@ static int __init setup_isl29018_als(const struct dmi_system_id *id)
> {
> /* add isl29018 light sensor */
> als = add_smbus_device("lightsensor", &isl_als_device);
> - return 0;
> + return 1;
> }
>
> static int __init setup_isl29023_als(const struct dmi_system_id *id)
> @@ -247,21 +247,21 @@ static int __init setup_isl29023_als(const struct dmi_system_id *id)
> /* add isl29023 light sensor on Panel GMBus */
> als = add_i2c_device("lightsensor", I2C_ADAPTER_PANEL,
> &isl_als_device);
> - return 0;
> + return 1;
> }
>
> static int __init setup_tsl2583_als(const struct dmi_system_id *id)
> {
> /* add tsl2583 light sensor on smbus */
> als = add_smbus_device(NULL, &tsl2583_als_device);
> - return 0;
> + return 1;
> }
>
> static int __init setup_tsl2563_als(const struct dmi_system_id *id)
> {
> /* add tsl2563 light sensor on smbus */
> als = add_smbus_device(NULL, &tsl2563_als_device);
> - return 0;
> + return 1;
> }
>
> static struct dmi_system_id __initdata chromeos_laptop_dmi_table[] = {
> --
> 1.7.9.5
>
>
>
--
Benson Leung
Software Engineer, Chrom* OS
bleung@chromium.org
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-27 4:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27 2:55 [PATCH] Platform: x86: chromeos_laptop: make dmi_check_callback return 1 Axel Lin
2013-02-27 4:17 ` Benson Leung
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.