ARM: SAMSUNG: Cleanup I2C code in plat-samsung

Removes the duplication of default info structure in
dev-i2c[0 ~ 7].c files

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
This commit is contained in:
Naveen Krishna Chatradhi 2011-07-16 13:30:09 +09:00 committed by Kukjin Kim
parent 2c2e2c27e6
commit 696f6fc1be
9 changed files with 32 additions and 72 deletions

View File

@ -48,7 +48,7 @@ struct platform_device s3c_device_i2c0 = {
.resource = s3c_i2c_resource,
};
static struct s3c2410_platform_i2c default_i2c_data0 __initdata = {
struct s3c2410_platform_i2c default_i2c_data __initdata = {
.flags = 0,
.slave_addr = 0x10,
.frequency = 100*1000,
@ -60,7 +60,7 @@ void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
struct s3c2410_platform_i2c *npd;
if (!pd)
pd = &default_i2c_data0;
pd = &default_i2c_data;
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
&s3c_device_i2c0);

View File

@ -44,20 +44,14 @@ struct platform_device s3c_device_i2c1 = {
.resource = s3c_i2c_resource,
};
static struct s3c2410_platform_i2c default_i2c_data1 __initdata = {
.flags = 0,
.bus_num = 1,
.slave_addr = 0x10,
.frequency = 100*1000,
.sda_delay = 100,
};
void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
{
struct s3c2410_platform_i2c *npd;
if (!pd)
pd = &default_i2c_data1;
if (!pd) {
pd = &default_i2c_data;
pd->bus_num = 1;
}
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
&s3c_device_i2c1);

View File

@ -45,20 +45,14 @@ struct platform_device s3c_device_i2c2 = {
.resource = s3c_i2c_resource,
};
static struct s3c2410_platform_i2c default_i2c_data2 __initdata = {
.flags = 0,
.bus_num = 2,
.slave_addr = 0x10,
.frequency = 100*1000,
.sda_delay = 100,
};
void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd)
{
struct s3c2410_platform_i2c *npd;
if (!pd)
pd = &default_i2c_data2;
if (!pd) {
pd = &default_i2c_data;
pd->bus_num = 2;
}
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
&s3c_device_i2c2);

View File

@ -43,20 +43,14 @@ struct platform_device s3c_device_i2c3 = {
.resource = s3c_i2c_resource,
};
static struct s3c2410_platform_i2c default_i2c_data3 __initdata = {
.flags = 0,
.bus_num = 3,
.slave_addr = 0x10,
.frequency = 100*1000,
.sda_delay = 100,
};
void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd)
{
struct s3c2410_platform_i2c *npd;
if (!pd)
pd = &default_i2c_data3;
if (!pd) {
pd = &default_i2c_data;
pd->bus_num = 3;
}
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
&s3c_device_i2c3);

View File

@ -43,20 +43,14 @@ struct platform_device s3c_device_i2c4 = {
.resource = s3c_i2c_resource,
};
static struct s3c2410_platform_i2c default_i2c_data4 __initdata = {
.flags = 0,
.bus_num = 4,
.slave_addr = 0x10,
.frequency = 100*1000,
.sda_delay = 100,
};
void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd)
{
struct s3c2410_platform_i2c *npd;
if (!pd)
pd = &default_i2c_data4;
if (!pd) {
pd = &default_i2c_data;
pd->bus_num = 4;
}
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
&s3c_device_i2c4);

View File

@ -43,20 +43,14 @@ struct platform_device s3c_device_i2c5 = {
.resource = s3c_i2c_resource,
};
static struct s3c2410_platform_i2c default_i2c_data5 __initdata = {
.flags = 0,
.bus_num = 5,
.slave_addr = 0x10,
.frequency = 100*1000,
.sda_delay = 100,
};
void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd)
{
struct s3c2410_platform_i2c *npd;
if (!pd)
pd = &default_i2c_data5;
if (!pd) {
pd = &default_i2c_data;
pd->bus_num = 5;
}
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
&s3c_device_i2c5);

View File

@ -43,20 +43,14 @@ struct platform_device s3c_device_i2c6 = {
.resource = s3c_i2c_resource,
};
static struct s3c2410_platform_i2c default_i2c_data6 __initdata = {
.flags = 0,
.bus_num = 6,
.slave_addr = 0x10,
.frequency = 100*1000,
.sda_delay = 100,
};
void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd)
{
struct s3c2410_platform_i2c *npd;
if (!pd)
pd = &default_i2c_data6;
if (!pd) {
pd = &default_i2c_data;
pd->bus_num = 6;
}
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
&s3c_device_i2c6);

View File

@ -43,20 +43,14 @@ struct platform_device s3c_device_i2c7 = {
.resource = s3c_i2c_resource,
};
static struct s3c2410_platform_i2c default_i2c_data7 __initdata = {
.flags = 0,
.bus_num = 7,
.slave_addr = 0x10,
.frequency = 100*1000,
.sda_delay = 100,
};
void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
{
struct s3c2410_platform_i2c *npd;
if (!pd)
pd = &default_i2c_data7;
if (!pd) {
pd = &default_i2c_data;
pd->bus_num = 7;
}
npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
&s3c_device_i2c7);

View File

@ -71,4 +71,6 @@ extern void s3c_i2c5_cfg_gpio(struct platform_device *dev);
extern void s3c_i2c6_cfg_gpio(struct platform_device *dev);
extern void s3c_i2c7_cfg_gpio(struct platform_device *dev);
extern struct s3c2410_platform_i2c default_i2c_data;
#endif /* __ASM_ARCH_IIC_H */