Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

i2c-pxa: Misc fixes

While working on the PCA9564-platform driver, I sometimes had a glimpse at the
pxa-driver. I found some suspicious places, and this patch contains my
suggestions. Note: They are not tested, due to no hardware.

[JD: Some more fixes.]

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Mike Rapoport <mike@compulab.co.il>
Tested-by: Eric Miao <ymiao3@marvell.com>

authored by

Wolfram Sang and committed by
Jean Delvare
a92b36ed c9a2c46d

+14 -11
+14 -11
drivers/i2c/busses/i2c-pxa.c
··· 999 999 spin_lock_init(&i2c->lock); 1000 1000 init_waitqueue_head(&i2c->wait); 1001 1001 1002 - sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id); 1002 + /* 1003 + * If "dev->id" is negative we consider it as zero. 1004 + * The reason to do so is to avoid sysfs names that only make 1005 + * sense when there are multiple adapters. 1006 + */ 1007 + i2c->adap.nr = dev->id != -1 ? dev->id : 0; 1008 + snprintf(i2c->adap.name, sizeof(i2c->adap.name), "pxa_i2c-i2c.%u", 1009 + i2c->adap.nr); 1003 1010 1004 1011 i2c->clk = clk_get(&dev->dev, "I2CCLK"); 1005 1012 if (IS_ERR(i2c->clk)) { ··· 1057 1050 i2c->adap.algo_data = i2c; 1058 1051 i2c->adap.dev.parent = &dev->dev; 1059 1052 1060 - /* 1061 - * If "dev->id" is negative we consider it as zero. 1062 - * The reason to do so is to avoid sysfs names that only make 1063 - * sense when there are multiple adapters. 1064 - */ 1065 - i2c->adap.nr = dev->id != -1 ? dev->id : 0; 1066 - 1067 1053 ret = i2c_add_numbered_adapter(&i2c->adap); 1068 1054 if (ret < 0) { 1069 1055 printk(KERN_INFO "I2C: Failed to add bus\n"); ··· 1080 1080 ereqirq: 1081 1081 clk_disable(i2c->clk); 1082 1082 i2c_pxa_disable(dev); 1083 + iounmap(i2c->reg_base); 1083 1084 eremap: 1084 1085 clk_put(i2c->clk); 1085 1086 eclk: ··· 1090 1089 return ret; 1091 1090 } 1092 1091 1093 - static int i2c_pxa_remove(struct platform_device *dev) 1092 + static int __exit i2c_pxa_remove(struct platform_device *dev) 1094 1093 { 1095 1094 struct pxa_i2c *i2c = platform_get_drvdata(dev); 1096 1095 ··· 1104 1103 clk_put(i2c->clk); 1105 1104 i2c_pxa_disable(dev); 1106 1105 1106 + iounmap(i2c->reg_base); 1107 1107 release_mem_region(i2c->iobase, i2c->iosize); 1108 1108 kfree(i2c); 1109 1109 ··· 1113 1111 1114 1112 static struct platform_driver i2c_pxa_driver = { 1115 1113 .probe = i2c_pxa_probe, 1116 - .remove = i2c_pxa_remove, 1114 + .remove = __exit_p(i2c_pxa_remove), 1117 1115 .driver = { 1118 1116 .name = "pxa2xx-i2c", 1117 + .owner = THIS_MODULE, 1119 1118 }, 1120 1119 }; 1121 1120 ··· 1125 1122 return platform_driver_register(&i2c_pxa_driver); 1126 1123 } 1127 1124 1128 - static void i2c_adap_pxa_exit(void) 1125 + static void __exit i2c_adap_pxa_exit(void) 1129 1126 { 1130 1127 platform_driver_unregister(&i2c_pxa_driver); 1131 1128 }