Skip to contentSkip to conversation

staging: rtl8192u: ieee80211: Remove typedef to the tx_pending_t structure

PATCH Superseded sayli karnik 2 participants 4 messages Feb 17, 2017 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192u: ieee80211: Remove typedef to the tx_pending_t structure

Using typedef for a structure type is not suggested in Linux kernel coding style guidelines. So remove typedef from structure tx_pending_t.

---
Grepped to ensure no other usage of the typedef variable.
The driver does not use the typdef variable anywhere, it declares using a structure variable when required.

 drivers/staging/rtl8192u/ieee80211/ieee80211.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211.h +2 -2
index 0d24705..7de3a78 100644
@@ -1456,10 +1456,10 @@ enum ieee80211_state {
 
 
 
-typedef struct tx_pending_t{
+struct tx_pending_t {
 	int frag;
 	struct ieee80211_txb *txb;
-}tx_pending_t;
+};
 
 typedef struct _bandwidth_autoswitch {
 	long threshold_20Mhzto40Mhz;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 16 lines · sayli karnik

Using typedef for a structure type is not suggested in Linux kernel coding style guidelines. So remove typedef from structure tx_pending_t.

---
Grepped to ensure no other usage of the typedef variable.
The driver does not use the typdef variable anywhere, it declares using a structure variable when required.

 drivers/staging/rtl8192u/ieee80211/ieee80211.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -0
index 0d24705..7de3a78 100644

drivers/staging/rtl8192u/ieee80211/ieee80211.h enum ieee80211_state { · line 1462

Quoted 9 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +2 -2
@@ -1456,10 +1456,10 @@ enum ieee80211_state {
 
 
 
-typedef struct tx_pending_t{
+struct tx_pending_t {
 	int frag;
 	struct ieee80211_txb *txb;
-}tx_pending_t;
+};

Was anyone using the typedef? Normally, a typedef is used elsewhere and when you remove the typedef, you need to update the users as well.

Also, it is normally only typedefs that have names that end in _t. So it would be better to change the type name to struct tx_pending.

drivers/staging/rtl8192u/ieee80211/ieee80211.h enum ieee80211_state { · line 1465

Quoted 2 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -0
 typedef struct _bandwidth_autoswitch {
 	long threshold_20Mhzto40Mhz;

You can work on this one also.

julia

Quoted 10 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -1
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170217080309.GA13492%40sayli-HP-15-Notebook-PC.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 23 lines · Julia Lawall
Quoted 19 lines · sayli karnik

Using typedef for a structure type is not suggested in Linux kernel coding style guidelines. So remove typedef from structure tx_pending_t.

---
Grepped to ensure no other usage of the typedef variable.
The driver does not use the typdef variable anywhere, it declares using a structure variable when required.

 drivers/staging/rtl8192u/ieee80211/ieee80211.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -0
index 0d24705..7de3a78 100644
@@ -1456,10 +1456,10 @@ enum ieee80211_state {
 
 
 
Quoted 10 lines

drivers/staging/rtl8192u/ieee80211/ieee80211.h enum ieee80211_state { · line 1462

Quoted 6 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +2 -2
-typedef struct tx_pending_t{
+struct tx_pending_t {
      int frag;
      struct ieee80211_txb *txb;
-}tx_pending_t;
+};

Was anyone using the typedef? Normally, a typedef is used elsewhere and when you remove the typedef, you need to update the users as well.

Yes, but I found this case to be a little different. There is one instance where they use-
struct tx_pending_t tx_pending;
(without using the typedef declared earlier)
I used grep to find out that the typedef was not used anywhere else.

Quoted 3 lines

Also, it is normally only typedefs that have names that end in _t. So it would be better to change the type name to struct tx_pending.

Ah, thought so. I'll send the next version.

Quoted 5 lines

drivers/staging/rtl8192u/ieee80211/ieee80211.h enum ieee80211_state { · line 1465

Quoted 2 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -0
 typedef struct _bandwidth_autoswitch {
      long threshold_20Mhzto40Mhz;

You can work on this one also.

Yes, I will.

Quoted 12 lines

julia

Quoted 10 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -1
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170217080309.GA13492%40sayli-HP-15-Notebook-PC.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
Quoted 5 lines · sayli karnik
Quoted 4 lines · Julia Lawall

On Fri, 17 Feb 2017, sayli karnik wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Using typedef for a structure type is not suggested in Linux kernel coding style guidelines. So remove typedef from structure tx_pending_t.

---
Grepped to ensure no other usage of the typedef variable.
The driver does not use the typdef variable anywhere, it declares using a structure variable when required.

Maybe I missed seeing this in the patch. But it should be above the --- because it could be of interest to people looking at the patch in the future. On the other hand, the terminology could be improved. Use "variable" for things that are associated with memory locations. Here you could refer to a type name.

The message could be more concise as. The typedef name is not used anywhere. All variables of this type are declared using "struct tx_pending_t".

Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
 drivers/staging/rtl8192u/ieee80211/ieee80211.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -0
index 0d24705..7de3a78 100644
@@ -1456,10 +1456,10 @@ enum ieee80211_state {
 
 
 
Quoted 10 lines

drivers/staging/rtl8192u/ieee80211/ieee80211.h enum ieee80211_state { · line 1462

Quoted 6 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +2 -2
-typedef struct tx_pending_t{
+struct tx_pending_t {
      int frag;
      struct ieee80211_txb *txb;
-}tx_pending_t;
+};

Was anyone using the typedef? Normally, a typedef is used elsewhere and when you remove the typedef, you need to update the users as well.

Quoted 3 lines

Yes, but I found this case to be a little different. There is one instance where they use-
struct tx_pending_t tx_pending;

This is a variable declaration. That is, you get an actual structure called tx_pending. Fortunately the names of types and names of variables are distinct, so struct tx_pending tx_pending; is also ok.

julia

Quoted 35 lines

(without using the typedef declared earlier)
I used grep to find out that the typedef was not used anywhere else.

Quoted 3 lines

Also, it is normally only typedefs that have names that end in _t. So it would be better to change the type name to struct tx_pending.

Ah, thought so. I'll send the next version.

Quoted 5 lines

drivers/staging/rtl8192u/ieee80211/ieee80211.h enum ieee80211_state { · line 1465

Quoted 2 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -0
 typedef struct _bandwidth_autoswitch {
      long threshold_20Mhzto40Mhz;

You can work on this one also.

Yes, I will.

Quoted 12 lines

julia

Quoted 10 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -1
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170217080309.GA13492%40sayli-HP-15-Notebook-PC.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAKG5xWiMvkoOFL-JRGh%3DQS-akQU2iVqxmV2E1gdKX2a6LEEChg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.