All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] isigen: create four gprs contexts
  2010-11-11 10:00 isigen: enabled multiple PDP contexts Mika Liljeberg
@ 2010-11-11 10:00 ` Mika Liljeberg
  2010-11-11 15:11   ` Denis Kenzior
  0 siblings, 1 reply; 6+ messages in thread
From: Mika Liljeberg @ 2010-11-11 10:00 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1625 bytes --]

---
 plugins/isigen.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/plugins/isigen.c b/plugins/isigen.c
index 838d060..3ea7110 100644
--- a/plugins/isigen.c
+++ b/plugins/isigen.c
@@ -58,6 +58,8 @@
 #include "drivers/isimodem/mtc.h"
 #include "drivers/isimodem/debug.h"
 
+#define ISI_DEFAULT_PDPS 4	/* Number of supported PDP contexts */
+
 struct isi_data {
 	struct ofono_modem *modem;
 	char const *ifname;
@@ -407,6 +409,7 @@ static void isigen_post_online(struct ofono_modem *modem)
 	struct isi_data *isi = ofono_modem_get_data(modem);
 	struct ofono_gprs *gprs;
 	struct ofono_gprs_context *gc;
+	int i;
 
 	DBG("(%p) with %s", modem, isi->ifname);
 
@@ -420,13 +423,19 @@ static void isigen_post_online(struct ofono_modem *modem)
 	ofono_call_barring_create(isi->modem, 0, "isimodem", isi->idx);
 	ofono_call_meter_create(isi->modem, 0, "isimodem", isi->idx);
 	ofono_radio_settings_create(isi->modem, 0, "isimodem", isi->idx);
-	gprs = ofono_gprs_create(isi->modem, 0, "isimodem", isi->idx);
-	gc = ofono_gprs_context_create(isi->modem, 0, "isimodem", isi->idx);
 
-	if (gprs && gc)
+	gprs = ofono_gprs_create(isi->modem, 0, "isimodem", isi->idx);
+	if (!gprs)
+		return;
+	for (i = 0; i < ISI_DEFAULT_PDPS; i++) {
+		gc = ofono_gprs_context_create(isi->modem, 0,
+						"isimodem", isi->idx);
+		if (!gc) {
+			DBG("Failed to add context %d", i);
+			break;
+		}
 		ofono_gprs_add_context(gprs, gc);
-	else
-		DBG("Failed to add context");
+	}
 }
 
 static int isigen_enable(struct ofono_modem *modem)
-- 
1.7.0.4


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

* Re: [PATCH 1/1] isigen: create four gprs contexts
  2010-11-11 10:00 ` [PATCH 1/1] isigen: create four gprs contexts Mika Liljeberg
@ 2010-11-11 15:11   ` Denis Kenzior
  2010-11-11 15:24     ` Mika.Liljeberg
  0 siblings, 1 reply; 6+ messages in thread
From: Denis Kenzior @ 2010-11-11 15:11 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1895 bytes --]

Hi Mika,

On 11/11/2010 04:00 AM, Mika Liljeberg wrote:
> ---
>  plugins/isigen.c |   19 ++++++++++++++-----
>  1 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/plugins/isigen.c b/plugins/isigen.c
> index 838d060..3ea7110 100644
> --- a/plugins/isigen.c
> +++ b/plugins/isigen.c
> @@ -58,6 +58,8 @@
>  #include "drivers/isimodem/mtc.h"
>  #include "drivers/isimodem/debug.h"
>  
> +#define ISI_DEFAULT_PDPS 4	/* Number of supported PDP contexts */
> +
>  struct isi_data {
>  	struct ofono_modem *modem;
>  	char const *ifname;
> @@ -407,6 +409,7 @@ static void isigen_post_online(struct ofono_modem *modem)
>  	struct isi_data *isi = ofono_modem_get_data(modem);
>  	struct ofono_gprs *gprs;
>  	struct ofono_gprs_context *gc;
> +	int i;
>  
>  	DBG("(%p) with %s", modem, isi->ifname);
>  
> @@ -420,13 +423,19 @@ static void isigen_post_online(struct ofono_modem *modem)
>  	ofono_call_barring_create(isi->modem, 0, "isimodem", isi->idx);
>  	ofono_call_meter_create(isi->modem, 0, "isimodem", isi->idx);
>  	ofono_radio_settings_create(isi->modem, 0, "isimodem", isi->idx);
> -	gprs = ofono_gprs_create(isi->modem, 0, "isimodem", isi->idx);
> -	gc = ofono_gprs_context_create(isi->modem, 0, "isimodem", isi->idx);
>  
> -	if (gprs && gc)
> +	gprs = ofono_gprs_create(isi->modem, 0, "isimodem", isi->idx);
> +	if (!gprs)
> +		return;

Tiny nitpick, but please follow the coding style.  Specifically item M1.

> +	for (i = 0; i < ISI_DEFAULT_PDPS; i++) {
> +		gc = ofono_gprs_context_create(isi->modem, 0,
> +						"isimodem", isi->idx);
> +		if (!gc) {
> +			DBG("Failed to add context %d", i);
> +			break;
> +		}

And again, item M1 here

>  		ofono_gprs_add_context(gprs, gc);
> -	else
> -		DBG("Failed to add context");
> +	}
>  }
>  
>  static int isigen_enable(struct ofono_modem *modem)

Regards,
-Denis

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

* RE: [PATCH 1/1] isigen: create four gprs contexts
  2010-11-11 15:11   ` Denis Kenzior
