staging: rtl8192u: unused code cleanup
cover staging: rtl8192u: unused code cleanup
Remove code that is unnecessary or unused.
Deepak R Varma (2):
staging: rtl8192u: remove unnecessary function implementation
staging: rtl8192u: remove unused macro definition
drivers/staging/rtl8192u/ieee80211/ieee80211.h | 5 ----- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 6 ------ drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 3 --- 3 files changed, 14 deletions(-)
--
2.30.2
PATCH 1/2 staging: rtl8192u: remove unnecessary function implementation
Current implementation of function ieee80211_tkip_null simply returns back to the caller without any useful instruction executions. This makes the function call and its implementation unnecessary and should be removed.
--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 3 --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 6 ------ drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 3 --- 3 files changed, 12 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -3
@@ -232,8 +232,6 @@ struct cb_desc {#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define ieee80211_tkip_null ieee80211_tkip_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rsl
@@ -2256,7 +2254,6 @@ void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);void softmac_mgmt_xmit (struct sk_buff *skb,struct ieee80211_device *ieee);/* ieee80211_crypt_ccmp&tkip&wep.c */ -void ieee80211_tkip_null (void );int ieee80211_crypto_init (void );void ieee80211_crypto_deinit (void );
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +0 -6
@@ -716,9 +716,3 @@ void ieee80211_crypto_tkip_exit(void) {ieee80211_unregister_crypto_ops (&ieee80211_crypt_tkip); } - -void ieee80211_tkip_null (void ) -{ -// printk("============>%s()\n", __func__); -return ; -}
drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +0 -3
@@ -159,9 +159,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->last_packet_time[i] =0 ; } -/* These function were added to load crypte module autoly */ -ieee80211_tkip_null (); -return dev; failed:
--
2.30.2
Greg Kroah-Hartman
maintainerRe: [PATCH 1/2] staging: rtl8192u: remove unnecessary function implementation
Quoted 52 lines · Deepak R Varma
Current implementation of function
ieee80211_tkip_nullsimply returns back to the caller without any useful instruction executions. This makes the function call and its implementation unnecessary and should be removed.Signed-off-by Deepak R Varma <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 3 --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 6 ------ drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 3 --- 3 files changed, 12 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-3@@ -232,8 +232,6 @@ struct cb_desc {#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define ieee80211_tkip_null ieee80211_tkip_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rsl@@ -2256,7 +2254,6 @@ void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);void softmac_mgmt_xmit (struct sk_buff *skb,struct ieee80211_device *ieee);/* ieee80211_crypt_ccmp&tkip&wep.c */ -void ieee80211_tkip_null (void );int ieee80211_crypto_init (void );void ieee80211_crypto_deinit (void );drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +0
-6@@ -716,9 +716,3 @@ void ieee80211_crypto_tkip_exit(void) {ieee80211_unregister_crypto_ops (&ieee80211_crypt_tkip); } - -void ieee80211_tkip_null (void ) -{ -// printk("============>%s()\n", __func__); -return ; -}drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +0
-0
drivers/staging/rtl8192u/ieee80211/ieee80211_module.c struct net_device *alloc_ieee80211(int sizeof_priv) · line 164
Quoted 6 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +0
-3@@ -159,9 +159,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->last_packet_time[i] =0 ; } -/* These function were added to load crypte module autoly */ -ieee80211_tkip_null (); -
Ah, but this was created on purpose, did you now break the module autoloading here? Is this built as a separate module or is it all one big module?
You need to explain why this does not change functionality in your changelog text.
thanks,
greg k-h
Re: [PATCH 1/2] staging: rtl8192u: remove unnecessary function implementation
Quoted 56 lines · Greg Kroah-Hartman
Quoted 55 lines · Deepak R Varma
Current implementation of function
ieee80211_tkip_nullsimply returns back to the caller without any useful instruction executions. This makes the function call and its implementation unnecessary and should be removed.Signed-off-by Deepak R Varma <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 3 --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 6 ------ drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 3 --- 3 files changed, 12 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-3@@ -232,8 +232,6 @@ struct cb_desc {#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define ieee80211_tkip_null ieee80211_tkip_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rsl@@ -2256,7 +2254,6 @@ void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);void softmac_mgmt_xmit (struct sk_buff *skb,struct ieee80211_device *ieee);/* ieee80211_crypt_ccmp&tkip&wep.c */ -void ieee80211_tkip_null (void );int ieee80211_crypto_init (void );void ieee80211_crypto_deinit (void );drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +0
-6@@ -716,9 +716,3 @@ void ieee80211_crypto_tkip_exit(void) {ieee80211_unregister_crypto_ops (&ieee80211_crypt_tkip); } - -void ieee80211_tkip_null (void ) -{ -// printk("============>%s()\n", __func__); -return ; -}drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +0
-0@@ -159,9 +159,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee->last_packet_time[i] =0 ; }
Quoted 7 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_module.c struct net_device *alloc_ieee80211(int sizeof_priv) · line 164
Quoted 3 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +0
-3-/* These function were added to load crypte module autoly */ -ieee80211_tkip_null (); -Ah, but this was created on purpose, did you now break the module autoloading here? Is this built as a separate module or is it all one big module?
Looks like a one big module on the kernel I built post this change. I looked into the modules.dep file for dependencies. I was able to load the driver r8192u_usb using modprobe without any issues.
Let me know if I should be looking at something else to validate your concern.
Quoted 3 lines
You need to explain why this does not change functionality in your changelog text.
Okay. I will work on it and send in a revision.
Quoted 5 lines
thanks,
greg k-h
PATCH 2/2 staging: rtl8192u: remove unused macro definition
In reply to Deepak R VarmaPre-processor macros that are defined but are never used should be cleaned up to avoid unexpected usage.
--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0 -2
@@ -230,8 +230,6 @@ struct cb_desc {#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl -#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rsl
--
2.30.2
Greg Kroah-Hartman
maintainerRe: [PATCH 2/2] staging: rtl8192u: remove unused macro definition
Quoted 13 lines · Deepak R Varma
Pre-processor macros that are defined but are never used should be cleaned up to avoid unexpected usage.
Signed-off-by Deepak R Varma <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- 1 file changed, 2 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-0
drivers/staging/rtl8192u/ieee80211/ieee80211.h struct cb_desc { · line 234
Quoted 7 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-2@@ -230,8 +230,6 @@ struct cb_desc {#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl -#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rsl
These #defines are a mess, please look into unwinding them as they should not be needed at all.
thanks,
greg k-h
Re: [PATCH 2/2] staging: rtl8192u: remove unused macro definition
Quoted 17 lines · Greg Kroah-Hartman
Quoted 16 lines · Deepak R Varma
Pre-processor macros that are defined but are never used should be cleaned up to avoid unexpected usage.
Signed-off-by Deepak R Varma <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- 1 file changed, 2 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-0@@ -230,8 +230,6 @@ struct cb_desc {#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl
Quoted 7 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h struct cb_desc { · line 234
Quoted 4 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-2-#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rslThese #defines are a mess, please look into unwinding them as they should not be needed at all.
Hello Greg,
I would like to know what you mean by "unwind them". Is there a documentation or past commit that I can review to understand the expectations better?
Thank you,
./drv
Quoted 5 lines
thanks,
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 2/2] staging: rtl8192u: remove unused macro definition
Quoted 26 lines · Deepak R Varma
Quoted 17 lines · Greg Kroah-Hartman
Quoted 16 lines · Deepak R Varma
Pre-processor macros that are defined but are never used should be cleaned up to avoid unexpected usage.
Signed-off-by Deepak R Varma <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- 1 file changed, 2 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-0@@ -230,8 +230,6 @@ struct cb_desc {#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rslQuoted 7 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h struct cb_desc { · line 234
Quoted 4 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-2-#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rslThese #defines are a mess, please look into unwinding them as they should not be needed at all.
Quoted 3 lines
Hello Greg,
I would like to know what you mean by "unwind them". Is there a documentation or past commit that I can review to understand the expectations better?
Look at them and try to figure out why they are there, and then work to remove them entirely. A define like this is very odd in the kernel, it should not be needed at all, right?
thanks,
greg k-h
Re: [PATCH 2/2] staging: rtl8192u: remove unused macro definition
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Deepak R Varma
Quoted 24 lines · Greg Kroah-Hartman
Quoted 13 lines · Deepak R Varma
Pre-processor macros that are defined but are never used should be cleaned up to avoid unexpected usage.
Signed-off-by Deepak R Varma <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- 1 file changed, 2 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-0drivers/staging/rtl8192u/ieee80211/ieee80211.h struct cb_desc { · line 234
Quoted 7 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-2@@ -230,8 +230,6 @@ struct cb_desc {#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl -#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rslThese #defines are a mess, please look into unwinding them as they should not be needed at all.
Quoted 7 lines
Quoted 3 lines
Hello Greg,
I would like to know what you mean by "unwind them". Is there a documentation or past commit that I can review to understand the expectations better?Look at them and try to figure out why they are there, and then work to remove them entirely. A define like this is very odd in the kernel, it should not be needed at all, right?
Hello Greg,
I will look into these additional macros soon and send any further edits as a separate patch (set). Is the current patch set with 2 patches acceptable?
Also, I am trying to get Coccinelle to work on my machine. Trying to work through strange issues. I will work on the macro unwinding task you suggested once a get the Coccinelle task completed.
Thank you,
./drv
Quoted 5 lines
thanks,
greg k-h
Re: [PATCH 2/2] staging: rtl8192u: remove unused macro definition
Quoted 36 lines · Deepak Varma
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Deepak R Varma
Quoted 24 lines · Greg Kroah-Hartman
Quoted 13 lines · Deepak R Varma
Pre-processor macros that are defined but are never used should be cleaned up to avoid unexpected usage.
Signed-off-by Deepak R Varma <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- 1 file changed, 2 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-0drivers/staging/rtl8192u/ieee80211/ieee80211.h struct cb_desc { · line 234
Quoted 7 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-2@@ -230,8 +230,6 @@ struct cb_desc {#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl -#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rslThese #defines are a mess, please look into unwinding them as they should not be needed at all.
Quoted 7 lines
Quoted 3 lines
Hello Greg,
I would like to know what you mean by "unwind them". Is there a documentation or past commit that I can review to understand the expectations better?Look at them and try to figure out why they are there, and then work to remove them entirely. A define like this is very odd in the kernel, it should not be needed at all, right?
Quoted 7 lines
Hello Greg,
I will look into these additional macros soon and send any further edits as a separate patch (set). Is the current patch set with 2 patches acceptable?Also, I am trying to get Coccinelle to work on my machine. Trying to work through strange issues. I will work on the macro unwinding task you suggested once a get the Coccinelle task completed.
Hello Greg,
Most of these macro defines appear to be unused in the module anywhere. I can simply delete the #defines for these and let the original function names be retained.
The other way is to rename the functions by the defined value. So, we will have to make the code change to use the foo_rsl symbol names at all places. This will be a bigger change involving the API name change itself.
I am unable to determine the initial intention as to why these #defines were added. Can you please suggest what would be the recommended way for the clean up of these unused macros?
Thank you,
./drv
Quoted 12 lines
Thank you,
./drvQuoted 5 lines
thanks,
greg k-h
Re: [PATCH 2/2] staging: rtl8192u: remove unused macro definition
Quoted 45 lines · Deepak R Varma
Quoted 36 lines · Deepak Varma
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Deepak R Varma
Quoted 24 lines · Greg Kroah-Hartman
Quoted 13 lines · Deepak R Varma
Pre-processor macros that are defined but are never used should be cleaned up to avoid unexpected usage.
Signed-off-by Deepak R Varma <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- 1 file changed, 2 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-0drivers/staging/rtl8192u/ieee80211/ieee80211.h struct cb_desc { · line 234
Quoted 7 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-2@@ -230,8 +230,6 @@ struct cb_desc {#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl -#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rslThese #defines are a mess, please look into unwinding them as they should not be needed at all.
Quoted 7 lines
Quoted 3 lines
Hello Greg,
I would like to know what you mean by "unwind them". Is there a documentation or past commit that I can review to understand the expectations better?Look at them and try to figure out why they are there, and then work to remove them entirely. A define like this is very odd in the kernel, it should not be needed at all, right?
Quoted 7 lines
Hello Greg,
I will look into these additional macros soon and send any further edits as a separate patch (set). Is the current patch set with 2 patches acceptable?Also, I am trying to get Coccinelle to work on my machine. Trying to work through strange issues. I will work on the macro unwinding task you suggested once a get the Coccinelle task completed.
Quoted 7 lines
Hello Greg,
Most of these macro defines appear to be unused in the module anywhere. I can simply delete the #defines for these and let the original function names be retained.
The other way is to rename the functions by the defined value. So, we will have to make the code change to use thefoo_rslsymbol names at all places. This will be a bigger change involving the API name change itself.
I'm not sure to understand. In the case of
#define abc def
If abc is never used, it would seem that you could just remove the macro definition.
If abc is used, one might consider whether the renaming is worth it, or whether the abc's should be changed to def. Or maybe def is a very simple function, that just calls some standard kernel function like kfree, in which can you could get rid of both abc and def everywhere and just use kfree.
It is often better to use standard functions, because it makes it easier for people to understand immediately what is going on.
julia
Quoted 24 lines
I am unable to determine the initial intention as to why these #defines were added. Can you please suggest what would be the recommended way for the clean up of these unused macros?
Thank you,
./drvQuoted 12 lines
Thank you,
./drvQuoted 5 lines
thanks,
greg k-h
Re: [PATCH 2/2] staging: rtl8192u: remove unused macro definition
Quoted 57 lines · Julia Lawall
Quoted 45 lines · Deepak R Varma
Quoted 36 lines · Deepak Varma
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Deepak R Varma
Quoted 24 lines · Greg Kroah-Hartman
Quoted 13 lines · Deepak R Varma
Pre-processor macros that are defined but are never used should be cleaned up to avoid unexpected usage.
Signed-off-by Deepak R Varma <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- 1 file changed, 2 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-0drivers/staging/rtl8192u/ieee80211/ieee80211.h struct cb_desc { · line 234
Quoted 7 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-2@@ -230,8 +230,6 @@ struct cb_desc {#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl -#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rslThese #defines are a mess, please look into unwinding them as they should not be needed at all.
Quoted 7 lines
Quoted 3 lines
Hello Greg,
I would like to know what you mean by "unwind them". Is there a documentation or past commit that I can review to understand the expectations better?Look at them and try to figure out why they are there, and then work to remove them entirely. A define like this is very odd in the kernel, it should not be needed at all, right?
Quoted 7 lines
Hello Greg,
I will look into these additional macros soon and send any further edits as a separate patch (set). Is the current patch set with 2 patches acceptable?Also, I am trying to get Coccinelle to work on my machine. Trying to work through strange issues. I will work on the macro unwinding task you suggested once a get the Coccinelle task completed.
Quoted 7 lines
Hello Greg,
Most of these macro defines appear to be unused in the module anywhere. I can simply delete the #defines for these and let the original function names be retained.
The other way is to rename the functions by the defined value. So, we will have to make the code change to use thefoo_rslsymbol names at all places. This will be a bigger change involving the API name change itself.
Quoted 1 line
I'm not sure to understand. In the case of
My apologies for not being clear in my message.
Quoted 5 lines
#define abc def
If abc is never used, it would seem that you could just remove the macro definition.
The module uses abc at all places in the code. It gets simply replaced by abc_rsl symbol name at compile time. I am unable to determine the utility of this compile time conversion. So, to clean it up, we can continue to use abc in the code (by simply removing the #define line) or make code changes to use abc_rsl (makes the #define line redundant and be deleted).
Hope this helps.
My question: should we use abc or def in the code? The only hint I have form the code comment is this line:
// added for kernel conflict
Quoted 9 lines
If abc is used, one might consider whether the renaming is worth it, or whether the abc's should be changed to def. Or maybe def is a very simple function, that just calls some standard kernel function like kfree, in which can you could get rid of both abc and def everywhere and just use kfree.
It is often better to use standard functions, because it makes it easier for people to understand immediately what is going on.
Thank you so much for the explanation. Since the initial intention is not clear to me, I am unable to decide the go forward name for these functions.
May I request to look at one of the macro implementations and make suggestion?
Quoted 28 lines
julia
Quoted 24 lines
I am unable to determine the initial intention as to why these #defines were added. Can you please suggest what would be the recommended way for the clean up of these unused macros?
Thank you,
./drvQuoted 12 lines
Thank you,
./drvQuoted 5 lines
thanks,
greg k-h
Re: [PATCH 2/2] staging: rtl8192u: remove unused macro definition
Quoted 85 lines · Deepak R Varma
Quoted 57 lines · Julia Lawall
Quoted 45 lines · Deepak R Varma
Quoted 36 lines · Deepak Varma
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Deepak R Varma
Quoted 24 lines · Greg Kroah-Hartman
Quoted 13 lines · Deepak R Varma
Pre-processor macros that are defined but are never used should be cleaned up to avoid unexpected usage.
Signed-off-by Deepak R Varma <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- 1 file changed, 2 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-0drivers/staging/rtl8192u/ieee80211/ieee80211.h struct cb_desc { · line 234
Quoted 7 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-2@@ -230,8 +230,6 @@ struct cb_desc {#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl -#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rslThese #defines are a mess, please look into unwinding them as they should not be needed at all.
Quoted 7 lines
Quoted 3 lines
Hello Greg,
I would like to know what you mean by "unwind them". Is there a documentation or past commit that I can review to understand the expectations better?Look at them and try to figure out why they are there, and then work to remove them entirely. A define like this is very odd in the kernel, it should not be needed at all, right?
Quoted 7 lines
Hello Greg,
I will look into these additional macros soon and send any further edits as a separate patch (set). Is the current patch set with 2 patches acceptable?Also, I am trying to get Coccinelle to work on my machine. Trying to work through strange issues. I will work on the macro unwinding task you suggested once a get the Coccinelle task completed.
Quoted 7 lines
Hello Greg,
Most of these macro defines appear to be unused in the module anywhere. I can simply delete the #defines for these and let the original function names be retained.
The other way is to rename the functions by the defined value. So, we will have to make the code change to use thefoo_rslsymbol names at all places. This will be a bigger change involving the API name change itself.Quoted 1 line
I'm not sure to understand. In the case of
My apologies for not being clear in my message.
Quoted 5 lines
#define abc def
If abc is never used, it would seem that you could just remove the macro definition.
The module uses abc at all places in the code. It gets simply replaced by
abc_rslsymbol name at compile time. I am unable to determine the utility of this compile time conversion. So, to clean it up, we can continue to use abc in the code (by simply removing the #define line) or make code changes to useabc_rsl(makes the #define line redundant and be deleted).Hope this helps.
My question: should we use abc or def in the code? The only hint I have form the code comment is this line:// added for kernel conflictQuoted 7 lines
If abc is used, one might consider whether the renaming is worth it, or whether the abc's should be changed to def. Or maybe def is a very simple function, that just calls some standard kernel function like kfree, in which can you could get rid of both abc and def everywhere and just use kfree.
Quoted 7 lines
Quoted 2 lines
It is often better to use standard functions, because it makes it easier for people to understand immediately what is going on.
Thank you so much for the explanation. Since the initial intention is not clear to me, I am unable to decide the go forward name for these functions.
May I request to look at one of the macro implementations and make suggestion?
Ah, ok I see, these macros replace both the names at the uses of eg free_ieee80211, but also the name at the point of the definition.
But the name free_ieee80211 isn't used elsewhere in the kernel source tree, so it would seem that changing the name is useless.
Maybe the purpose was to link this code with some other code that also uses the name free_ieee80211, but that other code doesn't seem to be part of the kernel.
At least, you could propose a patch that removes these definitions and explains clearly what the impact is, and see if the maintainers of the driver complain.
julia
Quoted 32 lines
Quoted 29 lines
julia
Quoted 24 lines
I am unable to determine the initial intention as to why these #defines were added. Can you please suggest what would be the recommended way for the clean up of these unused macros?
Thank you,
./drvQuoted 12 lines
Thank you,
./drvQuoted 5 lines
thanks,
greg k-h
Re: [PATCH 2/2] staging: rtl8192u: remove unused macro definition
Quoted 103 lines · Julia Lawall
Quoted 85 lines · Deepak R Varma
Quoted 57 lines · Julia Lawall
Quoted 45 lines · Deepak R Varma
Quoted 36 lines · Deepak Varma
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Deepak R Varma
Quoted 24 lines · Greg Kroah-Hartman
Quoted 13 lines · Deepak R Varma
Pre-processor macros that are defined but are never used should be cleaned up to avoid unexpected usage.
Signed-off-by Deepak R Varma <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- 1 file changed, 2 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-0drivers/staging/rtl8192u/ieee80211/ieee80211.h struct cb_desc { · line 234
Quoted 7 lines
drivers/staging/rtl8192u/ieee80211/ieee80211.h +0
-2@@ -230,8 +230,6 @@ struct cb_desc {#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl -#define ieee80211_ccmp_null ieee80211_ccmp_null_rsl -#define free_ieee80211 free_ieee80211_rsl#define alloc_ieee80211 alloc_ieee80211_rslThese #defines are a mess, please look into unwinding them as they should not be needed at all.
Quoted 7 lines
Quoted 3 lines
Hello Greg,
I would like to know what you mean by "unwind them". Is there a documentation or past commit that I can review to understand the expectations better?Look at them and try to figure out why they are there, and then work to remove them entirely. A define like this is very odd in the kernel, it should not be needed at all, right?
Quoted 7 lines
Hello Greg,
I will look into these additional macros soon and send any further edits as a separate patch (set). Is the current patch set with 2 patches acceptable?Also, I am trying to get Coccinelle to work on my machine. Trying to work through strange issues. I will work on the macro unwinding task you suggested once a get the Coccinelle task completed.
Quoted 7 lines
Hello Greg,
Most of these macro defines appear to be unused in the module anywhere. I can simply delete the #defines for these and let the original function names be retained.
The other way is to rename the functions by the defined value. So, we will have to make the code change to use thefoo_rslsymbol names at all places. This will be a bigger change involving the API name change itself.Quoted 1 line
I'm not sure to understand. In the case of
My apologies for not being clear in my message.
Quoted 5 lines
#define abc def
If abc is never used, it would seem that you could just remove the macro definition.
The module uses abc at all places in the code. It gets simply replaced by
abc_rslsymbol name at compile time. I am unable to determine the utility of this compile time conversion. So, to clean it up, we can continue to use abc in the code (by simply removing the #define line) or make code changes to useabc_rsl(makes the #define line redundant and be deleted).Hope this helps.
My question: should we use abc or def in the code? The only hint I have form the code comment is this line:// added for kernel conflictQuoted 7 lines
If abc is used, one might consider whether the renaming is worth it, or whether the abc's should be changed to def. Or maybe def is a very simple function, that just calls some standard kernel function like kfree, in which can you could get rid of both abc and def everywhere and just use kfree.
Quoted 7 lines
Quoted 2 lines
It is often better to use standard functions, because it makes it easier for people to understand immediately what is going on.
Thank you so much for the explanation. Since the initial intention is not clear to me, I am unable to decide the go forward name for these functions.
May I request to look at one of the macro implementations and make suggestion?
Ah, ok I see, these macros replace both the names at the uses of eg
free_ieee80211, but also the name at the point of the definition.But the name
free_ieee80211isn't used elsewhere in the kernel source tree, so it would seem that changing the name is useless.
Quoted 7 lines
Maybe the purpose was to link this code with some other code that also uses the name
free_ieee80211, but that other code doesn't seem to be part of the kernel.At least, you could propose a patch that removes these definitions and explains clearly what the impact is, and see if the maintainers of the driver complain.
Thank you so much. I will send in the proposed patch shortly.
./drv
Quoted 36 lines
julia
Quoted 32 lines
Quoted 29 lines
julia
Quoted 24 lines
I am unable to determine the initial intention as to why these #defines were added. Can you please suggest what would be the recommended way for the clean up of these unused macros?
Thank you,
./drvQuoted 12 lines
Thank you,
./drvQuoted 5 lines
thanks,
greg k-h