aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1/masters/ds2482.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/w1/masters/ds2482.c')
-rw-r--r--drivers/w1/masters/ds2482.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c
index d1cacd23576b..af492cc48db2 100644
--- a/drivers/w1/masters/ds2482.c
+++ b/drivers/w1/masters/ds2482.c
@@ -125,7 +125,7 @@ struct ds2482_w1_chan {
125 125
126struct ds2482_data { 126struct ds2482_data {
127 struct i2c_client client; 127 struct i2c_client client;
128 struct semaphore access_lock; 128 struct mutex access_lock;
129 129
130 /* 1-wire interface(s) */ 130 /* 1-wire interface(s) */
131 int w1_count; /* 1 or 8 */ 131 int w1_count; /* 1 or 8 */
@@ -265,7 +265,7 @@ static u8 ds2482_w1_touch_bit(void *data, u8 bit)
265 struct ds2482_data *pdev = pchan->pdev; 265 struct ds2482_data *pdev = pchan->pdev;
266 int status = -1; 266 int status = -1;
267 267
268 down(&pdev->access_lock); 268 mutex_lock(&pdev->access_lock);
269 269
270 /* Select the channel */ 270 /* Select the channel */
271 ds2482_wait_1wire_idle(pdev); 271 ds2482_wait_1wire_idle(pdev);
@@ -277,7 +277,7 @@ static u8 ds2482_w1_touch_bit(void *data, u8 bit)
277 bit ? 0xFF : 0)) 277 bit ? 0xFF : 0))
278 status = ds2482_wait_1wire_idle(pdev); 278 status = ds2482_wait_1wire_idle(pdev);
279 279
280 up(&pdev->access_lock); 280 mutex_unlock(&pdev->access_lock);
281 281
282 return (status & DS2482_REG_STS_SBR) ? 1 : 0; 282 return (status & DS2482_REG_STS_SBR) ? 1 : 0;
283} 283}
@@ -297,7 +297,7 @@ static u8 ds2482_w1_triplet(void *data, u8 dbit)
297 struct ds2482_data *pdev = pchan->pdev; 297 struct ds2482_data *pdev = pchan->pdev;
298 int status = (3 << 5); 298 int status = (3 << 5);
299 299
300 down(&pdev->access_lock); 300 mutex_lock(&pdev->access_lock);
301 301
302 /* Select the channel */ 302 /* Select the channel */
303 ds2482_wait_1wire_idle(pdev); 303 ds2482_wait_1wire_idle(pdev);
@@ -309,7 +309,7 @@ static u8 ds2482_w1_triplet(void *data, u8 dbit)
309 dbit ? 0xFF : 0)) 309 dbit ? 0xFF : 0))
310 status = ds2482_wait_1wire_idle(pdev); 310 status = ds2482_wait_1wire_idle(pdev);
311 311
312 up(&pdev->access_lock); 312 mutex_unlock(&pdev->access_lock);
313 313
314 /* Decode the status */ 314 /* Decode the status */
315 return (status >> 5); 315 return (status >> 5);
@@ -326,7 +326,7 @@ static void ds2482_w1_write_byte(void *data, u8 byte)
326 struct ds2482_w1_chan *pchan = data; 326 struct ds2482_w1_chan *pchan = data;
327 struct ds2482_data *pdev = pchan->pdev; 327 struct ds2482_data *pdev = pchan->pdev;
328 328
329 down(&pdev->access_lock); 329 mutex_lock(&pdev->access_lock);
330 330
331 /* Select the channel */ 331 /* Select the channel */
332 ds2482_wait_1wire_idle(pdev); 332 ds2482_wait_1wire_idle(pdev);
@@ -336,7 +336,7 @@ static void ds2482_w1_write_byte(void *data, u8 byte)
336 /* Send the write byte command */ 336 /* Send the write byte command */
337 ds2482_send_cmd_data(pdev, DS2482_CMD_1WIRE_WRITE_BYTE, byte); 337 ds2482_send_cmd_data(pdev, DS2482_CMD_1WIRE_WRITE_BYTE, byte);
338 338
339 up(&pdev->access_lock); 339 mutex_unlock(&pdev->access_lock);
340} 340}
341 341
342/** 342/**
@@ -351,7 +351,7 @@ static u8 ds2482_w1_read_byte(void *data)
351 struct ds2482_data *pdev = pchan->pdev; 351 struct ds2482_data *pdev = pchan->pdev;
352 int result; 352 int result;
353 353
354 down(&pdev->access_lock); 354 mutex_lock(&pdev->access_lock);
355 355
356 /* Select the channel */ 356 /* Select the channel */
357 ds2482_wait_1wire_idle(pdev); 357 ds2482_wait_1wire_idle(pdev);
@@ -370,7 +370,7 @@ static u8 ds2482_w1_read_byte(void *data)
370 /* Read the data byte */ 370 /* Read the data byte */
371 result = i2c_smbus_read_byte(&pdev->client); 371 result = i2c_smbus_read_byte(&pdev->client);
372 372
373 up(&pdev->access_lock); 373 mutex_unlock(&pdev->access_lock);
374 374
375 return result; 375 return result;
376} 376}
@@ -389,7 +389,7 @@ static u8 ds2482_w1_reset_bus(void *data)
389 int err; 389 int err;
390 u8 retval = 1; 390 u8 retval = 1;
391 391
392 down(&pdev->access_lock); 392 mutex_lock(&pdev->access_lock);
393 393
394 /* Select the channel */ 394 /* Select the channel */
395 ds2482_wait_1wire_idle(pdev); 395 ds2482_wait_1wire_idle(pdev);
@@ -409,7 +409,7 @@ static u8 ds2482_w1_reset_bus(void *data)
409 0xF0); 409 0xF0);
410 } 410 }
411 411
412 up(&pdev->access_lock); 412 mutex_unlock(&pdev->access_lock);
413 413
414 return retval; 414 return retval;
415} 415}
@@ -482,7 +482,7 @@ static int ds2482_detect(struct i2c_adapter *adapter, int address, int kind)
482 snprintf(new_client->name, sizeof(new_client->name), "ds2482-%d00", 482 snprintf(new_client->name, sizeof(new_client->name), "ds2482-%d00",
483 data->w1_count); 483 data->w1_count);
484 484
485 init_MUTEX(&data->access_lock); 485 mutex_init(&data->access_lock);
486 486
487 /* Tell the I2C layer a new client has arrived */ 487 /* Tell the I2C layer a new client has arrived */
488 if ((err = i2c_attach_client(new_client))) 488 if ((err = i2c_attach_client(new_client)))