| .. | .. |
|---|
| 236 | 236 | #if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER) |
|---|
| 237 | 237 | ax25_dama_info dama; |
|---|
| 238 | 238 | #endif |
|---|
| 239 | + refcount_t refcount; |
|---|
| 239 | 240 | } ax25_dev; |
|---|
| 240 | 241 | |
|---|
| 241 | 242 | typedef struct ax25_cb { |
|---|
| .. | .. |
|---|
| 290 | 291 | } |
|---|
| 291 | 292 | } |
|---|
| 292 | 293 | |
|---|
| 294 | +static inline void ax25_dev_hold(ax25_dev *ax25_dev) |
|---|
| 295 | +{ |
|---|
| 296 | + refcount_inc(&ax25_dev->refcount); |
|---|
| 297 | +} |
|---|
| 298 | + |
|---|
| 299 | +static inline void ax25_dev_put(ax25_dev *ax25_dev) |
|---|
| 300 | +{ |
|---|
| 301 | + if (refcount_dec_and_test(&ax25_dev->refcount)) { |
|---|
| 302 | + kfree(ax25_dev); |
|---|
| 303 | + } |
|---|
| 304 | +} |
|---|
| 293 | 305 | static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) |
|---|
| 294 | 306 | { |
|---|
| 295 | 307 | skb->dev = dev; |
|---|