Re: [PATCH 2/2] Bluetooth: Make HCI call directly into SCO and L2CAP event functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux