aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-powermac.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-12-06 11:06:20 -0500
committerJean Delvare <khali@linux-fr.org>2009-12-06 11:06:20 -0500
commitbc6286e50b4a34d8af52132d6e22f85c6c8853a7 (patch)
treeb75637331e7734e9bebebfc59ac7bf83fdac829d /drivers/i2c/busses/i2c-powermac.c
parent6dfa5ca3c9a35cb395ab1f51e0e500106c85dff4 (diff)
i2c-powermac: Drop temporary name buffer
We no longer need to write the adapter name to a temporary buffer. We can write it directly to the i2c_adapter's name field. This is more efficient. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Michel Daenzer <michel@daenzer.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/i2c/busses/i2c-powermac.c')
-rw-r--r--drivers/i2c/busses/i2c-powermac.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index b58fb7026597..02b02413850a 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -224,12 +224,12 @@ static int __devinit i2c_powermac_probe(struct platform_device *dev)
224 struct pmac_i2c_bus *bus = dev->dev.platform_data; 224 struct pmac_i2c_bus *bus = dev->dev.platform_data;
225 struct device_node *parent = NULL; 225 struct device_node *parent = NULL;
226 struct i2c_adapter *adapter; 226 struct i2c_adapter *adapter;
227 char name[32];
228 const char *basename; 227 const char *basename;
229 int rc; 228 int rc;
230 229
231 if (bus == NULL) 230 if (bus == NULL)
232 return -EINVAL; 231 return -EINVAL;
232 adapter = pmac_i2c_get_adapter(bus);
233 233
234 /* Ok, now we need to make up a name for the interface that will 234 /* Ok, now we need to make up a name for the interface that will
235 * match what we used to do in the past, that is basically the 235 * match what we used to do in the past, that is basically the
@@ -255,23 +255,22 @@ static int __devinit i2c_powermac_probe(struct platform_device *dev)
255 default: 255 default:
256 return -EINVAL; 256 return -EINVAL;
257 } 257 }
258 snprintf(name, 32, "%s %d", basename, pmac_i2c_get_channel(bus)); 258 snprintf(adapter->name, sizeof(adapter->name), "%s %d", basename,
259 pmac_i2c_get_channel(bus));
259 of_node_put(parent); 260 of_node_put(parent);
260 261
261 adapter = pmac_i2c_get_adapter(bus);
262 platform_set_drvdata(dev, adapter); 262 platform_set_drvdata(dev, adapter);
263 strcpy(adapter->name, name);
264 adapter->algo = &i2c_powermac_algorithm; 263 adapter->algo = &i2c_powermac_algorithm;
265 i2c_set_adapdata(adapter, bus); 264 i2c_set_adapdata(adapter, bus);
266 adapter->dev.parent = &dev->dev; 265 adapter->dev.parent = &dev->dev;
267 rc = i2c_add_adapter(adapter); 266 rc = i2c_add_adapter(adapter);
268 if (rc) { 267 if (rc) {
269 printk(KERN_ERR "i2c-powermac: Adapter %s registration " 268 printk(KERN_ERR "i2c-powermac: Adapter %s registration "
270 "failed\n", name); 269 "failed\n", adapter->name);
271 memset(adapter, 0, sizeof(*adapter)); 270 memset(adapter, 0, sizeof(*adapter));
272 } 271 }
273 272
274 printk(KERN_INFO "PowerMac i2c bus %s registered\n", name); 273 printk(KERN_INFO "PowerMac i2c bus %s registered\n", adapter->name);
275 274
276 if (!strncmp(basename, "uni-n", 5)) { 275 if (!strncmp(basename, "uni-n", 5)) {
277 struct device_node *np; 276 struct device_node *np;