Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1494752 > unrolled thread
| Started by | Pavel Machek <pavel@ucw.cz> |
|---|---|
| First post | 2016-10-03 11:00 +0200 |
| Last post | 2016-10-06 00:00 +0200 |
| Articles | 16 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Pavel Machek <pavel@ucw.cz> - 2016-10-03 11:00 +0200
Re: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Marcel Holtmann <marcel@holtmann.org> - 2016-10-05 13:20 +0200
Re: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Joe Perches <joe@perches.com> - 2016-10-05 20:00 +0200
Re: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Pavel Machek <pavel@ucw.cz> - 2016-10-05 21:20 +0200
Re: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Joe Perches <joe@perches.com> - 2016-10-05 21:20 +0200
Re: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Pavel Machek <pavel@ucw.cz> - 2016-10-06 00:20 +0200
Re: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Joe Perches <joe@perches.com> - 2016-10-06 00:30 +0200
Re: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Pavel Machek <pavel@ucw.cz> - 2016-10-06 09:10 +0200
Re: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Joe Perches <joe@perches.com> - 2016-10-06 09:10 +0200
Re: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Johan Hedberg <johan.hedberg@gmail.com> - 2016-10-06 10:40 +0200
RE: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel David Laight <David.Laight@ACULAB.COM> - 2016-10-06 11:50 +0200
Re: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Joe Perches <joe@perches.com> - 2016-10-06 13:40 +0200
RE: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel David Laight <David.Laight@ACULAB.COM> - 2016-10-06 15:10 +0200
Re: [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Joe Perches <joe@perches.com> - 2016-10-06 17:50 +0200
[PATCHv2] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Pavel Machek <pavel@ucw.cz> - 2016-10-05 23:00 +0200
Re: [PATCHv2] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel Marcel Holtmann <marcel@holtmann.org> - 2016-10-06 00:00 +0200
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-10-03 11:00 +0200 |
| Subject | [PATCH] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel |
| Message-ID | <so7gm-2Bj-5@gated-at.bofh.it> |
[Multipart message — attachments visible in raw view] — view raw
bluetooth.h is not part of user API, so __ variants are not neccessary
here.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index bfd1590..aea0371 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -60,8 +60,8 @@
#define BT_SECURITY 4
struct bt_security {
- __u8 level;
- __u8 key_size;
+ u8 level;
+ u8 key_size;
};
#define BT_SECURITY_SDP 0
#define BT_SECURITY_LOW 1
@@ -78,7 +78,7 @@ struct bt_security {
#define BT_POWER 9
struct bt_power {
- __u8 force_active;
+ u8 force_active;
};
#define BT_POWER_FORCE_ACTIVE_OFF 0
#define BT_POWER_FORCE_ACTIVE_ON 1
@@ -112,7 +112,7 @@ struct bt_power {
#define BT_VOICE 11
struct bt_voice {
- __u16 setting;
+ u16 setting;
};
#define BT_VOICE_TRANSPARENT 0x0003
@@ -188,7 +188,7 @@ static inline const char *state_to_string(int state)
/* BD Address */
typedef struct {
- __u8 b[6];
+ u8 b[6];
} __packed bdaddr_t;
/* BD Address type */
@@ -196,7 +196,7 @@ typedef struct {
#define BDADDR_LE_PUBLIC 0x01
#define BDADDR_LE_RANDOM 0x02
-static inline bool bdaddr_type_is_valid(__u8 type)
+static inline bool bdaddr_type_is_valid(u8 type)
{
switch (type) {
case BDADDR_BREDR:
@@ -208,7 +208,7 @@ static inline bool bdaddr_type_is_valid(__u8 type)
return false;
}
-static inline bool bdaddr_type_is_le(__u8 type)
+static inline bool bdaddr_type_is_le(u8 type)
{
switch (type) {
case BDADDR_LE_PUBLIC:
@@ -278,15 +278,16 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
/* Skb helpers */
struct l2cap_ctrl {
- __u8 sframe:1,
+ u8 sframe:1,
poll:1,
final:1,
fcs:1,
sar:2,
super:2;
- __u16 reqseq;
- __u16 txseq;
- __u8 retries;
+
+ u16 reqseq;
+ u16 txseq;
+ u8 retries;
__le16 psm;
bdaddr_t bdaddr;
struct l2cap_chan *chan;
@@ -302,7 +303,7 @@ typedef void (*hci_req_complete_skb_t)(struct hci_dev *hdev, u8 status,
#define HCI_REQ_SKB BIT(1)
struct hci_ctrl {
- __u16 opcode;
+ u16 opcode;
u8 req_flags;
u8 req_event;
union {
@@ -312,10 +313,10 @@ struct hci_ctrl {
};
struct bt_skb_cb {
- __u8 pkt_type;
- __u8 force_active;
- __u16 expect;
- __u8 incoming:1;
+ u8 pkt_type;
+ u8 force_active;
+ u16 expect;
+ u8 incoming:1;
union {
struct l2cap_ctrl l2cap;
struct hci_ctrl hci;
@@ -365,7 +366,7 @@ out:
return NULL;
}
-int bt_to_errno(__u16 code);
+int bt_to_errno(u16 code);
void hci_sock_set_flag(struct sock *sk, int nr);
void hci_sock_clear_flag(struct sock *sk, int nr);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[toc] | [next] | [standalone]
| From | Marcel Holtmann <marcel@holtmann.org> |
|---|---|
| Date | 2016-10-05 13:20 +0200 |
| Message-ID | <soSoV-ft-7@gated-at.bofh.it> |
| In reply to | #1494752 |
Hi Pavel,
> bluetooth.h is not part of user API, so __ variants are not neccessary
> here.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
> index bfd1590..aea0371 100644
> --- a/include/net/bluetooth/bluetooth.h
> +++ b/include/net/bluetooth/bluetooth.h
> @@ -60,8 +60,8 @@
>
> #define BT_SECURITY 4
> struct bt_security {
> - __u8 level;
> - __u8 key_size;
> + u8 level;
> + u8 key_size;
> };
> #define BT_SECURITY_SDP 0
> #define BT_SECURITY_LOW 1
> @@ -78,7 +78,7 @@ struct bt_security {
>
> #define BT_POWER 9
> struct bt_power {
> - __u8 force_active;
> + u8 force_active;
> };
> #define BT_POWER_FORCE_ACTIVE_OFF 0
> #define BT_POWER_FORCE_ACTIVE_ON 1
> @@ -112,7 +112,7 @@ struct bt_power {
>
> #define BT_VOICE 11
> struct bt_voice {
> - __u16 setting;
> + u16 setting;
> };
>
> #define BT_VOICE_TRANSPARENT 0x0003
> @@ -188,7 +188,7 @@ static inline const char *state_to_string(int state)
>
> /* BD Address */
> typedef struct {
> - __u8 b[6];
> + u8 b[6];
> } __packed bdaddr_t;
>
can you leave these out please. They are meant to become UAPI eventually.
> /* BD Address type */
> @@ -196,7 +196,7 @@ typedef struct {
> #define BDADDR_LE_PUBLIC 0x01
> #define BDADDR_LE_RANDOM 0x02
>
> -static inline bool bdaddr_type_is_valid(__u8 type)
> +static inline bool bdaddr_type_is_valid(u8 type)
> {
> switch (type) {
> case BDADDR_BREDR:
> @@ -208,7 +208,7 @@ static inline bool bdaddr_type_is_valid(__u8 type)
> return false;
> }
>
> -static inline bool bdaddr_type_is_le(__u8 type)
> +static inline bool bdaddr_type_is_le(u8 type)
> {
> switch (type) {
> case BDADDR_LE_PUBLIC:
> @@ -278,15 +278,16 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
>
> /* Skb helpers */
> struct l2cap_ctrl {
> - __u8 sframe:1,
> + u8 sframe:1,
> poll:1,
> final:1,
> fcs:1,
> sar:2,
> super:2;
> - __u16 reqseq;
> - __u16 txseq;
> - __u8 retries;
> +
> + u16 reqseq;
> + u16 txseq;
> + u8 retries;
> __le16 psm;
> bdaddr_t bdaddr;
> struct l2cap_chan *chan;
> @@ -302,7 +303,7 @@ typedef void (*hci_req_complete_skb_t)(struct hci_dev *hdev, u8 status,
> #define HCI_REQ_SKB BIT(1)
>
> struct hci_ctrl {
> - __u16 opcode;
> + u16 opcode;
> u8 req_flags;
> u8 req_event;
> union {
> @@ -312,10 +313,10 @@ struct hci_ctrl {
> };
>
> struct bt_skb_cb {
> - __u8 pkt_type;
> - __u8 force_active;
> - __u16 expect;
> - __u8 incoming:1;
> + u8 pkt_type;
> + u8 force_active;
> + u16 expect;
> + u8 incoming:1;
> union {
> struct l2cap_ctrl l2cap;
> struct hci_ctrl hci;
> @@ -365,7 +366,7 @@ out:
> return NULL;
> }
>
> -int bt_to_errno(__u16 code);
> +int bt_to_errno(u16 code);
The rest looks good to me.
Regards
Marcel
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-10-05 20:00 +0200 |
| Message-ID | <soYE1-4tz-1@gated-at.bofh.it> |
| In reply to | #1495811 |
On Wed, 2016-10-05 at 13:14 +0200, Marcel Holtmann wrote:
> Hi Pavel,
>
> > bluetooth.h is not part of user API, so __ variants are not neccessary
> > here.
> >
> > Signed-off-by: Pavel Machek <pavel@ucw.cz>
> >
> > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
[]
> > struct bt_skb_cb {
> > - __u8 pkt_type;
> > - __u8 force_active;
> > - __u16 expect;
> > - __u8 incoming:1;
> > + u8 pkt_type;
> > + u8 force_active;
> > + u16 expect;
> > + u8 incoming:1;
> > union {
> > struct l2cap_ctrl l2cap;
> > struct hci_ctrl hci;
trivia:
It's generally faster to use bool instead of u8 foo:1;
[toc] | [prev] | [next] | [standalone]
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-10-05 21:20 +0200 |
| Message-ID | <soZTs-5Rt-29@gated-at.bofh.it> |
| In reply to | #1495986 |
[Multipart message — attachments visible in raw view] — view raw
On Wed 2016-10-05 10:53:16, Joe Perches wrote:
> On Wed, 2016-10-05 at 13:14 +0200, Marcel Holtmann wrote:
> > Hi Pavel,
> >
> > > bluetooth.h is not part of user API, so __ variants are not neccessary
> > > here.
> > >
> > > Signed-off-by: Pavel Machek <pavel@ucw.cz>
> > >
> > > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
> []
> > > struct bt_skb_cb {
> > > - __u8 pkt_type;
> > > - __u8 force_active;
> > > - __u16 expect;
> > > - __u8 incoming:1;
> > > + u8 pkt_type;
> > > + u8 force_active;
> > > + u16 expect;
> > > + u8 incoming:1;
> > > union {
> > > struct l2cap_ctrl l2cap;
> > > struct hci_ctrl hci;
>
> trivia:
>
> It's generally faster to use bool instead of u8 foo:1;
Ok, but I'm not changing that in this patch.
(And actually, bool will take a lot more memory, right?)
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-10-05 21:20 +0200 |
| Message-ID | <soZTs-5Rt-31@gated-at.bofh.it> |
| In reply to | #1496008 |
On Wed, 2016-10-05 at 21:11 +0200, Pavel Machek wrote:
> On Wed 2016-10-05 10:53:16, Joe Perches wrote:
> > On Wed, 2016-10-05 at 13:14 +0200, Marcel Holtmann wrote:
> > > Hi Pavel,
> > >
> > > > bluetooth.h is not part of user API, so __ variants are not neccessary
> > > > here.
> > > >
> > > > Signed-off-by: Pavel Machek <pavel@ucw.cz>
> > > >
> > > > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
> >
> > []
> > > > struct bt_skb_cb {
> > > > - __u8 pkt_type;
> > > > - __u8 force_active;
> > > > - __u16 expect;
> > > > - __u8 incoming:1;
> > > > + u8 pkt_type;
> > > > + u8 force_active;
> > > > + u16 expect;
> > > > + u8 incoming:1;
> > > > union {
> > > > struct l2cap_ctrl l2cap;
> > > > struct hci_ctrl hci;
> >
> >
> > trivia:
> >
> > It's generally faster to use bool instead of u8 foo:1;
>
> Ok, but I'm not changing that in this patch.
> (And actually, bool will take a lot more memory, right?)
No worries, and bool is the same size as u8.
>
[toc] | [prev] | [next] | [standalone]
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-10-06 00:20 +0200 |
| Message-ID | <sp2HD-89L-19@gated-at.bofh.it> |
| In reply to | #1496009 |
[Multipart message — attachments visible in raw view] — view raw
On Wed 2016-10-05 12:15:34, Joe Perches wrote:
> On Wed, 2016-10-05 at 21:11 +0200, Pavel Machek wrote:
> > On Wed 2016-10-05 10:53:16, Joe Perches wrote:
> > > On Wed, 2016-10-05 at 13:14 +0200, Marcel Holtmann wrote:
> > > > Hi Pavel,
> > > >
> > > > > bluetooth.h is not part of user API, so __ variants are not neccessary
> > > > > here.
> > > > >
> > > > > Signed-off-by: Pavel Machek <pavel@ucw.cz>
> > > > >
> > > > > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
> > >
> > > []
> > > > > struct bt_skb_cb {
> > > > > - __u8 pkt_type;
> > > > > - __u8 force_active;
> > > > > - __u16 expect;
> > > > > - __u8 incoming:1;
> > > > > + u8 pkt_type;
> > > > > + u8 force_active;
> > > > > + u16 expect;
> > > > > + u8 incoming:1;
> > > > > union {
> > > > > struct l2cap_ctrl l2cap;
> > > > > struct hci_ctrl hci;
> > >
> > >
> > > trivia:
> > >
> > > It's generally faster to use bool instead of u8 foo:1;
> >
> > Ok, but I'm not changing that in this patch.
> > (And actually, bool will take a lot more memory, right?)
>
> No worries, and bool is the same size as u8.
Exactly what I'm talking about :-). One byte vs. one bit, right?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-10-06 00:30 +0200 |
| Message-ID | <sp2Rj-8d2-1@gated-at.bofh.it> |
| In reply to | #1496096 |
On Thu, 2016-10-06 at 00:13 +0200, Pavel Machek wrote: > On Wed 2016-10-05 12:15:34, Joe Perches wrote: > > On Wed, 2016-10-05 at 21:11 +0200, Pavel Machek wrote: > > > On Wed 2016-10-05 10:53:16, Joe Perches wrote: [] > > > > trivia: > > > > It's generally faster to use bool instead of u8 foo:1; > > > Ok, but I'm not changing that in this patch. > > > (And actually, bool will take a lot more memory, right?) > > No worries, and bool is the same size as u8. > Exactly what I'm talking about :-). One byte vs. one bit, right? Memory isn't bit addressable. So it's the same byte, it just doesn't use a read/modify/write operation to update a value.
[toc] | [prev] | [next] | [standalone]
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-10-06 09:10 +0200 |
| Message-ID | <spaYx-5fl-13@gated-at.bofh.it> |
| In reply to | #1496097 |
[Multipart message — attachments visible in raw view] — view raw
On Wed 2016-10-05 15:28:51, Joe Perches wrote: > On Thu, 2016-10-06 at 00:13 +0200, Pavel Machek wrote: > > On Wed 2016-10-05 12:15:34, Joe Perches wrote: > > > On Wed, 2016-10-05 at 21:11 +0200, Pavel Machek wrote: > > > > On Wed 2016-10-05 10:53:16, Joe Perches wrote: > [] > > > > > trivia: > > > > > It's generally faster to use bool instead of u8 foo:1; > > > > Ok, but I'm not changing that in this patch. > > > > (And actually, bool will take a lot more memory, right?) > > > No worries, and bool is the same size as u8. > > Exactly what I'm talking about :-). One byte vs. one bit, right? > > Memory isn't bit addressable. > So it's the same byte, it just doesn't use a read/modify/write > operation to update a value. I believe you are wrong. bit addressability does not matter, cpu can definitely get the bit values. u8 foo:1; u8 bar:1; u8 baz:1; should take 1 byte, where bool foo, bar, baz; will take more like 3. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-10-06 09:10 +0200 |
| Message-ID | <spaYx-5fl-11@gated-at.bofh.it> |
| In reply to | #1496189 |
On Thu, 2016-10-06 at 09:02 +0200, Pavel Machek wrote: > I believe you are wrong. bit addressability does not matter, cpu can > definitely get the bit values. > > u8 foo:1; > u8 bar:1; > u8 baz:1; > > should take 1 byte, where > > bool foo, bar, baz; > > will take more like 3. Definitely true. There is only one single bitfield foo here though so what you wrote doesn't apply.
[toc] | [prev] | [next] | [standalone]
| From | Johan Hedberg <johan.hedberg@gmail.com> |
|---|---|
| Date | 2016-10-06 10:40 +0200 |
| Message-ID | <spcnF-64l-65@gated-at.bofh.it> |
| In reply to | #1496190 |
Hi, On Thu, Oct 06, 2016, Joe Perches wrote: > On Thu, 2016-10-06 at 09:02 +0200, Pavel Machek wrote: > > I believe you are wrong. bit addressability does not matter, cpu can > > definitely get the bit values. > > > > u8 foo:1; > > u8 bar:1; > > u8 baz:1; > > > > should take 1 byte, where > > > > bool foo, bar, baz; > > > > will take more like 3. > > Definitely true. > > There is only one single bitfield foo here though > so what you wrote doesn't apply. What's in the tree is a left-over from times when there were multiple bit fields in this struct. By the time others were removed and there was only one left no-one has apparently bothered to update it to a bool or single u8. Johan
[toc] | [prev] | [next] | [standalone]
| From | David Laight <David.Laight@ACULAB.COM> |
|---|---|
| Date | 2016-10-06 11:50 +0200 |
| Message-ID | <spdto-6Li-43@gated-at.bofh.it> |
| In reply to | #1496009 |
From: Of Joe Perches ... > No worries, and bool is the same size as u8. That is not guaranteed at all. One of the ARM ABI defined bool to be the size of int. David
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-10-06 13:40 +0200 |
| Message-ID | <spfbQ-7Yg-23@gated-at.bofh.it> |
| In reply to | #1496536 |
On Thu, 2016-10-06 at 09:41 +0000, David Laight wrote: > From: Joe Perches > > No worries, and bool is the same ,size as u8. > That is not guaranteed at all. > One of the ARM ABI defined bool to be the size of int. Really? What kernel has sizeof(_Bool) != 1 ?
[toc] | [prev] | [next] | [standalone]
| From | David Laight <David.Laight@ACULAB.COM> |
|---|---|
| Date | 2016-10-06 15:10 +0200 |
| Message-ID | <spgAW-wz-3@gated-at.bofh.it> |
| In reply to | #1496608 |
From: Joe Perches > Sent: 06 October 2016 12:39 > On Thu, 2016-10-06 at 09:41 +0000, David Laight wrote: > > From: Joe Perches > > > No worries, and bool is the same ,size as u8. > > That is not guaranteed at all. > > One of the ARM ABI defined bool to be the size of int. > > Really? What kernel has sizeof(_Bool) != 1 ? Probably none, but I know systems have used larger bool. I found this: > with egcs-2.90.29 980515 (egcs-1.0.3 release) on alphaev56-dec-osf4.0d > bool = 8 > short = 2 > int = 4 > long = 8 I'm pretty sure something newer than an old alpha ABI used 4 byte bool. David
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-10-06 17:50 +0200 |
| Message-ID | <spj5L-2ak-1@gated-at.bofh.it> |
| In reply to | #1496639 |
On Thu, 2016-10-06 at 13:00 +0000, David Laight wrote: > From: Joe Perches > > Sent: 06 October 2016 12:39 > > On Thu, 2016-10-06 at 09:41 +0000, David Laight wrote: > > > From: Joe Perches > > > > No worries, and bool is the same ,size as u8. > > > That is not guaranteed at all. > > > One of the ARM ABI defined bool to be the size of int. > > Really? What kernel has sizeof(_Bool) != 1 ? > Probably none, but I know systems have used larger bool. > I found this: > > with egcs-2.90.29 980515 (egcs-1.0.3 release) on alphaev56-dec-osf4.0d > > bool = 8 > > short = 2 > > int = 4 > > long = 8 It's likely there are probably DSPs and old TOPS-20/CDC-6400 systems where sizeof(u16) isn't 2 as well. I think linux isn't likely to be ported successfully to those platforms. No matter. If bool isn't desired because some future expansion to this is likely and memory needs to be conserved, fine, use a bitfield. It can be slower than bool because it can be RMW. cheers, Joe
[toc] | [prev] | [next] | [standalone]
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-10-05 23:00 +0200 |
| Subject | [PATCHv2] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel |
| Message-ID | <sp1sd-71w-21@gated-at.bofh.it> |
| In reply to | #1494752 |
[Multipart message — attachments visible in raw view] — view raw
bluetooth.h is not part of user API, so __ variants are not neccessary
here.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
---
v2: not touching stuff that Marcel does not want touched, as it will
become API later.
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index bfd1590..aea0371 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -196,7 +196,7 @@ typedef struct {
#define BDADDR_LE_PUBLIC 0x01
#define BDADDR_LE_RANDOM 0x02
-static inline bool bdaddr_type_is_valid(__u8 type)
+static inline bool bdaddr_type_is_valid(u8 type)
{
switch (type) {
case BDADDR_BREDR:
@@ -208,7 +208,7 @@ static inline bool bdaddr_type_is_valid(__u8 type)
return false;
}
-static inline bool bdaddr_type_is_le(__u8 type)
+static inline bool bdaddr_type_is_le(u8 type)
{
switch (type) {
case BDADDR_LE_PUBLIC:
@@ -278,15 +278,16 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
/* Skb helpers */
struct l2cap_ctrl {
- __u8 sframe:1,
+ u8 sframe:1,
poll:1,
final:1,
fcs:1,
sar:2,
super:2;
- __u16 reqseq;
- __u16 txseq;
- __u8 retries;
+
+ u16 reqseq;
+ u16 txseq;
+ u8 retries;
__le16 psm;
bdaddr_t bdaddr;
struct l2cap_chan *chan;
@@ -302,7 +303,7 @@ typedef void (*hci_req_complete_skb_t)(struct hci_dev *hdev, u8 status,
#define HCI_REQ_SKB BIT(1)
struct hci_ctrl {
- __u16 opcode;
+ u16 opcode;
u8 req_flags;
u8 req_event;
union {
@@ -312,10 +313,10 @@ struct hci_ctrl {
};
struct bt_skb_cb {
- __u8 pkt_type;
- __u8 force_active;
- __u16 expect;
- __u8 incoming:1;
+ u8 pkt_type;
+ u8 force_active;
+ u16 expect;
+ u8 incoming:1;
union {
struct l2cap_ctrl l2cap;
struct hci_ctrl hci;
@@ -365,7 +366,7 @@ out:
return NULL;
}
-int bt_to_errno(__u16 code);
+int bt_to_errno(u16 code);
void hci_sock_set_flag(struct sock *sk, int nr);
void hci_sock_clear_flag(struct sock *sk, int nr);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[toc] | [prev] | [next] | [standalone]
| From | Marcel Holtmann <marcel@holtmann.org> |
|---|---|
| Date | 2016-10-06 00:00 +0200 |
| Subject | Re: [PATCHv2] bluetooth.h: __ variants of u8 and friends are not neccessary inside kernel |
| Message-ID | <sp2om-7M2-3@gated-at.bofh.it> |
| In reply to | #1496049 |
Hi Pavel, > bluetooth.h is not part of user API, so __ variants are not neccessary > here. > > Signed-off-by: Pavel Machek <pavel@ucw.cz> > > --- > v2: not touching stuff that Marcel does not want touched, as it will > become API later. patch has been applied to bluetooth-next tree. Regards Marcel
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web