diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-pxa.c')
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 8a0a99b93641..28e7b91a4553 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -837,20 +837,10 @@ static const struct i2c_algorithm i2c_pxa_algorithm = { | |||
837 | .functionality = i2c_pxa_functionality, | 837 | .functionality = i2c_pxa_functionality, |
838 | }; | 838 | }; |
839 | 839 | ||
840 | static struct pxa_i2c i2c_pxa = { | ||
841 | .lock = __SPIN_LOCK_UNLOCKED(i2c_pxa.lock), | ||
842 | .adap = { | ||
843 | .owner = THIS_MODULE, | ||
844 | .algo = &i2c_pxa_algorithm, | ||
845 | .name = "pxa2xx-i2c.0", | ||
846 | .retries = 5, | ||
847 | }, | ||
848 | }; | ||
849 | |||
850 | #define res_len(r) ((r)->end - (r)->start + 1) | 840 | #define res_len(r) ((r)->end - (r)->start + 1) |
851 | static int i2c_pxa_probe(struct platform_device *dev) | 841 | static int i2c_pxa_probe(struct platform_device *dev) |
852 | { | 842 | { |
853 | struct pxa_i2c *i2c = &i2c_pxa; | 843 | struct pxa_i2c *i2c; |
854 | struct resource *res; | 844 | struct resource *res; |
855 | struct i2c_pxa_platform_data *plat = dev->dev.platform_data; | 845 | struct i2c_pxa_platform_data *plat = dev->dev.platform_data; |
856 | int ret; | 846 | int ret; |
@@ -864,15 +854,20 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
864 | if (!request_mem_region(res->start, res_len(res), res->name)) | 854 | if (!request_mem_region(res->start, res_len(res), res->name)) |
865 | return -ENOMEM; | 855 | return -ENOMEM; |
866 | 856 | ||
867 | i2c = kmalloc(sizeof(struct pxa_i2c), GFP_KERNEL); | 857 | i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL); |
868 | if (!i2c) { | 858 | if (!i2c) { |
869 | ret = -ENOMEM; | 859 | ret = -ENOMEM; |
870 | goto emalloc; | 860 | goto emalloc; |
871 | } | 861 | } |
872 | 862 | ||
873 | memcpy(i2c, &i2c_pxa, sizeof(struct pxa_i2c)); | 863 | i2c->adap.owner = THIS_MODULE; |
864 | i2c->adap.algo = &i2c_pxa_algorithm; | ||
865 | i2c->adap.retries = 5; | ||
866 | |||
867 | spin_lock_init(&i2c->lock); | ||
874 | init_waitqueue_head(&i2c->wait); | 868 | init_waitqueue_head(&i2c->wait); |
875 | i2c->adap.name[strlen(i2c->adap.name) - 1] = '0' + dev->id % 10; | 869 | |
870 | sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id); | ||
876 | 871 | ||
877 | i2c->reg_base = ioremap(res->start, res_len(res)); | 872 | i2c->reg_base = ioremap(res->start, res_len(res)); |
878 | if (!i2c->reg_base) { | 873 | if (!i2c->reg_base) { |