linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtlwifi: convert to __packed notation
@ 2010-12-16 14:34 John W. Linville
  2010-12-16 15:05 ` Larry Finger
  0 siblings, 1 reply; 5+ messages in thread
From: John W. Linville @ 2010-12-16 14:34 UTC (permalink / raw)
  To: linux-wireless; +Cc: Larry Finger, John W. Linville

Use "__packed" instead of "__attribute__ ((packed))"...

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 drivers/net/wireless/rtlwifi/pci.h                 |    6 +++---
 .../net/wireless/rtlwifi/rtl8192ce/rtl8192c-trx.h  |    6 +++---
 drivers/net/wireless/rtlwifi/wifi.h                |    8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/pci.h b/drivers/net/wireless/rtlwifi/pci.h
index cdde858..d36a669 100644
--- a/drivers/net/wireless/rtlwifi/pci.h
+++ b/drivers/net/wireless/rtlwifi/pci.h
@@ -131,15 +131,15 @@ enum pci_bridge_vendor {
 
 struct rtl_rx_desc {
 	u32 dword[8];
-} __attribute__ ((packed));
+} __packed;
 
 struct rtl_tx_desc {
 	u32 dword[16];
-} __attribute__ ((packed));
+} __packed;
 
 struct rtl_tx_cmd_desc {
 	u32 dword[16];
-} __attribute__ ((packed));
+} __packed;
 
 struct rtl8192_tx_ring {
 	struct rtl_tx_desc *desc;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192c-trx.h b/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192c-trx.h
index 91e13c3..53d0e0a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192c-trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192c-trx.h
@@ -535,7 +535,7 @@ struct rx_fwinfo_92c {
 	u8 sgi_en:1;
 	u8 rxsc:2;
 	u8 reserve:4;
-} __attribute__ ((packed));
+} __packed;
 
 struct tx_desc_92c {
 	u32 pktsize:16;
@@ -637,7 +637,7 @@ struct tx_desc_92c {
 	u32 nextdescaddress64;
 
 	u32 reserve_pass_pcie_mm_limit[4];
-} __attribute__ ((packed));
+} __packed;
 
 struct rx_desc_92c {
 	u32 length:14;
@@ -695,7 +695,7 @@ struct rx_desc_92c {
 	u32 bufferaddress;
 	u32 bufferaddress64;
 
-} __attribute__ ((packed));
+} __packed;
 
 void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
 			  struct ieee80211_hdr *hdr,
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 0dd6824..3844dc9 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -551,13 +551,13 @@ struct rtl_hdr_3addr {
 	u8 addr3[ETH_ALEN];
 	__le16 seq_ctl;
 	u8 payload[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct rtl_info_element {
 	u8 id;
 	u8 len;
 	u8 data[0];
-} __attribute__ ((packed));
+} __packed;
 
 struct rtl_probe_rsp {
 	struct rtl_hdr_3addr header;
@@ -567,7 +567,7 @@ struct rtl_probe_rsp {
 	/*SSID, supported rates, FH params, DS params,
 	   CF params, IBSS params, TIM (if beacon), RSN */
 	struct rtl_info_element info_element[0];
-} __attribute__ ((packed));
+} __packed;
 
 /*LED related.*/
 /*ledpin Identify how to implement this SW led.*/
@@ -589,7 +589,7 @@ struct rtl_qos_parameters {
 	u8 aifs;
 	u8 flag;
 	__le16 tx_op;
-} __attribute__ ((packed));
+} __packed;
 
 struct rt_smooth_data {
 	u32 elements[100];	/*array to store values */
-- 
1.7.3.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] rtlwifi: convert to __packed notation
  2010-12-16 14:34 [PATCH] rtlwifi: convert to __packed notation John W. Linville
@ 2010-12-16 15:05 ` Larry Finger
  2010-12-16 15:21   ` John W. Linville
  0 siblings, 1 reply; 5+ messages in thread
From: Larry Finger @ 2010-12-16 15:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

On 12/16/2010 08:34 AM, John W. Linville wrote:
> Use "__packed" instead of "__attribute__ ((packed))"...
> 
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> ---
>  drivers/net/wireless/rtlwifi/pci.h                 |    6 +++---
>  .../net/wireless/rtlwifi/rtl8192ce/rtl8192c-trx.h  |    6 +++---
>  drivers/net/wireless/rtlwifi/wifi.h                |    8 ++++----
>  3 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/wireless/rtlwifi/pci.h b/drivers/net/wireless/rtlwifi/pci.h
> index cdde858..d36a669 100644
> --- a/drivers/net/wireless/rtlwifi/pci.h
> +++ b/drivers/net/wireless/rtlwifi/pci.h
> @@ -131,15 +131,15 @@ enum pci_bridge_vendor {
>  
>  struct rtl_rx_desc {
>  	u32 dword[8];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct rtl_tx_desc {
>  	u32 dword[16];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct rtl_tx_cmd_desc {
>  	u32 dword[16];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct rtl8192_tx_ring {
>  	struct rtl_tx_desc *desc;
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192c-trx.h b/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192c-trx.h
> index 91e13c3..53d0e0a 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192c-trx.h
> +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192c-trx.h
> @@ -535,7 +535,7 @@ struct rx_fwinfo_92c {
>  	u8 sgi_en:1;
>  	u8 rxsc:2;
>  	u8 reserve:4;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct tx_desc_92c {
>  	u32 pktsize:16;
> @@ -637,7 +637,7 @@ struct tx_desc_92c {
>  	u32 nextdescaddress64;
>  
>  	u32 reserve_pass_pcie_mm_limit[4];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct rx_desc_92c {
>  	u32 length:14;
> @@ -695,7 +695,7 @@ struct rx_desc_92c {
>  	u32 bufferaddress;
>  	u32 bufferaddress64;
>  
> -} __attribute__ ((packed));
> +} __packed;
>  
>  void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
>  			  struct ieee80211_hdr *hdr,
> diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
> index 0dd6824..3844dc9 100644
> --- a/drivers/net/wireless/rtlwifi/wifi.h
> +++ b/drivers/net/wireless/rtlwifi/wifi.h
> @@ -551,13 +551,13 @@ struct rtl_hdr_3addr {
>  	u8 addr3[ETH_ALEN];
>  	__le16 seq_ctl;
>  	u8 payload[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct rtl_info_element {
>  	u8 id;
>  	u8 len;
>  	u8 data[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct rtl_probe_rsp {
>  	struct rtl_hdr_3addr header;
> @@ -567,7 +567,7 @@ struct rtl_probe_rsp {
>  	/*SSID, supported rates, FH params, DS params,
>  	   CF params, IBSS params, TIM (if beacon), RSN */
>  	struct rtl_info_element info_element[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /*LED related.*/
>  /*ledpin Identify how to implement this SW led.*/
> @@ -589,7 +589,7 @@ struct rtl_qos_parameters {
>  	u8 aifs;
>  	u8 flag;
>  	__le16 tx_op;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct rt_smooth_data {
>  	u32 elements[100];	/*array to store values */

ACK.

As a point of interest, is this the "new" recommended way? The reason I ask is
that the Linux headers are mostly in the attribute form.

Larry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] rtlwifi: convert to __packed notation
  2010-12-16 15:05 ` Larry Finger
@ 2010-12-16 15:21   ` John W. Linville
  2010-12-16 16:03     ` Larry Finger
  2010-12-16 17:25     ` [PATCH] checkpatch.pl: Add "prefer __packed" check Joe Perches
  0 siblings, 2 replies; 5+ messages in thread
From: John W. Linville @ 2010-12-16 15:21 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless

On Thu, Dec 16, 2010 at 09:05:12AM -0600, Larry Finger wrote:
> On 12/16/2010 08:34 AM, John W. Linville wrote:
> > Use "__packed" instead of "__attribute__ ((packed))"...
> > 
> > Signed-off-by: John W. Linville <linville@tuxdriver.com>
 
> ACK.
> 
> As a point of interest, is this the "new" recommended way? The reason I ask is
> that the Linux headers are mostly in the attribute form.

AIUI, "__packed" is the one true way.  I think this facilitates
compling the kernel with compilers other than GCC.

At any rate, Dave Miller threatened to injure me if I kept sending him stuff using 
"__attribute__ ((packed))"... :-)

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] rtlwifi: convert to __packed notation
  2010-12-16 15:21   ` John W. Linville
@ 2010-12-16 16:03     ` Larry Finger
  2010-12-16 17:25     ` [PATCH] checkpatch.pl: Add "prefer __packed" check Joe Perches
  1 sibling, 0 replies; 5+ messages in thread
From: Larry Finger @ 2010-12-16 16:03 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

On 12/16/2010 09:21 AM, John W. Linville wrote:
> On Thu, Dec 16, 2010 at 09:05:12AM -0600, Larry Finger wrote:
>> On 12/16/2010 08:34 AM, John W. Linville wrote:
>>> Use "__packed" instead of "__attribute__ ((packed))"...
>>>
>>> Signed-off-by: John W. Linville<linville@tuxdriver.com>
>
>> ACK.
>>
>> As a point of interest, is this the "new" recommended way? The reason I ask is
>> that the Linux headers are mostly in the attribute form.
>
> AIUI, "__packed" is the one true way.  I think this facilitates
> compling the kernel with compilers other than GCC.
>
> At any rate, Dave Miller threatened to injure me if I kept sending him stuff using
> "__attribute__ ((packed))"... :-)

We certainly would not want that. Maintainers are too hard to find.

One point I missed earlier. As you are affecting both rtlwifi and rtl8192ce, 
both should be in the patch title.

Larry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] checkpatch.pl: Add "prefer __packed" check
  2010-12-16 15:21   ` John W. Linville
  2010-12-16 16:03     ` Larry Finger
@ 2010-12-16 17:25     ` Joe Perches
  1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2010-12-16 17:25 UTC (permalink / raw)
  To: John W. Linville, Andy Whitcroft, Andrew Morton
  Cc: Larry Finger, linux-wireless, LKML

There's a __packed #define for this __attribute__((packed)).
Might as well get checkpatch to tell people about it.

Signed-off-by: Joe Perches <joe@perches.com>

---

On Thu, 2010-12-16 at 10:21 -0500, John W. Linville wrote:
> On Thu, Dec 16, 2010 at 09:05:12AM -0600, Larry Finger wrote:
> > On 12/16/2010 08:34 AM, John W. Linville wrote:
> > > Use "__packed" instead of "__attribute__ ((packed))"...
> > As a point of interest, is this the "new" recommended way? The reason I ask is
> > that the Linux headers are mostly in the attribute form.
> AIUI, "__packed" is the one true way.  I think this facilitates
> compiling the kernel with compilers other than GCC.
> 
> At any rate, Dave Miller threatened to injure me if I kept sending him stuff using 
> "__attribute__ ((packed))"... :-)

 scripts/checkpatch.pl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3c7fc0..6fc24af 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2743,6 +2743,11 @@ sub process {
 			WARN("plain inline is preferred over $1\n" . $herecurr);
 		}
 
+# Check for __attribute__ packed, prefer __packed
+		if ($line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) {
+			WARN("__packed is preferred over __attribute__((packed))\n" . $herecurr);
+		}
+
 # check for sizeof(&)
 		if ($line =~ /\bsizeof\s*\(\s*\&/) {
 			WARN("sizeof(& should be avoided\n" . $herecurr);




^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-12-16 17:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-16 14:34 [PATCH] rtlwifi: convert to __packed notation John W. Linville
2010-12-16 15:05 ` Larry Finger
2010-12-16 15:21   ` John W. Linville
2010-12-16 16:03     ` Larry Finger
2010-12-16 17:25     ` [PATCH] checkpatch.pl: Add "prefer __packed" check Joe Perches

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).