@ 2010-11-11 15:24     ` Mika.Liljeberg
  0 siblings, 0 replies; 6+ messages in thread
From: Mika.Liljeberg @ 2010-11-11 15:24 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 170 bytes --]


> Tiny nitpick, but please follow the coding style.  
> Specifically item M1.

Hookay. I wish I had a script that picked these things up... *wink*

;-)

	MikaL

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

* isigen: create four gprs contexts
@ 2010-11-11 15:49 Mika Liljeberg
  2010-11-11 15:50 ` [PATCH 1/1] " Mika Liljeberg
  0 siblings, 1 reply; 6+ messages in thread
From: Mika Liljeberg @ 2010-11-11 15:49 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 184 bytes --]

Newlines added.

Br,

	 MikaL

[PATCH 1/1] isigen: create four gprs contexts

 plugins/isigen.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

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

* [PATCH 1/1] isigen: create four gprs contexts
  2010-11-11 15:49 isigen: create four gprs contexts Mika Liljeberg
@ 2010-11-11 15:50 ` Mika Liljeberg
  2010-11-11 15:53   ` Denis Kenzior
  0 siblings, 1 reply; 6+ messages in thread
From: Mika Liljeberg @ 2010-11-11 15:50 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]

---
 plugins/isigen.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/plugins/isigen.c b/plugins/isigen.c
index 838d060..fad4e20 100644
--- a/plugins/isigen.c
+++ b/plugins/isigen.c
@@ -58,6 +58,8 @@
 #include "drivers/isimodem/mtc.h"
 #include "drivers/isimodem/debug.h"
 
+#define ISI_DEFAULT_PDPS 4	/* Number of supported PDP contexts */
+
 struct isi_data {
 	struct ofono_modem *modem;
 	char const *ifname;
@@ -407,6 +409,7 @@ static void isigen_post_online(struct ofono_modem *modem)
 	struct isi_data *isi = ofono_modem_get_data(modem);
 	struct ofono_gprs *gprs;
 	struct ofono_gprs_context *gc;
+	int i;
 
 	DBG("(%p) with %s", modem, isi->ifname);
 
@@ -420,13 +423,21 @@ static void isigen_post_online(struct ofono_modem *modem)
 	ofono_call_barring_create(isi->modem, 0, "isimodem", isi->idx);
 	ofono_call_meter_create(isi->modem, 0, "isimodem", isi->idx);
 	ofono_radio_settings_create(isi->modem, 0, "isimodem", isi->idx);
+
 	gprs = ofono_gprs_create(isi->modem, 0, "isimodem", isi->idx);
-	gc = ofono_gprs_context_create(isi->modem, 0, "isimodem", isi->idx);
+	if (!gprs)
+		return;
+
+	for (i = 0; i < ISI_DEFAULT_PDPS; i++) {
+		gc = ofono_gprs_context_create(isi->modem, 0,
+						"isimodem", isi->idx);
+		if (!gc) {
+			DBG("Failed to add context %d", i);
+			break;
+		}
 
-	if (gprs && gc)
 		ofono_gprs_add_context(gprs, gc);
-	else
-		DBG("Failed to add context");
+	}
 }
 
 static int isigen_enable(struct ofono_modem *modem)
-- 
1.7.0.4


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

* Re: [PATCH 1/1] isigen: create four gprs contexts
  2010-11-11 15:50 ` [PATCH 1/1] " Mika Liljeberg
@ 2010-11-11 15:53   ` Denis Kenzior
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2010-11-11 15:53 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 227 bytes --]

Hi Mika,

On 11/11/2010 09:50 AM, Mika Liljeberg wrote:
> ---
>  plugins/isigen.c |   19 +++++++++++++++----
>  1 files changed, 15 insertions(+), 4 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2010-11-11 15:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-11 15:49 isigen: create four gprs contexts Mika Liljeberg
2010-11-11 15:50 ` [PATCH 1/1] " Mika Liljeberg
2010-11-11 15:53   ` Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2010-11-11 10:00 isigen: enabled multiple PDP contexts Mika Liljeberg
2010-11-11 10:00 ` [PATCH 1/1] isigen: create four gprs contexts Mika Liljeberg
2010-11-11 15:11   ` Denis Kenzior
2010-11-11 15:24     ` Mika.Liljeberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.