linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Ulisses Furquim <ulisses@profusion.mobi>
Cc: linux-bluetooth@vger.kernel.org, padovan@profusion.mobi
Subject: Re: [PATCH 2/2] Bluetooth: Make HCI call directly into SCO and L2CAP event functions
Date: Tue, 20 Dec 2011 18:10:42 -0800	[thread overview]
Message-ID: <1324433442.1965.148.camel@aeonflux> (raw)
In-Reply-To: <1324430302-3002-2-git-send-email-ulisses@profusion.mobi>

Hi Ulisses,

> The struct hci_proto and all related register/unregister and dispatching
> code was removed. HCI core code now call directly the SCO and L2CAP
> event functions.

<snip>

>  static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
>  								__u8 type)
>  {
> -	register struct hci_proto *hp;
>  	int mask = 0;
>  
> -	hp = hci_proto[HCI_PROTO_L2CAP];
> -	if (hp && hp->connect_ind)
> -		mask |= hp->connect_ind(hdev, bdaddr, type);
> -
> -	hp = hci_proto[HCI_PROTO_SCO];
> -	if (hp && hp->connect_ind)
> -		mask |= hp->connect_ind(hdev, bdaddr, type);
> +	mask |= l2cap_connect_ind(hdev, bdaddr, type);
> +	mask |= sco_connect_ind(hdev, bdaddr, type);

I am fine if you wanna do this in two steps for a more clean process of
getting where need to go, but we are not leaving it like this.

We do already know where the packet is going. So we can just check the
type up front. Remove the type check in the L2CAP/SCO and remove the
type parameter altogether.

No point in calling a function if we already know it just returns EINVAL
anyway.

>  	return mask;
>  }
>  
>  static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
>  {
> -	register struct hci_proto *hp;
> -
> -	hp = hci_proto[HCI_PROTO_L2CAP];
> -	if (hp && hp->connect_cfm)
> -		hp->connect_cfm(conn, status);
> -
> -	hp = hci_proto[HCI_PROTO_SCO];
> -	if (hp && hp->connect_cfm)
> -		hp->connect_cfm(conn, status);
> +	l2cap_connect_cfm(conn, status);
> +	sco_connect_cfm(conn, status);

Same here since conn->type will give you the link type. And so on for
all the others.

Regards

Marcel



  reply	other threads:[~2011-12-21  2:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21  1:18 [PATCH 1/2] Bluetooth: Always compile SCO and L2CAP in Bluetooth Core Ulisses Furquim
2011-12-21  1:18 ` [PATCH 2/2] Bluetooth: Make HCI call directly into SCO and L2CAP event functions Ulisses Furquim
2011-12-21  2:10   ` Marcel Holtmann [this message]
2011-12-21  1:56 ` [PATCH 1/2] Bluetooth: Always compile SCO and L2CAP in Bluetooth Core Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1324433442.1965.148.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=padovan@profusion.mobi \
    --cc=ulisses@profusion.mobi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).