|
25 | 25 | #include <linux/skbuff.h>
|
26 | 26 | #include <linux/if_arp.h>
|
27 | 27 | #include <linux/jiffies.h>
|
| 28 | +#include <linux/refcount.h> |
28 | 29 |
|
29 | 30 | #include <net/ax25.h>
|
30 | 31 |
|
@@ -70,7 +71,7 @@ struct mkiss {
|
70 | 71 | #define CRC_MODE_FLEX_TEST 3
|
71 | 72 | #define CRC_MODE_SMACK_TEST 4
|
72 | 73 |
|
73 |
| - atomic_t refcnt; |
| 74 | + refcount_t refcnt; |
74 | 75 | struct completion dead;
|
75 | 76 | };
|
76 | 77 |
|
@@ -668,15 +669,15 @@ static struct mkiss *mkiss_get(struct tty_struct *tty)
|
668 | 669 | read_lock(&disc_data_lock);
|
669 | 670 | ax = tty->disc_data;
|
670 | 671 | if (ax)
|
671 |
| - atomic_inc(&ax->refcnt); |
| 672 | + refcount_inc(&ax->refcnt); |
672 | 673 | read_unlock(&disc_data_lock);
|
673 | 674 |
|
674 | 675 | return ax;
|
675 | 676 | }
|
676 | 677 |
|
677 | 678 | static void mkiss_put(struct mkiss *ax)
|
678 | 679 | {
|
679 |
| - if (atomic_dec_and_test(&ax->refcnt)) |
| 680 | + if (refcount_dec_and_test(&ax->refcnt)) |
680 | 681 | complete(&ax->dead);
|
681 | 682 | }
|
682 | 683 |
|
@@ -704,7 +705,7 @@ static int mkiss_open(struct tty_struct *tty)
|
704 | 705 | ax->dev = dev;
|
705 | 706 |
|
706 | 707 | spin_lock_init(&ax->buflock);
|
707 |
| - atomic_set(&ax->refcnt, 1); |
| 708 | + refcount_set(&ax->refcnt, 1); |
708 | 709 | init_completion(&ax->dead);
|
709 | 710 |
|
710 | 711 | ax->tty = tty;
|
@@ -784,7 +785,7 @@ static void mkiss_close(struct tty_struct *tty)
|
784 | 785 | * We have now ensured that nobody can start using ap from now on, but
|
785 | 786 | * we have to wait for all existing users to finish.
|
786 | 787 | */
|
787 |
| - if (!atomic_dec_and_test(&ax->refcnt)) |
| 788 | + if (!refcount_dec_and_test(&ax->refcnt)) |
788 | 789 | wait_for_completion(&ax->dead);
|
789 | 790 | /*
|
790 | 791 | * Halt the transmit queue so that a new transmit cannot scribble
|
|
0 commit comments