aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-06-12 12:20:46 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:09:37 -0400
commit6275163e3ddbf0f0b34981bf6dc50b803e5a1c67 (patch)
treebdd6e4e4b299c9a363b572012a586c945174dcf9
parent9fdd9caf44296213c1e1130e86c2f919f83124da (diff)
V4L/DVB (8046): zoran: i2c structure templates clean-up
Clean up the use of structure templates in zoran_card. 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. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Ronald S. Bultje <rbultje@ronald.bitfreak.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/zoran_card.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c
index 006d48847e24..24afe81a59de 100644
--- a/drivers/media/video/zoran_card.c
+++ b/drivers/media/video/zoran_card.c
@@ -59,8 +59,6 @@
59#include "zoran_device.h" 59#include "zoran_device.h"
60#include "zoran_procfs.h" 60#include "zoran_procfs.h"
61 61
62#define I2C_NAME(x) (x)->name
63
64extern const struct zoran_format zoran_formats[]; 62extern const struct zoran_format zoran_formats[];
65 63
66static int card[BUZ_MAX] = { -1, -1, -1, -1 }; 64static int card[BUZ_MAX] = { -1, -1, -1, -1 };
@@ -809,7 +807,7 @@ clientunreg_unlock_and_return:
809 return res; 807 return res;
810} 808}
811 809
812static struct i2c_algo_bit_data zoran_i2c_bit_data_template = { 810static const struct i2c_algo_bit_data zoran_i2c_bit_data_template = {
813 .setsda = zoran_i2c_setsda, 811 .setsda = zoran_i2c_setsda,
814 .setscl = zoran_i2c_setscl, 812 .setscl = zoran_i2c_setscl,
815 .getsda = zoran_i2c_getsda, 813 .getsda = zoran_i2c_getsda,
@@ -818,24 +816,17 @@ static struct i2c_algo_bit_data zoran_i2c_bit_data_template = {
818 .timeout = 100, 816 .timeout = 100,
819}; 817};
820 818
821static struct i2c_adapter zoran_i2c_adapter_template = {
822 .name = "zr36057",
823 .id = I2C_HW_B_ZR36067,
824 .algo = NULL,
825 .client_register = zoran_i2c_client_register,
826 .client_unregister = zoran_i2c_client_unregister,
827};
828
829static int 819static int
830zoran_register_i2c (struct zoran *zr) 820zoran_register_i2c (struct zoran *zr)
831{ 821{
832 memcpy(&zr->i2c_algo, &zoran_i2c_bit_data_template, 822 memcpy(&zr->i2c_algo, &zoran_i2c_bit_data_template,
833 sizeof(struct i2c_algo_bit_data)); 823 sizeof(struct i2c_algo_bit_data));
834 zr->i2c_algo.data = zr; 824 zr->i2c_algo.data = zr;
835 memcpy(&zr->i2c_adapter, &zoran_i2c_adapter_template, 825 zr->i2c_adapter.id = I2C_HW_B_ZR36067;
836 sizeof(struct i2c_adapter)); 826 zr->i2c_adapter.client_register = zoran_i2c_client_register;
837 strncpy(I2C_NAME(&zr->i2c_adapter), ZR_DEVNAME(zr), 827 zr->i2c_adapter.client_unregister = zoran_i2c_client_unregister;
838 sizeof(I2C_NAME(&zr->i2c_adapter)) - 1); 828 strlcpy(zr->i2c_adapter.name, ZR_DEVNAME(zr),
829 sizeof(zr->i2c_adapter.name));
839 i2c_set_adapdata(&zr->i2c_adapter, zr); 830 i2c_set_adapdata(&zr->i2c_adapter, zr);
840 zr->i2c_adapter.algo_data = &zr->i2c_algo; 831 zr->i2c_adapter.algo_data = &zr->i2c_algo;
841 zr->i2c_adapter.dev.parent = &zr->pci_dev->dev; 832 zr->i2c_adapter.dev.parent = &zr->pci_dev->dev;