Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 220338
b: refs/heads/master
c: 73f12e8
h: refs/heads/master
v: v3
  • Loading branch information
Pavan Savoy authored and Greg Kroah-Hartman committed Oct 14, 2010
1 parent 596718a commit 5beab8a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 66 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da6830ac3969c9480e05ed2b21eee64e21a101d2
refs/heads/master: 73f12e8d3d94828b9efe2b8b8a34b4ad6d14ee47
73 changes: 17 additions & 56 deletions trunk/drivers/misc/ti-st/st_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@
#include <net/bluetooth/hci.h>
#include <linux/ti_wilink_st.h>

/* strings to be used for rfkill entries and by
* ST Core to be used for sysfs debug entry
*/
#define PROTO_ENTRY(type, name) name
const unsigned char *protocol_strngs[] = {
PROTO_ENTRY(ST_BT, "Bluetooth"),
PROTO_ENTRY(ST_FM, "FM"),
PROTO_ENTRY(ST_GPS, "GPS"),
};
/* function pointer pointing to either,
* st_kim_recv during registration to receive fw download responses
* st_int_recv after registration to receive proto stack responses
Expand Down Expand Up @@ -144,7 +135,7 @@ void st_reg_complete(struct st_data_s *st_gdata, char err)
static inline int st_check_data_len(struct st_data_s *st_gdata,
int protoid, int len)
{
register int room = skb_tailroom(st_gdata->rx_skb);
int room = skb_tailroom(st_gdata->rx_skb);

pr_debug("len %d room %d", len, room);

Expand Down Expand Up @@ -187,7 +178,7 @@ static inline int st_check_data_len(struct st_data_s *st_gdata,
static inline void st_wakeup_ack(struct st_data_s *st_gdata,
unsigned char cmd)
{
register struct sk_buff *waiting_skb;
struct sk_buff *waiting_skb;
unsigned long flags = 0;

spin_lock_irqsave(&st_gdata->lock, flags);
Expand Down Expand Up @@ -216,13 +207,13 @@ static inline void st_wakeup_ack(struct st_data_s *st_gdata,
void st_int_recv(void *disc_data,
const unsigned char *data, long count)
{
register char *ptr;
char *ptr;
struct hci_event_hdr *eh;
struct hci_acl_hdr *ah;
struct hci_sco_hdr *sh;
struct fm_event_hdr *fm;
struct gps_event_hdr *gps;
register int len = 0, type = 0, dlen = 0;
int len = 0, type = 0, dlen = 0;
static enum proto_type protoid = ST_MAX;
struct st_data_s *st_gdata = (struct st_data_s *)disc_data;

Expand Down Expand Up @@ -918,34 +909,27 @@ static void st_tty_flush_buffer(struct tty_struct *tty)
return;
}

static struct tty_ldisc_ops st_ldisc_ops = {
.magic = TTY_LDISC_MAGIC,
.name = "n_st",
.open = st_tty_open,
.close = st_tty_close,
.receive_buf = st_tty_receive,
.write_wakeup = st_tty_wakeup,
.flush_buffer = st_tty_flush_buffer,
.owner = THIS_MODULE
};

/********************************************************************/
int st_core_init(struct st_data_s **core_data)
{
struct st_data_s *st_gdata;
long err;
static struct tty_ldisc_ops *st_ldisc_ops;

/* populate and register to TTY line discipline */
st_ldisc_ops = kzalloc(sizeof(*st_ldisc_ops), GFP_KERNEL);
if (!st_ldisc_ops) {
pr_err("no mem to allocate");
return -ENOMEM;
}

st_ldisc_ops->magic = TTY_LDISC_MAGIC;
st_ldisc_ops->name = "n_st"; /*"n_hci"; */
st_ldisc_ops->open = st_tty_open;
st_ldisc_ops->close = st_tty_close;
st_ldisc_ops->receive_buf = st_tty_receive;
st_ldisc_ops->write_wakeup = st_tty_wakeup;
st_ldisc_ops->flush_buffer = st_tty_flush_buffer;
st_ldisc_ops->owner = THIS_MODULE;

err = tty_register_ldisc(N_TI_WL, st_ldisc_ops);
err = tty_register_ldisc(N_TI_WL, &st_ldisc_ops);
if (err) {
pr_err("error registering %d line discipline %ld",
N_TI_WL, err);
kfree(st_ldisc_ops);
return err;
}
pr_debug("registered n_shared line discipline");
Expand All @@ -956,7 +940,6 @@ int st_core_init(struct st_data_s **core_data)
err = tty_unregister_ldisc(N_TI_WL);
if (err)
pr_err("unable to un-register ldisc %ld", err);
kfree(st_ldisc_ops);
err = -ENOMEM;
return err;
}
Expand All @@ -970,30 +953,13 @@ int st_core_init(struct st_data_s **core_data)
/* Locking used in st_int_enqueue() to avoid multiple execution */
spin_lock_init(&st_gdata->lock);

