Skip to contentSkip to conversation

Remove wrapper functions and clean up the code

PATCH Superseded Shivani Bhardwaj 2 participants 7 messages Oct 28, 2015 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Remove wrapper functions and clean up the code

This patchset removes the wrapper functions which are not required and replaces their calls with appropriate functions. Also, some definitions are swapped between files in accordance with the functions that needed them.

After applying this patch, code becomes cleaner.

Shivani Bhardwaj (2):
Staging: wilc1000: linux_wlan_sdio: Drop unnecessary wrapper functions
Staging: wilc1000: linux_wlan: Replace function calls

 drivers/staging/wilc1000/linux_wlan.c      | 15 +++++++++--
 drivers/staging/wilc1000/linux_wlan_sdio.c | 42 +++---------------------------
 2 files changed, 17 insertions(+), 40 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/2 Staging: wilc1000: linux_wlan_sdio: Drop unnecessary wrapper functions

Remove the functions linux_sdio_get_speed(), linux_sdio_set_max_speed() and linux_sdio_set_default_speed(). Replace their calls with appropriate functions. Also, definitions associated with these functions should be removed.

---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 42 +++---------------------------
 1 file changed, 4 insertions(+), 38 deletions(-)
drivers/staging/wilc1000/linux_wlan_sdio.c +4 -38
index 1f8d874..d58baf2 100644
@@ -1,26 +1,12 @@
 #include "wilc_wfi_netdevice.h"
-
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/card.h>
 #include <linux/mmc/sdio_ids.h>
 #include <linux/mmc/sdio.h>
 #include <linux/mmc/host.h>
 
-
-
 #define SDIO_MODALIAS "wilc1000_sdio"
 
-#if defined(CUSTOMER_PLATFORM)
-/* TODO : User have to stable bus clock as user's environment. */
- #ifdef MAX_BUS_SPEED
- #define MAX_SPEED MAX_BUS_SPEED
- #else
- #define MAX_SPEED 50000000
- #endif
-#else
- #define MAX_SPEED (6 * 1000000) /* Max 50M */
-#endif
-
 struct wilc_sdio {
 	struct sdio_func *func;
 	struct wilc *wilc;
@@ -104,7 +90,6 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
 
 	sdio_release_host(func);
 
-
 	if (ret < 0) {
 		PRINT_ER("wilc_sdio_cmd53..failed, err(%d)\n", ret);
 		return 0;
@@ -206,11 +191,6 @@ static int linux_sdio_set_speed(int speed)
 	return 1;
 }
 
-static int linux_sdio_get_speed(void)
-{
-	return local_sdio_func->card->host->ios.clock;
-}
-
 int linux_sdio_init(void *pv)
 {
 
@@ -219,30 +199,16 @@ int linux_sdio_init(void *pv)
 	 **/
 
 
-	sdio_default_speed = linux_sdio_get_speed();
+	sdio_default_speed = local_sdio_func->card->host->ios.clock;
 	return 1;
 }
 
 void linux_sdio_deinit(void *pv)
 {
-
-	/**
-	 *      TODO :
-	 **/
-
+       /**
+        *      TODO :
+        **/
 
 	sdio_unregister_driver(&wilc_bus);
 }
 
-int linux_sdio_set_max_speed(void)
-{
-	return linux_sdio_set_speed(MAX_SPEED);
-}
-
-int linux_sdio_set_default_speed(void)
-{
-	return linux_sdio_set_speed(sdio_default_speed);
-}
-
-
-
Signature · 1 line
2.1.0
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: wilc1000: linux_wlan_sdio: Drop unnecessary wrapper functions

Quoted 14 lines · Shivani Bhardwaj

Remove the functions linux_sdio_get_speed(), linux_sdio_set_max_speed() and linux_sdio_set_default_speed(). Replace their calls with appropriate functions. Also, definitions associated with these functions should be removed.

---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 42 +++---------------------------
 1 file changed, 4 insertions(+), 38 deletions(-)
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -0
index 1f8d874..d58baf2 100644

drivers/staging/wilc1000/linux_wlan_sdio.c line 10

Quoted 10 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -3
@@ -1,26 +1,12 @@
 #include "wilc_wfi_netdevice.h"
-
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/card.h>
 #include <linux/mmc/sdio_ids.h>
 #include <linux/mmc/sdio.h>
 #include <linux/mmc/host.h>
 
-
-

Not clear why these blank lines are removed. They are not needed, but they are not part of what is described in the commit message either.

Quoted 17 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -11
 #define SDIO_MODALIAS "wilc1000_sdio"
 
-#if defined(CUSTOMER_PLATFORM)
-/* TODO : User have to stable bus clock as user's environment. */
- #ifdef MAX_BUS_SPEED
- #define MAX_SPEED MAX_BUS_SPEED
- #else
- #define MAX_SPEED 50000000
- #endif
-#else
- #define MAX_SPEED (6 * 1000000) /* Max 50M */
-#endif
-
 struct wilc_sdio {
 	struct sdio_func *func;
 	struct wilc *wilc;

drivers/staging/wilc1000/linux_wlan_sdio.c int linux_sdio_cmd53(sdio_cmd53_t *cmd) · line 107

Quoted 4 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -1
@@ -104,7 +90,6 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
 
 	sdio_release_host(func);
 
-

Sane for this one.

julia

Quoted 60 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +4 -24
 	if (ret < 0) {
 		PRINT_ER("wilc_sdio_cmd53..failed, err(%d)\n", ret);
 		return 0;
@@ -206,11 +191,6 @@ static int linux_sdio_set_speed(int speed)
 	return 1;
 }
 
-static int linux_sdio_get_speed(void)
-{
-	return local_sdio_func->card->host->ios.clock;
-}
-
 int linux_sdio_init(void *pv)
 {
 
@@ -219,30 +199,16 @@ int linux_sdio_init(void *pv)
 	 **/
 
 
-	sdio_default_speed = linux_sdio_get_speed();
+	sdio_default_speed = local_sdio_func->card->host->ios.clock;
 	return 1;
 }
 
 void linux_sdio_deinit(void *pv)
 {
-
-	/**
-	 *      TODO :
-	 **/
-
+       /**
+        *      TODO :
+        **/
 
 	sdio_unregister_driver(&wilc_bus);
 }
 
-int linux_sdio_set_max_speed(void)
-{
-	return linux_sdio_set_speed(MAX_SPEED);
-}
-
-int linux_sdio_set_default_speed(void)
-{
-	return linux_sdio_set_speed(sdio_default_speed);
-}
-
-
-
--

2.1.0

--
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/16ce4db27490fbed8cbe035c6bf7bc6993b19c80.1446029550.git.shivanib134%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: wilc1000: linux_wlan_sdio: Drop unnecessary wrapper functions

Quoted 48 lines · Julia Lawall
Quoted 14 lines · Shivani Bhardwaj

Remove the functions linux_sdio_get_speed(), linux_sdio_set_max_speed() and linux_sdio_set_default_speed(). Replace their calls with appropriate functions. Also, definitions associated with these functions should be removed.

---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 42 +++---------------------------
 1 file changed, 4 insertions(+), 38 deletions(-)
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -0
index 1f8d874..d58baf2 100644

drivers/staging/wilc1000/linux_wlan_sdio.c line 10

Quoted 10 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -3
@@ -1,26 +1,12 @@
 #include "wilc_wfi_netdevice.h"
-
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/card.h>
 #include <linux/mmc/sdio_ids.h>
 #include <linux/mmc/sdio.h>
 #include <linux/mmc/host.h>
 
-
-

Not clear why these blank lines are removed. They are not needed, but they are not part of what is described in the commit message either.

Quoted 18 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -11
 #define SDIO_MODALIAS "wilc1000_sdio"
 
-#if defined(CUSTOMER_PLATFORM)
-/* TODO : User have to stable bus clock as user's environment. */
- #ifdef MAX_BUS_SPEED
- #define MAX_SPEED MAX_BUS_SPEED
- #else
- #define MAX_SPEED 50000000
- #endif
-#else
- #define MAX_SPEED (6 * 1000000) /* Max 50M */
-#endif
-
 struct wilc_sdio {
      struct sdio_func *func;
      struct wilc *wilc;
@@ -104,7 +90,6 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
 
Quoted 8 lines

drivers/staging/wilc1000/linux_wlan_sdio.c int linux_sdio_cmd53(sdio_cmd53_t *cmd) · line 107

Quoted 3 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -1
      sdio_release_host(func);
 
-

Sane for this one.

julia

Should I just update the commit message or do it as a different patch in the series?
Thank you

Quoted 60 lines
Quoted 60 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +4 -24
      if (ret < 0) {
              PRINT_ER("wilc_sdio_cmd53..failed, err(%d)\n", ret);
              return 0;
@@ -206,11 +191,6 @@ static int linux_sdio_set_speed(int speed)
      return 1;
 }
 
-static int linux_sdio_get_speed(void)
-{
-     return local_sdio_func->card->host->ios.clock;
-}
-
 int linux_sdio_init(void *pv)
 {
 
@@ -219,30 +199,16 @@ int linux_sdio_init(void *pv)
       **/
 
 
-     sdio_default_speed = linux_sdio_get_speed();
+     sdio_default_speed = local_sdio_func->card->host->ios.clock;
      return 1;
 }
 
 void linux_sdio_deinit(void *pv)
 {
-
-     /**
-      *      TODO :
-      **/
-
+       /**
+        *      TODO :
+        **/
 
      sdio_unregister_driver(&wilc_bus);
 }
 
-int linux_sdio_set_max_speed(void)
-{
-     return linux_sdio_set_speed(MAX_SPEED);
-}
-
-int linux_sdio_set_default_speed(void)
-{
-     return linux_sdio_set_speed(sdio_default_speed);
-}
-
-
-
--

2.1.0

--
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/16ce4db27490fbed8cbe035c6bf7bc6993b19c80.1446029550.git.shivanib134%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#4 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: wilc1000: linux_wlan_sdio: Drop unnecessary wrapper functions

Quoted 55 lines · Shivani Bhardwaj
Quoted 54 lines · Julia Lawall
Quoted 14 lines · Shivani Bhardwaj

Remove the functions linux_sdio_get_speed(), linux_sdio_set_max_speed() and linux_sdio_set_default_speed(). Replace their calls with appropriate functions. Also, definitions associated with these functions should be removed.

---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 42 +++---------------------------
 1 file changed, 4 insertions(+), 38 deletions(-)
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -0
index 1f8d874..d58baf2 100644

drivers/staging/wilc1000/linux_wlan_sdio.c line 10

Quoted 10 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -3
@@ -1,26 +1,12 @@
 #include "wilc_wfi_netdevice.h"
-
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/card.h>
 #include <linux/mmc/sdio_ids.h>
 #include <linux/mmc/sdio.h>
 #include <linux/mmc/host.h>
 
-
-

Not clear why these blank lines are removed. They are not needed, but they are not part of what is described in the commit message either.

Quoted 17 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -11
 #define SDIO_MODALIAS "wilc1000_sdio"
 
-#if defined(CUSTOMER_PLATFORM)
-/* TODO : User have to stable bus clock as user's environment. */
- #ifdef MAX_BUS_SPEED
- #define MAX_SPEED MAX_BUS_SPEED
- #else
- #define MAX_SPEED 50000000
- #endif
-#else
- #define MAX_SPEED (6 * 1000000) /* Max 50M */
-#endif
-
 struct wilc_sdio {
      struct sdio_func *func;
      struct wilc *wilc;

drivers/staging/wilc1000/linux_wlan_sdio.c int linux_sdio_cmd53(sdio_cmd53_t *cmd) · line 107

Quoted 4 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -1
@@ -104,7 +90,6 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
 
      sdio_release_host(func);
 
-

Sane for this one.

Quoted 5 lines
Quoted 2 lines

julia

Should I just update the commit message or do it as a different patch in the series?

Do it as a different patch.

julia

Quoted 70 lines

Thank you

Quoted 53 lines
Quoted 53 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +4 -24
      if (ret < 0) {
              PRINT_ER("wilc_sdio_cmd53..failed, err(%d)\n", ret);
              return 0;
@@ -206,11 +191,6 @@ static int linux_sdio_set_speed(int speed)
      return 1;
 }
 
-static int linux_sdio_get_speed(void)
-{
-     return local_sdio_func->card->host->ios.clock;
-}
-
 int linux_sdio_init(void *pv)
 {
 
@@ -219,30 +199,16 @@ int linux_sdio_init(void *pv)
       **/
 
 
-     sdio_default_speed = linux_sdio_get_speed();
+     sdio_default_speed = local_sdio_func->card->host->ios.clock;
      return 1;
 }
 
 void linux_sdio_deinit(void *pv)
 {
-
-     /**
-      *      TODO :
-      **/
-
+       /**
+        *      TODO :
+        **/
 
      sdio_unregister_driver(&wilc_bus);
 }
 
-int linux_sdio_set_max_speed(void)
-{
-     return linux_sdio_set_speed(MAX_SPEED);
-}
-
-int linux_sdio_set_default_speed(void)
-{
-     return linux_sdio_set_speed(sdio_default_speed);
-}
-
-
-
--

2.1.0

Quoted 7 lines
Quoted 7 lines

--
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/16ce4db27490fbed8cbe035c6bf7bc6993b19c80.1446029550.git.shivanib134%40gmail.com.
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/CAKHNQQGXZsPEYowxdDUjw741pDbCQ3-ewrYoAzMTR4ARZY%2Bv3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#5 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: wilc1000: linux_wlan_sdio: Drop unnecessary wrapper functions

Quoted 60 lines · Julia Lawall
Quoted 58 lines · Shivani Bhardwaj
Quoted 56 lines · Julia Lawall
Quoted 14 lines · Shivani Bhardwaj

Remove the functions linux_sdio_get_speed(), linux_sdio_set_max_speed() and linux_sdio_set_default_speed(). Replace their calls with appropriate functions. Also, definitions associated with these functions should be removed.

---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 42 +++---------------------------
 1 file changed, 4 insertions(+), 38 deletions(-)
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -0
index 1f8d874..d58baf2 100644

drivers/staging/wilc1000/linux_wlan_sdio.c line 10

Quoted 10 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -3
@@ -1,26 +1,12 @@
 #include "wilc_wfi_netdevice.h"
-
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/card.h>
 #include <linux/mmc/sdio_ids.h>
 #include <linux/mmc/sdio.h>
 #include <linux/mmc/host.h>
 
-
-

Not clear why these blank lines are removed. They are not needed, but they are not part of what is described in the commit message either.

Quoted 17 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -11
 #define SDIO_MODALIAS "wilc1000_sdio"
 
-#if defined(CUSTOMER_PLATFORM)
-/* TODO : User have to stable bus clock as user's environment. */
- #ifdef MAX_BUS_SPEED
- #define MAX_SPEED MAX_BUS_SPEED
- #else
- #define MAX_SPEED 50000000
- #endif
-#else
- #define MAX_SPEED (6 * 1000000) /* Max 50M */
-#endif
-
 struct wilc_sdio {
      struct sdio_func *func;
      struct wilc *wilc;

drivers/staging/wilc1000/linux_wlan_sdio.c int linux_sdio_cmd53(sdio_cmd53_t *cmd) · line 107

Quoted 4 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +0 -1
@@ -104,7 +90,6 @@ int linux_sdio_cmd53(sdio_cmd53_t *cmd)
 
      sdio_release_host(func);
 
-

Sane for this one.

julia

Quoted 7 lines
Quoted 2 lines

Should I just update the commit message or do it as a different patch in the series?

Do it as a different patch.

julia

Alright.

Thank you

Quoted 70 lines
Quoted 70 lines

Thank you

Quoted 53 lines
Quoted 53 lines
drivers/staging/wilc1000/linux_wlan_sdio.c +4 -24
      if (ret < 0) {
              PRINT_ER("wilc_sdio_cmd53..failed, err(%d)\n", ret);
              return 0;
@@ -206,11 +191,6 @@ static int linux_sdio_set_speed(int speed)
      return 1;
 }
 
-static int linux_sdio_get_speed(void)
-{
-     return local_sdio_func->card->host->ios.clock;
-}
-
 int linux_sdio_init(void *pv)
 {
 
@@ -219,30 +199,16 @@ int linux_sdio_init(void *pv)
       **/
 
 
-     sdio_default_speed = linux_sdio_get_speed();
+     sdio_default_speed = local_sdio_func->card->host->ios.clock;
      return 1;
 }
 
 void linux_sdio_deinit(void *pv)
 {
-
-     /**
-      *      TODO :
-      **/
-
+       /**
+        *      TODO :
+        **/
 
      sdio_unregister_driver(&wilc_bus);
 }
 
-int linux_sdio_set_max_speed(void)
-{
-     return linux_sdio_set_speed(MAX_SPEED);
-}
-
-int linux_sdio_set_default_speed(void)
-{
-     return linux_sdio_set_speed(sdio_default_speed);
-}
-
-
-
--

2.1.0

Quoted 7 lines
Quoted 7 lines

--
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/16ce4db27490fbed8cbe035c6bf7bc6993b19c80.1446029550.git.shivanib134%40gmail.com.
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/CAKHNQQGXZsPEYowxdDUjw741pDbCQ3-ewrYoAzMTR4ARZY%2Bv3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#6 lore raw

PATCH 2/2 Staging: wilc1000: linux_wlan: Replace function calls

In reply to Shivani Bhardwaj

Replace calls to wrapper functions with the actual functions called by wrapper functions. Definitions needed to make those calls should also be added.

---
 drivers/staging/wilc1000/linux_wlan.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +13 -2
index 9f899da..fbc3584 100644
@@ -45,6 +45,17 @@
  #define _linux_wlan_device_removal()		{}
 #endif
 
+#if defined(CUSTOMER_PLATFORM)
+/* TODO : User have to stable bus clock as user's environment. */
+#ifdef MAX_BUS_SPEED
+#define MAX_SPEED MAX_BUS_SPEED
+#else
+#define MAX_SPEED 50000000
+#endif
+#else
+#define MAX_SPEED (6 * 1000000) /* Max 50M */
+#endif
+
 extern bool g_obtainingIP;
 extern u16 Set_machw_change_vir_if(bool bValue);
 extern void resolve_disconnect_aberration(void *drvHandler);
@@ -976,8 +987,8 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
 	nwi->io_func.io_deinit = linux_sdio_deinit;
 	nwi->io_func.u.sdio.sdio_cmd52 = linux_sdio_cmd52;
 	nwi->io_func.u.sdio.sdio_cmd53 = linux_sdio_cmd53;
-	nwi->io_func.u.sdio.sdio_set_max_speed = linux_sdio_set_max_speed;
-	nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_default_speed;
+	nwi->io_func.u.sdio.sdio_set_max_speed = linux_sdio_set_speed(MAX_SPEED);
+	nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_speed(sdio_default_speed);
 #else
 	nwi->io_func.io_type = HIF_SPI;
 	nwi->io_func.io_init = linux_spi_init;
Signature · 1 line
2.1.0