| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * PPP async serial channel driver for Linux. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 1999 Paul Mackerras. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of the GNU General Public License |
|---|
| 8 | | - * as published by the Free Software Foundation; either version |
|---|
| 9 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 10 | 6 | * |
|---|
| 11 | 7 | * This driver provides the encapsulation and framing for sending |
|---|
| 12 | 8 | * and receiving PPP frames over async serial lines. It relies on |
|---|
| .. | .. |
|---|
| 70 | 66 | struct tasklet_struct tsk; |
|---|
| 71 | 67 | |
|---|
| 72 | 68 | refcount_t refcnt; |
|---|
| 73 | | - struct semaphore dead_sem; |
|---|
| 69 | + struct completion dead; |
|---|
| 74 | 70 | struct ppp_channel chan; /* interface to generic ppp layer */ |
|---|
| 75 | 71 | unsigned char obuf[OBUFSIZE]; |
|---|
| 76 | 72 | }; |
|---|
| .. | .. |
|---|
| 148 | 144 | static void ap_put(struct asyncppp *ap) |
|---|
| 149 | 145 | { |
|---|
| 150 | 146 | if (refcount_dec_and_test(&ap->refcnt)) |
|---|
| 151 | | - up(&ap->dead_sem); |
|---|
| 147 | + complete(&ap->dead); |
|---|
| 152 | 148 | } |
|---|
| 153 | 149 | |
|---|
| 154 | 150 | /* |
|---|
| .. | .. |
|---|
| 186 | 182 | tasklet_init(&ap->tsk, ppp_async_process, (unsigned long) ap); |
|---|
| 187 | 183 | |
|---|
| 188 | 184 | refcount_set(&ap->refcnt, 1); |
|---|
| 189 | | - sema_init(&ap->dead_sem, 0); |
|---|
| 185 | + init_completion(&ap->dead); |
|---|
| 190 | 186 | |
|---|
| 191 | 187 | ap->chan.private = ap; |
|---|
| 192 | 188 | ap->chan.ops = &async_ops; |
|---|
| .. | .. |
|---|
| 235 | 231 | * by the time it returns. |
|---|
| 236 | 232 | */ |
|---|
| 237 | 233 | if (!refcount_dec_and_test(&ap->refcnt)) |
|---|
| 238 | | - down(&ap->dead_sem); |
|---|
| 234 | + wait_for_completion(&ap->dead); |
|---|
| 239 | 235 | tasklet_kill(&ap->tsk); |
|---|
| 240 | 236 | |
|---|
| 241 | 237 | ppp_unregister_channel(&ap->chan); |
|---|
| .. | .. |
|---|
| 263 | 259 | */ |
|---|
| 264 | 260 | static ssize_t |
|---|
| 265 | 261 | ppp_asynctty_read(struct tty_struct *tty, struct file *file, |
|---|
| 266 | | - unsigned char __user *buf, size_t count) |
|---|
| 262 | + unsigned char *buf, size_t count, |
|---|
| 263 | + void **cookie, unsigned long offset) |
|---|
| 267 | 264 | { |
|---|
| 268 | 265 | return -EAGAIN; |
|---|
| 269 | 266 | } |
|---|