提交 cc842407 编写于 作者: A Alexander Shishkin 提交者: Greg Kroah-Hartman

stm class: Plug stm device's unlink callback

STM device's unlink callback is never actually called from anywhere in
the stm class code.

This patch adds calls to stm driver's unlink method after the unlinking
has succeeded.
Signed-off-by: NAlexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 b4ca34aa
...@@ -376,14 +376,19 @@ static int stm_char_open(struct inode *inode, struct file *file) ...@@ -376,14 +376,19 @@ static int stm_char_open(struct inode *inode, struct file *file)
static int stm_char_release(struct inode *inode, struct file *file) static int stm_char_release(struct inode *inode, struct file *file)
{ {
struct stm_file *stmf = file->private_data; struct stm_file *stmf = file->private_data;
struct stm_device *stm = stmf->stm;
if (stm->data->unlink)
stm->data->unlink(stm->data, stmf->output.master,
stmf->output.channel);
stm_output_free(stmf->stm, &stmf->output); stm_output_free(stm, &stmf->output);
/* /*
* matches the stm_char_open()'s * matches the stm_char_open()'s
* class_find_device() + try_module_get() * class_find_device() + try_module_get()
*/ */
stm_put_device(stmf->stm); stm_put_device(stm);
kfree(stmf); kfree(stmf);
return 0; return 0;
...@@ -865,8 +870,18 @@ static int __stm_source_link_drop(struct stm_source_device *src, ...@@ -865,8 +870,18 @@ static int __stm_source_link_drop(struct stm_source_device *src,
spin_unlock(&src->link_lock); spin_unlock(&src->link_lock);
spin_unlock(&stm->link_lock); spin_unlock(&stm->link_lock);
if (!ret && src->data->unlink) /*
src->data->unlink(src->data); * Call the unlink callbacks for both source and stm, when we know
* that we have actually performed the unlinking.
*/
if (!ret) {
if (src->data->unlink)
src->data->unlink(src->data);
if (stm->data->unlink)
stm->data->unlink(stm->data, src->output.master,
src->output.channel);
}
return ret; return ret;
} }
......
...@@ -74,6 +74,9 @@ struct stm_device; ...@@ -74,6 +74,9 @@ struct stm_device;
* it must return zero; * it must return zero;
* 3) if it does not support the requested packet type/flag combination, * 3) if it does not support the requested packet type/flag combination,
* it must return -ENOTSUPP. * it must return -ENOTSUPP.
*
* The @unlink callback is called when there are no more active writers so
* that the master/channel can be quiesced.
*/ */
struct stm_data { struct stm_data {
const char *name; const char *name;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册