diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/scx200_acb.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index 517a050625f1..02150bb25d43 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -378,6 +378,7 @@ static struct i2c_algorithm scx200_acb_algorithm = { | |||
378 | }; | 378 | }; |
379 | 379 | ||
380 | static struct scx200_acb_iface *scx200_acb_list; | 380 | static struct scx200_acb_iface *scx200_acb_list; |
381 | static DECLARE_MUTEX(scx200_acb_list_mutex); | ||
381 | 382 | ||
382 | static int scx200_acb_probe(struct scx200_acb_iface *iface) | 383 | static int scx200_acb_probe(struct scx200_acb_iface *iface) |
383 | { | 384 | { |
@@ -463,10 +464,10 @@ static int __init scx200_acb_create(int base, int index) | |||
463 | goto errout_release; | 464 | goto errout_release; |
464 | } | 465 | } |
465 | 466 | ||
466 | lock_kernel(); | 467 | down(&scx200_acb_list_mutex); |
467 | iface->next = scx200_acb_list; | 468 | iface->next = scx200_acb_list; |
468 | scx200_acb_list = iface; | 469 | scx200_acb_list = iface; |
469 | unlock_kernel(); | 470 | up(&scx200_acb_list_mutex); |
470 | 471 | ||
471 | return 0; | 472 | return 0; |
472 | 473 | ||
@@ -509,17 +510,17 @@ static void __exit scx200_acb_cleanup(void) | |||
509 | { | 510 | { |
510 | struct scx200_acb_iface *iface; | 511 | struct scx200_acb_iface *iface; |
511 | 512 | ||
512 | lock_kernel(); | 513 | down(&scx200_acb_list_mutex); |
513 | while ((iface = scx200_acb_list) != NULL) { | 514 | while ((iface = scx200_acb_list) != NULL) { |
514 | scx200_acb_list = iface->next; | 515 | scx200_acb_list = iface->next; |
515 | unlock_kernel(); | 516 | up(&scx200_acb_list_mutex); |
516 | 517 | ||
517 | i2c_del_adapter(&iface->adapter); | 518 | i2c_del_adapter(&iface->adapter); |
518 | release_region(iface->base, 8); | 519 | release_region(iface->base, 8); |
519 | kfree(iface); | 520 | kfree(iface); |
520 | lock_kernel(); | 521 | down(&scx200_acb_list_mutex); |
521 | } | 522 | } |
522 | unlock_kernel(); | 523 | up(&scx200_acb_list_mutex); |
523 | } | 524 | } |
524 | 525 | ||
525 | module_init(scx200_acb_init); | 526 | module_init(scx200_acb_init); |