/* ldisc_ops ref to be only used in __exit of module */
st_gdata->ldisc_ops = st_ldisc_ops;

#if 0
err = st_kim_init();
if (err) {
pr_err("error during kim initialization(%ld)", err);
kfree(st_gdata);
err = tty_unregister_ldisc(N_TI_WL);
if (err)
pr_err("unable to un-register ldisc");
kfree(st_ldisc_ops);
return -1;
}
#endif

err = st_ll_init(st_gdata);
if (err) {
pr_err("error during st_ll initialization(%ld)", err);
kfree(st_gdata);
err = tty_unregister_ldisc(N_TI_WL);
if (err)
pr_err("unable to un-register ldisc");
kfree(st_ldisc_ops);
return -1;
}
*core_data = st_gdata;
Expand All @@ -1007,11 +973,7 @@ void st_core_exit(struct st_data_s *st_gdata)
err = st_ll_deinit(st_gdata);
if (err)
pr_err("error during deinit of ST LL %ld", err);
#if 0
err = st_kim_deinit();
if (err)
pr_err("error during deinit of ST KIM %ld", err);
#endif

if (st_gdata != NULL) {
/* Free ST Tx Qs and skbs */
skb_queue_purge(&st_gdata->txq);
Expand All @@ -1022,7 +984,6 @@ void st_core_exit(struct st_data_s *st_gdata)
err = tty_unregister_ldisc(N_TI_WL);
if (err)
pr_err("unable to un-register ldisc %ld", err);
kfree(st_gdata->ldisc_ops);
/* free the global data pointer */
kfree(st_gdata);
}
Expand Down
15 changes: 8 additions & 7 deletions trunk/drivers/misc/ti-st/st_kim.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const unsigned char *protocol_names[] = {
};

#define MAX_ST_DEVICES 3 /* Imagine 1 on each UART for now */
struct platform_device *st_kim_devices[MAX_ST_DEVICES];
static struct platform_device *st_kim_devices[MAX_ST_DEVICES];

/**********************************************************************/
/* internal functions */
Expand Down Expand Up @@ -157,17 +157,18 @@ static inline int kim_check_data_len(struct kim_data_s *kim_gdata, int len)
void kim_int_recv(struct kim_data_s *kim_gdata,
const unsigned char *data, long count)
{
register char *ptr;
const unsigned char *ptr;
struct hci_event_hdr *eh;
register int len = 0, type = 0;
int len = 0, type = 0;

pr_debug("%s", __func__);
/* Decode received bytes here */
ptr = (char *)data;
ptr = data;
if (unlikely(ptr == NULL)) {
pr_err(" received null from TTY ");
return;
}

while (count) {
if (kim_gdata->rx_count) {
len = min_t(unsigned int, kim_gdata->rx_count, count);
Expand Down Expand Up @@ -231,7 +232,7 @@ void kim_int_recv(struct kim_data_s *kim_gdata,
static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name)
{
unsigned short version = 0, chip = 0, min_ver = 0, maj_ver = 0;
char read_ver_cmd[] = { 0x01, 0x01, 0x10, 0x00 };
const char read_ver_cmd[] = { 0x01, 0x01, 0x10, 0x00 };

pr_debug("%s", __func__);

Expand Down Expand Up @@ -278,8 +279,8 @@ static long download_firmware(struct kim_data_s *kim_gdata)
{
long err = 0;
long len = 0;
register unsigned char *ptr = NULL;
register unsigned char *action_ptr = NULL;
unsigned char *ptr = NULL;
unsigned char *action_ptr = NULL;
unsigned char bts_scr_name[30] = { 0 }; /* 30 char long bts scr name? */

err = read_local_version(kim_gdata, bts_scr_name);
Expand Down
2 changes: 0 additions & 2 deletions trunk/include/linux/ti_wilink_st.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ extern long st_unregister(enum proto_type);
* can occur , where as during other times other events CH8, CH9
* can occur.
* @tty: tty provided by the TTY core for line disciplines.
* @ldisc_ops: the procedures that this line discipline registers with TTY.
* @tx_skb: If for some reason the tty's write returns lesser bytes written
* then to maintain the rest of data to be written on next instance.
* This needs to be protected, hence the lock inside wakeup func.
Expand Down Expand Up @@ -132,7 +131,6 @@ extern long st_unregister(enum proto_type);
struct st_data_s {
unsigned long st_state;
struct tty_struct *tty;
struct tty_ldisc_ops *ldisc_ops;
struct sk_buff *tx_skb;
#define ST_TX_SENDING 1
#define ST_TX_WAKEUP 2
Expand Down

0 comments on commit 5beab8a

Please sign in to comment.