Commit 16c59c58 authored by Marcel Holtmann's avatar Marcel Holtmann

[Bluetooth] Make more code static

This patch makes more needlessly global code static.
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 0110a87d
...@@ -216,22 +216,6 @@ struct rfcomm_dlc { ...@@ -216,22 +216,6 @@ struct rfcomm_dlc {
#define RFCOMM_CFC_DISABLED 0 #define RFCOMM_CFC_DISABLED 0
#define RFCOMM_CFC_ENABLED RFCOMM_MAX_CREDITS #define RFCOMM_CFC_ENABLED RFCOMM_MAX_CREDITS
extern struct task_struct *rfcomm_thread;
extern unsigned long rfcomm_event;
static inline void rfcomm_schedule(uint event)
{
if (!rfcomm_thread)
return;
//set_bit(event, &rfcomm_event);
set_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
wake_up_process(rfcomm_thread);
}
extern struct semaphore rfcomm_sem;
#define rfcomm_lock() down(&rfcomm_sem);
#define rfcomm_unlock() up(&rfcomm_sem);
/* ---- RFCOMM DLCs (channels) ---- */ /* ---- RFCOMM DLCs (channels) ---- */
struct rfcomm_dlc *rfcomm_dlc_alloc(int prio); struct rfcomm_dlc *rfcomm_dlc_alloc(int prio);
void rfcomm_dlc_free(struct rfcomm_dlc *d); void rfcomm_dlc_free(struct rfcomm_dlc *d);
...@@ -271,11 +255,6 @@ static inline void rfcomm_dlc_unthrottle(struct rfcomm_dlc *d) ...@@ -271,11 +255,6 @@ static inline void rfcomm_dlc_unthrottle(struct rfcomm_dlc *d)
} }
/* ---- RFCOMM sessions ---- */ /* ---- RFCOMM sessions ---- */
struct rfcomm_session *rfcomm_session_add(struct socket *sock, int state);
struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst);
struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *err);
void rfcomm_session_del(struct rfcomm_session *s);
void rfcomm_session_close(struct rfcomm_session *s, int err);
void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *dst); void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *dst);
static inline void rfcomm_session_hold(struct rfcomm_session *s) static inline void rfcomm_session_hold(struct rfcomm_session *s)
...@@ -283,12 +262,6 @@ static inline void rfcomm_session_hold(struct rfcomm_session *s) ...@@ -283,12 +262,6 @@ static inline void rfcomm_session_hold(struct rfcomm_session *s)
atomic_inc(&s->refcnt); atomic_inc(&s->refcnt);
} }
static inline void rfcomm_session_put(struct rfcomm_session *s)
{
if (atomic_dec_and_test(&s->refcnt))
rfcomm_session_del(s);
}
/* ---- RFCOMM chechsum ---- */ /* ---- RFCOMM chechsum ---- */
extern u8 rfcomm_crc_table[]; extern u8 rfcomm_crc_table[];
......
...@@ -61,8 +61,12 @@ ...@@ -61,8 +61,12 @@
struct proc_dir_entry *proc_bt_rfcomm; struct proc_dir_entry *proc_bt_rfcomm;
#endif #endif
struct task_struct *rfcomm_thread; static struct task_struct *rfcomm_thread;
DECLARE_MUTEX(rfcomm_sem);
static DECLARE_MUTEX(rfcomm_sem);
#define rfcomm_lock() down(&rfcomm_sem);
#define rfcomm_unlock() up(&rfcomm_sem);
unsigned long rfcomm_event; unsigned long rfcomm_event;
static LIST_HEAD(session_list); static LIST_HEAD(session_list);
...@@ -81,6 +85,10 @@ static void rfcomm_make_uih(struct sk_buff *skb, u8 addr); ...@@ -81,6 +85,10 @@ static void rfcomm_make_uih(struct sk_buff *skb, u8 addr);
static void rfcomm_process_connect(struct rfcomm_session *s); static void rfcomm_process_connect(struct rfcomm_session *s);
static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *err);
static struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst);
static void rfcomm_session_del(struct rfcomm_session *s);
/* ---- RFCOMM frame parsing macros ---- */ /* ---- RFCOMM frame parsing macros ---- */
#define __get_dlci(b) ((b & 0xfc) >> 2) #define __get_dlci(b) ((b & 0xfc) >> 2)
#define __get_channel(b) ((b & 0xf8) >> 3) #define __get_channel(b) ((b & 0xf8) >> 3)
...@@ -111,6 +119,21 @@ static void rfcomm_process_connect(struct rfcomm_session *s); ...@@ -111,6 +119,21 @@ static void rfcomm_process_connect(struct rfcomm_session *s);
#define __get_rpn_stop_bits(line) (((line) >> 2) & 0x1) #define __get_rpn_stop_bits(line) (((line) >> 2) & 0x1)
#define __get_rpn_parity(line) (((line) >> 3) & 0x3) #define __get_rpn_parity(line) (((line) >> 3) & 0x3)
static inline void rfcomm_schedule(uint event)
{
if (!rfcomm_thread)
return;
//set_bit(event, &rfcomm_event);
set_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
wake_up_process(rfcomm_thread);
}
static inline void rfcomm_session_put(struct rfcomm_session *s)
{
if (atomic_dec_and_test(&s->refcnt))
rfcomm_session_del(s);
}
/* ---- RFCOMM FCS computation ---- */ /* ---- RFCOMM FCS computation ---- */
/* CRC on 2 bytes */ /* CRC on 2 bytes */
...@@ -458,7 +481,7 @@ int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig) ...@@ -458,7 +481,7 @@ int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig)
} }
/* ---- RFCOMM sessions ---- */ /* ---- RFCOMM sessions ---- */
struct rfcomm_session *rfcomm_session_add(struct socket *sock, int state) static struct rfcomm_session *rfcomm_session_add(struct socket *sock, int state)
{ {
struct rfcomm_session *s = kmalloc(sizeof(*s), GFP_KERNEL); struct rfcomm_session *s = kmalloc(sizeof(*s), GFP_KERNEL);
if (!s) if (!s)
...@@ -487,7 +510,7 @@ struct rfcomm_session *rfcomm_session_add(struct socket *sock, int state) ...@@ -487,7 +510,7 @@ struct rfcomm_session *rfcomm_session_add(struct socket *sock, int state)
return s; return s;
} }
void rfcomm_session_del(struct rfcomm_session *s) static void rfcomm_session_del(struct rfcomm_session *s)
{ {
int state = s->state; int state = s->state;
...@@ -505,7 +528,7 @@ void rfcomm_session_del(struct rfcomm_session *s) ...@@ -505,7 +528,7 @@ void rfcomm_session_del(struct rfcomm_session *s)
module_put(THIS_MODULE); module_put(THIS_MODULE);
} }
struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst) static struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst)
{ {
struct rfcomm_session *s; struct rfcomm_session *s;
struct list_head *p, *n; struct list_head *p, *n;
...@@ -521,7 +544,7 @@ struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst) ...@@ -521,7 +544,7 @@ struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst)
return NULL; return NULL;
} }
void rfcomm_session_close(struct rfcomm_session *s, int err) static void rfcomm_session_close(struct rfcomm_session *s, int err)
{ {
struct rfcomm_dlc *d; struct rfcomm_dlc *d;
struct list_head *p, *n; struct list_head *p, *n;
...@@ -542,7 +565,7 @@ void rfcomm_session_close(struct rfcomm_session *s, int err) ...@@ -542,7 +565,7 @@ void rfcomm_session_close(struct rfcomm_session *s, int err)
rfcomm_session_put(s); rfcomm_session_put(s);
} }
struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *err) static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *err)
{ {
struct rfcomm_session *s = NULL; struct rfcomm_session *s = NULL;
struct sockaddr_l2 addr; struct sockaddr_l2 addr;
......
...@@ -393,7 +393,7 @@ static int rfcomm_sock_connect(struct socket *sock, struct sockaddr *addr, int a ...@@ -393,7 +393,7 @@ static int rfcomm_sock_connect(struct socket *sock, struct sockaddr *addr, int a
return err; return err;
} }
int rfcomm_sock_listen(struct socket *sock, int backlog) static int rfcomm_sock_listen(struct socket *sock, int backlog)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int err = 0; int err = 0;
...@@ -437,7 +437,7 @@ int rfcomm_sock_listen(struct socket *sock, int backlog) ...@@ -437,7 +437,7 @@ int rfcomm_sock_listen(struct socket *sock, int backlog)
return err; return err;
} }
int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int flags) static int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int flags)
{ {
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
struct sock *sk = sock->sk, *nsk; struct sock *sk = sock->sk, *nsk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment