aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1/masters
diff options
context:
space:
mode:
authorEvgeniy Polyakov <johnpol@2ka.mipt.ru>2006-04-03 04:04:27 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-22 14:22:50 -0400
commitabd52a13206e02537ca1dc08fc5438c7d27bdbf1 (patch)
treeefe0ff89898aad10600d392ac727dcea9e7af322 /drivers/w1/masters
parent46e07f6e5eb0e465e086b8f485f4238bd453e3e9 (diff)
[PATCH] w1: Use mutexes instead of semaphores.
Use mutexes instead of semaphores. Patch tested on x86_64 and i386 with test bus master driver. Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/w1/masters')
-rw-r--r--drivers/w1/masters/ds2482.c24
-rw-r--r--drivers/w1/masters/ds2490.c10
2 files changed, 17 insertions, 17 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)))
diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
index 637677833da5..299e274d241a 100644
--- a/drivers/w1/masters/ds2490.c
+++ b/drivers/w1/masters/ds2490.c
@@ -169,7 +169,7 @@ static int ds_send_control(struct ds_device *, u16, u16);
169static int ds_send_control_cmd(struct ds_device *, u16, u16); 169static int ds_send_control_cmd(struct ds_device *, u16, u16);
170 170
171static LIST_HEAD(ds_devices); 171static LIST_HEAD(ds_devices);
172static DECLARE_MUTEX(ds_mutex); 172static DEFINE_MUTEX(ds_mutex);
173 173
174static struct usb_driver ds_driver = { 174static struct usb_driver ds_driver = {
175 .name = "DS9490R", 175 .name = "DS9490R",
@@ -887,9 +887,9 @@ static int ds_probe(struct usb_interface *intf,
887 if (err) 887 if (err)
888 goto err_out_clear; 888 goto err_out_clear;
889 889
890 down(&ds_mutex); 890 mutex_lock(&ds_mutex);
891 list_add_tail(&dev->ds_entry, &ds_devices); 891 list_add_tail(&dev->ds_entry, &ds_devices);
892 up(&ds_mutex); 892 mutex_unlock(&ds_mutex);
893 893
894 return 0; 894 return 0;
895 895
@@ -909,9 +909,9 @@ static void ds_disconnect(struct usb_interface *intf)
909 if (!dev) 909 if (!dev)
910 return; 910 return;
911 911
912 down(&ds_mutex); 912 mutex_lock(&ds_mutex);
913 list_del(&dev->ds_entry); 913 list_del(&dev->ds_entry);
914 up(&ds_mutex); 914 mutex_unlock(&ds_mutex);
915 915
916 ds_w1_fini(dev); 916 ds_w1_fini(dev);
917 917