* [PATCH 2/3] matroxfb: i2c structure templates clean-up
@ 2008-06-17 18:03 Jean Delvare
0 siblings, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2008-06-17 18:03 UTC (permalink / raw)
To: Petr Vandrovec; +Cc: linux-fbdev-devel
Clean up the use of structure templates in i2c-matroxfb. For one
thing, a real template is supposed to be read-only. And in some cases
it's more efficient to initialize the few fields we need individually.
This makes i2c-matroxfb.ko 16% smaller on my system.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
drivers/video/matrox/i2c-matroxfb.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
--- linux-2.6.26-rc6.orig/drivers/video/matrox/i2c-matroxfb.c 2008-06-17 18:41:52.000000000 +0200
+++ linux-2.6.26-rc6/drivers/video/matrox/i2c-matroxfb.c 2008-06-17 18:53:08.000000000 +0200
@@ -87,13 +87,7 @@ static int matroxfb_gpio_getscl(void* da
return (matroxfb_read_gpio(b->minfo) & b->mask.clock) ? 1 : 0;
}
-static struct i2c_adapter matrox_i2c_adapter_template =
-{
- .owner = THIS_MODULE,
- .id = I2C_HW_B_G400,
-};
-
-static struct i2c_algo_bit_data matrox_i2c_algo_template =
+static const struct i2c_algo_bit_data matrox_i2c_algo_template =
{
.setsda = matroxfb_gpio_setsda,
.setscl = matroxfb_gpio_setscl,
@@ -110,7 +104,8 @@ static int i2c_bus_reg(struct i2c_bit_ad
b->minfo = minfo;
b->mask.data = data;
b->mask.clock = clock;
- b->adapter = matrox_i2c_adapter_template;
+ b->adapter.owner = THIS_MODULE;
+ b->adapter.id = I2C_HW_B_G400;
snprintf(b->adapter.name, sizeof(b->adapter.name), name,
minfo->fbcon.node);
i2c_set_adapdata(&b->adapter, b);
--
Jean Delvare
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 0/3] matroxfb fixes and improvements
@ 2008-08-08 14:49 Jean Delvare
2008-08-08 15:02 ` [PATCH 2/3] matroxfb: i2c structure templates clean-up Jean Delvare
0 siblings, 1 reply; 3+ messages in thread
From: Jean Delvare @ 2008-08-08 14:49 UTC (permalink / raw)
To: linux-fbdev-devel, Antonino Daplas; +Cc: Petr Vandrovec, LKML
Hi Antonino,
Not having heard of Petr in one month and a half, I am sending these 3
patches again. Patch 1/3 (matrox maven: Fix a broken error path) in
particular should be applied ASAP. Patch 2/3 (matroxfb: i2c structure
templates clean-up) would be good to have as well and I tested it.
Patch 3/3 (matrox maven: Convert to a new-style i2c driver) needs
testing before it can go upstream. I can't test it myself, but it has
been in linux-next for 6 weeks or so.
Thanks,
--
Jean Delvare
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] matroxfb: i2c structure templates clean-up
2008-08-08 14:49 [PATCH 0/3] matroxfb fixes and improvements Jean Delvare
@ 2008-08-08 15:02 ` Jean Delvare
2008-08-08 16:36 ` Krzysztof Helt
0 siblings, 1 reply; 3+ messages in thread
From: Jean Delvare @ 2008-08-08 15:02 UTC (permalink / raw)
To: linux-fbdev-devel, Antonino Daplas; +Cc: Petr Vandrovec, LKML
Clean up the use of structure templates in i2c-matroxfb. In this case
it's more efficient to initialize the few fields we need individually.
This makes i2c-matroxfb.ko 16% smaller on my system.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
drivers/video/matrox/i2c-matroxfb.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
--- linux-2.6.26-rc6.orig/drivers/video/matrox/i2c-matroxfb.c 2008-06-17 20:23:41.000000000 +0200
+++ linux-2.6.26-rc6/drivers/video/matrox/i2c-matroxfb.c 2008-06-17 20:27:36.000000000 +0200
@@ -87,13 +87,7 @@ static int matroxfb_gpio_getscl(void* da
return (matroxfb_read_gpio(b->minfo) & b->mask.clock) ? 1 : 0;
}
-static struct i2c_adapter matrox_i2c_adapter_template =
-{
- .owner = THIS_MODULE,
- .id = I2C_HW_B_G400,
-};
-
-static struct i2c_algo_bit_data matrox_i2c_algo_template =
+static const struct i2c_algo_bit_data matrox_i2c_algo_template =
{
.setsda = matroxfb_gpio_setsda,
.setscl = matroxfb_gpio_setscl,
@@ -112,7 +106,8 @@ static int i2c_bus_reg(struct i2c_bit_ad
b->minfo = minfo;
b->mask.data = data;
b->mask.clock = clock;
- b->adapter = matrox_i2c_adapter_template;
+ b->adapter.owner = THIS_MODULE;
+ b->adapter.id = I2C_HW_B_G400;
snprintf(b->adapter.name, sizeof(b->adapter.name), name,
minfo->fbcon.node);
i2c_set_adapdata(&b->adapter, b);
--
Jean Delvare
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 2/3] matroxfb: i2c structure templates clean-up
2008-08-08 15:02 ` [PATCH 2/3] matroxfb: i2c structure templates clean-up Jean Delvare
@ 2008-08-08 16:36 ` Krzysztof Helt
0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Helt @ 2008-08-08 16:36 UTC (permalink / raw)
To: Jean Delvare, Andrew Morton
Cc: Petr Vandrovec, linux-fbdev-devel, LKML, Antonino Daplas
On Fri, 8 Aug 2008 17:02:08 +0200
Jean Delvare <khali@linux-fr.org> wrote:
> Clean up the use of structure templates in i2c-matroxfb. In this case
> it's more efficient to initialize the few fields we need individually.
> This makes i2c-matroxfb.ko 16% smaller on my system.
>
> Signed-off-by: Jean Delvare <khali@linux-fr.org>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/matrox/i2c-matroxfb.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> --- linux-2.6.26-rc6.orig/drivers/video/matrox/i2c-matroxfb.c 2008-06-17 20:23:41.000000000 +0200
> +++ linux-2.6.26-rc6/drivers/video/matrox/i2c-matroxfb.c 2008-06-17 20:27:36.000000000 +0200
> @@ -87,13 +87,7 @@ static int matroxfb_gpio_getscl(void* da
> return (matroxfb_read_gpio(b->minfo) & b->mask.clock) ? 1 : 0;
> }
>
> -static struct i2c_adapter matrox_i2c_adapter_template =
> -{
> - .owner = THIS_MODULE,
> - .id = I2C_HW_B_G400,
> -};
> -
> -static struct i2c_algo_bit_data matrox_i2c_algo_template =
> +static const struct i2c_algo_bit_data matrox_i2c_algo_template =
> {
> .setsda = matroxfb_gpio_setsda,
> .setscl = matroxfb_gpio_setscl,
> @@ -112,7 +106,8 @@ static int i2c_bus_reg(struct i2c_bit_ad
> b->minfo = minfo;
> b->mask.data = data;
> b->mask.clock = clock;
> - b->adapter = matrox_i2c_adapter_template;
> + b->adapter.owner = THIS_MODULE;
> + b->adapter.id = I2C_HW_B_G400;
> snprintf(b->adapter.name, sizeof(b->adapter.name), name,
> minfo->fbcon.node);
> i2c_set_adapdata(&b->adapter, b);
>
> --
> Jean Delvare
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Tylko dla detektywow! Konkurs na Smaker.pl
Kliknij >>> http://link.interia.pl/f1eb1
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-08 16:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-17 18:03 [PATCH 2/3] matroxfb: i2c structure templates clean-up Jean Delvare
-- strict thread matches above, loose matches on Subject: below --
2008-08-08 14:49 [PATCH 0/3] matroxfb fixes and improvements Jean Delvare
2008-08-08 15:02 ` [PATCH 2/3] matroxfb: i2c structure templates clean-up Jean Delvare
2008-08-08 16:36 ` Krzysztof Helt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).