提交 2aba3220 编写于 作者: L Linus Torvalds

Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

Pull crypto fix from Herbert Xu:
 "This fixes a crash on resume in the ccree driver"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: ccree - fix resume race condition on init
...@@ -380,7 +380,7 @@ static int init_cc_resources(struct platform_device *plat_dev) ...@@ -380,7 +380,7 @@ static int init_cc_resources(struct platform_device *plat_dev)
rc = cc_ivgen_init(new_drvdata); rc = cc_ivgen_init(new_drvdata);
if (rc) { if (rc) {
dev_err(dev, "cc_ivgen_init failed\n"); dev_err(dev, "cc_ivgen_init failed\n");
goto post_power_mgr_err; goto post_buf_mgr_err;
} }
/* Allocate crypto algs */ /* Allocate crypto algs */
...@@ -403,6 +403,9 @@ static int init_cc_resources(struct platform_device *plat_dev) ...@@ -403,6 +403,9 @@ static int init_cc_resources(struct platform_device *plat_dev)
goto post_hash_err; goto post_hash_err;
} }
/* All set, we can allow autosuspend */
cc_pm_go(new_drvdata);
/* If we got here and FIPS mode is enabled /* If we got here and FIPS mode is enabled
* it means all FIPS test passed, so let TEE * it means all FIPS test passed, so let TEE
* know we're good. * know we're good.
...@@ -417,8 +420,6 @@ static int init_cc_resources(struct platform_device *plat_dev) ...@@ -417,8 +420,6 @@ static int init_cc_resources(struct platform_device *plat_dev)
cc_cipher_free(new_drvdata); cc_cipher_free(new_drvdata);
post_ivgen_err: post_ivgen_err:
cc_ivgen_fini(new_drvdata); cc_ivgen_fini(new_drvdata);
post_power_mgr_err:
cc_pm_fini(new_drvdata);
post_buf_mgr_err: post_buf_mgr_err:
cc_buffer_mgr_fini(new_drvdata); cc_buffer_mgr_fini(new_drvdata);
post_req_mgr_err: post_req_mgr_err:
......
...@@ -100,20 +100,19 @@ int cc_pm_put_suspend(struct device *dev) ...@@ -100,20 +100,19 @@ int cc_pm_put_suspend(struct device *dev)
int cc_pm_init(struct cc_drvdata *drvdata) int cc_pm_init(struct cc_drvdata *drvdata)
{ {
int rc = 0;
struct device *dev = drvdata_to_dev(drvdata); struct device *dev = drvdata_to_dev(drvdata);
/* must be before the enabling to avoid resdundent suspending */ /* must be before the enabling to avoid resdundent suspending */
pm_runtime_set_autosuspend_delay(dev, CC_SUSPEND_TIMEOUT); pm_runtime_set_autosuspend_delay(dev, CC_SUSPEND_TIMEOUT);
pm_runtime_use_autosuspend(dev); pm_runtime_use_autosuspend(dev);
/* activate the PM module */ /* activate the PM module */
rc = pm_runtime_set_active(dev); return pm_runtime_set_active(dev);
if (rc) }
return rc;
/* enable the PM module*/
pm_runtime_enable(dev);
return rc; /* enable the PM module*/
void cc_pm_go(struct cc_drvdata *drvdata)
{
pm_runtime_enable(drvdata_to_dev(drvdata));
} }
void cc_pm_fini(struct cc_drvdata *drvdata) void cc_pm_fini(struct cc_drvdata *drvdata)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
extern const struct dev_pm_ops ccree_pm; extern const struct dev_pm_ops ccree_pm;
int cc_pm_init(struct cc_drvdata *drvdata); int cc_pm_init(struct cc_drvdata *drvdata);
void cc_pm_go(struct cc_drvdata *drvdata);
void cc_pm_fini(struct cc_drvdata *drvdata); void cc_pm_fini(struct cc_drvdata *drvdata);
int cc_pm_suspend(struct device *dev); int cc_pm_suspend(struct device *dev);
int cc_pm_resume(struct device *dev); int cc_pm_resume(struct device *dev);
...@@ -29,6 +30,8 @@ static inline int cc_pm_init(struct cc_drvdata *drvdata) ...@@ -29,6 +30,8 @@ static inline int cc_pm_init(struct cc_drvdata *drvdata)
return 0; return 0;
} }
static void cc_pm_go(struct cc_drvdata *drvdata) {}
static inline void cc_pm_fini(struct cc_drvdata *drvdata) {} static inline void cc_pm_fini(struct cc_drvdata *drvdata) {}
static inline int cc_pm_suspend(struct device *dev) static inline int cc_pm_suspend(struct device *dev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册