diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-11-10 12:01:08 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-11-10 12:01:08 +0100 |
| commit | f13f61f557d3739272a0132177c6a7697d6f8ba8 (patch) | |
| tree | 98a8f15b4b3fc8a11beada7c3510de3bd489d862 /usr | |
| parent | 6f3f25ffafe72354b959d6b4b0303563acdaadca (diff) | |
Version three of upstream remake
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'usr')
| -rw-r--r-- | usr/src/dkms_source_tree/applesmc.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/usr/src/dkms_source_tree/applesmc.c b/usr/src/dkms_source_tree/applesmc.c index 01071e5..7b22f67 100644 --- a/usr/src/dkms_source_tree/applesmc.c +++ b/usr/src/dkms_source_tree/applesmc.c | |||
| @@ -150,7 +150,9 @@ static struct applesmc_registers { | |||
| 150 | bool has_key_backlight; /* has keyboard backlight */ | 150 | bool has_key_backlight; /* has keyboard backlight */ |
| 151 | bool init_complete; /* true when fully initialized */ | 151 | bool init_complete; /* true when fully initialized */ |
| 152 | struct applesmc_entry *cache; /* cached key entries */ | 152 | struct applesmc_entry *cache; /* cached key entries */ |
| 153 | } smcreg; | 153 | } smcreg = { |
| 154 | .mutex = __MUTEX_INITIALIZER(smcreg.mutex), | ||
| 155 | }; | ||
| 154 | 156 | ||
| 155 | static const int debug; | 157 | static const int debug; |
| 156 | static struct platform_device *pdev; | 158 | static struct platform_device *pdev; |
| @@ -500,8 +502,6 @@ static int applesmc_init_smcreg_try(void) | |||
| 500 | if (s->init_complete) | 502 | if (s->init_complete) |
| 501 | return 0; | 503 | return 0; |
| 502 | 504 | ||
| 503 | mutex_init(&s->mutex); | ||
| 504 | |||
| 505 | ret = read_register_count(&s->key_count); | 505 | ret = read_register_count(&s->key_count); |
| 506 | if (ret) | 506 | if (ret) |
| 507 | return ret; | 507 | return ret; |
| @@ -561,19 +561,25 @@ static int applesmc_init_smcreg(void) | |||
| 561 | 561 | ||
| 562 | for (ms = 0; ms < INIT_TIMEOUT_MSECS; ms += INIT_WAIT_MSECS) { | 562 | for (ms = 0; ms < INIT_TIMEOUT_MSECS; ms += INIT_WAIT_MSECS) { |
| 563 | ret = applesmc_init_smcreg_try(); | 563 | ret = applesmc_init_smcreg_try(); |
| 564 | if (!ret) | 564 | if (!ret) { |
| 565 | if (ms) | ||
| 566 | pr_info("init_smcreg() took %d ms\n", ms); | ||
| 565 | return 0; | 567 | return 0; |
| 566 | pr_warn("slow init, retrying\n"); | 568 | } |
| 567 | msleep(INIT_WAIT_MSECS); | 569 | msleep(INIT_WAIT_MSECS); |
| 568 | } | 570 | } |
| 569 | 571 | ||
| 572 | kfree(smcreg.cache); | ||
| 573 | smcreg.cache = NULL; | ||
| 574 | |||
| 570 | return ret; | 575 | return ret; |
| 571 | } | 576 | } |
| 572 | 577 | ||
| 573 | static void applesmc_destroy_smcreg(void) | 578 | static void applesmc_destroy_smcreg(void) |
| 574 | { | 579 | { |
| 575 | kfree(smcreg.cache); | 580 | kfree(smcreg.cache); |
| 576 | memset(&smcreg, 0, sizeof(smcreg)); | 581 | smcreg.cache = NULL; |
| 582 | smcreg.init_complete = false; | ||
| 577 | } | 583 | } |
| 578 | 584 | ||
| 579 | /* Device model stuff */ | 585 | /* Device model stuff */ |
