[PATCH v2 2/2] staging: speakup: refactor to use existing code in vt

Samuel Thibault samuel.thibault at ens-lyon.org
Wed Apr 3 02:38:44 EDT 2019


Okash Khawaja, le mer. 03 avril 2019 00:27:43 +0100, a ecrit:
> +void speakup_cancel_selection(void)
> +{
> +	cancel_work_sync(&speakup_sel_work.work);
> +	tty_kref_put(speakup_sel_work.tty);
> +	/* setting to null so that if work fails to run and we cancel it,
> +	 * we can run it again without getting EBUSY forever from there on.
> +	 */
> +	speakup_sel_work.tty = NULL;

Thinking again about it, you can not just put the kref on the tty, you
need to know whether the work happened (thus already put the kref) or
not (thus hasn't put the kref).

So instead of just setting tty to NULL, you should xchg it with NULL,
and if it wasn't NULL (the work didn't happen), put the kref.

Samuel


More information about the Speakup mailing list