aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/i2c_ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/i2c_ec.c')
-rw-r--r--drivers/acpi/i2c_ec.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/drivers/acpi/i2c_ec.c b/drivers/acpi/i2c_ec.c
index 72478a665c8c..84239d51dc0c 100644
--- a/drivers/acpi/i2c_ec.c
+++ b/drivers/acpi/i2c_ec.c
@@ -115,8 +115,6 @@ static int acpi_ec_smb_read(struct acpi_ec_smbus *smbus, u8 address, u8 * data)
115 u8 val; 115 u8 val;
116 int err; 116 int err;
117 117
118 ACPI_FUNCTION_TRACE("acpi_ec_smb_read");
119
120 err = ec_read(smbus->base + address, &val); 118 err = ec_read(smbus->base + address, &val);
121 if (!err) { 119 if (!err) {
122 *data = val; 120 *data = val;
@@ -129,8 +127,6 @@ static int acpi_ec_smb_write(struct acpi_ec_smbus *smbus, u8 address, u8 data)
129{ 127{
130 int err; 128 int err;
131 129
132 ACPI_FUNCTION_TRACE("acpi_ec_smb_write");
133
134 err = ec_write(smbus->base + address, data); 130 err = ec_write(smbus->base + address, data);
135 return (err); 131 return (err);
136} 132}
@@ -144,8 +140,6 @@ acpi_ec_smb_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
144 unsigned char protocol, len = 0, pec, temp[2] = { 0, 0 }; 140 unsigned char protocol, len = 0, pec, temp[2] = { 0, 0 };
145 int i; 141 int i;
146 142
147 ACPI_FUNCTION_TRACE("acpi_ec_smb_access");
148
149 if (read_write == I2C_SMBUS_READ) { 143 if (read_write == I2C_SMBUS_READ) {
150 protocol = ACPI_EC_SMB_PRTCL_READ; 144 protocol = ACPI_EC_SMB_PRTCL_READ;
151 } else { 145 } else {
@@ -290,7 +284,6 @@ acpi_ec_smb_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
290 284
291static u32 acpi_ec_smb_func(struct i2c_adapter *adapter) 285static u32 acpi_ec_smb_func(struct i2c_adapter *adapter)
292{ 286{
293 ACPI_FUNCTION_TRACE("acpi_ec_smb_func");
294 287
295 return (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | 288 return (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
296 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | 289 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
@@ -312,22 +305,20 @@ static int acpi_ec_hc_add(struct acpi_device *device)
312 struct acpi_ec_hc *ec_hc; 305 struct acpi_ec_hc *ec_hc;
313 struct acpi_ec_smbus *smbus; 306 struct acpi_ec_smbus *smbus;
314 307
315 ACPI_FUNCTION_TRACE("acpi_ec_hc_add");
316
317 if (!device) { 308 if (!device) {
318 return_VALUE(-EINVAL); 309 return -EINVAL;
319 } 310 }
320 311
321 ec_hc = kmalloc(sizeof(struct acpi_ec_hc), GFP_KERNEL); 312 ec_hc = kmalloc(sizeof(struct acpi_ec_hc), GFP_KERNEL);
322 if (!ec_hc) { 313 if (!ec_hc) {
323 return_VALUE(-ENOMEM); 314 return -ENOMEM;
324 } 315 }
325 memset(ec_hc, 0, sizeof(struct acpi_ec_hc)); 316 memset(ec_hc, 0, sizeof(struct acpi_ec_hc));
326 317
327 smbus = kmalloc(sizeof(struct acpi_ec_smbus), GFP_KERNEL); 318 smbus = kmalloc(sizeof(struct acpi_ec_smbus), GFP_KERNEL);
328 if (!smbus) { 319 if (!smbus) {
329 kfree(ec_hc); 320 kfree(ec_hc);
330 return_VALUE(-ENOMEM); 321 return -ENOMEM;
331 } 322 }
332 memset(smbus, 0, sizeof(struct acpi_ec_smbus)); 323 memset(smbus, 0, sizeof(struct acpi_ec_smbus));
333 324
@@ -341,7 +332,7 @@ static int acpi_ec_hc_add(struct acpi_device *device)
341 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error obtaining _EC\n")); 332 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error obtaining _EC\n"));
342 kfree(ec_hc->smbus); 333 kfree(ec_hc->smbus);
343 kfree(smbus); 334 kfree(smbus);
344 return_VALUE(-EIO); 335 return -EIO;
345 } 336 }
346 337
347 smbus->ec = acpi_driver_data(device->parent); 338 smbus->ec = acpi_driver_data(device->parent);
@@ -357,7 +348,7 @@ static int acpi_ec_hc_add(struct acpi_device *device)
357 "EC SMBus adapter: Failed to register adapter\n")); 348 "EC SMBus adapter: Failed to register adapter\n"));
358 kfree(smbus); 349 kfree(smbus);
359 kfree(ec_hc); 350 kfree(ec_hc);
360 return_VALUE(-EIO); 351 return -EIO;
361 } 352 }
362 353
363 ec_hc->smbus = smbus; 354 ec_hc->smbus = smbus;
@@ -365,17 +356,15 @@ static int acpi_ec_hc_add(struct acpi_device *device)
365 printk(KERN_INFO PREFIX "%s [%s]\n", 356 printk(KERN_INFO PREFIX "%s [%s]\n",
366 acpi_device_name(device), acpi_device_bid(device)); 357 acpi_device_name(device), acpi_device_bid(device));
367 358
368 return_VALUE(AE_OK); 359 return AE_OK;
369} 360}
370 361
371static int acpi_ec_hc_remove(struct acpi_device *device, int type) 362static int acpi_ec_hc_remove(struct acpi_device *device, int type)
372{ 363{
373 struct acpi_ec_hc *ec_hc; 364 struct acpi_ec_hc *ec_hc;
374 365
375 ACPI_FUNCTION_TRACE("acpi_ec_hc_remove");
376
377 if (!device) { 366 if (!device) {
378 return_VALUE(-EINVAL); 367 return -EINVAL;
379 } 368 }
380 ec_hc = acpi_driver_data(device); 369 ec_hc = acpi_driver_data(device);
381 370
@@ -383,30 +372,27 @@ static int acpi_ec_hc_remove(struct acpi_device *device, int type)
383 kfree(ec_hc->smbus); 372 kfree(ec_hc->smbus);
384 kfree(ec_hc); 373 kfree(ec_hc);
385 374
386 return_VALUE(AE_OK); 375 return AE_OK;
387} 376}
388 377
389static int __init acpi_ec_hc_init(void) 378static int __init acpi_ec_hc_init(void)
390{ 379{
391 int result; 380 int result;
392 381
393 ACPI_FUNCTION_TRACE("acpi_ec_hc_init");
394 result = acpi_bus_register_driver(&acpi_ec_hc_driver); 382 result = acpi_bus_register_driver(&acpi_ec_hc_driver);
395 if (result < 0) { 383 if (result < 0) {
396 return_VALUE(-ENODEV); 384 return -ENODEV;
397 } 385 }
398 return_VALUE(0); 386 return 0;
399} 387}
400 388
401static void __exit acpi_ec_hc_exit(void) 389static void __exit acpi_ec_hc_exit(void)
402{ 390{
403 ACPI_FUNCTION_TRACE("acpi_ec_hc_exit");
404 acpi_bus_unregister_driver(&acpi_ec_hc_driver); 391 acpi_bus_unregister_driver(&acpi_ec_hc_driver);
405} 392}
406 393
407struct acpi_ec_hc *acpi_get_ec_hc(struct acpi_device *device) 394struct acpi_ec_hc *acpi_get_ec_hc(struct acpi_device *device)
408{ 395{
409 ACPI_FUNCTION_TRACE("acpi_get_ec_hc");
410 return ((struct acpi_ec_hc *)acpi_driver_data(device->parent)); 396 return ((struct acpi_ec_hc *)acpi_driver_data(device->parent));
411} 397}
412 398