Changeset 5571
- Timestamp:
- 12/15/08 14:29:18 (4 years ago)
- Files:
-
- 1 modified
-
i2c/trunk/kernel/i2c-core.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
i2c/trunk/kernel/i2c-core.c
r5570 r5571 36 36 /* ----- global defines ---------------------------------------------------- */ 37 37 38 #define I2C_LOCK_LIST(adap) down(&adap->lock) 39 #define I2C_UNLOCK_LIST(adap) up(&adap->lock) 38 /* exclusive access to the bus */ 39 #define I2C_LOCK(adap) down(&adap->lock) 40 #define I2C_UNLOCK(adap) up(&adap->lock) 40 41 41 42 #define DEB(x) if (i2c_debug>=1) x; … … 314 315 int rval; 315 316 316 I2C_LOCK _LIST(adapter);317 I2C_LOCK(adapter); 317 318 rval = __i2c_check_addr(adapter, addr); 318 I2C_UNLOCK _LIST(adapter);319 I2C_UNLOCK(adapter); 319 320 320 321 return rval; … … 329 330 return -EBUSY; 330 331 331 I2C_LOCK _LIST(adapter);332 I2C_LOCK(adapter); 332 333 for (i = 0; i < I2C_CLIENT_MAX; i++) 333 334 if (NULL == adapter->clients[i]) … … 337 338 " i2c-core.o: attach_client(%s) - enlarge I2C_CLIENT_MAX.\n", 338 339 client->name); 339 I2C_UNLOCK _LIST(adapter);340 I2C_UNLOCK(adapter); 340 341 return -ENOMEM; 341 342 } 342 343 adapter->clients[i] = client; 343 I2C_UNLOCK _LIST(adapter);344 I2C_UNLOCK(adapter); 344 345 345 346 if (adapter->client_register) … … 374 375 } 375 376 376 I2C_LOCK _LIST(adapter);377 I2C_LOCK(adapter); 377 378 for (i = 0; i < I2C_CLIENT_MAX; i++) 378 379 if (client == adapter->clients[i]) … … 382 383 "[%s] not found\n", 383 384 client->name); 384 I2C_UNLOCK _LIST(adapter);385 I2C_UNLOCK(adapter); 385 386 return -ENODEV; 386 387 } 387 388 adapter->clients[i] = NULL; 388 I2C_UNLOCK _LIST(adapter);389 I2C_UNLOCK(adapter); 389 390 390 391 DEB(printk(KERN_DEBUG "i2c-core.o: client [%s] unregistered.\n",client->name)); … … 583 584 sorted by address */ 584 585 order_nr=0; 585 I2C_LOCK _LIST(adap);586 I2C_LOCK(adap); 586 587 for (j = 0; j < I2C_CLIENT_MAX; j++) { 587 588 if ((client = adap->clients[j]) && … … 606 607 client->driver->name); 607 608 } 608 I2C_UNLOCK _LIST(adap);609 I2C_UNLOCK(adap); 609 610 up(&core_lists); 610 611 … … 693 694 } 694 695 695 down(&adap->lock);696 I2C_LOCK(adap); 696 697 ret = adap->algo->master_xfer(adap,msgs,num); 697 up(&adap->lock);698 I2C_UNLOCK(adap); 698 699 699 700 return ret; … … 720 721 count,client->adapter->name)); 721 722 722 down(&adap->lock);723 I2C_LOCK(adap); 723 724 ret = adap->algo->master_xfer(adap,&msg,1); 724 up(&adap->lock);725 I2C_UNLOCK(adap); 725 726 726 727 /* if everything went ok (i.e. 1 msg transmitted), return #bytes … … 750 751 count,client->adapter->name)); 751 752 752 down(&adap->lock);753 I2C_LOCK(adap); 753 754 ret = adap->algo->master_xfer(adap,&msg,1); 754 up(&adap->lock);755 I2C_UNLOCK(adap); 755 756 756 757 DEB2(printk(KERN_DEBUG "i2c-core.o: master_recv: return:%d (count:%d, addr:0x%02x)\n", … … 1347 1348 1348 1349 if (adapter->algo->smbus_xfer) { 1349 down(&adapter->lock);1350 I2C_LOCK(adapter); 1350 1351 res = adapter->algo->smbus_xfer(adapter,addr,flags,read_write, 1351 1352 command,size,data); 1352 up(&adapter->lock);1353 I2C_UNLOCK(adapter); 1353 1354 } else 1354 1355 res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write,
